Bay 12 Games Forum

Dwarf Fortress => DF Modding => Utilities and 3rd Party Applications => Topic started by: expwnent on June 20, 2014, 02:40:48 am

Title: DFHack 0.43.03-r1
Post by: expwnent on June 20, 2014, 02:40:48 am
DFHack is an attempt to unite the various ways hack tools access DF memory and allow for easier development of new tools (and of course, make the game more enjoyable for players). It comes with some useful tools that can fix your fort and make things easier to handle. DFHack integrates with Dwarf Fortress and extends it with plugins, a command console and a way to bind hotkeys to the commands.

Continued development of DFHack would be impossible without its contributors and definitely isn't a one robot show. Check this out! (https://dfhack.readthedocs.org/en/stable/docs/Authors.html) Peterix started the project but has become relatively inactive so I've volunteered to take over managing the releases. It's open source so anyone can add changes and make their own releases.

Some command examples:
'reveal'     - reveals the map or portions of it.
'digFlood' - digs out a mineral vein as it is discovered without revealing the size
'prospect'   - counts available raw materials - mostly minerals.
'clean'      - removes nasty bloodstains and other such materials from the map, items and creatures.
'cleanowned' - removes ownership of claimed items, solving problems with worn clothing and military starving out the fort.
'stonesense' - an embedded version of the Stonesense isometric visualizer, ready for use.

And many more...

How to install DFHack:

How to uninstall DFHack:

Read the Readme (https://dfhack.readthedocs.org) for the full list of commands, their usage and installation instructions.

DFHack 0.43.03-r1 (Current):
Download Link (https://github.com/DFHack/dfhack/releases/tag/0.43.03-r1)

Currently Available Versions:

What's New

Code: [Select]
This is a release for 0.43.03 (*not* 0.43.04, 0.43.05, or anything newer - support for those is in progress, but likely to take longer than usual, so we decided to make a release for 0.43.03 in the meantime). Please do let us know about any issues - we can always make another 0.43.03 release, even if support for newer versions isn't done.

Changes since 0.42.06:

Lua
---
- Label widgets can now easily register handlers for mouse clicks

New Features
------------
- `add-thought`: allow syndrome name as ``-thought`` argument
- `gui/gm-editor`

    - Added ability to insert default types into containers. For primitive types leave the type entry empty, and for references use ``*``.
    - Added ``shift-esc`` binding to fully exit from editor
    - Added ``gui/gm-editor toggle`` command to toggle editor visibility (saving position)

- `modtools/create-unit`:

    - Added an option to attach units to an existing wild animal population
    - Added an option to attach units to a map feature

Fixes
-----
- `autofarm`: Can now handle crops that grow for more than a season
- `combine-plants`: Fixed recursion into sub-containers
- `createitem`: Now moves multiple created items to cursor correctly
- `exportlegends`: Improved handling of unknown enum items (fixes many errors)
- `gui/create-item`: Fixed quality when creating multiple items
- `gui/mod-manager`: Fixed error when mods folder doesn't exist
- `modtools/item-trigger`: Fixed handling of items with subtypes
- `stockflow`:

    - Can order metal mechanisms
    - Fixed material category of thread-spinning jobs

Misc Improvements
-----------------
- The built-in ``ls`` command now wraps the descriptions of commands
- `catsplosion`: now a lua script instead of a plugin
- `fix/diplomats`: replaces ``fixdiplomats``
- `fix/merchants`: replaces ``fixmerchants``
- Unified script documentation and in-terminal help options

Removed
-------
- `tweak` manager-quantity: no longer needed

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

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

The source code is available from github (https://github.com/DFHack/dfhack), please read the Compile (https://dfhack.readthedocs.org/en/latest/docs/Compile.html) document before building.

DFHack has many developers so we don't take donations. Donate generously to Toady instead! (http://www.bay12games.com/support.html) You can say it's in honor of DFHack if you want.

Full list of (old) downloadable versions can be found here: http://dethware.org/dfhack/download/ (http://dethware.org/dfhack/download/)

Previous Thread (http://www.bay12forums.com/smf/index.php?topic=91166.0)
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 20, 2014, 02:41:07 am
Older releases:
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 20, 2014, 02:41:48 am
Reserved.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 20, 2014, 05:35:09 am
PTW, standing by for OSX compile.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 20, 2014, 05:55:44 am
I have a working OS X build, which I will upload as soon as I can (assuming danaris doesn't do it first).
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 20, 2014, 06:20:14 am
PTW.  It's great to have an official release again - hopefully all the various scripts and plugins can once more support a single version.  The new features also look great!

I noticed that the Readme link goes to expwnent/dfhack, while the other links are to DFHack/dfhack - is this intentional, and are there any plans regarding the organisation page?
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 20, 2014, 06:27:48 am
I noticed that the Readme link goes to expwnent/dfhack, while the other links are to DFHack/dfhack - is this intentional, and are there any plans regarding the organisation page?
The 0.34.11-r5 branch hasn't been merged back into DFHack/dfhack yet.
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 20, 2014, 06:49:58 am
Thought it'd be something like that.  I'm playing around with it now - i'll probably hold a starter pack release a day or two for Falconne's plugins to update, but I have to mention that your embark tools are fantastic

Edit:  very minor bug report, in the dfhack.init_example workflow bindings are given twice - near the top of the contextual bindings as Ctrl-W, Ctrl-I; and near the bottom as Alt-W. 
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 20, 2014, 07:03:14 am
Here (http://dffd.wimbli.com/file.php?id=8683) is an OS X build.
Title: Re: DFHack 0.34.11 r5
Post by: greycat on June 20, 2014, 08:51:48 am
I noticed that the Readme link goes to expwnent/dfhack, while the other links are to DFHack/dfhack - is this intentional, and are there any plans regarding the organisation page?
The 0.34.11-r5 branch hasn't been merged back into DFHack/dfhack yet.

The Readme (https://github.com/expwnent/dfhack/blob/0.34.11-r5/Readme.rst) linked in the top post, under "Getting DFHack", links to http://github.com/peterix/dfhack and says releases are announced in http://tinyurl.com/dfhack-ng which redirects to the r3 forum thread (http://www.bay12forums.com/smf/index.php?topic=91166).

It's all very confusing.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 20, 2014, 09:01:05 am
I noticed that the Readme link goes to expwnent/dfhack, while the other links are to DFHack/dfhack - is this intentional, and are there any plans regarding the organisation page?
The 0.34.11-r5 branch hasn't been merged back into DFHack/dfhack yet.

The Readme (https://github.com/expwnent/dfhack/blob/0.34.11-r5/Readme.rst) linked in the top post, under "Getting DFHack", links to http://github.com/peterix/dfhack and says releases are announced in http://tinyurl.com/dfhack-ng which redirects to the r3 forum thread (http://www.bay12forums.com/smf/index.php?topic=91166).

It's all very confusing.
peterix/dfhack redirects to DFHack/dfhack, the new official repo (the links in the readme are outdated, as is the link in the first post). Expwnent made this release from a branch in expwnent/dfhack, which should be merged back into DFHack/dfhack once someone with write access decides to.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 20, 2014, 11:56:10 am
The links pointed to my repo for things that have changed in this release. There are a few links to the main repo for things that have not changed and for things like the bug tracker, which is one of the places bug reports should go (this thread or the irc channel are also fine). Now that I have write access to the main repo, I switched the links to there. Everything should be fine now.

The readme there is wrong. It's a bug in the documentation.
Title: Re: DFHack 0.34.11 r5
Post by: FallenAngel on June 20, 2014, 12:51:51 pm
This, my friends, is going to be Fun.
And Helpful.
And !!Helpful!!.
Dfhack is awesome.
EDIT: Which plugin lets you manage jobs and check emotions? Because it doesn't seem to be on automatically.
Title: Re: DFHack 0.34.11 r5
Post by: greycat on June 20, 2014, 02:50:04 pm
EDIT: Which plugin lets you manage jobs and check emotions? Because it doesn't seem to be on automatically.

I believe you're referring to "manipulator" (this is the ASCII version of Therapist, which you get by pressing u l) and "dwarfmonitor", which puts the colored numbers in the lower right corner of the main screen.
Title: Re: DFHack 0.34.11 r5
Post by: Meph on June 20, 2014, 02:51:19 pm
I have a question, one that is rather important for MasterworkDF. Especially considering that I myself cannot code C++. Lua I understand a bit by now.

How much cross-compability exists between r4 and r5, and, if any assumptions can be made, how much updating will need to be done for the DF2014 release?

Where the r5 release has 36 scripts in the script folder, Masterwork has 151. If most of them break, a big portion of the mod becomes broken as well.
Title: Re: DFHack 0.34.11 r5
Post by: FallenAngel on June 20, 2014, 03:00:43 pm
EDIT: Which plugin lets you manage jobs and check emotions? Because it doesn't seem to be on automatically.

I believe you're referring to "manipulator" (this is the ASCII version of Therapist, which you get by pressing u l) and "dwarfmonitor", which puts the colored numbers in the lower right corner of the main screen.

I was referring to the "manipulator", except pressing "u" shows no "l" option, and pressing "l" does as much as it does in normal DF when in the unit menu.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 20, 2014, 03:13:40 pm
I have a question, one that is rather important for MasterworkDF. Especially considering that I myself cannot code C++. Lua I understand a bit by now.

How much cross-compability exists between r4 and r5, and, if any assumptions can be made, how much updating will need to be done for the DF2014 release?

Where the r5 release has 36 scripts in the script folder, Masterwork has 151. If most of them break, a big portion of the mod becomes broken as well.

The advantage of a scripting language like lua or ruby is that you don't have to compile. This means that if there are few changes to DFHack, you don't have to change a thing. Plugins have to be compiled for exactly the right version.

The disadvantage is you don't get the advice (or runtime speed) of a compiler. You don't know until runtime whether it's accessing a variable that doesn't exist. When df-structures changes happen, it can break compatibility. Since df itself makes absolutely no backward compatibility for us (as it shouldn't), DFHack doesn't promise anything either.

The following link describes all of the changes in df-structures since the last release: https://github.com/DFHack/df-structures/compare/DFHack:d6bcaa991cfe9ab5a8031b1721d548a73258d7ed...DFHack:36e0b203de64dbd57deb39ca849fffc66cad8f54

Most of the changes only add newly identified variables, so they don't break backwards compatibility unless you were using a variable and referring to it by its temporary name without knowing what it does. I don't know if anything has been renamed. I think it would be a good policy for the future to document such changes for new releases. I'll try to do that.

You should also look at the changes in the Lua API, but that tends to be backwards compatible.
Title: Re: DFHack 0.34.11 r5
Post by: Quietust on June 20, 2014, 03:25:10 pm
EDIT: Which plugin lets you manage jobs and check emotions? Because it doesn't seem to be on automatically.

I believe you're referring to "manipulator" (this is the ASCII version of Therapist, which you get by pressing u l) and "dwarfmonitor", which puts the colored numbers in the lower right corner of the main screen.

I was referring to the "manipulator", except pressing "u" shows no "l" option, and pressing "l" does as much as it does in normal DF when in the unit menu.
That's because all plugins are disabled by default and must be explicitly enabled. You can automatically enable them by adding the appropriate commands to dfhack.init - see "dfhack.init-example" for more information.
Title: Re: DFHack 0.34.11 r5
Post by: FallenAngel on June 20, 2014, 03:57:19 pm
EDIT: Which plugin lets you manage jobs and check emotions? Because it doesn't seem to be on automatically.

I believe you're referring to "manipulator" (this is the ASCII version of Therapist, which you get by pressing u l) and "dwarfmonitor", which puts the colored numbers in the lower right corner of the main screen.
Ah, thanks.
On an unrelated note, using invasion-now to make two dwarven sieges, I lost 3 of my starting 7. I forgot I gave them the axegun.
Time to see if four unhappy metal beings can duke it out with GOBLINS.
They don't have axeguns.

I was referring to the "manipulator", except pressing "u" shows no "l" option, and pressing "l" does as much as it does in normal DF when in the unit menu.
That's because all plugins are disabled by default and must be explicitly enabled. You can automatically enable them by adding the appropriate commands to dfhack.init - see "dfhack.init-example" for more information.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 20, 2014, 04:33:59 pm
Meph: I updated the main post with all of the renamed variables. It does not include newly discovered variables, just ones that had not-obviously-temporary-names that were changed. Took forever, but it's done now.
Title: Re: DFHack 0.34.11 r5
Post by: Meph on June 20, 2014, 04:47:34 pm
Meph: I updated the main post with all of the renamed variables. It does not include newly discovered variables, just ones that had not-obviously-temporary-names that were changed. Took forever, but it's done now.
Thank you. :)
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 20, 2014, 06:01:14 pm
By the way, to any experienced raw modders out there: what scripts are commonly used that are not included in DFHack by default? Scripts are pretty small, so as long as they work and are useful to a large number of people, they should be included. I know my way around DFHack internals, but I don't know as much about how stuff is used.
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on June 20, 2014, 07:34:19 pm
I couldn't answer that, since I'm biased.
Title: Re: DFHack 0.34.11 r5
Post by: Meph on June 20, 2014, 07:41:25 pm
What do you mean, biased? At least you know how the scripts are done. :P

Here my thoughts:

If you want any of them, I can have a look through my folder and send them to you/post them here. But most of them are in the dfhack script collection already. :)

IndigoFenix has written dozens of awesome features for the Masterwork Gnomes as well. Druidium and animal speech/taming, custom machines that allow turing complete setups (much easier than in vanilla), and for example a gun that shoots a cage as projectile and traps the unit it hits. Better ask him for details.... although he would have to write some form of readme. ^^
Title: Re: DFHack 0.34.11 r5
Post by: greycat on June 20, 2014, 08:17:07 pm
How much cross-compability exists between r4 and r5, and, if any assumptions can be made, how much updating will need to be done for the DF2014 release?

Most of the changes only add newly identified variables, so they don't break backwards compatibility unless you were using a variable and referring to it by its temporary name without knowing what it does.

There are some scripts used in Masterwork that do refer to struct fields by their temporary names (anon_4, anon_5 and unk1 are the ones I have run across).  I don't have a full list, because I only fixed the ones that I actually ran across during my playing.  But here's what I have so far:

Code: [Select]
diff -ur MWDF-tmp/Dwarf Fortress/hack/scripts/construct-creature.lua MWDF/Dwarf
Fortress/hack/scripts/construct-creature.lua
--- MWDF-tmp/Dwarf Fortress/hack/scripts/construct-creature.lua 2014-03-28 10:06
:56.000000000 -0400
+++ MWDF/Dwarf Fortress/hack/scripts/construct-creature.lua     2014-06-13 21:04
:23.477664448 -0400
@@ -290,8 +290,8 @@
     --unit.relations.old_time=?? --TODO add normal age
     --[[ interataction stuff, probably timers ]]--
     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
+    unit.curse.own_interaction:resize(num_inter) -- new for interactions
+    unit.curse.own_interaction_delay:resize(num_inter) -- new for interactions
     --[[ body stuff ]]
     
     local body=unit.body

diff -ur MWDF-tmp/Dwarf Fortress/hack/scripts/itemsyndrome.lua MWDF/Dwarf Fortre
ss/hack/scripts/itemsyndrome.lua
--- MWDF-tmp/Dwarf Fortress/hack/scripts/itemsyndrome.lua       2014-06-08 17:29
:30.000000000 -0400
+++ MWDF/Dwarf Fortress/hack/scripts/itemsyndrome.lua   2014-06-19 10:07:05.4013
87096 -0400
@@ -120,7 +120,7 @@
     newSyndrome.year=df.global.cur_year
     newSyndrome.year_time=df.global.cur_year_tick
     newSyndrome.ticks=0
-    newSyndrome.unk1=0
+    newSyndrome.wound_id=0
        --newSyndrome.flags=0
     for k,v in ipairs(target_syndrome.ce) do
         local sympt=df.unit_syndrome.T_symptoms:new()

diff -ur MWDF-tmp/Dwarf Fortress/hack/scripts/spawnkid.lua MWDF/Dwarf Fortress/h
ack/scripts/spawnkid.lua
--- MWDF-tmp/Dwarf Fortress/hack/scripts/spawnkid.lua   2014-05-26 02:18:24.0000
00000 -0400
+++ MWDF/Dwarf Fortress/hack/scripts/spawnkid.lua       2014-06-14 13:06:34.231613947 -0400
@@ -163,7 +163,7 @@
     --todo set weapon bodypart
     
     local num_inter=#caste.body_info.interactions
-    unit.curse.anon_5:resize(num_inter)
+    unit.curse.own_interaction_delay:resize(num_inter)
     return unit
 end
 function findRace(name)

diff -ur MWDF-tmp/Dwarf Fortress/hack/scripts/spawn.lua MWDF/Dwarf Fortress/hack
/scripts/spawn.lua
--- MWDF-tmp/Dwarf Fortress/hack/scripts/spawn.lua      2014-06-07 06:49:20.0000
00000 -0400
+++ MWDF/Dwarf Fortress/hack/scripts/spawn.lua  2014-06-14 13:06:52.951893393 -0
400
@@ -97,8 +97,8 @@
     --unit.relations.old_time=?? --TODO add normal age
     --[[ interataction stuff, probably timers ]]--
     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
+    unit.curse.own_interaction:resize(num_inter) -- new for interactions
+    unit.curse.own_interaction_delay:resize(num_inter) -- new for interactions
     --[[ body stuff ]]
     
     local body=unit.body
@@ -190,7 +190,7 @@
     --todo set weapon bodypart
     
     local num_inter=#caste.body_info.interactions
-    unit.curse.anon_5:resize(num_inter)
+    unit.curse.own_interaction_delay:resize(num_inter)
     return unit
 end
 function findRace(name)

diff -ur MWDF-tmp/Dwarf Fortress/hack/scripts/spawnunit.lua MWDF/Dwarf Fortress/
hack/scripts/spawnunit.lua
--- MWDF-tmp/Dwarf Fortress/hack/scripts/spawnunit.lua  2014-06-11 10:12:17.0000
00000 -0400
+++ MWDF/Dwarf Fortress/hack/scripts/spawnunit.lua      2014-06-14 13:05:58.3110
77739 -0400
@@ -74,8 +74,8 @@
     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
+       unit.curse.own_interaction:resize(num_inter) -- new for interactions
+       unit.curse.own_interaction_delay:resize(num_inter) -- new for interactions
     local body=unit.body
     
     body.body_plan=caste.body_info
@@ -169,7 +169,7 @@
     df.global.world.units.other.ANY_ANIMAL:insert("#",unit)
 
     local num_inter=#caste.body_info.interactions
-    unit.curse.anon_5:resize(num_inter)
+    unit.curse.own_interaction_delay:resize(num_inter)
     return unit
 end
 function findRace(name)
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 20, 2014, 08:38:49 pm
FWIW, here's the scripts that I include in the Starter Pack that were not in r3 (excluding those in r5):

force (http://www.bay12forums.com/smf/index.php?topic=123817),  unit info viewer GUI (http://dffd.wimbli.com/file.php?id=7717), plugin to fix growthbug (http://dffd.wimbli.com/file.php?id=7849), forumdwarves (http://dffd.wimbli.com/file.php?id=7245), showunitsyndromes (http://www.bay12forums.com/smf/index.php?topic=91166.msg4214644#msg4214644), removewear (http://www.bay12forums.com/smf/index.php?topic=91166.msg4094347#msg4094347),  repeat (http://www.bay12forums.com/smf/index.php?topic=91166.msg4698983#msg4698983), feeding-timers (http://www.bay12forums.com/smf/index.php?topic=138609.msg5288227#msg5288227)

Edit:  particularly the growth-bug fix - url=https://github.com/KurikAmudnil/dfhack/tree/master/plugins/growthfix]here's the source[/url] - since it seems that r5 doesn't fix that at all.  I'll have to track down one of the script versions in the meantime. 
Title: Re: DFHack 0.34.11 r5
Post by: Urist Da Vinci on June 20, 2014, 09:07:18 pm
unit.body.body_plan.attacks i.e. caste_attack appears to have problems. DFhack crashed when trying to printall the tissue_layer_idx. Other data such as the skill used for body part attacks is always printed as 0.

See https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L559

Also see Quietust's post here: http://www.bay12forums.com/smf/index.php?topic=91166.msg4960241#msg4960241 and my preceding original research.

EDIT: contact_perc should be at offset 0xe8 according to my original research, but in R5 it is at 0xf8. Everything else is likewise shifted, which causes the errors. There is likely too many "specialattack" vectors defined (the things that Q found).
Title: Re: DFHack 0.34.11 r5
Post by: Rose on June 20, 2014, 11:49:50 pm
Stonesense should be updated in the next day or two.
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 20, 2014, 11:58:48 pm
Stonesense should be updated in the next day or two.

Excellent!
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 21, 2014, 02:08:24 am
Stonesense should be updated in the next day or two.

Any chance to make it compatible with Opengl (print_mode:standard) rendering on osx?

The problem seems to be that StoneSense does not support PRINT_MODE:STANDARD on OS X 10.9.
It crashes even on vanilla "dfhack 0.34.11 r3 for osx" if init/init.txt is changed to the PRINT_MODE:STANDARD.
TWBT needs PRINT_MODE:STANDARD or PRINT_MODE:SHADER to work, thus they are not compatible for now.

Seems like something only StoneSense developers can fix.
Title: Re: DFHack 0.34.11 r5
Post by: astronom on June 21, 2014, 06:39:18 am
How to heal rotten bodypart?
My dwarves dig warpstone and they heart and spine are roten. fullheal or healunit script doesnt remove rotten status. (i'm use this script https://gist.github.com/warmist/8594614)
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 21, 2014, 12:22:53 pm
Stonesense links are now provided in the front post for Windows and Linux.

I'm going to say that if you use the temporary names in a script, then you're accepting the risk of a change and it's the scripter's responsibility to stay current. At some point, I might write a script to automate what I did in the main post this time and make it include ALL changes. If I manage that, it'll help with those too.
Title: Re: DFHack 0.34.11 r5
Post by: Quietust on June 21, 2014, 03:48:57 pm
unit.body.body_plan.attacks i.e. caste_attack appears to have problems. DFhack crashed when trying to printall the tissue_layer_idx. Other data such as the skill used for body part attacks is always printed as 0.

See https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L559
Looks like I got something messed up when mapping out that structure; remapping it now.

[edit] Fixed them now - specialattack_temp_mat should only be length 3, and there should be an additional int32 "velocity_modifier" after skill.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 21, 2014, 05:22:47 pm
What do you mean, biased? At least you know how the scripts are done. :P

Here my thoughts:
  • Autofixhandedness is a must, otherwise custom gloves cant be done.
  • Embark dwarves and embark points, for more dwarves/points at the start.
  • A script for skill training, I have several ones I use in the mod.
  • Boltguns conversion scripts. He can charm captured invaders and make civ members of them.
  • Everything Roses has written, ever. Seriously, they do so much for raw modders.
  • An announcements script.
  • Urist DaVincis scripts to add/remove materials and pets to civs.
  • Emigration by IndigoFenix, to handle unhappy dwarves.
  • Empregnate to replenish civ members.
  • Putnams Itemsyndrome, ProjectileExpansion, Gods, HackWish and more. Lots of this is basis for enchanted weapons, special ammo...
  • Force Event, also Putnam. Forces caravans, migrants, sieges... super useful for more interaction with the world, and to make reactions that might trigger a full blown attack. Good for bored people that want a challenge.
  • A feed script that sets hunger/thirst to 0, to allow keeping grazing animals indoor, which are fed manually.
  • Quietusts make-monarch, which allows people that play with low pop-limits to get kings. Usually you need 140 dwarves to trigger the possible arrival of the king, the script allows smaller forts to do that.
  • Add/Remove thoughts. Scripts that temper with thoughts, adding good or bad ones. Necessary for finer balancing, and to help save almost miserable dwarves.
  • Spawnunit is included now? Warmists creature spawning. This fixed the holy grail of modding, creating new units.

If you want any of them, I can have a look through my folder and send them to you/post them here. But most of them are in the dfhack script collection already. :)

IndigoFenix has written dozens of awesome features for the Masterwork Gnomes as well. Druidium and animal speech/taming, custom machines that allow turing complete setups (much easier than in vanilla), and for example a gun that shoots a cage as projectile and traps the unit it hits. Better ask him for details.... although he would have to write some form of readme. ^^

Masterwork-specific scripts should, of course, stay as a part of Masterwork so that we don't clutter the default scripts folder, but send me any that you think would be generally useful for modders overall. I'm a bit curious to see what scripters are doing these days anyway. If there's a more recent version of anything already in the repo, send me those too. I agree most or all of Putnam's scripts should be included unless he objects for any reason.

I realize this would be extra work, but if possible I'd like to comment each script with its original author to ensure that everyone is credited properly. If you could help with that I would appreciate it.

FWIW, here's the scripts that I include in the Starter Pack that were not in r3 (excluding those in r5):

force (http://www.bay12forums.com/smf/index.php?topic=123817),  unit info viewer GUI (http://dffd.wimbli.com/file.php?id=7717), plugin to fix growthbug (http://dffd.wimbli.com/file.php?id=7849), forumdwarves (http://dffd.wimbli.com/file.php?id=7245), showunitsyndromes (http://www.bay12forums.com/smf/index.php?topic=91166.msg4214644#msg4214644), removewear (http://www.bay12forums.com/smf/index.php?topic=91166.msg4094347#msg4094347),  repeat (http://www.bay12forums.com/smf/index.php?topic=91166.msg4698983#msg4698983), feeding-timers (http://www.bay12forums.com/smf/index.php?topic=138609.msg5288227#msg5288227)

Edit:  particularly the growth-bug fix - here's the source (https://github.com/KurikAmudnil/dfhack/tree/master/plugins/growthfix) - since it seems that r5 doesn't fix that at all.  I'll have to track down one of the script versions in the meantime.

I'd prefer a script version to include in the repo. That's the sort of thing that shouldn't require a plugin. Technically plugins make startup time a little slower for the main program and make compile time a little slower. Individually it doesn't matter, but in general I think we should use scripts when possible. I realize that many of the plugins I've written could be converted into scripts and I'm working on it.


In general, I'd like to keep the scripts in the repo up to date. Someone (probably the original author) should let me know when there's an update to any of them. Ideally they'd make a pull request themselves but a lot of people don't know how to use git (it's not that hard and the tutorials out there are good).
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 21, 2014, 05:31:19 pm
I'm currently using Kurik's ruby script, here (http://www.bay12forums.com/smf/index.php?topic=91166.msg4313566#msg4313566).  Which I just realised isn't listed on my contents page... I'll go fix that. 

Edit:  and with the stonesense build, I get an error right at the top when I open DF:  "plugin stonesense has no enabled var" in red. 
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on June 21, 2014, 07:28:23 pm
I don't object; the only reason I haven't done a pull request to get them included myself is because I'm meek as shit and worried that I'm not up to snuff.
Title: Re: DFHack 0.34.11 r5
Post by: Meph on June 21, 2014, 09:07:23 pm
Quote
Edit:  and with the stonesense build, I get an error right at the top when I open DF:  "plugin stonesense has no enabled var" in red.
I have the same since a dozen version or so of my mod. Never figured out what it is, Japa doesnt now either. Doesnt seem to do any harm.

Are falconnes plugins in this mix?

When I find the time I can bundle you up a few scripts with author name and all that, but I will work on text will be text for now.
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 21, 2014, 09:41:52 pm
Quote
Edit:  and with the stonesense build, I get an error right at the top when I open DF:  "plugin stonesense has no enabled var" in red.
I have the same since a dozen version or so of my mod. Never figured out what it is, Japa doesnt now either. Doesnt seem to do any harm.

Are falconnes plugins in this mix?
Huh.  If it's not causing any issues I guess I'll stick it in, and hope the overlay version comes out soon...

Falconne's plugins are in, but as they were about a month ago - v43 or v44 probably - and the drop-in set should update soon. 
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 21, 2014, 09:58:24 pm
Japa should really fix it. It won't cause problems, but it should still be fixed.

Falconne's plugins are already merged in periodically by angavrilov.

Putnam: I'll take a look at your scripts. The most recent versions are in your gist right?
Title: Re: DFHack 0.34.11 r5
Post by: Rose on June 21, 2014, 10:04:07 pm
Quote
Edit:  and with the stonesense build, I get an error right at the top when I open DF:  "plugin stonesense has no enabled var" in red.
I have the same since a dozen version or so of my mod. Never figured out what it is, Japa doesnt now either. Doesnt seem to do any harm.

Are falconnes plugins in this mix?
Huh.  If it's not causing any issues I guess I'll stick it in, and hope the overlay version comes out soon...

Falconne's plugins are in, but as they were about a month ago - v43 or v44 probably - and the drop-in set should update soon.

That is  the overlay version, actually.

EDIT: I fixed the overlay var error. a fix should be up in a bit.
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 21, 2014, 10:33:28 pm
And checking the logs, I got no result for typing "stonesense overley".  /derp.  It works now. 

It's fantastic.  It even works with mousequery, although the following cursor is offset a little in tracking mode. 

Edit:  the cursor, for me, is always offset from the mouse by the same amount:  [-2,3,0] tiles (ie DF cursor is above and left of the mouse).  This happens with both 16x16 and 12x8 tilesets.  Would it be possible to configure an offset? 

I also get a crash if I launch the overlay from dfhack.init, and then maximise the DF window before everything finishes loading.  Waiting a few seconds to maximise avoids the issue. 
Title: Re: DFHack 0.34.11 r5
Post by: itg on June 22, 2014, 03:19:49 am
Great work! Just wanted to report a little bug: the "die" command causes the game to crash. I mean, mission accomplished, in a sense, but still.
Title: Re: DFHack 0.34.11 r5
Post by: Rose on June 22, 2014, 03:26:38 am
that's a known bug, and not sure how to fix it, but it only happens after stonesense has been run.
Title: Re: DFHack 0.34.11 r5
Post by: catvanbrian on June 22, 2014, 09:20:09 am
how do you spawn wild animals with the command spawn?
Title: Re: DFHack 0.34.11 r5
Post by: Quietust on June 22, 2014, 11:03:27 am
Quietusts make-monarch, which allows people that play with low pop-limits to get kings. Usually you need 140 dwarves to trigger the possible arrival of the king, the script allows smaller forts to do that.
I don't recall writing that script, and a quick check against the DFHack repository shows that it was Warmist who added it. I may have provided guidance on writing it, but I'm pretty sure I didn't actually write it (since I would've insisted on also adding history events for assigning the new monarch and possibly also for removing the old one).

Besides, there's a much easier way to get a King in a smaller fortress - run the command ":lua df.global.ui.fortress_rank = 5" to become a Metropolis.
Title: Re: DFHack 0.34.11 r5
Post by: WillowLuman on June 22, 2014, 07:43:36 pm
PTW, though waiting for some more fixes.
Title: Re: DFHack 0.34.11 r5
Post by: Meph on June 22, 2014, 09:31:36 pm
Quietusts make-monarch, which allows people that play with low pop-limits to get kings. Usually you need 140 dwarves to trigger the possible arrival of the king, the script allows smaller forts to do that.
I don't recall writing that script, and a quick check against the DFHack repository shows that it was Warmist who added it. I may have provided guidance on writing it, but I'm pretty sure I didn't actually write it (since I would've insisted on also adding history events for assigning the new monarch and possibly also for removing the old one).

Besides, there's a much easier way to get a King in a smaller fortress - run the command ":lua df.global.ui.fortress_rank = 5" to become a Metropolis.
Sorry Warmist/Quietust, I remember you (Quietust) posting the command you just quoted, and I added it to my scripts. I thought it was make-monarch. ^^
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 23, 2014, 12:41:24 am
New version of DFHack compiled with an older version of gcc for Linux users who don't have the most recent version.
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 23, 2014, 01:33:44 am
I'm working out how to do a dfhack tab in the LNP launcher (https://github.com/PeridexisErrant/Starter-Pack-Launcher/issues/4), and thinking of using the onload.init - but I can't find any documentation on that in the readme.  Does anyone have a link or details on what the file should be called and where it goes?
Title: Re: DFHack 0.34.11 r5
Post by: Meph on June 23, 2014, 02:18:44 am
You call the file "Onload.init" and put it into dwarffortress/raw.

Whats in it? That depends on you. Its exactly like the dfhack init, just that the dfhack init is read out when the game starts, while the onload init is read out when someone loads a world.

The onload.init is saved in each region folder, so if you have settings for it, they will be stored with each save. Mine has this in it:
Quote
#Adds pet types to civs on world load
AddMinionToCiv
AddMountToCiv
AddPackToCiv
AddPullToCiv
AddWagonToCiv
AddPetToCiv

#embark points and embark group
points 1274
dwarves 7

#patches the armor stands
enable fix-armory

#putnams awesome items
itemsyndrome contaminantsOn enable
itemsyndrome enable
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 23, 2014, 03:05:53 am
@Meph - thanks, that's all I needed.  The basic idea is that I can keep it small enough to just generate a new file based on selected options, and leave everything else in dfhack.init

I'm also doing some unrelated cleanup and need to update a script, but I can't work out what "unit.appearance.unk_4c8" is these days (which I think is the problem).
Spoiler: details (click to show/hide)
Title: Re: DFHack 0.34.11 r5
Post by: Rose on June 23, 2014, 04:31:38 am
My suggestion would be to diff the DFHack r3 sources with the DFhack r5 sources and hunt it down.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 23, 2014, 07:34:36 am
@Meph - thanks, that's all I needed.  The basic idea is that I can keep it small enough to just generate a new file based on selected options, and leave everything else in dfhack.init

I'm also doing some unrelated cleanup and need to update a script, but I can't work out what "unit.appearance.unk_4c8" is these days (which I think is the problem).

I can do one better. I've been doing a lot of Lua recently and I happened to have already updated that script. There was one script in that folder that I forgot to test, so maybe it's that one, but I'd give this an 80% chance of working.

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r5
Post by: Warmist on June 23, 2014, 07:47:36 am
My suggestion would be to diff the DFHack r3 sources with the DFhack r5 sources and hunt it down.
It would be a fun challenge to make a script that automates that. Lets say that you pass it git commit X and git commit Y and it outputs fields which changes in form "unit.wounds.unk48->unit.wounds.emotional_trauma"
That only involves interfacing with git and parsing xmls...
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 23, 2014, 08:06:58 am
I can do one better. I've been doing a lot of Lua recently and I happened to have already updated that script. There was one script in that folder that I forgot to test, so maybe it's that one, but I'd give this an 80% chance of working.

tested, works.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on June 23, 2014, 12:13:31 pm
Is it just me or is rendermax.plug.dll simply not included in the wimbli dfhack zip file?

By the way, to any experienced raw modders out there: what scripts are commonly used that are not included in DFHack by default? Scripts are pretty small, so as long as they work and are useful to a large number of people, they should be included. I know my way around DFHack internals, but I don't know as much about how stuff is used.

I'm not an experienced modder but as a regular player I often use callmedic.lua (http://www.bay12forums.com/smf/index.php?topic=91166.msg4858685;topicseen#msg4858685) and blooddel.lua (http://www.bay12forums.com/smf/index.php?topic=91166.msg4246062#msg4246062) from UristDaVinci as well as load-screen.lua from Lethosor. I also copy and paste scripts from PE's pack that aren't in the main repo and sometimes I play with IndigoFenix's druidism and machina. And when I'm really, really lazy I fire up df-ai.

Also there's a bug (http://www.bay12forums.com/smf/index.php?topic=131527) patched by UristDaVinci that fixes some combat mechanics related to non-integer values and since I'm too lazy I usually copy and paste PE's executable too :P
Title: Re: DFHack 0.34.11 r5
Post by: Meph on June 23, 2014, 12:34:37 pm
Nopenope, that link you posted is blank.  :-\

Could you please post the callmedic.lua and blooddel.lua? I do not have them in MDF, and would like to include them. Maybe with a short description of what they actually do? (I can guess, but it would be nice to be sure)
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on June 23, 2014, 12:53:32 pm
Updated to include links. Turns out callmedic wasn't exactly from UristDaVinci.

And since we're talking about what scripts should be included, DFHack spells/script list (whatever its name is nowadays) should be in. These are mostly modder stuff but even regular players tend to get bored. There are also a few tidbits on Putnam and a few others' gists that I sometimes fetch to play with. No reason they shouldn't be included if they are in a working state.
Title: Re: DFHack 0.34.11 r5
Post by: Urist Da Vinci on June 23, 2014, 08:23:59 pm
Is there any way the "ls" command which lists all possible commands, plugins, and scripts can be improved to group/sort things so that we don't get a 2 kilometer long mess, especially if more scripts are added?

...
 as a regular player I often use callmedic.lua (http://www.bay12forums.com/smf/index.php?topic=91166.msg4858685;topicseen#msg4858685) and blooddel.lua (http://www.bay12forums.com/smf/index.php?topic=91166.msg4246062#msg4246062) from UristDaVinci
...

I did not make any "call medic" script. Perhaps you were thinking of the one that resets the feeding/watering patients/prisoners countdown? http://www.bay12forums.com/smf/index.php?topic=138609.msg5286137#msg5286137

This thread has scripts for getting the butchering results from creatures or corpse/body items: http://www.bay12forums.com/smf/index.php?topic=137332.msg5134076#msg5134076 , presumably useful like prospector.

... And since we're talking about what scripts should be included, DFHack spells/script list (whatever its name is nowadays) should be in....

Many of those require complex interactions between plugins, scripts, and parsing raw file strings hidden in things like syndrome classes. It isn't something you can just drop onto an existing game.
Title: Re: DFHack 0.34.11 r5
Post by: Roses on June 24, 2014, 10:37:04 am
Question, I have a table in lua args = {[0] = 'here', [1] = 'upgrade', [2] = '500'}, I thought that #args == 3, but when I do print(#args) I get 2. Did I misunderstand what the #args did?

Code: [Select]
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
Detected spatter add reactions - enabling plugin.
Detected reaction hooks - enabling plugin.
Fixing cloth stockpile handling (bug 5739)...
Patched 200506 bad references in 6046 materials.
FixGrowth: Fixed 6 units so that their size will grow/thicken.
[DFHack]# spells/base_upgradebuilding
Upgradable Buildings: Loaded
1                        = upgrade
2                        = 500
0                        = here
2                                                    <== #args
0                                                    <== should be 500 if #args == 3
500                                                  <== args[2]
[DFHack]#
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 24, 2014, 10:40:49 am
Lua table indexes start from 1, not 0.
Title: Re: DFHack 0.34.11 r5
Post by: Roses on June 24, 2014, 10:45:24 am
Looking through some lua documentation I found this;

Code: [Select]
The # operator doesn't count all the items in the table (!), instead it finds the last integer (not-fractional number) key. Because of how it's implemented, its results are undefined if all the integer keys in the table aren't consecutive (that is, don't use it for tables used as sparse arrays[2]).
So I was indeed misinterpreting what the # operator does. It is much more limited than I had hoped, I will have to make sure my scripts account for this.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on June 24, 2014, 03:25:27 pm
So what's with the lack of rendermax? Isn't it in the r5 changelog in the OP?

Quote
Many of those require complex interactions between plugins, scripts, and parsing raw file strings hidden in things like syndrome classes. It isn't something you can just drop onto an existing game.
What I usually do is use a Masterwork build and remove most of the extra stuff like metals and Succubi until I'm left with a practically vanilla game to play with. It'd be a pain to re-add all this stuff on top of a vanilla game by hand.
Title: Re: DFHack 0.34.11 r5
Post by: falcn on June 25, 2014, 09:30:46 am
I'm sorry if it is an obvious question - I'm new to df. There are no bin patches for OS X in dfhack r5?

Question 2: What am I doing wrong?
I want seedwatch to activate automatically.

Dwarf Fortress r5/data/save/region1/raw/onload.init
Code: [Select]
seedwatch all 25
seedwatch MUSHROOM_HELMET_PLUMP 50
seedwatch start

Log:
Code: [Select]
seedwatch supervision started.
seedwatch deactivated due to game load/unload
Protecting 62 jobs.
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]# seedwatch info
seedwatch Info:
seedwatch is not supervising.  Use 'seedwatch start' to start supervision.
Title: Re: DFHack 0.34.11 r5
Post by: Quietust on June 25, 2014, 10:39:23 am
There are no bin patches for OS X in dfhack r5?
Most of the binary patches were only written for Windows and Linux - considerable extra effort is required in order to port them to OSX, so it hasn't been done yet.

[edit] For the record, I've located all of the patch points (http://www.qmtpro.com/~quietust/df/df_osx_patches.txt) for the various patches, though I currently don't have the means to write the patches myself.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 25, 2014, 11:26:48 am
In trying to run DFHack on Linux, I'm experiencing an error where libstdc++.so.6 does not contain versions GLIBCXX_3.4.20, GLIBCXX_3.4.18, GLIBCXX_3.4.15, CXXABI_1.3.8, or CXXABI_1.3.5, and as such, I cannot run it. Libstdc++.so.6 is in the libs folder, so it is accounted for.

I hate to be that guy, but am I missing packages or libraries, goon up somewhere in unzipping the file, generally emit stupidity, or...?
Remove libstdc++ from libs/ and let DFHack use your system libc++.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 25, 2014, 11:47:26 am
If you don't have gcc 4.9 installed (e.g. on Ubuntu), try the version for gcc 4.8 from the first post (here (http://dffd.wimbli.com/file.php?id=8692)).
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 25, 2014, 06:34:25 pm
Thanks to jj`` and Quietust, the hospital-overstocking binpatch now works on OS X: https://github.com/DFHack/dfhack/tree/develop/patches/v0.34.11%20osx (save the .dif file(s) to "hack/patches/v0.34.11 osx/(patch name).dif").
Note that for this to work, you must patch hack/lua/binpatch.lua (not hack/scripts/binpatch.lua). Change line 45 from
Code: [Select]
local base = dfhack.internal.getImageBase()to
Code: [Select]
local base = (dfhack.getOSType() == 'darwin' and 0x1000) or dfhack.internal.getImageBase()This fix is also possible with DFHack r3/r4, but I have not tested the binpatch with those versions yet.

Edit: typo, updated link
Title: Re: DFHack 0.34.11 r5
Post by: falcn on June 25, 2014, 06:43:03 pm
Most of the binary patches were only written for Windows and Linux - considerable extra effort is required in order to port them to OSX, so it hasn't been done yet.

[edit] For the record, I've located all of the patch points (http://www.qmtpro.com/~quietust/df/df_osx_patches.txt) for the various patches, though I currently don't have the means to write the patches myself.
Unfortunately, assembler isn't my cup of tea.
Thanks to jj`` and Quietust, the hospital-overstocking binpatch now works on OS X: \
Thanks! Works on 0.34.11 r5 / OS X 10.9.3, no overstocking
Title: Re: DFHack 0.34.11 r5
Post by: Monkeylordmafia on June 25, 2014, 09:19:05 pm
what happened to the fullheal command?
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 25, 2014, 09:28:24 pm
what happened to the fullheal command?
That doesn't appear to have ever been part of the DFHack repository. An older version for r3 can be found here (http://www.bay12forums.com/smf/index.php?topic=91166.4125) - it isn't compatible with r5, but parts of it still work.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 25, 2014, 10:32:02 pm
I'll add it the queue of scripts I'm updating to include in this and future versions.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 26, 2014, 04:06:26 am
There are no bin patches for OS X in dfhack r5?
Most of the binary patches were only written for Windows and Linux - considerable extra effort is required in order to port them to OSX, so it hasn't been done yet.

[edit] For the record, I've located all of the patch points (http://www.qmtpro.com/~quietust/df/df_osx_patches.txt) for the various patches, though I currently don't have the means to write the patches myself.
Excellent. I checked the list, and there are 2 more binpatches that could make the list:
User2's manager unlimiter (http://www.bay12forums.com/smf/index.php?topic=91166.msg5318968#msg5318968)
Urist Da Vinci's weapon velocity patch (http://www.bay12games.com/dwarves/mantisbt/view.php?id=6364)

I see that jj is wrinting the .dif-s. Should I send the PM with this?

And a bit noob question. The patch that jj posted looks like this:
Spoiler (click to show/hide)
Do I need to use it as it is, or only the lines with the plus signs? I'm asking because I've seen github patches that marked the line changes with minus and plus signs, and I'm unsure about this one. The game accepts the binpatch either way, but I can't confirm if it's working correctly or not. :(
Title: Re: DFHack 0.34.11 r5
Post by: ag on June 26, 2014, 04:17:34 am
And a bit noob question. The patch that jj posted looks like this:
Code: [Select]
00110776: 75 90
00110777: D8 90
006602C4: 04 3C
006602CE: 40 47
Do I need to use it as it is, or only the lines with the plus signs? I'm asking because I've seen github patches that marked the line changes with minus and plus signs, and I'm unsure about this one. The game accepts the binpatch either way, but I can't confirm if it's working correctly or not. :(

Actually the important part is those four lines at the end. The rest is just documentation.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 26, 2014, 04:26:12 am
Actually the important part is those four lines at the end. The rest is just documentation.
Thx!
Title: Re: DFHack 0.34.11 r5
Post by: falcn on June 26, 2014, 05:16:41 am
Excellent. I checked the list, and there are 2 more binpatches that could make the list:
User2's manager unlimiter (http://www.bay12forums.com/smf/index.php?topic=91166.msg5318968#msg5318968)
I've tried this patch for OS X and it's not working for me (this is the point where I give up due to my absent binary debugging skills)
Title: Re: DFHack 0.34.11 r5
Post by: falcn on June 26, 2014, 06:09:54 am
soundsense-season appears to be doing nothing at all.
ss_fix.log file doesn't get created or updated.
Title: Re: DFHack 0.34.11 r5
Post by: Intrinsic on June 26, 2014, 06:21:31 am
A huge thanks to all those involved with getting r5 out the door.
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 26, 2014, 06:40:19 am
soundsense-season appears to be doing nothing at all.
ss_fix.log file doesn't get created or updated.

It's been a while, but I'm pretty sure that soundsense-season writes to the gamelog. The "soundsense" script writes to the other file, and is distributed with the utility not with dfhack.
Title: Re: DFHack 0.34.11 r5
Post by: falcn on June 26, 2014, 07:18:12 am
soundsense-season appears to be doing nothing at all.
ss_fix.log file doesn't get created or updated.

It's been a while, but I'm pretty sure that soundsense-season writes to the gamelog. The "soundsense" script writes to the other file, and is distributed with the utility not with dfhack.

My bad. I thought the "soundsense-season" superseded old "soundsense" script, now I have looked at the code and saw that it doesn't.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 26, 2014, 07:32:45 am
Excellent. I checked the list, and there are 2 more binpatches that could make the list:
User2's manager unlimiter (http://www.bay12forums.com/smf/index.php?topic=91166.msg5318968#msg5318968)
I've tried this patch for OS X and it's not working for me (this is the point where I give up due to my absent binary debugging skills)
Here's a script (https://github.com/lethosor/dfhack-scripts/blob/master/manager-quantity.lua) I wrote that does the same thing (call it from the main manager screen with a job selected).
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 26, 2014, 07:46:23 am
https://github.com/expwnent/dfhack/commit/596ab0e1b85dff4107a65847247d4b7ec1eafa12

All the scripts I've added are in there. They should be safe for the current version. There are a lot of them, so go check them out! I also added a few convenience things like the "repeat" command / repeatUtil / etc.

I added an onReport event that happens when a combat report happens (much more often than you think: it doesn't have to be visible to the user). More exciting is the onStrike event which triggers when any unit hits another. For convenience, it also tries to compute whether they hit the target with a weapon or with a unit attack. It needs testing, so let me know how it goes.
Title: Re: DFHack 0.34.11 r5
Post by: falcn on June 26, 2014, 08:12:34 am
Here's a script (https://github.com/lethosor/dfhack-scripts/blob/master/manager-quantity.lua) I wrote that does the same thing (call it from the main manager screen with a job selected).
Thanks! Here it is in the context
Code: [Select]
keybinding add M@jobmanagement "manager-quantity"
Title: Re: DFHack 0.34.11 r5
Post by: Monkeylordmafia on June 26, 2014, 08:30:53 am
thanks for the script update, dfhack is a life saver fun prevention. Anyone help me put new scripts into the current version of dfhack so I can run them?
Title: Re: DFHack 0.34.11 r5
Post by: Urist Da Vinci on June 26, 2014, 09:15:31 am
I am not sure what the criteria is to include a binary patch as part of DFHack, but this one may be interesting to some people:

Cave Fish Binary Patch (bug 5703 Underground lake, despite having fish, is always reported as "there is nothing to catch") (http://www.bay12games.com/dwarves/mantisbt/view.php?id=5703)

Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 26, 2014, 10:57:10 am
https://github.com/expwnent/dfhack/commit/596ab0e1b85dff4107a65847247d4b7ec1eafa12

All the scripts I've added are in there. They should be safe for the current version. There are a lot of them, so go check them out! I also added a few convenience things like the "repeat" command / repeatUtil / etc.

I added an onReport event that happens when a combat report happens (much more often than you think: it doesn't have to be visible to the user). More exciting is the onStrike event which triggers when any unit hits another. For convenience, it also tries to compute whether they hit the target with a weapon or with a unit attack. It needs testing, so let me know how it goes.

Having a problem running growthbug with the new repeat command. osx, dfhack-r5 Here is what I did:
...and dwarf fortress becomes unresponsive immediately, tried letting it run for 5 minutes to see if it returns, but no luck.

EDIT: same result with feeding-timers. Even trying to run "repeat enable" without arguments in the console freezes the game.
Title: Re: DFHack 0.34.11 r5
Post by: indyofcomo on June 26, 2014, 11:12:23 am
What's the simplest way(probably on the wiki) to find out what string I should be using with workflow?
Title: Re: DFHack 0.34.11 r5
Post by: Timeless Bob on June 26, 2014, 06:08:03 pm
What is an "embark offset patch"?  Because I'm getting an "embark offset patch not found" when trying to use "embark anywhere" or "embark nano".
Title: Re: DFHack 0.34.11 r5
Post by: Nalbir on June 26, 2014, 06:32:30 pm
I cannot seem to get this working on Archlinux 64bit. The game window just appears then disappears. Terminal feedback doesn't really tell me anything either.

Code: [Select]
[glen@arch df_linux-phoebus]$ ./dfhack
Gtk-Message: Failed to load module "canberra-gtk-module"
Sound devices available:
OpenAL Soft
Picking OpenAL Soft. 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: 1280x400
Font size: 16x16
Resizing grid to 80x25
Resizing font to 16x16

Resetting textures


Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 26, 2014, 08:26:27 pm
Anything in stderr.log? Some package managers use custom versions of libgraphics that don't export symbols that DFHack needs to run, and Arch might be one of those. Try the default libgraphics from http://www.bay12games.com/dwarves/ and see if that works.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 27, 2014, 12:43:05 am
https://github.com/expwnent/dfhack/commit/596ab0e1b85dff4107a65847247d4b7ec1eafa12

All the scripts I've added are in there. They should be safe for the current version. There are a lot of them, so go check them out! I also added a few convenience things like the "repeat" command / repeatUtil / etc.

I added an onReport event that happens when a combat report happens (much more often than you think: it doesn't have to be visible to the user). More exciting is the onStrike event which triggers when any unit hits another. For convenience, it also tries to compute whether they hit the target with a weapon or with a unit attack. It needs testing, so let me know how it goes.

Having a problem running growthbug with the new repeat command. osx, dfhack-r5 Here is what I did:
  • save growthbug.lua to hack/script
  • save repeat.lua to hack/script
  • save repeatUtil.lua to hack/lua/plugins
  • add to dfhack.init: "repeat enable 1 months growthbug now"
...and dwarf fortress becomes unresponsive immediately, tried letting it run for 5 minutes to see if it returns, but no luck.

EDIT: same result with feeding-timers. Even trying to run "repeat enable" without arguments in the console freezes the game.

https://github.com/expwnent/dfhack/commit/66098c2bb4a12016e2623b2b3814ff1890b935ab

The documentation was wrong. I changed the syntax of the repeat command and forgot to document it properly. It should work now. Also there was a minor error in removewear which I fixed.

edit: https://github.com/expwnent/dfhack/commit/61d73cc6c28477eca81dda79b8ea14994a098ed9

Another tweak to prevent the infinite loop in the repeat script if you use the wrong syntax.

edit2: I didn't document this, but it should also be possible to call DFHack plugins from lua using the repeat command if you want.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 27, 2014, 03:37:11 am
/snip
The documentation was wrong. I changed the syntax of the repeat command and forgot to document it properly. It should work now. Also there was a minor error in removewear which I fixed.

Thx for the fix, it works now. However the growtbug.lua script throws this error message if run from the dfhack console

Code: [Select]
..._8.6/Macnewbie/Dwarf Fortress/hack/scripts/growthbug.lua:19: attempt to index field 'units' (a nil value)
stack traceback:
..._8.6/Macnewbie/Dwarf Fortress/hack/scripts/growthbug.lua:19: in main chunk
(...tail calls...)
and this, if run in the onload.init:
Code: [Select]
..._8.6/Macnewbie/Dwarf Fortress/hack/scripts/growthbug.lua:19: attempt to index field 'units' (a nil value)
stack traceback:
..._8.6/Macnewbie/Dwarf Fortress/hack/scripts/growthbug.lua:19: in main chunk
(...tail calls...)
[C]: in function 'runCommand'
./hack/lua/dfhack.lua:384: in function 'run_command'
...bie_8.6/Macnewbie/Dwarf Fortress/hack/scripts/repeat.lua:70: in function 'func'
./hack/lua/plugins/repeatUtil.lua:27: in function 'helper'
./hack/lua/plugins/repeatUtil.lua:30: in function 'scheduleEvery'
...bie_8.6/Macnewbie/Dwarf Fortress/hack/scripts/repeat.lua:69: in main chunk
(...tail calls...)

The command is the same both times: repeat -time 1 months -command growthbug

And another question: is there any reason to be careful with the repeat commands? I'm thinking adding cleanowned, build-location, perhaps stuckdoors to be run on a 1 month interval. Should I expect slowdowns from these calculations, or is it negligible? Does dfhack run on the same core as df, or are these scripts run on a different one?
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 27, 2014, 04:21:23 am
For now you should add it to onLoad.init in your raws folder, not dfhack.init. The problem is that it was running before your world loads.

These scripts should be light on your FPS, so that shouldn't have any noticeable effect.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 27, 2014, 04:43:56 am
For now you should add it to onLoad.init in your raws folder, not dfhack.init. The problem is that it was running before your world loads.

That was my idea as well, "cleanowned scattered x", feeding-timers, build-location work, but growthbug doesn't. Check out the second error message, that's from running it with the onLoad.init.

Quote
These scripts should be light on your FPS, so that shouldn't have any noticeable effect.
Cool, one month it is!
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 27, 2014, 05:08:10 am
Oh, that should be df.global.world.units.all instead of df.world.units.all.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 27, 2014, 06:00:20 am
Oh, that should be df.global.world.units.all instead of df.world.units.all.
Perfect!

@Peredexiserrant:

Plus I have a question about item-occupancy.lua: What does it do, should I run it with repeat, or at all.
Title: Re: DFHack 0.34.11 r5
Post by: ag on June 27, 2014, 06:04:32 am
Plus I have a question about item-occupancy.lua: What does it do, should I run it with repeat, or at all.

That script is an extremely slow process intended to diagnose and fix corruption from buggy scripts or plugins teleporting items around. It should only be used if you encounter problems like dwarves claiming there is an item in a tile when there is none. It's somewhat similar to programs like chkdisk that fix your filesystem.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 27, 2014, 06:15:03 am
That script is an extremely slow process intended to diagnose and fix corruption from buggy scripts or plugins teleporting items around. It should only be used if you encounter problems like dwarves claiming there is an item in a tile when there is none. It's somewhat similar to programs like chkdisk that fix your filesystem.
Thx, noted, deleted from onload.
One more: I tried running the blooddel command to test if it works, and it won't delete blood barrels from an already arrived caravan. Is it intended behaviour? Is it only effective on future caravans?
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 27, 2014, 06:31:06 am
Nice. 

The thing I'm grappling with is that (as I understand) there's a separate Onload.init for each save, which creates some issues for people who move old saves over to a new pack and probably a support headache when someone changes settings and it doesn't behave as they expect. 

My plan was to find someone who can make this happen (https://github.com/PeridexisErrant/Starter-Pack-Launcher/issues/4), and basically just run a few things from there - recreating all such files each time a setting is changes.  It would be simple enough to make a monster-option for all bugfixes with multicmd;;;;;;; - but I probably won't move anything I expect people to leave on unless it can't be done from dfhack.init.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 27, 2014, 07:07:19 am
The thing I'm grappling with is that (as I understand) there's a separate Onload.init for each save, which creates some issues for people who move old saves over to a new pack and probably a support headache when someone changes settings and it doesn't behave as they expect.
Two solutions come to mind:
1. You already have a script to help migrating saves, add a line to copy onload.init to the individual saves
2. Add a copy of onload.init to the raw folder of every graphics pack, and tell the players to always reapply the graphics settings before playing. That's what I'm going to do.

A setting manager is not a bad idea, but it's not an immediate solution.
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 27, 2014, 07:27:26 am
I had thought of the first, and I plan to do this eventually - but it's a real pain, with way more special cases than I want to consider.  The second could work - I'd have to check how selectively the windows GUI copies those folders over.  On the other hand, it makes all the issues with propagating settings even worse if I want to use it for more that always-on bugfixing. 

Serious questions to dfhack people:  how hard would it be to have a single Onload.init in the same place as dfhack.init? 

This would be a huge plus for my setup in the Starter Pack.  If keeping the current function is desired, it could be overridden when an in-save-folder init file is found. 
Title: Re: DFHack 0.34.11 r5
Post by: Meph on June 27, 2014, 07:30:53 am
Wouldnt that create the same issue? Players load an old save with specific settings, and it doesnt behave like it did when they created it.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 27, 2014, 07:41:26 am

Serious questions to dfhack people:  how hard would it be to have a single Onload.init in the same place as dfhack.init? 
You can probably do it fairly easily by calling "script onload.init" whenever a region loads.
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 27, 2014, 07:52:22 am
What I'm after would basically fake having a single simple file; if you mean a save from an older pack I already reset dfhack.init by default so that any new items will usually make it through.  There's no perfect solutions, so I try to make the default work for the minimum-effort newbie.  It seems to work out pretty well for most :)

You can probably do it fairly easily by calling "script onload.init" whenever a region loads.
I'll look into this if I have a day free sometime, but that might not happen for a while. 
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 27, 2014, 08:11:30 am
This should work in dfhack.init:
Code: [Select]
:lua dfhack.onStateChange.onloadscript = function(state) if state == SC_WORLD_LOADED then dfhack.run_command('script onload.init') end end
If you want output to be displayed, use this instead:
Code: [Select]
:lua dfhack.onStateChange.onloadscript = function(state) if state == SC_WORLD_LOADED then print((dfhack.run_command('script onload.init'))) end end
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on June 27, 2014, 08:19:12 am
And by substituting the filename I can use a separate non-conflicting single file, yes? Thanks!
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 27, 2014, 08:21:19 am
That script is referring to "onload.init" in the main DF folder (not a region folder), although the name doesn't make a difference.
Title: Re: DFHack 0.34.11 r5
Post by: indyofcomo on June 27, 2014, 08:44:06 am
What's the simplest way(probably on the wiki) to find out what string I should be using with workflow?
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 27, 2014, 06:06:53 pm
I had thought of the first, and I plan to do this eventually - but it's a real pain, with way more special cases than I want to consider.  The second could work - I'd have to check how selectively the windows GUI copies those folders over.  On the other hand, it makes all the issues with propagating settings even worse if I want to use it for more that always-on bugfixing. 

Serious questions to dfhack people:  how hard would it be to have a single Onload.init in the same place as dfhack.init? 

This would be a huge plus for my setup in the Starter Pack.  If keeping the current function is desired, it could be overridden when an in-save-folder init file is found.

Not that hard, but Lethosor's solution is better. You can do it with dfhack.init as is.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 27, 2014, 06:07:38 pm
One more: I tried running the blooddel command to test if it works, and it won't delete blood barrels from an already arrived caravan. Is it intended behaviour? Is it only effective on future caravans?

Yes, only future caravans.
Title: Re: DFHack 0.34.11 r5
Post by: Urist Da Vinci on June 27, 2014, 08:14:33 pm
One more: I tried running the blooddel command to test if it works, and it won't delete blood barrels from an already arrived caravan. Is it intended behaviour? Is it only effective on future caravans?

Yes, only future caravans.

Correct. The script removes bloods etc. from the list of extracts that a civ can bring. This will also prevent you from embarking with or requesting blood barrels. Items that already exist on the map are not affected. The script only needs to be run once per world, as the change appears to be saved in the world data.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 27, 2014, 09:35:09 pm
What's the simplest way(probably on the wiki) to find out what string I should be using with workflow?
If you mean the item/material tokens, they can be found at http://dwarffortresswiki.org/index.php/DF2012:Item_token and http://dwarffortresswiki.org/index.php/DF2012:Material_token, respectively. The createitem page (http://dwarffortresswiki.org/index.php/Utility:DFHack/createitem) may also be useful.
Title: Re: DFHack 0.34.11 r5
Post by: Rose on June 27, 2014, 11:36:59 pm
Alternately use the much more friendly workflow GUI script.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on June 28, 2014, 02:03:59 pm
This should work in dfhack.init:
Code: [Select]
:lua dfhack.onStateChange.onloadscript = function(state) if state == SC_WORLD_LOADED then dfhack.run_command('script onload.init') end end
What is the syntax, if I want to run a script at embark/after embark. Will the script only act on the active world, or any saves?

What is an "embark offset patch"?  Because I'm getting an "embark offset patch not found" when trying to use "embark anywhere" or "embark nano".
Yeah, the embark script does that, use the embark-tools instead: enable embark-tools in the console, then you get a GUI option.

What's the simplest way(probably on the wiki) to find out what string I should be using with workflow?
Use this as a base (https://db.tt/SD5s609Q), copypaste into dfhack, or add to dfhack.init or onload.init.
Title: Re: DFHack 0.34.11 r5
Post by: Riemann on June 28, 2014, 05:43:14 pm
Hey all, I've learned me some Ruby in the last couple days and am working on a DFHack script. Could use some help:

I have a reference to a Unit object and want to get the string name for that units Profession.

been poking at this for a while and I cannot figure out the syntax for working with the classes that contain things that kind of look like Enums (such as Profession)


this is what I have so far
Code: [Select]
def OutputDorfInfo(dorf)
    str = "#{dorf.name}" if dorf.name.has_name

    if dorf.custom_profession != ""
        str << " the #{dorf.custom_profession}"
    else
        str << dorf.profession.inspect()
    end

    str << " member of the militia squad #{dorf.military.squad_tg.name}" if dorf.military.squad_id != -1

    str << ". \nBorn in the year #{dorf.relations.birth_year}."

    if dorf.relations.spouse_id != -1
        str << "\nMarried to #{dorf.relations.spouse_tg.name}."
    end

    if dorf.relations.lover_id != -1
        str << "\nLover of #{dorf.relations.lover_tg.name}."
    end

    artifactName = dorf.status.artifact_name.to_s()
    if artifactName && artifactName.length > 0
        str << "\nCreator of the artifact #{artifactName}."
    end
   
    puts str
end


dorfs = DFHack.unit_citizens

dorfs.each { |d|
    OutputDorfInfo(d)
    puts ""
}
Title: Re: DFHack 0.34.11 r5
Post by: Riemann on June 28, 2014, 06:20:17 pm
Found it!

the syntax I was looking for is DFHack::Profession::Caption[dorf.profession]
Title: Re: DFHack 0.34.11 r5
Post by: Riemann on June 28, 2014, 10:52:42 pm
Does anyone know of how to generate the physical description of a dorf in Ruby?
Title: Building for Fedora 20
Post by: esarbe on June 30, 2014, 11:54:44 am
Hi there,

i've cloned the dfhack repo and I'm trying to build dfhack for fedora 20. I'm stuck at the configure build step, however:

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.

I'm at a loss here. The libstdc++ package is installed. Which hash map implementation is required?

(gcc version 4.8.3)

Cheers,
esarbe
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 30, 2014, 12:59:53 pm
Make sure you have a 32-bit GCC or multilib enabled.
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on June 30, 2014, 01:32:17 pm
https://github.com/expwnent/dfhack/commit/596ab0e1b85dff4107a65847247d4b7ec1eafa12

All the scripts I've added are in there. They should be safe for the current version. There are a lot of them, so go check them out! I also added a few convenience things like the "repeat" command / repeatUtil / etc.

I added an onReport event that happens when a combat report happens (much more often than you think: it doesn't have to be visible to the user). More exciting is the onStrike event which triggers when any unit hits another. For convenience, it also tries to compute whether they hit the target with a weapon or with a unit attack. It needs testing, so let me know how it goes.

I would recommend renaming hackWish to something more descriptive like gui/createitems or something along those lines.
Title: Re: DFHack 0.34.11 r5
Post by: Rumrusher on June 30, 2014, 06:09:53 pm
So cackling summoned bogeymen in fort mode seem to act friendly after you made the switch.
(http://www.truimagz.com/host/fortcrush2/de/instant-friendly-bogiemen.png)
Sadly I have no idea how to trigger the cackling to keep spawning bogeymen in fort mode.

So good news it's even Easier to train and tame bogeymen.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on June 30, 2014, 07:08:50 pm
I would recommend renaming hackWish to something more descriptive like gui/createitems or something along those lines.

It's on the todo list. I'm actually going to move the main part to modules/Items.cpp and re-expose it to Lua then have gui/hack-wish.lua for your nice user interface and modtools/create-item.lua for creating things from item-trigger/etc. It's all going to be different at first, but once it's all standardized and everyone switches over it'll be a lot easier to work with.
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on June 30, 2014, 07:14:18 pm
Sounds great.
Title: Re: DFHack 0.34.11 r5
Post by: FallenAngel on June 30, 2014, 07:59:16 pm
Using the awesome power of "mode set", I have discovered and proven a few things about the game.
Fortress Mode and Arena Mode are very similar, as are Adventure Mode and Controlling-a-Creature-in-Arena Mode - to get to Fortress Mode from Adventure Mode, you must go to the second Arena Mode, remove control of the creature, and then set it to Fortress Mode.
The game defaults to the first entry specified for a type of object if none is defined - two examples are "toad" and "iron". "There are no idle toads or jobs" indeed.
Perhaps the ability to spawn a creature in Fortress Mode as a citizen could be added in another version/update?
Also, the game seems to define members of a civilized race as Hostile under a surprising set of conditions - using embark-tools to embark on a human fort had all soldiers hostile but the local law-giver Friendly. Using "mode set" proves that this seems to apply to any non-major historical figure - in a mass of hostile Human Bone Carvers, Farmers, and Engravers, a Bowman, a Lye Maker, and a Child were all Friendly for some reason, as well as the "adventurer", who was not my original due to "mode set" magics. Also, going from Arena Mode to Fortress Mode acts as if the game were under the effect of "reveal hell" minus the force-pause. Letting the game tick one frame lets the spoilers fly out, and going much further crashes the game.
More Research is required, preferably with more magma.
Title: Re: DFHack 0.34.11 r5
Post by: Blastbeard on June 30, 2014, 08:06:59 pm
Perhaps the ability to spawn a creature in Fortress Mode as a citizen could be added in another version/update?

Yes. YES. Please yes. I want that so badly you could not even know, and it would be useful in so many ways. Being able to decide its name, age, and skill/attribute levels would be good too.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on June 30, 2014, 08:22:47 pm
Perhaps the ability to spawn a creature in Fortress Mode as a citizen could be added in another version/update?

Yes. YES. Please yes. I want that so badly you could not even know, and it would be useful in so many ways. Being able to decide its name, age, and skill/attribute levels would be good too.
I'm pretty sure spawnunit can do most of this (except for age and skills, which are fairly easy to set manually).
Edit: link (https://gist.github.com/warmist/8563110)
Title: Re: DFHack 0.34.11 r5
Post by: FallenAngel on June 30, 2014, 08:23:18 pm
It's hard to think of a situation where it wouldn't be useful.
New soldier, on-the-field testing, bait for a trap, not Miserable citizen, the list goes on for its uses.
Title: Re: DFHack 0.34.11 r5
Post by: Rumrusher on June 30, 2014, 10:29:44 pm
Perhaps the ability to spawn a creature in Fortress Mode as a citizen could be added in another version/update?

Yes. YES. Please yes. I want that so badly you could not even know, and it would be useful in so many ways. Being able to decide its name, age, and skill/attribute levels would be good too.
I'm pretty sure spawnunit can do most of this (except for age and skills, which are fairly easy to set manually).
Edit: link (https://gist.github.com/warmist/8563110)
you can't even set age in arena so  it can do all of those by editing the newly created unit.
spawn unit kinda killed the idea of arena spawning stuff... oh and one thing combat_side is tied to arena and 0 is Independent and 1 is team 1 and so on.
Not much to do in that other than performing the more broken way to switch between modes other than the save method like spawning liquids and spawning units and items are all done by plugins or addons to dfhack by now.
the only thing I can see arena has in use is to set up easier to do community events that doesn't take years of dfhack to make or run and cracking the other plane riddle "is it possible for a dwarf to add more land to a worldgen? can said land not be connected to the world."
Title: Re: DFHack 0.34.11 r5
Post by: GreyPowerVan on June 30, 2014, 10:46:52 pm
Is anyone still working on autolabor?  I was trying to teach my wife dwarf fortress and she hated micromanaging workers, but I just discovered autolabor can halt your fortress, due to it assigning 7 woodcutters (even though I only have one axe) and then being unable to assign them to the mining duty due to the equipment bug.

I eventually fixed it by disabling autolabor and going into therapist, then making people miners and turning autolabor back on, but that's not a solution.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 01, 2014, 06:04:58 am
I'm working on converting spawn-unit to C++ and also other things. Does anyone have a working, tested script that has to do with adding units to historical entities and groups? It would help.
Title: Re: DFHack 0.34.11 r5
Post by: Warmist on July 01, 2014, 06:10:22 am
I'm working on converting spawn-unit to C++ and also other things. Does anyone have a working, tested script that has to do with adding units to historical entities and groups? It would help.
https://gist.github.com/warmist/8563110#file-spawn-unit-lua-L364

The issue is that it add historical figure (and more importantly nemesis entry) to a site. If site is not available i have no idea how badly it corrupts your saves. The issue is that we don't mess with save files as a principle. Afaik this works in fort mode.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 01, 2014, 07:17:54 am
I don't know how to expose it to Lua, but I typed it up in C++. https://github.com/expwnent/dfhack/tree/spawnUnit

Warmist: if you could expose it to Lua and sanity check it for me I would greatly appreciate it. I don't really know what I'm doing.
Title: Re: DFHack 0.34.11 r5
Post by: Warmist on July 01, 2014, 07:30:32 am
I think it would be as easy as adding few lines here: https://github.com/expwnent/dfhack/blob/spawnUnit/library/LuaApi.cpp#L1402
Might be wrong though...
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 01, 2014, 07:33:10 am
I tried that. It threw an exception about complex objects.
Title: Re: DFHack 0.34.11 r5
Post by: Warmist on July 01, 2014, 07:38:48 am
Okay, i'll look into this, hopefully tonight.
Title: Re: DFHack 0.34.11 r5
Post by: breadman on July 01, 2014, 02:42:36 pm
Is anyone still working on autolabor?  I was trying to teach my wife dwarf fortress and she hated micromanaging workers, but I just discovered autolabor can halt your fortress, due to it assigning 7 woodcutters (even though I only have one axe) and then being unable to assign them to the mining duty due to the equipment bug.

I've considered fixing that, but haven't yet gotten around to more than a cursory scan of the source (https://github.com/DFHack/dfhack/blob/develop/plugins/autolabor.cpp).  It has specific provisions for the three equipment labors (woodcutting, hunting, and mining), but they don't seem to work quite right.

So far, I've been able to work around the issue by limiting those three labors to small numbers (for example, autolabor CUTWOOD 1 2).  As long as the sum is less than the number of civilians in your fort, you should be all right.

I have also noticed that it tends to send quite a few people fishing even when limited to allow only one fisher, because it prefers to assign labors to an idle dwarf than to the ones actively performing the task.
Title: Re: DFHack 0.34.11 r5
Post by: Quarterblue on July 01, 2014, 06:32:23 pm
Is Emigration in the repo? I think it should be in, it's a useful, easily customizable feature that can't hurt.
Title: Re: DFHack 0.34.11 r5
Post by: Riemann on July 01, 2014, 06:37:43 pm
So mucking about in Ruby for a DFHack plugin was way easier than Lua but still I am feeling too constrained here. Should have just stuck to what I know and gone with C++ from the start.

would any of you fine chaps have a link to how to set up a build environment for a C++ DFHack plugin? If it matters I'll be using Visual Studio.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 01, 2014, 06:40:31 pm
https://github.com/DFHack/dfhack/blob/master/Compile.rst
Title: Re: DFHack 0.34.11 r5
Post by: Riemann on July 01, 2014, 06:46:34 pm
thanks! will check that out when I get home
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 01, 2014, 08:10:51 pm
Danaris has put up an experimental version of Stonesense here (http://topazgryphon.org/~tcollett/df/dfhack-0.34.11-r5-stonesense-Darwin.tar.bz2). It's not that stable or official yet, but it should work well enough for screenshots and experiments (be sure to save before using it).
Title: Re: DFHack 0.34.11 r5
Post by: fricy on July 02, 2014, 03:33:36 am
Danaris has put up an experimental version of Stonesense here (http://topazgryphon.org/~tcollett/df/dfhack-0.34.11-r5-stonesense-Darwin.tar.bz2). It's not that stable or official yet, but it should work well enough for screenshots and experiments (be sure to save before using it).
Won't load, freetype 6 dylib is missing.
Nevermind, works with freetype6 from XQuartz.

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r5
Post by: danaris on July 02, 2014, 09:13:59 am
Yep, this is why I hadn't posted about that build myself—I'm still trying to work all the library bugs out of it :P
Title: Re: DFHack 0.34.11 r5
Post by: Merkator on July 02, 2014, 11:59:49 am
Hi everyone.
I spent few minutes on writing something that seems to me useful.
DF normally doesn't give you any small 'reward' when you play it.
By reward I mean things like 'Badges' or 'Achievements'.
From psychological point of view they give us great tool for attracting attention of players and even teaching
about game itself.

Here is the source code -> https://gist.github.com/Demagogue/216e89435d2550108f6f (https://gist.github.com/Demagogue/216e89435d2550108f6f)


This is already only basic template and lack almost any documentation and code for updating variables.

 

Title: Re: DFHack 0.34.11 r5
Post by: Putnam on July 02, 2014, 12:11:52 pm
Hehe, sounds fun. I could definitely find a use for that.
Title: Re: DFHack 0.34.11 r5
Post by: Meph on July 02, 2014, 12:18:02 pm
Hi everyone.
I spent few minutes on writing something that seems to me useful.
DF normally doesn't give you any small 'reward' when you play it.
By reward I mean things like 'Badges' or 'Achievements'.
From psychological point of view they give us great tool for attracting attention of players and even teaching
about game itself.

Here is the source code -> https://gist.github.com/Demagogue/216e89435d2550108f6f (https://gist.github.com/Demagogue/216e89435d2550108f6f)


This is already only basic template and lack almost any documentation and code for updating variables.
I love it. :)
Title: Re: DFHack 0.34.11 r5
Post by: Merkator on July 03, 2014, 06:13:14 am
@Putnam @Meph Great to see you both like it.

I made some updates.
Little more docs now + now it is possible to set how often those archievement achievements (I don't know why but I always have the weird feeling that somewhere inside word 'achievement' need to be 'r'. ) need to be checked.
For now I don't have time to test it properly, but if you feel generous download it and play with this.
I appreciate every comment about my style and/or mistakes.
 
Link stay the same -> https://gist.github.com/Demagogue/216e89435d2550108f6f (https://gist.github.com/Demagogue/216e89435d2550108f6f)

If I clutter this topic just say I move somewhere else.  ::)
Title: Building for Fedora 20, c'td.
Post by: esarbe on July 03, 2014, 06:44:13 am
Hi everyone,

thanks for the help so far!

(just in case anyone is having the same problems:
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.
)

i was able to build the dfhack 0.34.11 r5 on Fedora 20 (Heisenbug). I was indeed lacking the appropriate i686 packages, which in the case of Fedora are glibc-devel.i686 and libstdc++-devel.i686. I also added the -m32 flag to the C and CXX compilers.

However; for the project build to actually complete I had to manually add the /usr/lib/pthread.so library during the linking stage for protoc-bin and dfhack-run.

In the case of protoc-bin I edited the generated file 'build/depends/protobuf/CMakeFiles/protoc-bin.dir/link.txt'


Code: [Select]
/usr/bin/c++   -m32 -fvisibility=hidden -m32 -march=i686 -mtune=generic -std=c++0x -O3 -DNDEBUG  \
  CMakeFiles/protoc-bin.dir/google/protobuf/compiler/main.cc.o  -o protoc -rdynamic libprotoc.so  /usr/lib/libpthread.so \
  libprotobuf.so -lz -Wl,-rpath,/home/bra/source/dfhack/build/depends/protobuf

I guess this is something that could be fixed during build configurations. I don't have any experience with cmake, so I'm open to any suggestions on how to fix this.

Cheers,
esarbe


Title: Re: DFHack 0.34.11 r5
Post by: ExpHP on July 03, 2014, 12:54:54 pm
A couple of tips for those still on the previous LTS release of Ubuntu (12.04 Precise), which was only superseded very recently, and will continue to receive support for a couple more years:

Even the alternate version included here is still too "bleeding-edge" compared to the versions of g++ available on the Precise repositories, so you'll need to build it.  Here's a complete list of commands to run, starting from a fresh 32-bit Ubuntu 12.04: (64-bit users, read below)
Spoiler (click to show/hide)

64-bit users will need to get multiarch or i386 versions of most of the packages.  I personally find it to be a lot of trouble seeking out all the appropriate 32-bit dev packages sometimes, so I will describe how you can get around this entirely by using lxc to create a virtual 32-bit build environment.
Spoiler (click to show/hide)

You may still need a couple of 32-bit packages to run DFhack outside the virtual box, but not nearly as many as you would need to build it.
Title: Re: DFHack 0.34.11 r5
Post by: SanderMarechal on July 03, 2014, 06:22:04 pm
Hi. I can't get dfhack to work. I am on a fresh install of Debian "Jessie" testing, the upcoming Debian release. My Linux is 64bit but I installed all the libraries I need (I think) in 32bit. Vanilla DF works fine. But when I try to start dfhack I get:

sander@porky:/opt/df_linux$ ./dfhack
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./hack/libprotobuf-lite.so)
-e


Any help? I have libstdc++6 installed in both 32bit and 64bit versions so I'm not sure what the problem is. Is this a problem with the libstdc++.so.6 file shipped by DF?

EDIT: I think I worked around it for now, but I haven't properly tested yet. dfhack starts, but I haven't run any game yet. What I did was move the provided libs/libstdc++.so.6 out of the way and replace it with a symlink to /usr/lib/gcc/i586-linux-gnu/4.9/libstdc++.so
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on July 03, 2014, 06:34:05 pm
Taken from here (https://aur.archlinux.org/packages/dfhack-git/)

A workaround appears to be overwriting /opt/df_linux/libs/libstdc++.so.6 with the one from lib32-gcc-libs
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 03, 2014, 08:38:16 pm
EDIT: I think I worked around it for now, but I haven't properly tested yet. dfhack starts, but I haven't run any game yet. What I did was move the provided libs/libstdc++.so.6 out of the way and replace it with a symlink to /usr/lib/gcc/i586-linux-gnu/4.9/libstdc++.so
That should work - you might not even need the symlink, if the library is in the correct location.
Title: Re: DFHack 0.34.11 r5
Post by: ExpHP on July 04, 2014, 10:14:38 am
That should work - you might not even need the symlink, if the library is in the correct location.
Indeed.  In my case (Ubuntu 12.04 x86_64), simply deleting the offending library in the DF folder enabled it to locate the correct library on my system.  (although it would be useful to know if there are distributions on which it won't work without adding a symlink)
Title: Re: DFHack 0.34.11 r5
Post by: thistleknot on July 04, 2014, 08:50:01 pm
I used dfhack gui/gm-editor to remove a ghost [that wasn't engraveable]

first I set his dead flag to true
then I set his ghostly flag to false

solve my issue,

just sharing.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 04, 2014, 09:05:33 pm
Why not "tweak clear-ghostly"? (Edit: It appears to do the same thing, but I consider it more convenient.)
Title: Re: DFHack 0.34.11 r5
Post by: thistleknot on July 04, 2014, 09:10:04 pm
oh... I didn't know that existed.  I was looking through my text dump of the ls list of dfhack for anything with the word "ghost"
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 04, 2014, 09:12:22 pm
That's because "tweak" accepts subcommands, which aren't visible with "ls". They are listed in the Readme (https://github.com/dfhack/dfhack) (also available at hack/Readme.html, if you want to read it offline).
Title: Re: DFHack 0.34.11 r5
Post by: Dirst on July 05, 2014, 12:37:18 am
Not sure this is exactly the right place to ask this question, but I can't get syndromeTrigger to work.  I have a set of minerals that are supposed to trigger a script when mined, but the script is never getting called (I put an unconditional print in there to make sure).  The script runs from the DFHack prompt, but repeated applications of the boil-away stone don't work.  Once I found out that syndromeTrigger can be enabled or disabled, I re-genned a world with syndromeTrigger enabled, but got the same (non)results.


The script is a stripped-down version of spawn-unit.lua with an added bit to make an announcement.

I'm probably making a rookie mistake with the syndromeTrigger, but I just can't find it.  Any and all help would be greatly appreciated!
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 05, 2014, 02:42:32 am
The most common mistake with syndromeTrigger is that you have to explicitly enable it in dfhack.init or manually with

Code: [Select]
enable syndromeTrigger
Just glancing at your inorganic, it looks fine to me but I haven't tested it personally. If you still have problems after the above I'll look into it in more detail.

PS: Just so you know, in the next release you'll need to switch over to the new system, which will require this line in onLoad.init:

Code: [Select]
syndrome-trigger -syndrome "wake gabbro" -command [ tesb-spawn GABBRO \\LOCATION \\UNIT_ID ]
Title: Re: DFHack 0.34.11 r5
Post by: Dante on July 05, 2014, 05:21:34 am
Posting to follow.
Title: Re: DFHack 0.34.11 r5
Post by: Merkator on July 05, 2014, 07:07:51 am
Posting to follow.

You know, you have option notify.
I'm saying just in case.
If mods will be removing upper post. Please remove this one two.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on July 05, 2014, 07:12:30 am
Posting to follow.
You know, you have option notify.
I'm saying just in case.
If mods will be removing upper post. Please remove this one two.
The two are not the same, if you select notify you get email spam, if you ptw you get unread notification.
Title: Re: DFHack 0.34.11 r5
Post by: Merkator on July 05, 2014, 11:41:40 am
But you know setting up folder for this kind of 'SPAM' is really easy.  :D
And I think it make thread more readable BTW.

Ok. I probably need some excuse for posting such useless OT.  :P

I am mostly on final line with my achievement plugin. Most things work, fully tested.
It should be easier to add more options. Only one, ugly bit is lack of nice display, but I don't have enough time today to add those few lines.
So here is a link => https://gist.github.com/Demagogue/216e89435d2550108f6f (https://gist.github.com/Demagogue/216e89435d2550108f6f)

If you want to play with it there are to samples.
First the sample.lua is just presentation of tool. Mostly basic stuff.
basic_planting.lua is the more RL examples. When I add display it should give nice big popups on screen.
I have plans to integrate it into nice in-game, interactive tutorial. 

Installation goes like that:
Spoiler (click to show/hide)

Criticism and opinions are welcomed.

Title: Re: DFHack 0.34.11 r5
Post by: Bartholomew The Pious on July 06, 2014, 08:46:00 pm
y did I type nyan
(http://puu.sh/9ZYZj/9e8995f38a.jpg)
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 06, 2014, 09:46:25 pm
That's the "kittens" plugin.
Possible Problems:
  • Developer plugins were accidentally included in the linux distribution in the Linux and Windows versions. These plugins are used by individual developers for testing purposes. Unless you are certain otherwise, you should assume they are all dangerous, and that there will not be any backwards compatibility guarantees. The safest thing is to delete them from hack/plugins manually after installing. The full list:
    • autolabor2
    • buildprobe
    • counters
    • dumpmats
    • eventExample
    • frozen
    • itemhacks
    • kittens
    • memview
    • nestboxes
    • notes
    • onceExample
    • printArgs
    • rawdump
    • ref-index
    • rprobe
    • stepBetween
    • stockcheck
    • stripcaged
    • tiles
    • tilesieve
    • vectors
    • vshook
Title: Re: DFHack 0.34.11 r5
Post by: Bartholomew The Pious on July 06, 2014, 10:19:58 pm
That's the "kittens" plugin.
Possible Problems:
  • Developer plugins were accidentally included in the linux distribution in the Linux and Windows versions. These plugins are used by individual developers for testing purposes. Unless you are certain otherwise, you should assume they are all dangerous, and that there will not be any backwards compatibility guarantees. The safest thing is to delete them from hack/plugins manually after installing. The full list:
    • autolabor2
    • buildprobe
    • counters
    • dumpmats
    • eventExample
    • frozen
    • itemhacks
    • kittens
    • memview
    • nestboxes
    • notes
    • onceExample
    • printArgs
    • rawdump
    • ref-index
    • rprobe
    • stepBetween
    • stockcheck
    • stripcaged
    • tiles
    • tilesieve
    • vectors
    • vshook
so far the only dangerous thing kitten does is prevent me from quitting the game at all, unless the console is terminated
Title: Re: DFHack 0.34.11 r5
Post by: Dirst on July 06, 2014, 10:20:45 pm
The most common mistake with syndromeTrigger is that you have to explicitly enable it in dfhack.init or manually with

Code: [Select]
enable syndromeTrigger
Just glancing at your inorganic, it looks fine to me but I haven't tested it personally. If you still have problems after the above I'll look into it in more detail.

PS: Just so you know, in the next release you'll need to switch over to the new system, which will require this line in onLoad.init:

Code: [Select]
syndrome-trigger -syndrome "wake gabbro" -command [ tesb-spawn GABBRO \\LOCATION \\UNIT_ID ]
It turns out that it's syndromeTrigger enable rather than enable syndromeTrigger but thanks for the tip on putting it in the init file.  Unfortunately, it still doesn't seem to work :(

Although I can hunt down some of the actual mineral clusters, what I've been doing as a test is using DFHack's createitem BOULDER "LIVING GRANITE" (which sometimes fails to check temperature, leaving a boil-away stone that doesn't boil away).  When it poofs properly, there's no indication of the syndrome.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 07, 2014, 02:40:52 am
syndromeTrigger enable and enable syndromeTrigger should both work.

Not sure this is exactly the right place to ask this question, but I can't get syndromeTrigger to work.  I have a set of minerals that are supposed to trigger a script when mined, but the script is never getting called (I put an unconditional print in there to make sure).  The script runs from the DFHack prompt, but repeated applications of the boil-away stone don't work.  Once I found out that syndromeTrigger can be enabled or disabled, I re-genned a world with syndromeTrigger enabled, but got the same (non)results.


The script is a stripped-down version of spawn-unit.lua with an added bit to make an announcement.

I'm probably making a rookie mistake with the syndromeTrigger, but I just can't find it.  Any and all help would be greatly appreciated!

Are you sure that the syndrome is being applied at all? Can you make it happen when the syndrome is applied as part of an interaction?
Title: Re: DFHack 0.34.11 r5
Post by: Dirst on July 07, 2014, 10:31:50 am
syndromeTrigger enable and enable syndromeTrigger should both work.

Not sure this is exactly the right place to ask this question, but I can't get syndromeTrigger to work.  I have a set of minerals that are supposed to trigger a script when mined, but the script is never getting called (I put an unconditional print in there to make sure).  The script runs from the DFHack prompt, but repeated applications of the boil-away stone don't work.  Once I found out that syndromeTrigger can be enabled or disabled, I re-genned a world with syndromeTrigger enabled, but got the same (non)results.


The script is a stripped-down version of spawn-unit.lua with an added bit to make an announcement.

I'm probably making a rookie mistake with the syndromeTrigger, but I just can't find it.  Any and all help would be greatly appreciated!

Are you sure that the syndrome is being applied at all? Can you make it happen when the syndrome is applied as part of an interaction?
That occurred to me after I quit for the night.  Next time I get a crack at it, I'll add a specific effect like a blinking tile or something to make sure.  I just find it hard to believe that the dwarf happened to not inhale after so many tests.
Title: Re: DFHack 0.34.11 r5
Post by: ChaosOrdeal on July 08, 2014, 05:25:27 pm
OK, I'll be the guy who asks.  Where can I find info regarding DFHack for the just-released (0.40.0x) version.  Please note that this is NOT a when-you-gonna-get-it-done-? post.  I just want to know where to check for it when it is finished, or is in beta and needs testers, and thanks for all your very appreciated work so far.
Title: Re: DFHack 0.34.11 r5
Post by: BigD145 on July 08, 2014, 05:56:34 pm
OK, I'll be the guy who asks.  Where can I find info regarding DFHack for the just-released (0.40.0x) version.  Please note that this is NOT a when-you-gonna-get-it-done-? post.  I just want to know where to check for it when it is finished, or is in beta and needs testers, and thanks for all your very appreciated work so far.

Probably right here or at least in a new topic in the DF Modding subforum. It wouldn't be anywhere else here. Github is the only other place to look.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 08, 2014, 05:58:54 pm
OK, I'll be the guy who asks.  Where can I find info regarding DFHack for the just-released (0.40.0x) version.  Please note that this is NOT a when-you-gonna-get-it-done-? post.  I just want to know where to check for it when it is finished, or is in beta and needs testers, and thanks for all your very appreciated work so far.

Probably right here or at least in a new topic in the DF Modding subforum. It wouldn't be anywhere else here. Github is the only other place to look.
#dfhack on freenode.net is fairly active
Title: Re: DFHack 0.34.11 r5
Post by: Meph on July 08, 2014, 09:13:45 pm
Quote
its not a when-you-gonna-get-it-done-? post.
Oh, but I want to do one. :P

I am in absolutely no hurry with this, but a rough idea (1 week, 1 month, 3 months-after-Toady-did-bugfix-releases-himself), would be nice. Not necessary in any way, but it would allow me to time my own stuff better to be on par with it.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 08, 2014, 09:32:31 pm
Quote
its not a when-you-gonna-get-it-done-? post.
Oh, but I want to do one. :P

I am in absolutely no hurry with this, but a rough idea (1 week, 1 month, 3 months-after-Toady-did-bugfix-releases-himself), would be nice. Not necessary in any way, but it would allow me to time my own stuff better to be on par with it.
Updating from 0.31.25 to 0.34.02 took 9 days, IIRC. It'll probably be longer this time - maybe 2 weeks? I'm not doing memory analysis myself, so I'm not sure.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 09, 2014, 12:20:16 am
Some amount of time between a week and a month is seems like a safe bet.
Title: Re: DFHack 0.34.11 r5
Post by: Warmist on July 09, 2014, 12:42:55 am
Some amount of time between a week and a month is seems like a safe bet.
But does not take into account meteor strikes. I would plan from a week and infinity. :D

EDIT: a somewhat realistic measure of progress:  here  (https://github.com/DFHack/df-structures/blob/master/v0.40.01.lst). The more stuff gets aligned/verified, the more finished new version is.
Title: Re: DFHack 0.34.11 r5
Post by: Arbinire on July 09, 2014, 01:37:45 pm
my guess is there'll be a wait for bugfix updates first, which is reasonable.  That said I'm looking forward to playing the new adventure mode with advfort :D, hopefully now we'll be able to build anywhere now and not just already established lairs *crosses fingers*
Title: Re: DFHack 0.34.11 r5
Post by: Warmist on July 09, 2014, 05:10:47 pm
my guess is there'll be a wait for bugfix updates first, which is reasonable.  That said I'm looking forward to playing the new adventure mode with advfort :D, hopefully now we'll be able to build anywhere now and not just already established lairs *crosses fingers*
Actually there was a script that would create a site at current location. Bigger problem was returning to almost any site would duplicate something till it lagged everything to death. Hopefully that is fixed in new df.
Title: Re: DFHack 0.34.11 r5
Post by: Hibgolz98G on July 09, 2014, 08:21:36 pm
Sorry but how do I run the stonesense inside of the game? I really cant figure it out and its one of the coolest new features. I try to enter stonesense into DFhack while the game is running but it just makes a second window like it always does.
Title: Re: DFHack 0.34.11 r5
Post by: Rose on July 09, 2014, 09:22:48 pm
type "stonesense overlay"
Title: Re: DFHack 0.34.11 r5
Post by: Hibgolz98G on July 09, 2014, 10:08:57 pm
That's amazing! Dwarf Fortress with graphics!
Title: Re: DFHack 0.34.11 r5
Post by: Hesperid on July 10, 2014, 07:45:11 am
Version 0.40.01 is so absolutely broken that I don't think it's even worth updating DFhack for it, yet.

e: typo
Title: Re: DFHack 0.34.11 r5
Post by: Warmist on July 10, 2014, 07:47:42 am
Version 0.40.01 is so absolutely broken that I don't think it's even worth updating DFhack for it, yet.

e: typo
Bugfixes usually change very little of df compared to real releases so almost everything will be straightforward to port into bugfix version.
Title: Re: DFHack 0.34.11 r5
Post by: Skyrunner on July 10, 2014, 09:50:43 am
ptw, also mentioning that the image in Japa's sig automatically updates to tell you how much has been done on DF Hack!

(http://skycoders.no-ip.org:60001/images/progressbar.png)
Title: Re: DFHack 0.34.11 r5
Post by: Hesperid on July 10, 2014, 04:37:11 pm
So the newest release (r5) of DFhack for 0.34.11 doesn't work for me because the shared object libstdc++ that is bundled requires a newer glibc. I did the usual workaround of removing it and linking to my system's shared object, however:

stonesense.plug.so ALSO requires this same version of glibc. And I can't just replace the stonesense shared objects.

So I downloaded the stonesense repository to compile it. The compile instructions simply say it can't be compiled alone and must be compiled with DFhack.

So I download the source to DFhack and all the 32-bit libraries it requires and all the ruby nonsense it requires. I finally get it to compile, but: the compiled shared objects don't include stonesense!

So I go through the Cmake file in plugins/ to see that stonesense isn't included anywhere in the list. As a last resort I try just including it as a directory -- maybe now it'll get built. Well, no. There's a syntax error in the source code:

custom_builds/dfhack/plugins/stonesense/Creatures.cpp:578:35: error: ‘InBody’ is not a member of ‘df::unit_inventory_item::T_mode’ itemslot->mode != df::unit_inventory_item::T_mode::InBody) {

Doubt I have what it takes to actually start fixing code. The instructions to building stonesense say to look at the instructions to building DFhack to see how to build stonesense. The compile instructions for DFhack don't even mention stonesense.

So how do I build stonesense?
Title: Re: DFHack 0.34.11 r5
Post by: danaris on July 10, 2014, 08:39:11 pm
So I download the source to DFhack and all the 32-bit libraries it requires and all the ruby nonsense it requires. I finally get it to compile, but: the compiled shared objects don't include stonesense!

You need to change the NO to YES on line 9 of plugins/CMakeLists.txt, then rebuild.

Quote
There's a syntax error in the source code:

custom_builds/dfhack/plugins/stonesense/Creatures.cpp:578:35: error: ‘InBody’ is not a member of ‘df::unit_inventory_item::T_mode’ itemslot->mode != df::unit_inventory_item::T_mode::InBody) {

I believe this means you need to update the dfstructures submodule in library/xml (git submodule init; git submodule update in the main DFHack directory should do this). However, I'm not 100% sure.

Is this on Linux or OS X?
Title: Re: DFHack 0.34.11 r5
Post by: Hesperid on July 10, 2014, 08:41:35 pm
So I download the source to DFhack and all the 32-bit libraries it requires and all the ruby nonsense it requires. I finally get it to compile, but: the compiled shared objects don't include stonesense!

You need to change the NO to YES on line 9 of plugins/CMakeLists.txt, then rebuild.

Quote
There's a syntax error in the source code:

custom_builds/dfhack/plugins/stonesense/Creatures.cpp:578:35: error: ‘InBody’ is not a member of ‘df::unit_inventory_item::T_mode’ itemslot->mode != df::unit_inventory_item::T_mode::InBody) {

I believe this means you need to update the dfstructures submodule in library/xml (git submodule init; git submodule update in the main DFHack directory should do this). However, I'm not 100% sure.

Is this on Linux or OS X?

It's on Linux. I updated the submodules before the error already so the problem's not there. I got it to work by stealing a copy of that single file from a different person's repository. It compiled and hasn't run into massive bugs at least yet.

I don't recommend anyone else going that route if they can avoid it, however.
Title: Re: DFHack 0.34.11 r5
Post by: Spacebat on July 10, 2014, 09:45:51 pm
I'm a programmer and I've worked with DFhack, how can I contribute to the update?
Title: Re: DFHack 0.34.11 r5
Post by: phphoenix on July 11, 2014, 01:19:41 pm
I seem to be having an issue with exterminate, no matter how i select the unit by 'v' or 'k' or unit list, it either tells me i need to select a unit ingame or "Invalid race, use one of...". I've also tried "exterminate pig slaughter/butcher" (yes I have pigs) and get the same result, looking at the code for the script it seems like there should be a list there but it doesn't seem to be printing or finding it.
Title: Re: DFHack 0.34.11 r5
Post by: salithus on July 11, 2014, 01:29:05 pm
I seem to be having an issue with exterminate, no matter how i select the unit by 'v' or 'k' or unit list, it either tells me i need to select a unit ingame or "Invalid race, use one of...". I've also tried "exterminate pig slaughter/butcher" (yes I have pigs) and get the same result, looking at the code for the script it seems like there should be a list there but it doesn't seem to be printing or finding it.
I've run into this same thing, but I assumed it was because I was getting the name for voracious cave crawlers wrong.
Title: Re: DFHack 0.34.11 r5
Post by: phphoenix on July 12, 2014, 04:26:15 pm
 
I seem to be having an issue with exterminate, no matter how i select the unit by 'v' or 'k' or unit list, it either tells me i need to select a unit ingame or "Invalid race, use one of...". I've also tried "exterminate pig slaughter/butcher" (yes I have pigs) and get the same result, looking at the code for the script it seems like there should be a list there but it doesn't seem to be printing or finding it.
I've run into this same thing, but I assumed it was because I was getting the name for voracious cave crawlers wrong.

I fixed my problem, seems to have been with the ruby api implementation in the Lazy Noob Pack, I just downloaded dfhack and extracted over the existing version of dfhack in the LNP and it worked. Not sure if that's what you were using salithus.
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on July 12, 2014, 04:39:24 pm
I seem to be having an issue with exterminate, no matter how i select the unit by 'v' or 'k' or unit list, it either tells me i need to select a unit ingame or "Invalid race, use one of...". I've also tried "exterminate pig slaughter/butcher" (yes I have pigs) and get the same result, looking at the code for the script it seems like there should be a list there but it doesn't seem to be printing or finding it.
I've run into this same thing, but I assumed it was because I was getting the name for voracious cave crawlers wrong.

I fixed my problem, seems to have been with the ruby api implementation in the Lazy Noob Pack, I just downloaded dfhack and extracted over the existing version of dfhack in the LNP and it worked. Not sure if that's what you were using salithus.

The Ruby API is part of DFHack, the Lazy Newb Pack doesn't add any functionality to DFHack.
Title: Re: DFHack 0.34.11 r5
Post by: fricy on July 12, 2014, 05:15:50 pm
I seem to be having an issue with exterminate, no matter how i select the unit by 'v' or 'k' or unit list, it either tells me i need to select a unit ingame or "Invalid race, use one of...". I've also tried "exterminate pig slaughter/butcher" (yes I have pigs) and get the same result, looking at the code for the script it seems like there should be a list there but it doesn't seem to be printing or finding it.
I've run into this same thing, but I assumed it was because I was getting the name for voracious cave crawlers wrong.
I fixed my problem, seems to have been with the ruby api implementation in the Lazy Noob Pack, I just downloaded dfhack and extracted over the existing version of dfhack in the LNP and it worked. Not sure if that's what you were using salithus
The Ruby API is part of DFHack, the Lazy Newb Pack doesn't add any functionality to DFHack.

Yeah, actually my fault. I sent over some scripts to Peredexiserrant, one of them was /hack/ruby/ruby-autogen.rb which has different line endings on mac, and because of this fails on windows. (btw: is that normal?)
thx for the report.
Title: Re: DFHack 0.34.11 r5
Post by: salithus on July 12, 2014, 05:33:07 pm
I seem to be having an issue with exterminate, no matter how i select the unit by 'v' or 'k' or unit list, it either tells me i need to select a unit ingame or "Invalid race, use one of...". I've also tried "exterminate pig slaughter/butcher" (yes I have pigs) and get the same result, looking at the code for the script it seems like there should be a list there but it doesn't seem to be printing or finding it.
I've run into this same thing, but I assumed it was because I was getting the name for voracious cave crawlers wrong.
I fixed my problem, seems to have been with the ruby api implementation in the Lazy Noob Pack, I just downloaded dfhack and extracted over the existing version of dfhack in the LNP and it worked. Not sure if that's what you were using salithus
The Ruby API is part of DFHack, the Lazy Newb Pack doesn't add any functionality to DFHack.

Yeah, actually my fault. I sent over some scripts to Peredexiserrant, one of them was /hack/ruby/ruby-autogen.rb which has different line endings on mac, and because of this fails on windows. (btw: is that normal?)
thx for the report.
Sweet - I'll try this out later today and let you know if it works for me too.
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on July 12, 2014, 08:39:25 pm
Thanks for the bug reports!  I've changed the line endings in that file for pack r66. 
Title: Re: DFHack 0.34.11 r5
Post by: derriesen on July 13, 2014, 05:33:06 am
Hi there,

is there a way to get DF-Hack running with the current release? Basically I just want to use "reveal" before embarking.. I'm too picky with my embarks and it takes forever when trial and erroring embarks...
Title: Re: DFHack 0.34.11 r5
Post by: scamtank on July 13, 2014, 05:34:38 am
No. Sit down and let the grown-ups keep working.
Title: Re: DFHack 0.34.11 r5
Post by: teoleo on July 13, 2014, 06:30:24 am
some help:

how open the console and use stonesense?

and my game freeze at the world update......
Title: Re: DFHack 0.34.11 r5
Post by: derriesen on July 13, 2014, 07:10:02 am
Allright! Ill be sitting down and wait it out patiently.
Thanks for creating such a usefull tool!

regards
Title: Re: DFHack 0.34.11 r5
Post by: KingKaol on July 13, 2014, 04:06:19 pm
Over in the Dwarf Therapist thread, Peridexis linked to this reddit thread (http://www.reddit.com/r/dwarffortress/comments/2ajsoy/dwarf_therapist_df_v04001_success/) where kyril posted a generated DT ini with memory locations and a link to the repository `df-structures` which he said was maintained by the DF Hack team: git://github.com/kyril/df-structures .

I cloned it and following the instructions in README.UPDATE to run `./new-runtime.pl v0.40.02 ~`. Then the readme instructs to launch the linux DF version and "launch the tool" (which I am guessing is `start.sh`), however the script comes to an error because the executable `./sbcl-runtime` is not found in the current directory. I did try installing `sbcl` and changing the script to run `/usr/bin/sbcl` but I am put into an sbcl prompt with errors about missing package `ASDF` which I tried fixing by installing `sbcl-source` and `cl-asdf` but still the error remains.

Anyone know anything more about using df-structures?
Title: Re: DFHack 0.34.11 r5
Post by: mifki on July 13, 2014, 04:37:50 pm
Code: [Select]
git clone git://github.com/angavrilov/cl-linux-debug.git
wget https://github.com/downloads/angavrilov/cl-linux-debug/sbcl-runtime.bz2
bzip2 -d sbcl-runtime.bz2

From here http://www.bay12forums.com/smf/index.php?topic=91166.msg2964753#msg2964753
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on July 13, 2014, 06:19:40 pm
some help:

how open the console and use stonesense?

and my game freeze at the world update......

No DFHack with 40.x yet. 

In 34.11, ctrl-shift-P "ssense overlay"
Title: Re: DFHack 0.34.11 r5
Post by: belarm on July 13, 2014, 10:19:30 pm
Yeah, actually my fault. I sent over some scripts to Peredexiserrant, one of them was /hack/ruby/ruby-autogen.rb which has different line endings on mac, and because of this fails on windows. (btw: is that normal?)
thx for the report.

It's normal if you're using a standard text editor, IIRC. Grab an IDE designed for development and it should allow you to choose which encoding to use. Scite's pretty easy to use and open-source: http://www.scintilla.org/SciTE-OSX.html
Title: Re: DFHack 0.34.11 r5
Post by: Snaaty on July 14, 2014, 04:05:06 am
Hello,
I cannot seem to select a hotkey for df 0.34.11 with dfhack r4. Can someone tell me how to put a hotkey for "digv" step by step?
Help is much appreciated.
Title: Re: DFHack 0.34.11 r5
Post by: teoleo on July 14, 2014, 04:11:11 am
some help:

how open the console and use stonesense?

and my game freeze at the world update......

No DFHack with 40.x yet. 

In 34.11, ctrl-shift-P "ssense overlay"

Thank
Title: Re: DFHack 0.34.11 r5
Post by: fricy on July 14, 2014, 04:13:58 am
I cannot seem to select a hotkey for df 0.34.11 with dfhack r4. Can someone tell me how to put a hotkey for "digv" step by step?
This is from the dfhack.init of LNP:
Code: [Select]
keybinding add Ctrl-V digv
It's normal if you're using a standard text editor, IIRC. Grab an IDE designed for development and it should allow you to choose which encoding to use. Scite's pretty easy to use and open-source: http://www.scintilla.org/SciTE-OSX.html
Yes, I know how to save them with different encoding, but I didn't edit it, my problem was that it came from the same github repo (afaik) and used different encoding in the mac pack, and in the win pack. BUT it was the only one, there were a few other ruby scripts in the same directory that used windows encoding... so not so straightforward.
And to clarify my question: is it normal for ruby/dfhack to have a problem with line-endings, and would it be easy to make it go away? Or is it caused by windows, in which case ignore me.
Title: Re: DFHack 0.34.11 r5
Post by: Kamin on July 16, 2014, 02:04:26 am
PTW
Title: Re: DFHack 0.34.11 r5
Post by: Xnidus on July 16, 2014, 02:26:04 am
Hi guys,

For the moment, I continue playing with the 0.34.11 version, waiting for the buxfixing and a solution for the deadly FPS of the last version. I downloaded the Peridexis Errant LNP, that include the dfhack 0.34.11-r5.

My questions are:

1. Have included the "digging invaders" plugging in the dfhack r5?

2a. If the answer is yes... The digging invaders plugging is activated by default or I must activate the plugging? How?

2b. If the answer is no... How I can install and activate the digging invaders plugging?

I also must advice that I'm really bad with the programmation stuff and plugging installation, the simple activation of the growth-bug fix was a small headhache...  :-[
Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on July 16, 2014, 02:40:27 am
It's not included.  You need to find the plugin, put it in the folder "/DF/hack/plugins/", and add the activation command to dfhack.init
Title: Re: DFHack 0.34.11 r5
Post by: Xnidus on July 16, 2014, 03:10:04 am
It's not included.  You need to find the plugin, put it in the folder "/DF/hack/plugins/", and add the activation command to dfhack.init

Thanks!  :D

pD. Uuups... Looks like that this pluggin only is ready for dfhack r4  :-\ Well, when arrive to home I will try to install and see what happens...

Title: Re: DFHack 0.34.11 r5
Post by: PeridexisErrant on July 16, 2014, 04:43:25 am
It won't work, you need a plugin compiled for the version of dfhack you're using.  This isn't a 'it might be broken', it's a 'dfhack will refuse to even try loading the plugin. 
Title: Re: DFHack 0.34.11 r5
Post by: Xnidus on July 16, 2014, 06:32:10 am
Damm  :(

I really like to see the diggin invaders, but I not sacrifice the size of the creatures due to this; and  I don't remember the growthfix plugging for dfhack r4...
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 20, 2014, 09:40:30 pm
The diggingInvaders plugin is packaged with r5. The link from the forum thread is for the r4 version. It's already there so you don't have to install it.
Title: Re: DFHack 0.34.11 r5
Post by: SMASH! on July 21, 2014, 09:43:25 am
71% for the rest of my live  :-[
Title: Re: DFHack 0.34.11 r5
Post by: int_ua on July 21, 2014, 09:48:47 am
71% for the rest of my live  :-[
Are you that ill?   :'(
Title: Re: DFHack 0.34.11 r5
Post by: cephalo on July 21, 2014, 09:54:01 am
71% for the rest of my live  :-[
Are you that ill?   :'(

We are all suffering from a vitamin H deficiency.
Title: Re: DFHack 0.34.11 r5
Post by: Rose on July 21, 2014, 10:11:14 am
Note that the bar will likely never reach 100%.

Right now, there's enough for people to start updating plugins.

We just need somebody who knows enough about them to do that.
Title: Re: DFHack 0.34.11 r5
Post by: Skyrunner on July 21, 2014, 10:20:07 am
Why won't it reach 100%? Are there structures that just aren't there anymore, or are the dfhack people not bothered to do it?
Title: Re: DFHack 0.34.11 r5
Post by: Rose on July 21, 2014, 10:23:56 am
THey're structures that never get used by any DFHack tools
Title: Re: DFHack 0.34.11 r5
Post by: SMASH! on July 21, 2014, 12:29:29 pm
Note that the bar will likely never reach 100%.

Right now, there's enough for people to start updating plugins.

We just need somebody who knows enough about them to do that.
No, I don't want that.
Give me tiletypes.
Title: Re: DFHack 0.34.11 r5
Post by: Rose on July 21, 2014, 12:35:49 pm
There's enough to get tiletypes updated to 40.01.
Title: Re: DFHack 0.34.11 r5
Post by: breadman on July 21, 2014, 02:13:51 pm
Right now, there's enough for people to start updating plugins.

We just need somebody who knows enough about them to do that.

I've considered updating the stockflow plugin, but can no longer compile for Windows.  I've used Kiryl's Linux offsets to compile a version that lets DF launch, but it crashes whenever I embark or load a fortress, even with all plugins disabled and uninstalled.

So far, it looks like only two of the job types need to be removed from the list, though I would like to verify that the randomized metals get loaded properly.  The C++ hooks failed to load, though that might be due to unverified offsets.

On top of that, I should update it to handle subsequent fortresses within the world, let it gracefully handle changes to the reaction list, and maybe add a purge option.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 21, 2014, 04:03:29 pm
Right now, there's enough for people to start updating plugins.

We just need somebody who knows enough about them to do that.

I've considered updating the stockflow plugin, but can no longer compile for Windows.  I've used Kiryl's Linux offsets to compile a version that lets DF launch, but it crashes whenever I embark or load a fortress, even with all plugins disabled and uninstalled.
That's a known issue (in EventManager, I believe).
Edit: It's been fixed by Quietust now.
Title: Re: DFHack 0.34.11 r5
Post by: ag on July 22, 2014, 02:58:33 am
Why won't it reach 100%? Are there structures that just aren't there anymore, or are the dfhack people not bothered to do it?

Some of  the structures are part of the economy or similar rare or obsolete things, so finding an instance to verify is hard or requires hacking things to turn disabled stuff on. Also, most of the yellow section of the diagram can be recolored green by now; only the red is completely untouched.
Title: Re: DFHack 0.34.11 r5
Post by: Skyrunner on July 22, 2014, 03:12:42 am
Why won't it reach 100%? Are there structures that just aren't there anymore, or are the dfhack people not bothered to do it?

Some of  the structures are part of the economy or similar rare or obsolete things, so finding an instance to verify is hard or requires hacking things to turn disabled stuff on. Also, most of the yellow section of the diagram can be recolored green by now; only the red is completely untouched.

Well, the managers of the file it draws from need to mark all ALIGNED as VERIFIED, then :P
Title: Re: DFHack 0.34.11 r5
Post by: Eko on July 22, 2014, 06:39:01 pm
Registered here to ask if there was any information available about how I can help get those obscure structures found.  I have a small amount of experience dealing with structures and memory, pointers and such.  Enough that I think I know what to look for. 

Is there perhaps a quick guide, or a helpful person who could throw a quick pointer my way to get started?

I've found that without all the scripts, DF seems more convoluted than normal.  I need my dfhack back.
Title: Re: DFHack 0.34.11 r5
Post by: Warmist on July 23, 2014, 12:43:43 am
Registered here to ask if there was any information available about how I can help get those obscure structures found.  I have a small amount of experience dealing with structures and memory, pointers and such.  Enough that I think I know what to look for. 

Is there perhaps a quick guide, or a helpful person who could throw a quick pointer my way to get started?

I've found that without all the scripts, DF seems more convoluted than normal.  I need my dfhack back.
Afaik almost everything is done now. We (and i mean they) are working on bringing plugins (and maybe scripts) up to date now.
If you are really interested in helping try visiting irc channel (but be patient - timezones). The idea is that there is a tool in linux that lets easily check structures by "how they look" and a malloc patch to figure out sizes. And in windows there is disassembly. Offsets and structures are held in: https://github.com/DFHack/df-structures (https://github.com/DFHack/df-structures)
Title: Re: DFHack 0.34.11 r5
Post by: Skyrunner on July 23, 2014, 04:00:04 am
If you guys have a file that tracks which plugins are up-to-date, I could update the script to reflect that.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 23, 2014, 07:47:14 pm
If you look at plugins/CMakeLists.txt in DFHack:develop and count how many lines are commented out that should tell you how many plugins need updating.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 23, 2014, 08:42:01 pm
If you look at plugins/CMakeLists.txt in DFHack:develop and count how many lines are commented out that should tell you how many plugins need updating.
It's in quietust:develop (https://github.com/quietust/dfhack/blob/develop/plugins/CMakeLists.txt) at the moment. edit: reword
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 23, 2014, 09:29:51 pm
For now. As people fix things, they'll get merged into DFHack:develop.
Title: Re: DFHack 0.34.11 r5
Post by: Rose on July 23, 2014, 10:42:44 pm
Last time I checked, DFHack:develop doesn't have much.
Title: Re: DFHack 0.34.11 r5
Post by: Rafal99 on July 24, 2014, 01:28:36 am
Hello everyone.

I decided that Adventure Mode inventory screen could be improved a lot, so I started writing a DFHack plugin.
I started by reimplementing the default screen to expand to whole window, but later I got a lot of new ideas.
After 5 days of working on it I have pretty much finished the display part.

Here is what I got so far:
Screenshots on Imgur (http://imgur.com/a/413mX/embed#1)

- first screenshot shows DF default inventory screen for comparison.
- second one shows my AdvInventory plugin with items in default order
- Third one shows the plugin with items in sorted order.

If anyone is wondering, the "EIW" flags will show whether the item can be eaten, interacted or worn.
(all screens are from DF 0.34.11 because I am waiting for new DFHack before I move development to DF 0.40)

Hope you like it :)

As I said the display part is practically finished but there is almost no interaction with it yet. Only Sorting, Tab and ESC keys work at the moment, not even scrolling the list does. So there is still much work to do.
And there is even more work to do to support all the actions, because my plan is to eventually allow all actions like Eat, Put, Remove, Throw etc. to be available from this one screen.
I plan to release a version with basic functionality once the new DFHack ready, and then continue work on more advanced fuctions.


Rafal99 / Carabus
Title: Re: DFHack 0.34.11 r5
Post by: Felgard on July 24, 2014, 06:07:56 am
If you look at plugins/CMakeLists.txt in DFHack:develop and count how many lines are commented out that should tell you how many plugins need updating.
It's in quietust:develop (https://github.com/quietust/dfhack/blob/develop/plugins/CMakeLists.txt) at the moment. edit: reword

woho with that link and some shoehorning,ctrl-c,ctrl-v and one sledgehammer i got dfhack to work with 40.04

And no i wont uppload since my version is probably very unstable but if you whant it and know how it works get quietust dfhack and then the do the usually inti, update and so on but don't build instead pull the df-structures from https://github.com/DFHack/df-structures/ (https://github.com/DFHack/df-structures/) and replace the contents in library/xml with it
Title: Re: DFHack 0.34.11 r5
Post by: RabblerouserGT on July 24, 2014, 09:03:42 am
Hello everyone.

I decided that Adventure Mode inventory screen could be improved a lot, so I started writing a DFHack plugin.
I started by reimplementing the default screen to expand to whole window, but later I got a lot of new ideas.
After 5 days of working on it I have pretty much finished the display part.

Here is what I got so far:
Screenshots on Imgur (http://imgur.com/a/413mX/embed#1)

- first screenshot shows DF default inventory screen for comparison.
- second one shows my AdvInventory plugin with items in default order
- Third one shows the plugin with items in sorted order.

If anyone is wondering, the "EIW" flags will show whether the item can be eaten, interacted or worn.
(all screens are from DF 0.34.11 because I am waiting for new DFHack before I move development to DF 0.40)

Hope you like it :)

As I said the display part is practically finished but there is almost no interaction with it yet. Only Sorting, Tab and ESC keys work at the moment, not even scrolling the list does. So there is still much work to do.
And there is even more work to do to support all the actions, because my plan is to eventually allow all actions like Eat, Put, Remove, Throw etc. to be available from this one screen.
I plan to release a version with basic functionality once the new DFHack ready, and then continue work on more advanced fuctions.


Rafal99 / Carabus
I... It's beautiful. Even if DFHack doesn't put it in (I hope they will), if you have your own threads, I'd like a link so I can subscribe.
I've always felt for years that adventure mode could use a UI overhaul.
Title: Re: DFHack 0.34.11 r5
Post by: Rafal99 on July 24, 2014, 09:16:55 am
I... It's beautiful. Even if DFHack doesn't put it in (I hope they will), if you have your own threads, I'd like a link so I can subscribe.
I've always felt for years that adventure mode could use a UI overhaul.
Thank you :)
I will make a release thread once I get all the basic functionality in. I will be sure to notify you when it happens.
As for including in DFHack thats the plan eventually but I will want the plugin to be mostly feature-complete and playtested properly first.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 24, 2014, 09:48:39 am
If you look at plugins/CMakeLists.txt in DFHack:develop and count how many lines are commented out that should tell you how many plugins need updating.
It's in quietust:develop (https://github.com/quietust/dfhack/blob/develop/plugins/CMakeLists.txt) at the moment. edit: reword

woho with that link and some shoehorning,ctrl-c,ctrl-v and one sledgehammer i got dfhack to work with 40.04

And no i wont uppload since my version is probably very unstable but if you whant it and know how it works get quietust dfhack and then the do the usually inti, update and so on but don't build instead pull the df-structures from https://github.com/DFHack/df-structures/ (https://github.com/DFHack/df-structures/) and replace the contents in library/xml with it
A much simpler way (instead of creating a separate clone of df-structures) is to change to library/xml and run "git checkout master".
Title: Re: DFHack 0.34.11 r5
Post by: RabblerouserGT on July 24, 2014, 10:01:06 am
Is the plan to have the whole DFhack plugin list migrated to 0.40 at once before you release it?
Or can we get a barebones version with fastdwarf, reveal, autodump, etc before then?
Title: Re: DFHack 0.34.11 r5
Post by: dree12 on July 24, 2014, 11:41:15 am
Is the plan to have the whole DFhack plugin list migrated to 0.40 at once before you release it?
Or can we get a barebones version with fastdwarf, reveal, autodump, etc before then?

I think it would be a good idea to release shortly after 0.40.05 if possible, since that release incorporates most binary patches. Then, the binary patches can be omitted from DFHack so as not to create unnecessary confusion.
Title: Re: DFHack 0.34.11 r5
Post by: Tharwen on July 25, 2014, 01:17:05 pm
Screenshots on Imgur (http://imgur.com/a/413mX/embed#1)

I find this very arousing.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on July 25, 2014, 06:13:27 pm
Just so I know, are there scripts or plugins that are going to be completely obsolete with no chance of working for the current version?
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on July 25, 2014, 08:24:38 pm
Force event, most likely.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on July 26, 2014, 12:28:13 am
It'll work for some events, just not for invasions.
Title: Re: DFHack 0.34.11 r5
Post by: RabblerouserGT on July 26, 2014, 07:21:52 am
Guessing forcing a fey mood will still be available since that's confined to your fort.
But since armies marching is handled by the during-playtime history happening around you now... forcing invaders might be hard to do if not impossible.

I really only use the fastdwarf (slow PC), liquids, gatherplants, reveal/unreveal, and vdig commands, really.
Title: Re: DFHack 0.34.11 r5
Post by: YAHG on July 26, 2014, 08:42:43 am
Screenshots on Imgur (http://imgur.com/a/413mX/embed#1)

I find this very arousing.

Holy crap is that cool!
Title: Re: DFHack 0.34.11 r5
Post by: RabblerouserGT on July 27, 2014, 08:58:39 am
Screenshots on Imgur (http://imgur.com/a/413mX/embed#1)

I find this very arousing.

Holy crap is that cool!
Hehe.. yeah, would be nice if it was a checkbox to tick in the DFHack tab of the DF Starter Pack.
SORTING! OMG! Something adventure mode had needed for ages.


Also, new DF version is expected today. "and this version'll probably see the sun outside its cave tomorrow." That was yesterday. Hoping DFHack will be close behind, yes? :D
Title: Re: DFHack 0.34.11 r5
Post by: scamtank on July 27, 2014, 09:49:57 am
It's not far now. As much as I'd like to believe that Quietust et al. are holding off the shiny and complete new DFHack suite until then, it'll probably trail behind for a bit longer.
Title: Re: DFHack 0.34.11 r5
Post by: dree12 on July 27, 2014, 10:40:44 am
It's not far now. As much as I'd like to believe that Quietust et al. are holding off the shiny and complete new DFHack suite until then, it'll probably trail behind for a bit longer.

Yeah, it looks like there is still a lot to do. Maybe it'll be ready in a week or so.
Title: Re: DFHack 0.34.11 r5
Post by: Dutchy on July 27, 2014, 11:38:31 am
Can we follow development and the reverse engineering for 0.40 anywhere? As a developer, I am curious how the process works.
Title: Re: DFHack 0.34.11 r5
Post by: scamtank on July 27, 2014, 11:41:42 am
Listening in on #dfhack and keeping an eye on the different Github branches of DFHack depositories are a good place to start, I think.
Title: Re: DFHack 0.34.11 r5
Post by: Skyrunner on July 28, 2014, 11:14:40 am
Just noting that the progress bar is now drawing from .40.05's lst file.
Title: Re: DFHack 0.34.11 r5
Post by: Dirst on July 28, 2014, 11:23:48 am
Just noting that the progress bar is now drawing from .40.05's lst file.
(http://goo.gl/zTOLc1)
That yellow area got really big really fast.  It's amazing how fast all of this stuff gets updated every time DF ticks to another version.
Title: Re: DFHack 0.34.11 r5
Post by: ag on July 28, 2014, 11:31:58 am
The yellow area was marked by automated code running a quick check on structures in memory; it's yellow precisely because no human looked at that stuff.
Title: Re: DFHack 0.34.11 r5
Post by: se5a on July 29, 2014, 02:26:07 am
Listening in on #dfhack and keeping an eye on the different Github branches of DFHack depositories are a good place to start, I think.

Only if you've already got a clue. otherwise it's just... words.
Title: Re: DFHack 0.34.11 r5
Post by: Samarkand on July 29, 2014, 04:32:25 pm
Can someone clarify where development is on the v40 dfhack. A while ago the bars were at seventy percent, now they seem to be at eight. Also, someone mentioned dfhack might come out soon after 40.05, but I'm unsure if this was a plan or a guess. Thanks for any and all clarification!
Title: Re: DFHack 0.34.11 r5
Post by: therahedwig on July 29, 2014, 04:38:01 pm
Can someone clarify where development is on the v40 dfhack. A while ago the bars were at seventy percent, now they seem to be at eight. Also, someone mentioned dfhack might come out soon after 40.05, but I'm unsure if this was a plan or a guess. Thanks for any and all clarification!

It's because the structure verifying needs to be done per release. However, a large part can be done via clever scripting, hence it being fast.

Other than that, plugins need to be updated and verified by their developers.
Title: Re: DFHack 0.34.11 r5
Post by: Dirst on July 29, 2014, 04:50:23 pm
Can someone clarify where development is on the v40 dfhack. A while ago the bars were at seventy percent, now they seem to be at eight. Also, someone mentioned dfhack might come out soon after 40.05, but I'm unsure if this was a plan or a guess. Thanks for any and all clarification!

It's because the structure verifying needs to be done per release. However, a large part can be done via clever scripting, hence it being fast.

Other than that, plugins need to be updated and verified by their developers.
The big yellow portion seems to be what has been identified by scripts, with the green portion being what has been verified by actual humans.  The yellow+green shot up to about 54% amazingly fast.
Title: Re: DFHack 0.34.11 r5
Post by: Tharwen on July 30, 2014, 01:11:08 pm
Uh... what happened to the progress bar? It was on 71% yesterday.
Title: Re: DFHack 0.34.11 r5
Post by: Samarkand on July 30, 2014, 01:41:37 pm
Uh... what happened to the progress bar? It was on 71% yesterday.
Can someone clarify where development is on the v40 dfhack. A while ago the bars were at seventy percent, now they seem to be at eight. Also, someone mentioned dfhack might come out soon after 40.05, but I'm unsure if this was a plan or a guess. Thanks for any and all clarification!

It's because the structure verifying needs to be done per release. However, a large part can be done via clever scripting, hence it being fast.

Other than that, plugins need to be updated and verified by their developers.
The big yellow portion seems to be what has been identified by scripts, with the green portion being what has been verified by actual humans.  The yellow+green shot up to about 54% amazingly fast.
Literally immediately above your post.
Title: Re: DFHack 0.34.11 r5
Post by: dree12 on July 30, 2014, 01:53:21 pm
Uh... what happened to the progress bar? It was on 71% yesterday.

0.40.05 changed several structures, as well as added a new d_init option, and so things have to be realigned.
Title: Re: DFHack 0.34.11 r5
Post by: Tharwen on July 30, 2014, 03:39:21 pm
Uh... what happened to the progress bar? It was on 71% yesterday.

0.40.05 changed several structures, as well as added a new d_init option, and so things have to be realigned.

Oh, I didn't realise DfHack was already moving onto 40.05.
Title: Re: DFHack 0.34.11 r5
Post by: emhs on July 30, 2014, 09:41:11 pm
I think some of us are confused because expwnent's post at the top still reads 0.40.01, even though it's reset to a later release.
Title: Re: DFHack 0.34.11 r5
Post by: se5a on July 30, 2014, 11:16:36 pm
yeah but common sense says that going for the latest one, especially since it has some of the binary fixes included, makes more sense.

Use Ockham's razor folks.  I know dwarfs don't like to shave, but when you've got logic fleas it's a good idea.
Title: Re: DFHack 0.34.11 r5
Post by: crossmr on July 31, 2014, 08:36:06 pm
the fixmerchants and fixdiplomats options that existed before, is there anywhere that details what the actual changes are?
I know toady fixed the elven diplomat in the new one (but only if you gen a new world) so I wondered about adding it into an existing world like you could before.

I wondered if we could do this ourselves manually while we we wait for everything else to be fixed.

Does anyone have the content that these two commands fixed, and could hint at where to insert it?
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on July 31, 2014, 08:53:30 pm
If they're Lua scripts, they require DFHack to work - they're not simple raw/binary patches.
Title: Re: DFHack 0.34.11 r5
Post by: crossmr on August 01, 2014, 12:07:44 am
If they're Lua scripts, they require DFHack to work - they're not simple raw/binary patches.

I don't know what they are. I don't think they're scripts as they aren't in the scripts directory. They were included as a basic function in dfhack.
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on August 01, 2014, 12:25:30 am
They are a plugin (https://github.com/DFHack/dfhack/blob/f5de76e2cce0dd1dd266ed1d6ac79d711bf37c29/plugins/fixpositions.cpp), which also requires DFHack.
Title: Re: DFHack 0.34.11 r5
Post by: crossmr on August 01, 2014, 12:28:14 am
They are a plugin (https://github.com/DFHack/dfhack/blob/f5de76e2cce0dd1dd266ed1d6ac79d711bf37c29/plugins/fixpositions.cpp), which also requires DFHack.

So that's not something we can attempt manually at all? It's not a matter of simply editing one of the files?
Title: Re: DFHack 0.34.11 r5
Post by: Rose on August 01, 2014, 12:29:27 am
They are a plugin (https://github.com/DFHack/dfhack/blob/f5de76e2cce0dd1dd266ed1d6ac79d711bf37c29/plugins/fixpositions.cpp), which also requires DFHack.

So that's not something we can attempt manually at all? It's not a matter of simply editing one of the files?
It's a matter of simply editing 50 of the files.
Title: Re: DFHack 0.34.11 r5
Post by: crossmr on August 01, 2014, 12:41:09 am
They are a plugin (https://github.com/DFHack/dfhack/blob/f5de76e2cce0dd1dd266ed1d6ac79d711bf37c29/plugins/fixpositions.cpp), which also requires DFHack.

So that's not something we can attempt manually at all? It's not a matter of simply editing one of the files?
It's a matter of simply editing 50 of the files.

haha okay, I guess I'll wait and keep my fingers crossed. Generating a new world now, so elf diplomat is at least fixed. Would like to have the Human guild guy though, their caravans have been useless lately.
Title: Re: DFHack 0.34.11 r5
Post by: int_ua on August 01, 2014, 12:59:35 am
I know toady fixed the elven diplomat in the new one (but only if you gen a new world) so I wondered about adding it into an existing world like you could before.

Can you please add the bug number?
Title: Re: DFHack 0.34.11 r5
Post by: crossmr on August 01, 2014, 02:12:35 am
I know toady fixed the elven diplomat in the new one (but only if you gen a new world) so I wondered about adding it into an existing world like you could before.

Can you please add the bug number?

Bug for what? Today fixed the elven diplomat, so if you gen a new world he'll work. But an existing save it isn't enabled. I had wanted to use the dfhack script to add him to an existing save.
Title: Re: DFHack 0.34.11 r5
Post by: int_ua on August 01, 2014, 07:24:39 am
Bug for what? Today fixed the elven diplomat, so if you gen a new world he'll work. But an existing save it isn't enabled. I had wanted to use the dfhack script to add him to an existing save.
Oh, it's from http://www.bay12games.com/dwarves/ , found it, thanks.
Title: Re: DFHack 0.34.11 r5
Post by: Streeter on August 04, 2014, 02:04:40 pm
The DFHack progress graph seems to be at a standstill. Have you guys hit a roadblock? Or is Toady's update schedule setting y'all back.


Or, has real life (ghasp) pulled you from the project temporarily?


No pressure, just want to hear from you folks. Making sure you're not dead. :P
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on August 04, 2014, 03:44:54 pm
The progress bar is still using v0.40.05 (https://github.com/DFHack/df-structures/blob/master/v0.40.05.lst)'s structures - v0.40.06 (https://github.com/DFHack/df-structures/blob/master/v0.40.06.lst) is around 5% verified. Each minor update creates additional work, as addresses change and structures have to be re-checked, but the bulk of the remaining work is updating and testing plugins.
Title: Re: DFHack 0.34.11 r5
Post by: MoonMan on August 04, 2014, 04:06:40 pm
What do I have to type to make a shell, let's say from a turtle, appear? I can't get the createitem syntax right.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on August 04, 2014, 04:30:40 pm
http://dwarffortresswiki.org/index.php/Utility:DFHack/createitem#Body_parts

Does "SHELL CREATURE_MAT:(creature):SHELL" work?
Title: Re: DFHack 0.34.11 r5
Post by: MoonMan on August 04, 2014, 04:43:31 pm
http://dwarffortresswiki.org/index.php/Utility:DFHack/createitem#Body_parts

Does "SHELL CREATURE_MAT:(creature):SHELL" work?

No, the problem is the item field at the beginning. It doesn't recognize SHELL. I guess I could also try making raw mussels or something but I'm not sure how to do that either.
Title: Re: DFHack 0.34.11 r5
Post by: scamtank on August 04, 2014, 04:48:20 pm
Body parts fall under the CORPSEPIECE token, a notoriously difficult and vague construction in reaction usage. Give it a shot anyway.
Title: Re: DFHack 0.34.11 r5
Post by: MoonMan on August 04, 2014, 04:51:42 pm
CORPSEPIECE gives "cannot create item of that type". But FISH_RAW NAUTILUS:MALE worked. That's probably the way to go.
Title: Re: DFHack 0.34.11 r5
Post by: Gamerlord on August 05, 2014, 05:04:36 am
Trying to use createitem to make granite blocks, but I have no idea of what the <item> is.

(It asks for 'createitem <item> <material> [count])

EDIT: Nevermind, got it. Had to put the item and material in caps.
Title: Re: DFHack 0.34.11 r5
Post by: fluffhead on August 05, 2014, 09:28:23 am
is it possible to have a base version that allows dfreveal/dfunreveal to see the hidden areas while we wait for plugin verification? 
Title: Re: DFHack 0.34.11 r5
Post by: locustgate on August 05, 2014, 09:51:57 pm
Is there a program out there that will let me see what layer a cavern starts? Similar to reveal.
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on August 05, 2014, 10:21:37 pm
Not any specifically designed for that purpose that I know of, although reveal followed by unreveal would work.
Title: Re: DFHack 0.34.11 r5
Post by: MystRunner on August 05, 2014, 11:21:55 pm
I can't wait for DF Hack to get updated. I'd like my prospector tool. XD
Title: Re: DFHack 0.34.11 r5
Post by: YAHG on August 06, 2014, 09:15:53 am
Is there a program out there that will let me see what layer a cavern starts? Similar to reveal.

Dwaven radar works decently, but it wont find the top of the cavern.
Title: Re: DFHack 0.34.11 r5
Post by: ajshell1 on August 06, 2014, 11:05:26 am
I can't wait for DF Hack to get updated. I'd like my prospector tool. XD
Me too. That and digv. I didn't realize how much I depended on those two commands until now.
Also, I would like to thank expwnent (and anybody else working on this project) for updating this mod. You have my sincere gratitude now, and you will have even more when the process of updating is done.
Title: Re: DFHack 0.34.11 r5
Post by: Roses on August 06, 2014, 11:51:56 am
Several questions

1. Is there a variable that keeps track of when a fort was started?
2. We used to able to force invasions, is that going to be possible in the new version?
3. If so, was it only invasions of races that exist on the map?
4. If I use spawnunit to mimick an invasion will the game hate me for creating 20+ units at once?
5. Is there an eventful command to run at every week or season start? (I know I can use the callback function to set configurable time delays and such, but just wondering if there is another method)
6. There were some other questions I thought about, but they now seem to have escaped my mind. Will edit this post if I think of them.
Title: Re: DFHack 0.34.11 r5
Post by: Meph on August 06, 2014, 11:59:32 am
Quote
3. If so, was it only invasions of races that exist on the map?
4. If I use spawnunit to mimick an invasion will the game hate me for creating 20+ units at once?
3. Yes, the civ had to exist.
4. No, I spammed units quite heavily while testing, and sometimes I embarked with 7 warlocks spawning 4 minions each, which was no problem at all.
Title: Re: DFHack 0.34.11 r5
Post by: Roses on August 06, 2014, 12:00:42 pm
Excellent, see my scripts thread for my idea and why I am asking all the questions :)
Title: Re: DFHack 0.34.11 r5
Post by: Roses on August 06, 2014, 10:43:21 pm
Question about custom announcments;

What are the types and flags for
Code: [Select]
dfhack.gui.makeAnnouncement(type,flags,pos,text,color[,is_bright]And what is the "slot"
Code: [Select]
dfhack.gui.addCombatReport(unit,slot,report_index)
Title: Re: DFHack 0.34.11 r5
Post by: Tirion on August 07, 2014, 08:07:24 am
Generic dfhack question: how do I assume direct control of one of my dwarves in fort mode, and start adventuring as him/her?
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on August 07, 2014, 08:35:00 am
It's not guaranteed to work perfectly, but this should work (in a fortress):
Code: [Select]
mode set <return>
2 <return>
Then assume control of a creature and run:
Code: [Select]
mode set <return>
1 <return>
I'm not sure if doing this will corrupt your save or not if you attempt to save, so be sure to make a backup of your region folder.
Title: Re: DFHack 0.34.11 r5
Post by: Meph on August 07, 2014, 10:52:59 am
Is there a spawnunit equivalent or version for r5? I couldnt find one anywhere. I did write warmist a while ago, who directed me here: https://gist.github.com/warmist/8563110 but it does not run with r5.

Title: Re: DFHack 0.34.11 r5
Post by: expwnent on August 07, 2014, 04:04:23 pm
Warmist is working on it for the next release but may or may not finish in time. As far as I know there isn't one for r5.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on August 07, 2014, 07:08:04 pm
There has been a very long delay since 0.40.01 was released, and most of that's my fault at this point. I probably could have gotten a release done sooner if I had been more on top of things. To everyone waiting, I am sorry.

I'm going away for a long weekend, but when I get back I intend to do a release of whatever we have at the time for the most recent version we can at the time. Nothing is 100% with real life stuff of course, but probably Tuesday, very probably on or before Wednesday.
Title: Re: DFHack 0.34.11 r5
Post by: Meph on August 07, 2014, 07:10:58 pm
Take as much time as you need. :)
Title: Re: DFHack 0.34.11 r5
Post by: Rumrusher on August 07, 2014, 08:10:24 pm
in other news I'm working on ghosts and what you can do with them knowing that now they are hellishly bugged.
hopefully assigning them jobs or pointing them to migrants/invaders/who ever would be in the works.
who wants a ghost army?
Title: Re: DFHack 0.34.11 r5
Post by: mnjiman on August 07, 2014, 08:12:45 pm
Thank you for keeping up on this utterly amazing utility program.
Title: Re: DFHack 0.34.11 r5
Post by: khearn on August 07, 2014, 08:23:34 pm
Enjoy your weekend. We know it's a lot of work trying to keep up with the frequent releases, and we appreciate that you're doing it. Whatever you're able to release next week will be wonderful. Thanks!

   Keith
Title: Re: DFHack 0.34.11 r5
Post by: Meph on August 07, 2014, 08:25:52 pm
in other news I'm working on ghosts and what you can do with them knowing that now they are hellishly bugged.
hopefully assigning them jobs or pointing them to migrants/invaders/who ever would be in the works.
who wants a ghost army?
Here, I do, please, Ghost Army coming up?

For Warlocks very useful. :)
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on August 07, 2014, 08:31:27 pm
Me too for ghost army. Is it possible to trigger ghosts on command?
Title: Re: DFHack 0.34.11 r5
Post by: Meph on August 07, 2014, 09:47:27 pm
In the readme I only found showmood and forcing moods on people... is there any way at all to stop a mood from happening, or cancel a mood?

And what exactly are the minimum requirements for moods to happen. Quietust once mentioned a population of 20, but I dont know if there are any others, and if its enough to breach 20 once... if I had 21 dwarves and after that (because of death) under 20, will moods still happen, because the 20 population was reached at some point in time?
Title: Re: DFHack 0.34.11 r5
Post by: lethosor on August 07, 2014, 10:11:30 pm
In the readme I only found showmood and forcing moods on people... is there any way at all to stop a mood from happening, or cancel a mood?

And what exactly are the minimum requirements for moods to happen. Quietust once mentioned a population of 20, but I dont know if there are any others, and if its enough to breach 20 once... if I had 21 dwarves and after that (because of death) under 20, will moods still happen, because the 20 population was reached at some point in time?
No, unless I'm misunderstanding this:
Quote from: http://dwarffortresswiki.org/index.php/DF2014:Strange_mood#Conditions
In order for a dwarf to be struck with a strange mood, three conditions must be met:
* There is no currently active strange mood,
* The maximum number of artifacts is not met,
* There are at least 20 eligible dwarves (see below), including dwarves who have already created artifacts.
If all three of these conditions are true, the game may trigger a strange mood according to the frequency.
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 07, 2014, 10:50:01 pm
http://i.imgur.com/gpMn8fE.png

Any idea what happened? I am not good with computer.
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on August 07, 2014, 10:54:01 pm
You forgot to do the submodule stuff, I think.
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 07, 2014, 10:58:34 pm
You forgot to do the submodule stuff, I think.
You mean ruby and xml stuff? I'm pretty sure I did that.
I'm new to this whole github thing and the most I've ever compiled before was c programs I wrote with codeblocks.
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on August 07, 2014, 11:30:20 pm
In git.
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 07, 2014, 11:35:13 pm
In git.
Can you please explain what this means/how to do that?
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on August 07, 2014, 11:40:35 pm
https://github.com/DFHack/dfhack/blob/master/Compile.rst#id1

Quote
If you just want to compile DFHack or work on it by contributing patches, it's quite enough to clone from the read-only address:

git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update

Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 07, 2014, 11:42:17 pm
You're trying to build development branch, right?
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 07, 2014, 11:53:12 pm
https://github.com/DFHack/dfhack/blob/master/Compile.rst#id1

Quote
If you just want to compile DFHack or work on it by contributing patches, it's quite enough to clone from the read-only address:

git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update

Thanks. I actually did it in the beginning, but doing it again gave me 2 new commits and now it compiled for 2 minutes and 40 seconds instead of 40 seconds and gave me this:
http://puu.sh/aJtfb/ba7c8f167f.png
And yes it's the development branch.
Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 07, 2014, 11:56:24 pm
https://github.com/DFHack/dfhack/blob/master/Compile.rst#id1

Quote
If you just want to compile DFHack or work on it by contributing patches, it's quite enough to clone from the read-only address:

git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update

Thanks. I actually did it in the beginning, but doing it again gave me 2 new commits and now it compiled for 2 minutes and 40 seconds instead of 40 seconds and gave me this:
http://puu.sh/aJtfb/ba7c8f167f.png
And yes it's the development branch.

That's fine - library compiled ok, and I wouldn't expect all plugins to compile in devel branch. I think.
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 08, 2014, 12:01:25 am
Yeah, that's what I thought.
Last question.
Am I supposed to gather and manually copy all the dll's and exe's myself, or am I missing something?
Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 08, 2014, 12:07:11 am
Well, there's install batch file and a script to set df path, but I don't know what they're doing.
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 08, 2014, 12:09:08 am
Well, there's install batch file and a script to set df path, but I don't know what they're doing.
I don't think it works. I tried running it.
Thanks either way!
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 08, 2014, 12:22:27 am
http://puu.sh/aJuQ8/401a76eef7.png
http://puu.sh/aJuT6/d05fc2a5b0.png

Hooray! it works.
Reveal works.
Title: Re: DFHack 0.34.11 r5
Post by: Rumrusher on August 08, 2014, 05:03:14 am
(http://www.truimagz.com/host/fortcrush2/de/ghost-control.gif)
ghost control just because you're dead and restless doesn't mean you get to act like a noble.
might have to figure out how to jerry rig companion fort into unit fort.
Title: Re: DFHack 0.34.11 r5
Post by: Quietust on August 08, 2014, 08:58:39 am
http://puu.sh/aJuQ8/401a76eef7.png
http://puu.sh/aJuT6/d05fc2a5b0.png

Hooray! it works.
Reveal works.
In case anyone else wants it.
https://mega.co.nz/#!w903SBbL!tBZNl6bh3mQ02VgsCPTCcdHyB-sxJQPWhyhjQF5Rdm8
Try building against a repository that's actually been adjusted for version 0.40, such as this one (https://github.com/quietust/dfhack/tree/develop).
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 08, 2014, 01:20:08 pm
http://puu.sh/aJuQ8/401a76eef7.png
http://puu.sh/aJuT6/d05fc2a5b0.png

Hooray! it works.
Reveal works.
Try building against a repository that's actually been adjusted for version 0.40, such as this one (https://github.com/quietust/dfhack/tree/develop).
I was actually using yours :/
Maybe I installed some compiler wrong
Title: Re: DFHack 0.34.11 r5
Post by: Quietust on August 08, 2014, 03:09:17 pm
I think I see what the problem is - DFHack 0.40-r0 currently has a bunch of plugins disabled (they need significant changes to get them working again), but you apparently included old versions of those plugins from 0.34.11-r5 (which you really should delete, since there's no way they'll work as-is).
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 08, 2014, 03:52:57 pm
I think I see what the problem is - DFHack 0.40-r0 currently has a bunch of plugins disabled (they need significant changes to get them working again), but you apparently included old versions of those plugins from 0.34.11-r5 (which you really should delete, since there's no way they'll work as-is).
Yeah, I figured that much.
I kind of overwritten a 0.34.11-r5 dfhack folder and the deprecated plugins were left, but I deleted them, disabled all the previous version patches in the init file and everything mostly works.
Thanks again!
Title: Re: DFHack 0.34.11 r5
Post by: palu on August 08, 2014, 09:37:34 pm
Is there a build availabe for 0.40? If not, how can I do it myself?
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on August 08, 2014, 09:53:15 pm
Go through the build instructions using Quietust's repository instead of DFHack's. It works. I even have a script written for it, though I think the structures may have been changed since then (with my research), so it might not work. I'll update it when DFHack does, whatever, heh.

Research, for those interested:

unit_soul.unk1 is actually orientation_flags. The flags are as follows:

undetermined (used for adventurers)
male_lover
male_marry
female_lover
female_marry
Title: Re: DFHack 0.34.11 r5
Post by: Rumrusher on August 09, 2014, 01:01:38 pm
Go through the build instructions using Quietust's repository instead of DFHack's. It works. I even have a script written for it, though I think the structures may have been changed since then (with my research), so it might not work. I'll update it when DFHack does, whatever, heh.

Research, for those interested:

unit_soul.unk1 is actually orientation_flags. The flags are as follows:

undetermined (used for adventurers)
male_lover
male_marry
female_lover
female_marry
uhh most of my adventurers don't have undetermined marked when I checked so it could be used for megabeasts or creatures who don't have a separate sex or atleast going by your Gaydar.
Title: Re: DFHack 0.34.11 r5
Post by: Putnam on August 09, 2014, 01:25:15 pm
Every adventurer I made when testing had "1" as their unk1 value--I'd assume megabeasts and sexless creatures are more likely 0.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 11, 2014, 08:13:11 pm
Trying to run dfhack for Linux Mint Qiana 17. Building is fine (using gcc 4.8.2) but when I launch the dfhack script it doesn't seem to be recognized by the game and it doesn't look like dfhack is loaded.
Running with gdb outputs this:

Quote
Starting program: /home/user/Games/DF/df_linux/libs/Dwarf_Fortress
ERROR: ld.so: object './hack/libdfhack.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Any clue as to why dfhack isn't recognized by the game?
Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 11, 2014, 08:39:20 pm
Trying to run dfhack for Linux Mint Qiana 17. Building is fine (using gcc 4.8.2) but when I launch the dfhack script it doesn't seem to be recognized by the game and it doesn't look like dfhack is loaded.
Running with gdb outputs this:

Quote
Starting program: /home/user/Games/DF/df_linux/libs/Dwarf_Fortress
ERROR: ld.so: object './hack/libdfhack.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Any clue as to why dfhack isn't recognized by the game?

GDB output isn't very informative because getting gdb to work is a bit tricky in mixed 32/64 bit environment.
Doesn't it output anything at all when you start df/dfhack normally without gdb?
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 11, 2014, 08:45:43 pm
Nothing apart from standard DF output

Quote
Sound devices available:
OpenAL Soft
Picking OpenAL Soft. 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
Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 11, 2014, 09:09:11 pm
Nothing apart from standard DF output

Quote
Sound devices available:
OpenAL Soft
Picking OpenAL Soft. 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

Check that you installed dfhack correctly, and that md5 of Dwarf_Fortress matches one of the values in hack/symbols.xml for that df version.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 11, 2014, 09:38:45 pm
It seems that there is a md5sum mismatch and the symbols.xml file doesn't contain any entry for .40.08. I then tried downloading the develop branch but then build fails at 44% about a missing header file:
Quote
/home/user/Games/DF/dfhack/library/LuaApi.cpp:69:25: fatal error: df/identity.h: No such file or directory
 #include "df/identity.h"
                         ^
compilation terminated.
make[2]: *** [library/CMakeFiles/dfhack.dir/LuaApi.cpp.o] Error 1
make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
make: *** [all] Error 2
Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 11, 2014, 10:33:33 pm
It seems that there is a md5sum mismatch and the symbols.xml file doesn't contain any entry for .40.08. I then tried downloading the develop branch but then build fails at 44% about a missing header file:
Quote
/home/user/Games/DF/dfhack/library/LuaApi.cpp:69:25: fatal error: df/identity.h: No such file or directory
 #include "df/identity.h"
                         ^
compilation terminated.
make[2]: *** [library/CMakeFiles/dfhack.dir/LuaApi.cpp.o] Error 1
make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
make: *** [all] Error 2

Probably you should have mentioned that you're trying to run a version that is out only a day ago...
Title: Re: DFHack 0.34.11 r5
Post by: Rose on August 11, 2014, 10:34:40 pm
Uh, yeah, dfhack isn't updated for .08 yet. Give it time.
Title: Re: DFHack 0.34.11 r5
Post by: Electrode on August 11, 2014, 11:24:54 pm
Uh, yeah, dfhack isn't updated for .08 yet. Give it time.

Mostly working on .08 for me, using quietust's tree pulled about 8 hours ago.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 12, 2014, 12:26:51 am
Well thanks for mentioning it, built ran fine and even though it's still wonky (e.g. unretiring crashes the game and many plugins don't work) it's still useable.
Title: Re: DFHack 0.34.11 r5
Post by: int_ua on August 12, 2014, 07:46:21 am
Try building against a repository that's actually been adjusted for version 0.40, such as this one (https://github.com/quietust/dfhack/tree/develop).
Anyone with 64-bit 14.04 (K)ubuntu? http://askubuntu.com/questions/510269/how-to-install-build-essentiali386-to-compile-a-32-bit-executable-on-a-64-bit-s

Update: Had to delete dfhack and reclone it after installing all the dependencies like advised in http://www.bay12forums.com/smf/index.php?topic=91166.msg3235195#msg3235195

Code: [Select]
sudo apt-get install gcc-multilib g++-multilib
sudo apt-get install libxml-libxml-perl --no-install-recommends
# sudo ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include # not sure it's necessary
sudo apt-get install lib32z1-dev
sudo apt-get install libxml-libxslt-perl

git clone -b develop https://github.com/DFHack/dfhack.git
cd dfhack
git submodule init
git submodule update
cd build/
cmake .. -DCMAKE_INSTALL_PREFIX=/home/int/games/df/2014/df_linux
make install

Update 2: Updated the code above to the one that worked for me.
Title: Re: DFHack 0.34.11 r5
Post by: Stormrage on August 12, 2014, 08:33:59 am
It seems that there is a md5sum mismatch and the symbols.xml file doesn't contain any entry for .40.08. I then tried downloading the develop branch but then build fails at 44% about a missing header file:
Quote
/home/user/Games/DF/dfhack/library/LuaApi.cpp:69:25: fatal error: df/identity.h: No such file or directory
 #include "df/identity.h"
                         ^
compilation terminated.
make[2]: *** [library/CMakeFiles/dfhack.dir/LuaApi.cpp.o] Error 1
make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
make: *** [all] Error 2
It seems quitesutst's dev branch builds fine but there is a version mismatch.
However, I built https://github.com/DFHack/dfhack/tree/develop (after pulling and updating submodules) and it built fine and worked fine except autolabor.plug.dll which failed to initialize.
Title: Re: DFHack 0.34.11 r5
Post by: BatCountry on August 12, 2014, 10:26:19 am
Somewhat out of left field - the protobuf dependency fails to configure properly if you  have clang installed on Linux (it gets selected over the GNU compiler for some reason.)

Spoiler (click to show/hide)

That'll fix that, but I'm not entirely certain it won't break GNU on older distros.
Title: Re: DFHack 0.34.11 r5
Post by: ohgoditburns on August 12, 2014, 11:11:39 am
I ended up failing protobuf build until I remembered to switch to the develop branch before building. I am having general problems with libstdc++.6.dylib on OSX trying to actually run the thing, I think because xcode and gcc are not playing nice. 
Title: Re: DFHack 0.34.11 r5
Post by: isitanos on August 12, 2014, 01:47:50 pm
Tried building Quietut's develop branch at the "Change version to v0.40.08" commit with Visual Studio Express 2010 and using the recommended cmake and perl, but compilation fails. Also, cmake fails to download the ruby library.
Title: Re: DFHack 0.34.11 r5
Post by: sv-esk on August 12, 2014, 01:56:23 pm
Tried building Quietut's develop branch at the "Change version to v0.40.08" commit with Visual Studio Express 2010 and using the recommended cmake and perl, but compilation fails. Also, cmake fails to download the ruby library.
Same thing(windows). You can download ruby manually from http://cloud.github.com/downloads/jjyg/dfhack/msvcrtruby187.tar.gz and put this *.tar.gz into .....build\VC2010\plugins\ruby\
Then run generate-MSVC-all.bat again
----------
 My building attempts fails with lots of errors in autolabor2, rprobe, misery, prospector and stonesense.
I tried to delete these plugins from CMakeLists.txt . It compiled succesfully but doesnt work.(I can launch DF but DFHack console seems to be not connected properly to DF)

May be my problem in VC? I am using VC2012.
I changed "6" line in generate-MSVC-all.bat  --->   cmake ..\.. -G"Visual Studio 11"    .....blahblahblah
and second line in package-release.bat ----> call "%VS110COMNTOOLS%vsvars32.bat"


Title: Re: DFHack 0.34.11 r5
Post by: danaris on August 12, 2014, 04:59:26 pm
Somewhat out of left field - the protobuf dependency fails to configure properly if you  have clang installed on Linux (it gets selected over the GNU compiler for some reason.)

I suspect that DF will not actually run properly if built with clang (since I tried it on OS X, and it didn't ;D ).

If you've got other compilers getting in the way, then before running CMake, you need to export CC=/path/to/gcc and export CXX=/path/to/g++.
Title: Re: DFHack 0.34.11 r5
Post by: Thormgrim on August 12, 2014, 05:05:11 pm
ptw
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 12, 2014, 06:11:39 pm
Since it seems there's no link as yet, here are my DFhack builds based on Quietust's latest pull
GNU/Linux: http://wikisend.com/download/557900/df_linux_40_08_hack.tar.gz
OS X: http://rghost.net/57423137
Note that the links will likely expire in 7 and 30 days respectively, until I find a better file-hosting site. Most stuff works, including most UI plugins and the essentials like reveal or dig-v.
Title: Re: DFHack 0.34.11 r5
Post by: smjjames on August 12, 2014, 06:47:39 pm
I wonder when DFhack will be available for 40.08? I'd really like to be able to figure out what the heck is going on with the responses and why x is acting y way. It's really confusing atm and vague.

And also whatever is causing some underground critters to spam path fail errors sometimes. I feel like posting a bug report, but just saying I'm getting craploads of path fail errors isn't really enough.
Title: Re: DFHack 0.34.11 r5
Post by: Imperator314 on August 12, 2014, 06:50:43 pm
Since it seems there's no link as yet, here are my DFhack builds based on Quietust's latest pull
GNU/Linux: http://wikisend.com/download/557900/df_linux_40_08_hack.tar.gz
OS X: http://rghost.net/57423137
Note that the links will likely expire in 7 and 30 days respectively, until I find a better file-hosting site. Most stuff works, including most UI plugins and the essentials like reveal or dig-v.

Is this available for windows?
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 12, 2014, 07:07:04 pm
Building stuff for Windows is a pain in the butt. For some reason my Windows partition can't install the SP1 update of Visual Studio Express 2010 (says it can't detect VS). If there's a way to install it as a standalone I'd be grateful (and I could build dfhack I guess).

Quote
I wonder when DFhack will be available for 40.08? I'd really like to be able to figure out what the heck is going on with the responses and why x is acting y way. It's really confusing atm and vague.

And also whatever is causing some underground critters to spam path fail errors sometimes. I feel like posting a bug report, but just saying I'm getting craploads of path fail errors isn't really enough.
Look at the post above yours, tell me if it works.
Title: Re: DFHack 0.34.11 r5
Post by: sv-esk on August 12, 2014, 07:44:40 pm
Finally, installed vc2010 and sp1 succesfully.
Removed stonesense, rprobe and autolabor2. Because it causes errors and fail while compiling. May be someone more experienced can build with it and post here?
Removed autolabor.plug.dll - because it fails to initialize.
Removed "UI and game logic tweaks", "Apply binary patches at runtime" , "Scripts" and stockflow from dfhack.init. It seems , they are for 34.11. Something of them even causes crash on embarking.
dfhack.init-example left unchanged
Is this available for windows?
Here is it: http://www.mediafire.com/download/pf9bdyvsyq815np/dfhack-0.40.08-r0-Windows.zip (edit: outdated)
Reveal, autodump, createitem, liquids, tiletypes, search, manipulator, prospect, exterminate, digl, digv works fine.
It can be very buggy. Use at your own risk. It is recommended to wait official build.(edit: official build avaible!)
Title: Re: DFHack 0.34.11 r5
Post by: smjjames on August 12, 2014, 08:05:50 pm
Building stuff for Windows is a pain in the butt. For some reason my Windows partition can't install the SP1 update of Visual Studio Express 2010 (says it can't detect VS). If there's a way to install it as a standalone I'd be grateful (and I could build dfhack I guess).

Quote
I wonder when DFhack will be available for 40.08? I'd really like to be able to figure out what the heck is going on with the responses and why x is acting y way. It's really confusing atm and vague.

And also whatever is causing some underground critters to spam path fail errors sometimes. I feel like posting a bug report, but just saying I'm getting craploads of path fail errors isn't really enough.
Look at the post above yours, tell me if it works.

I can't run it, using Windows 8 here and I used the OSX one. It just refuses to launch.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 12, 2014, 08:27:36 pm
Yeah uh that's because I built it on OS X so I don't think it's going to run on Windows. You should probably use sv-esk's build; I managed to build it for Windows (after removing what he did) but for some reason it crashes on embark, even when commenting out obsolete binpatches.
Title: Re: DFHack 0.34.11 r5
Post by: smjjames on August 12, 2014, 08:52:38 pm
Going to wait for an official build though maybe.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 12, 2014, 08:55:14 pm
I think it has more to do with the plugins - the builds work mostly fine but many plugins haven't been updated to work with .40.08 yet, causing all sorts of weirdness.
Title: Re: DFHack 0.34.11 r5
Post by: Imperator314 on August 12, 2014, 09:31:39 pm
Finally, installed vc2010 and sp1 succesfully.
Removed stonesense, rprobe and autolabor2. Because it causes errors and fail while compiling. May be someone more experienced can build with it and post here?
Removed autolabor.plug.dll - because it fails to initialize.
Removed "UI and game logic tweaks", "Apply binary patches at runtime" , "Scripts" and stockflow from dfhack.init. It seems , they are for 34.11. Something of them even causes crash on embarking.
dfhack.init-example left unchanged
Is this available for windows?
Here is it: http://www.mediafire.com/download/pf9bdyvsyq815np/dfhack-0.40.08-r0-Windows.zip
Reveal, autodump, createitem, liquids, tiletypes, search, manipulator, prospect, exterminate, digl, digv works fine.
It can be very buggy. Use at your own risk. It is recommended to wait official build.

It doesn't like the new SDL. I get this error when I try to start DF: “The program can’t start because protobuf-lite.dll is missing from your computer.”
Title: Re: DFHack 0.34.11 r5
Post by: sv-esk on August 12, 2014, 09:47:43 pm
It doesn't like the new SDL. I get this error when I try to start DF: “The program can’t start because protobuf-lite.dll is missing from your computer.”
Looks like an error while extracting the archive
 protobuf-lite.dll, SDL.dll(4Mb), all other files and "hack" folder from archive must be extracted to root DF folder (where Dwarf Fortress.exe, old SDL.dll(that will be replaced), "data", "raw", "SDL" folders)
Title: Re: DFHack 0.34.11 r5
Post by: ohgoditburns on August 12, 2014, 10:14:20 pm
Since it seems there's no link as yet, here are my DFhack builds based on Quietust's latest pull
GNU/Linux: http://wikisend.com/download/557900/df_linux_40_08_hack.tar.gz
OS X: http://rghost.net/57423137
Note that the links will likely expire in 7 and 30 days respectively, until I find a better file-hosting site. Most stuff works, including most UI plugins and the essentials like reveal or dig-v.

Getting crashes as soon as I unpause after embark.

Code: [Select]
# /Users/rbrady/df/dfhack: line 15: 69791 Bus error: 10           DYLD_INSERT_LIBRARIES=./hack/libdfhack.dylib ./dwarfort.exe "$@"

logout

Title: Re: DFHack 0.34.11 r5
Post by: isitanos on August 12, 2014, 11:37:28 pm
Yeah um, careful with those experimental builds people. Given how dfhack toys with DF's memory, if some obsolete plugin change the wrong things you're likely to end up with crashes and saves corruption... so only use those for fooling around with a fortress you don't care about much.

Also, some people should educate themselves on what OSX, Windows and Linux are. No excuse, you've got Wikipedia and the intertubes at your disposal.
Title: Re: DFHack 0.34.11 r5
Post by: Streeter on August 13, 2014, 12:15:06 am
Isitanos, I don't get the impression that the folks ITT cloning the repos will have unrealistic expectations. They probably comprehend what it means to be an unstable/incomplete version. I just see it as enthusiastic beta testing. :P


Compared to most game communities, even other early release games, I don't find Dwarf Fortress fans to be very entitled.  8)
Title: Re: DFHack 0.34.11 r5
Post by: ohgoditburns on August 13, 2014, 10:24:30 am
There's a repo here: https://github.com/EldrickWT/dfhack that supposedly compiles, "but expect explosions". Testing it on osx. Hopefully it won't crash right off the bat :P
Title: Re: DFHack 0.34.11 r5
Post by: Phoebus on August 13, 2014, 10:24:47 am
*deleted*
Title: Re: DFHack 0.34.11 r5
Post by: fricy on August 13, 2014, 10:44:46 am
There's a repo here: https://github.com/EldrickWT/dfhack that supposedly compiles, "but expect explosions". Testing it on osx. Hopefully it won't crash right off the bat :P
Uploading Macnewbie with DFhack right now, cherry picked all the commits that'd compile.
Title: Re: DFHack 0.34.11 r5
Post by: ohgoditburns on August 13, 2014, 10:48:41 am
I haven't been able to get anything I compile myself to work. Always get some message like:

Code: [Select]
dyld: lazy symbol binding failed: Symbol not found: __ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm
  Referenced from: ./hack/libdfhack.dylib
  Expected in: /Users/rbrady/df/libs/libstdc++.6.dylib

There are no errors in compiling, but plenty of warnings about how variable X is too small to hold all values of Y.

Obviously, since I was able to use the one compiled earlier by nopenope, this is a problem on my end. Anyone know how to resolve the problems with libstdc++.6.dylib?
Title: Re: DFHack 0.34.11 r5
Post by: fricy on August 13, 2014, 12:00:02 pm
I haven't been able to get anything I compile myself to work. Always get some message like:
Code: [Select]
dyld: lazy symbol binding failed: Symbol not found: __ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm
  Referenced from: ./hack/libdfhack.dylib
  Expected in: /Users/rbrady/df/libs/libstdc++.6.dylib
There are no errors in compiling, but plenty of warnings about how variable X is too small to hold all values of Y.
Obviously, since I was able to use the one compiled earlier by nopenope, this is a problem on my end. Anyone know how to resolve the problems with libstdc++.6.dylib?

Not quite the same error (http://www.bay12games.com/dwarves/mantisbt/view.php?id=3263), and it may not have anything to do with the error, but I'd check if you have proper X11 (http://xquartz.macosforge.org/landing/) on your system. Especially if you want to compile on 10.8/10.9. Plus the 40.08 osx memory structures are not yet in the official repo, you need to pull them from lethosor's.
Title: Re: DFHack 0.34.11 r5
Post by: Philii on August 13, 2014, 01:51:55 pm
DFHack 0.40.08-r0 Windows
In trade menu, press [q] to search and Crash.
Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 13, 2014, 04:51:48 pm
I haven't been able to get anything I compile myself to work. Always get some message like:

Code: [Select]
dyld: lazy symbol binding failed: Symbol not found: __ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm
  Referenced from: ./hack/libdfhack.dylib
  Expected in: /Users/rbrady/df/libs/libstdc++.6.dylib

There are no errors in compiling, but plenty of warnings about how variable X is too small to hold all values of Y.

Obviously, since I was able to use the one compiled earlier by nopenope, this is a problem on my end. Anyone know how to resolve the problems with libstdc++.6.dylib?

What compiler are you using? If newer than gcc 4.5 then you need to copy libstdc++.6.dylib from compiler lib to df (not from /usr/lib !).
Title: Re: DFHack 0.34.11 r5
Post by: ohgoditburns on August 13, 2014, 05:01:50 pm
gcc 4.8. Brew errors out if I try to install 4.5. Not sure why. I think brew puts stuff in usr/local/lib, so I'll try that. Thanks!
Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 13, 2014, 05:12:00 pm
Plus the 40.08 osx memory structures are not yet in the official repo, you need to pull them from lethosor's.

--offtopic below--
That's what I hate git/github for. Before cool-distributed-trendy-git-github people gained write access to a single repo and just worked there together. Now they're forking and forking, right now we have at least five more or less active dfhack repos, nobody knows which one to use at a given point in time and when changes going to be merged into the "main" repo.
--offtopic end--
Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 13, 2014, 05:13:39 pm
gcc 4.8. Brew errors out if I try to install 4.5. Not sure why. I think brew puts stuff in usr/local/lib, so I'll try that. Thanks!

For brew and 4.9 the path is /usr/local/Cellar/gcc49/4.9.0/lib/gcc/x86_64-apple-darwin13.2.0/4.9.0/i386/libstdc++.6.dylib don't forget the folder in bold.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 13, 2014, 10:37:19 pm

--offtopic below--
That's what I hate git/github for. Before cool-distributed-trendy-git-github people gained write access to a single repo and just working there together. Now they're forking and forking, right now we have at least five more or less active dfhack repose, nobody knows which one to use at a given point in time and when changes going to be merged into the "main" repo.
--offtopic end--

This. I don't think I'm the only one wanting to be bleeding-edge and it's just silly to have to fetch stuff from unofficial repos because of all these forks. Hardly anyone knows which one will compile, which one will run, which one is Linux/OS X compatible (since these are usually given less priority), etc. Even the AUR contains outdated versions.
Title: Re: DFHack 0.34.11 r5
Post by: Roses on August 13, 2014, 10:42:56 pm

--offtopic below--
That's what I hate git/github for. Before cool-distributed-trendy-git-github people gained write access to a single repo and just working there together. Now they're forking and forking, right now we have at least five more or less active dfhack repose, nobody knows which one to use at a given point in time and when changes going to be merged into the "main" repo.
--offtopic end--

This. I don't think I'm the only one wanting to be bleeding-edge and it's just silly to have to fetch stuff from unofficial repos because of all these forks. Hardly anyone knows which one will compile, which one will run, which one is Linux/OS X compatible (since these are usually given less priority), etc. Even the AUR contains outdated versions.
Honestly it doesn't bother me much. If you want to use a system before it is officially released then you need to do the work to make sure all of the parts are correct. If everything was in a single place and working then it would be the official release. Having things in separate repos allows people to make changes for one specific thing (like making it OSX compatible, or Linux compatible, or whatever) and then when they have that aspect working, they can merge it back into the main repo for all to use.
Title: Re: DFHack 0.34.11 r5
Post by: salithus on August 13, 2014, 10:46:57 pm

--offtopic below--
That's what I hate git/github for. Before cool-distributed-trendy-git-github people gained write access to a single repo and just working there together. Now they're forking and forking, right now we have at least five more or less active dfhack repose, nobody knows which one to use at a given point in time and when changes going to be merged into the "main" repo.
--offtopic end--

This. I don't think I'm the only one wanting to be bleeding-edge and it's just silly to have to fetch stuff from unofficial repos because of all these forks. Hardly anyone knows which one will compile, which one will run, which one is Linux/OS X compatible (since these are usually given less priority), etc. Even the AUR contains outdated versions.
Honestly it doesn't bother me much. If you want to use a system before it is officially released then you need to do the work to make sure all of the parts are correct. If everything was in a single place and working then it would be the official release. Having things in separate repos allows people to make changes for one specific thing (like making it OSX compatible, or Linux compatible, or whatever) and then when they have that aspect working, they can merge it back into the main repo for all to use.
eh, I still prefer the centralized repo with branching/tagging used liberally. that way you can have tags for official releases, branches for people doing whatever they feel like, and a trunk that will always at least compile (or someone pays dearly) even if it isn't 100% functional. actually had a discussion about this today at work and how we will never ever use git for future projects because of the kind of fragmentation I'm seeing on DF projects.
Title: Re: DFHack 0.34.11 r5
Post by: mifki on August 13, 2014, 10:51:30 pm

--offtopic below--
That's what I hate git/github for. Before cool-distributed-trendy-git-github people gained write access to a single repo and just working there together. Now they're forking and forking, right now we have at least five more or less active dfhack repose, nobody knows which one to use at a given point in time and when changes going to be merged into the "main" repo.
--offtopic end--

This. I don't think I'm the only one wanting to be bleeding-edge and it's just silly to have to fetch stuff from unofficial repos because of all these forks. Hardly anyone knows which one will compile, which one will run, which one is Linux/OS X compatible (since these are usually given less priority), etc. Even the AUR contains outdated versions.
Honestly it doesn't bother me much. If you want to use a system before it is officially released then you need to do the work to make sure all of the parts are correct. If everything was in a single place and working then it would be the official release. Having things in separate repos allows people to make changes for one specific thing (like making it OSX compatible, or Linux compatible, or whatever) and then when they have that aspect working, they can merge it back into the main repo for all to use.
eh, I still prefer the centralized repo with branching/tagging used liberally. that way you can have tags for official releases, branches for people doing whatever they feel like, and a trunk that will always at least compile (or someone pays dearly) even if it isn't 100% functional. actually had a discussion about this today at work and how we will never ever use git for future projects because of the kind of fragmentation I'm seeing on DF projects.

Yep. Well, actually even with decentralised VCS you don't have to fork and work in different repos, it's just what github made popular and "standard way of using git".
Also, for example, I was going to add dfhack to my build server to automatically build it for 0.40 as development goes until the official release, but it's just not possible - I can't build and publish 5 repos.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 13, 2014, 10:53:30 pm
Yep.
Also, for example, I was going to add dfhack to my build server to automatically build it for 0.40 as development goes until the official release, but it's just not possible - I can't build and publish 5 repos.
Heh, it's funny since I recently told myself I should be writing a script that automatically updates and builds dfhack until I got stuck with the same issue.
Title: Re: DFHack 0.34.11 r5
Post by: therahedwig on August 14, 2014, 06:19:03 am
Strangely enough, you don't see this problem on big opensource software projects, because they make sure that things get merged back into master, and only do big new features in branches, and merge them as soon as they are sure it won't break the rest of the program.

Edit: Though those guys usually have their own git repo and don't use github, and usually also more organised. I guess I can see what you guys mean.
Title: Re: DFHack 0.34.11 r5
Post by: Warmist on August 14, 2014, 06:36:01 am
Yep.
Also, for example, I was going to add dfhack to my build server to automatically build it for 0.40 as development goes until the official release, but it's just not possible - I can't build and publish 5 repos.
Heh, it's funny since I recently told myself I should be writing a script that automatically updates and builds dfhack until I got stuck with the same issue.
Depends on what you want: bleeding edge- pull _Q and ag develop branches into your own (maybe few other you want) and merge and build. Want something more sane: use DFHack develop branch (usually updated 0.5 times a day). Want stable/releases build DFHack master.
I am doing the first thing (not automatically) and don't really care about most other things other people are doing (or at least until it's stable enough to be in master).
Title: Re: DFHack 0.34.11 r5
Post by: smjjames on August 14, 2014, 08:30:26 am
Yeah um, careful with those experimental builds people. Given how dfhack toys with DF's memory, if some obsolete plugin change the wrong things you're likely to end up with crashes and saves corruption... so only use those for fooling around with a fortress you don't care about much.

Also, some people should educate themselves on what OSX, Windows and Linux are. No excuse, you've got Wikipedia and the intertubes at your disposal.

To be fair, nopenope didn't say which one of his downloads was windows compatible.
Title: Re: DFHack 0.34.11 r5
Post by: expwnent on August 14, 2014, 04:10:39 pm
--offtopic below--
That's what I hate git/github for. Before cool-distributed-trendy-git-github people gained write access to a single repo and just worked there together. Now they're forking and forking, right now we have at least five more or less active dfhack repos, nobody knows which one to use at a given point in time and when changes going to be merged into the "main" repo.
--offtopic end--

The advantages outweigh the disadvantages. Nobody needs to ask to fork the repo, and anyone can choose what updates they want to include. The github.com/DFHack/DFHack (or similar URL) is the "official" version and is always at least as up to date as the most recent release. We're in an unusually long delay before the release so it's a bit behind. Also there are submodules and git submodules are slightly terrible.

edit: What Warmist said.
Title: Re: DFHack 0.34.11 r5
Post by: isitanos on August 14, 2014, 05:35:21 pm
Isitanos, I don't get the impression that the folks ITT cloning the repos will have unrealistic expectations. They probably comprehend what it means to be an unstable/incomplete version. I just see it as enthusiastic beta testing. :P
Actually I was thinking about other folks downloading the experimental binaries from this thread, not those cloning the repos. The latter indeed know what they're getting into (hopefully :P ).

To be fair, nopenope didn't say which one of his downloads was windows compatible.
To be fair, someone with the slightest knowledge of OS's instantly knows that a download is not for windows if it's for OSX or Linux. Hence my encouragement to learn about those. No offense meant.
Title: Re: DFHack 0.34.11 r5
Post by: Nopenope on August 14, 2014, 07:59:50 pm
To be fair he could have been right if dfhack were written in a scripting language or other portable language like java, e.g. soundsense doesn't have a special version for Linux as far as I know.

In other news, the latest DFHack repo builds and runs smoothly but the game crashes on embark unpause; probably a broken plugin.
Title: Re: DFHack 0.40.08-r1
Post by: expwnent on August 15, 2014, 05:15:07 am
New release!
Title: Re: DFHack 0.40.08-r1
Post by: scamtank on August 15, 2014, 05:34:12 am
First post before everything explodes.

Thanks for your everything, everyone involved. I've missed this.

e: dang, this thing just doesn't stop crashing
Title: Re: DFHack 0.40.08-r1
Post by: rx80 on August 15, 2014, 07:06:24 am
First post before everything explodes.

Thanks for your everything, everyone involved. I've missed this.

e: dang, this thing just doesn't stop crashing

in dfhack init disable: tweak craft-age-wear
Title: Re: DFHack 0.40.08-r1
Post by: Nimrod on August 15, 2014, 07:09:16 am
First off: THANK YOU from the bottom of my heart for updating this great tool!

Second, I have the crash issue too, will try disabling ' tweak craft-age-wear' ... brb (thanks for the tip, bro)

Edit: seems to work perfectly! no more crashing so far. rx80, you are a legendary Hackdwarf! ;)
Title: Re: DFHack 0.40.08-r1
Post by: scamtank on August 15, 2014, 07:19:09 am
Hey, that seemed to do the trick.

Here's one from me to you: tweak military-stable-assign makes Adventure mode crash any time you view the inventory. Get rid of that, too.
Title: Re: DFHack 0.40.08-r1
Post by: Xerberus on August 15, 2014, 07:23:59 am
First post before everything explodes.

Thanks for your everything, everyone involved. I've missed this.

e: dang, this thing just doesn't stop crashing

in dfhack init disable: tweak craft-age-wear

can you please tell me how i do that, i opened up the dfhack . init with editor (wordpad) but i couldn'T find craft-age-wear (using the starter pack r2). which file do i have to change and what do i have to change (changing it from yes to no, 1 to 0 or deleting a line)? thx in advance!
Title: Re: DFHack 0.40.08-r1
Post by: scamtank on August 15, 2014, 07:26:19 am
It's there. Look harder.

When you do, add a # in front of it to comment it out.
Title: Re: DFHack 0.40.08-r1
Post by: Xerberus on August 15, 2014, 07:34:00 am
It's there. Look harder.

When you do, add a # in front of it to comment it out.

found it and thanks for the help!
Title: Re: DFHack 0.40.08-r1.2
Post by: expwnent on August 15, 2014, 07:46:22 am
DFHack 0.40.08-r1 had a bug in dfhack.init-example where a few commands would make DF crash just after loading a save. The only change to DFHack 0.40.08-r1.1 and DFHack 0.40.08-r1.2 is in this file. Manually overwrite the file with the most recent version (http://pastebin.com/zbxb7gpL) if you grabbed DFHack 0.40.08-r1 before this fix.
Title: Re: DFHack 0.40.08-r1.2
Post by: YAHG on August 15, 2014, 08:21:29 am
NICE!!!! Thank you all the people who worked on this for me  ;D
Title: Re: DFHack 0.40.08-r1.2
Post by: Tzyx on August 15, 2014, 08:38:44 am
awesome, time to try this sucker out!
Title: Re: DFHack 0.40.08-r1.2
Post by: Quietust on August 15, 2014, 08:43:11 am
Attention: Do NOT use either of these versions, as they were built against outdated structures data where the virtual method table for the "item" class is misaligned, which will cause various plugins to crash Dwarf Fortress if they try to manipulate items in certain ways.

A new version will be available shortly.
Title: Re: DFHack 0.40.08-r1.2
Post by: YAHG on August 15, 2014, 08:47:20 am
Attention: Do NOT use either of these versions, as they were built against outdated structures data where the virtual method table for the "item" class is misaligned, which will cause various plugins to crash Dwarf Fortress if they try to manipulate items in certain ways.

A new version will be available shortly.

That's like giving a man a lil bit o crack, then leaving the rest on the table (with the pipe and lighter) and telling him not to finish it  >:).

Then again if we do not listen to you we will all be turned into a Oprelian Amoeba  :-X
Title: Re: DFHack 0.40.08-r1.2
Post by: OzoneGrif on August 15, 2014, 09:04:37 am
Thanks a lot for DFHack !

I'm doing some tests :
- Search in the stock screen crashes.
- "stocks show" in the command line crashes.
- "strangemood" in the command crashes
- "Ctrl+Shift+I" keybinding crashes
- Creating a workflow in the GUI (Z then Alt+W) crashes
- The Job assign text under Stockpiles (J:) hide some of the listed links

Overrall, it works quite well :)
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 15, 2014, 09:06:01 am
A what amoeba?

Anyway, I was going to grab Peridexis's pack before I saw Quietusts warning about the fact that it's bugged. Can't wait for a functional DFhack to play around with.

Been frustrated by my curiosity about what is causing the spam of pathing errors from underground critters (mostly crundles, but anything down there can do it) and being unable to see what the heck is happening down there.
Title: Re: DFHack 0.40.08-r2
Post by: expwnent on August 15, 2014, 09:57:28 am
Basically everything will crash in r1. r2 should be mostly ok, but still be careful with it.
Title: Re: DFHack 0.40.08-r2
Post by: Aquathug on August 15, 2014, 09:58:56 am
Basically everything will crash in r1. r2 should be mostly ok, but still be careful with it.

Sweet. Thank you sir.
Title: Re: DFHack 0.40.08-r2
Post by: gosam on August 15, 2014, 11:11:54 am
Praise the coders!

It's working so far for me. Had to fiddle a bit with the LD_LIBRARY_PATH due to my setup (problems with libtiff), but it's all good now.
Thanks to everyone involved!
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 15, 2014, 12:03:57 pm
You're using an old, unworking version of hackwish. Like, literally doesn't work. Here's one that does:

Code: [Select]
-- Allows for script-based wishing.
 
function getGenderString(gender)
 local genderStr
 if gender==0 then
  genderStr=string.char(12)
 elseif gender==1 then
  genderStr=string.char(11)
 else
  return ""
 end
 return string.char(40)..genderStr..string.char(41)
end
 
function getCreatureList()
 local crList={}
 for k,cr in ipairs(df.global.world.raws.creatures.alphabetic) do
  for kk,ca in ipairs(cr.caste) do
   local str=ca.caste_name[0]
   str=str..' '..getGenderString(ca.gender)
   table.insert(crList,{str,nil,ca})
  end
 end
 return crList
end
 
function getMatFilter(itemtype)
  local itemTypes={
   SEEDS=function(mat,parent,typ,idx)
    return mat.flags.SEED_MAT
   end,
   PLANT=function(mat,parent,typ,idx)
    return mat.flags.STRUCTURAL_PLANT_MAT
   end,
   LEAVES=function(mat,parent,typ,idx)
    return mat.flags.LEAF_MAT
   end,
   MEAT=function(mat,parent,typ,idx)
    return mat.flags.MEAT
   end,
   CHEESE=function(mat,parent,typ,idx)
    return (mat.flags.CHEESE_PLANT or mat.flags.CHEESE_CREATURE)
   end,
   LIQUID_MISC=function(mat,parent,typ,idx)
    return (mat.flags.LIQUID_MISC_PLANT or mat.flags.LIQUID_MISC_CREATURE or mat.flags.LIQUID_MISC_OTHER)
   end,
   POWDER_MISC=function(mat,parent,typ,idx)
    return (mat.flags.POWDER_MISC_PLANT or mat.flags.POWDER_MISC_CREATURE)
   end,
   DRINK=function(mat,parent,typ,idx)
    return (mat.flags.ALCOHOL_PLANT or mat.flags.ALCOHOL_CREATURE)
   end,
   GLOB=function(mat,parent,typ,idx)
    return (mat.flags.STOCKPILE_GLOB)
   end,
   WOOD=function(mat,parent,typ,idx)
    return (mat.flags.WOOD)
   end,
   THREAD=function(mat,parent,typ,idx)
    return (mat.flags.THREAD_PLANT)
   end,
   LEATHER=function(mat,parent,typ,idx)
    return (mat.flags.LEATHER)
   end
  }
  return itemTypes[df.item_type[itemtype]] or getRestrictiveMatFilter(itemtype)
end
 
function getRestrictiveMatFilter(itemType)
 if not args.veryRestrictive then return nil else
 local itemTypes={
   WEAPON=function(mat,parent,typ,idx)
    return (mat.flags.ITEMS_WEAPON or mat.flags.ITEMS_WEAPON_RANGED)
   end,
   AMMO=function(mat,parent,typ,idx)
    return (mat.flags.ITEMS_AMMO)
   end,
   ARMOR=function(mat,parent,typ,idx)
    return (mat.flags.ITEMS_ARMOR)
   end,
   SHOES,SHIELD,HELM,GLOVES=ARMOR,ARMOR,ARMOR,ARMOR,
   INSTRUMENT=function(mat,parent,typ,idx)
    return (mat.flags.ITEMS_HARD)
   end,
   GOBLET,FLASK,TOY,RING,CROWN,SCEPTER,FIGURINE,TOOL=INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,INSTRUMENT,
   AMULET=function(mat,parent,typ,idx)
    return (mat.flags.ITEMS_SOFT or mat.flags.ITEMS_HARD)
   end,
   EARRING,BRACELET=AMULET,AMULET,
   ROCK=function(mat,parent,typ,idx)
    return (mat.flags.IS_STONE)
   end,
   BOULDER=ROCK,
   BAR=function(mat,parent,typ,idx)
    return (mat.flags.IS_METAL or mat.flags.SOAP or mat.id==COAL)
   end
   
  }
 return itemTypes[df.item_type[itemType]]
 end
end
 
function createItem(mat,itemType,quality,creator,description)
dfhack.items.createItem(itemType[1], itemType[2], mat[1], mat[2], creator)
 if df.item_type[itemType[1]]=='SLAB' then
  item.description=description
 end
end
 
function qualityTable()
 return {{'None'},
 {'-Well-crafted-'},
 {'+Finely-crafted+'},
 {'*Superior*'},
 {string.char(240)..'Exceptional'..string.char(240)},
 {string.char(15)..'Masterwork'..string.char(15)}
 }
end
 
local script=require('gui.script')
 
function showItemPrompt(text,item_filter,hide_none)
 require('gui.materials').ItemTypeDialog{
  prompt=text,
  item_filter=item_filter,
  hide_none=hide_none,
  on_select=script.mkresume(true),
  on_cancel=script.mkresume(false),
  on_close=script.qresume(nil)
 }:show()
 
 return script.wait()
end
 
function showMaterialPrompt(title, prompt, filter, inorganic, creature, plant) --the one included with DFHack doesn't have a filter or the inorganic, creature, plant things available
 require('gui.materials').MaterialDialog{
  frame_title = title,
  prompt = prompt,
  mat_filter = filter,
  use_inorganic = inorganic,
  use_creature = creature,
  use_plant = plant,
  on_select = script.mkresume(true),
  on_cancel = script.mkresume(false),
  on_close = script.qresume(nil)
 }:show()
 
 return script.wait()
end
 
function usesCreature(itemtype)
 typesThatUseCreatures={REMAINS=true,FISH=true,FISH_RAW=true,VERMIN=true,PET=true,EGG=true,CORPSE=true,CORPSEPIECE=true}
 return typesThatUseCreatures[df.item_type[itemtype]]
end
 
function getCreatureRaceAndCaste(caste)
 return df.global.world.raws.creatures.list_creature[caste.index],df.global.world.raws.creatures.list_caste[caste.index]
end
 
function hackWish(unit)
 script.start(function()
  local amountok, amount
  local matok,mattype,matindex,matFilter
  local itemok,itemtype,itemsubtype=showItemPrompt('What item do you want?',function(itype) return df.item_type[itype]~='CORPSE' and df.item_type[itype]~='FOOD' end ,true)
  if not args.notRestrictive then
   matFilter=getMatFilter(itemtype)
  end
  if not usesCreature(itemtype) then
   matok,mattype,matindex=showMaterialPrompt('Wish','And what material should it be made of?',matFilter)
  else
   local creatureok,useless,creatureTable=script.showListPrompt('Wish','What creature should it be?',COLOR_LIGHTGREEN,getCreatureList())
   mattype,matindex=getCreatureRaceAndCaste(creatureTable[3])
  end
  local qualityok,quality=script.showListPrompt('Wish','What quality should it be?',COLOR_LIGHTGREEN,qualityTable())
  local description
  if df.item_type[itemtype]=='SLAB' then
   local descriptionok
   descriptionok,description=script.showInputPrompt('Slab','What should the slab say?',COLOR_WHITE)
  end
  if args.multi then
   repeat amountok,amount=script.showInputPrompt('Wish','How many do you want? (numbers only!)',COLOR_LIGHTGREEN) until tonumber(amount)
    if mattype and itemtype then
     for i=1,tonumber(amount) do
      createItem({mattype,matindex},{itemtype,itemsubtype},quality,unit,description)
     end
    end
  else
   if mattype and itemtype then
    createItem({mattype,matindex},{itemtype,itemsubtype},quality,unit,description)
   end   
  end
 end)
end
 
scriptArgs={...}

utils=require('utils')

validArgs = validArgs or utils.invert({
 'startup',
 'all',
 'restrictive',
 'unit',
 'multi'
})

args = utils.processArgs({...}, validArgs)
 
eventful=require('plugins.eventful')

if not args.startup then
 local unit=args.unit and df.unit.find(args.unit) or dfhack.gui.getSelectedUnit(true)
 hackWish(unit)
else
 eventful.onReactionComplete.hackWishP=function(reaction,unit,input_items,input_reagents,output_items,call_native)
  if not reaction.code:find('DFHACK_WISH') then return nil end
  hackWish(unit)
 end
end
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 15, 2014, 12:30:40 pm
Two questions here:

1. If I load up Peridexis's starter pack, which uses r1, is the only thing I have to replace to update DFhack to r2 is the DFhack.init in the newer download, right?

2. How do I view the coordinates like those in the 'path fail' errors?
Title: Re: DFHack 0.40.08-r2
Post by: scamtank on August 15, 2014, 12:52:03 pm
1. No. r1 is fucked under the hood in more ways than just those tweaks. Get the r2 version.
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 15, 2014, 12:53:57 pm
I get that, but is the only thing I have to replace is one file or is there more? I'm just checking on that.
Title: Re: DFHack 0.40.08-r2
Post by: fricy on August 15, 2014, 12:58:52 pm
I get that, but is the only thing I have to replace is one file or is there more? I'm just checking on that.
At least the complete /hack directory and the .init.
Title: Re: DFHack 0.40.08-r2
Post by: Quietust on August 15, 2014, 01:24:22 pm
I get that, but is the only thing I have to replace is one file or is there more? I'm just checking on that.
At least the complete /hack directory and the .init.
Most notably, you need to update all of the DLLs - SDL.dll, protobuf-lite.dll, lua.dll, libruby.dll, dfhack-client.dll, and all of the plugins - failing to update any of those can and will cause it to continue crashing.
Title: Re: DFHack 0.40.08-r2
Post by: SeelenJägerTee on August 15, 2014, 01:24:35 pm
https://github.com/DFHack/dfhack#lua
Quote
lua (without any parameters)

This starts an interactive lua interpreter.
But I can't find any documentation about what do do when IN the interpreter.
E.g. this post (http://www.bay12forums.com/smf/index.php?topic=129349.msg4455928#msg4455928) tells me what to do. But where can I find info on the data structure if I wanted to come up with sth. like this myself?
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 15, 2014, 01:28:06 pm
https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst

gui/gm-editor is a good tool that does pretty much the same thing.
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 15, 2014, 01:28:36 pm
I get that, but is the only thing I have to replace is one file or is there more? I'm just checking on that.
At least the complete /hack directory and the .init.
Most notably, you need to update all of the DLLs - SDL.dll, protobuf-lite.dll, lua.dll, libruby.dll, dfhack-client.dll, and all of the plugins - failing to update any of those can and will cause it to continue crashing.

I'll wait for peridexis to update it in a couple hours, unless I can just swap files? Then again, I wouldn't be 100% sure on what I'm doing.

Anybody know anything about the second question? Lethosor says in http://www.bay12games.com/dwarves/mantisbt/view.php?id=7821 that they are cursor coordinates, but how do I get that to show?
Title: Re: DFHack 0.40.08-r2
Post by: scamtank on August 15, 2014, 02:41:24 pm
Just unpack the damn thing into the root folder where Dwarf Fortress.exe is sitting. This isn't hard.
Title: Re: DFHack 0.40.08-r2
Post by: YAHG on August 15, 2014, 02:53:33 pm
Just unpack the damn thing into the root folder where Dwarf Fortress.exe is sitting. This isn't hard.

This is what I did. I made a backup of my sdl.dll though so I can feel smart. 8)
Title: Re: DFHack 0.40.08-r2
Post by: Dirst on August 15, 2014, 02:57:42 pm
Just unpack the damn thing into the root folder where Dwarf Fortress.exe is sitting. This isn't hard.

This is what I did. I made a backup of my sdl.dll though so I can feel smart. 8)
Well, I stayed at a Best Western Inn last night.  :P
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 15, 2014, 03:00:57 pm
And I saved a bunch om money on car insurance.

By not owning a car.
Title: Re: DFHack 0.40.08-r2
Post by: YAHG on August 15, 2014, 03:04:12 pm
And I saved a bunch om money on car insurance.

By not owning a car.

Did you at least get a good rate?  :P
Title: Re: DFHack 0.40.08-r2
Post by: bennerman on August 15, 2014, 03:13:19 pm
How do I use rename? It's saying it isn't a recognized command
Title: Re: DFHack 0.40.08-r2
Post by: fricy on August 15, 2014, 03:20:35 pm
You're using an old, unworking version of hackwish. Like, literally doesn't work. Here's one that does:
/snip

OSX 40.08-r2:
Code: [Select]
[DFHack]# gui/hack-wish
...ons/dfhack_osx_0.40.08-r2/hack/scripts/gui/hack-wish.lua:197: attempt to index global 'utils' (a nil value)
stack traceback:
...ons/dfhack_osx_0.40.08-r2/hack/scripts/gui/hack-wish.lua:197: in main chunk
(...tail calls...)

How do I use rename? It's saying it isn't a recognized command
It's gui/rename, default keybind: ctrl-shift-n
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 15, 2014, 03:30:49 pm
The heck happened to my requires...

EDIT: Fixed.
Title: Re: DFHack 0.40.08-r2
Post by: scamtank on August 15, 2014, 03:37:04 pm
tweak military-training is still in the readme and floating around in the .init, but is it no longer there? Trying to invoke it just makes tweak fart out a command list like I was typing gibberish at it.
Title: Re: DFHack 0.40.08-r2
Post by: fricy on August 15, 2014, 03:39:24 pm
The heck happened to my requires...

EDIT: Fixed.
same error

tweak military-training is still in the readme and floating around in the .init, but is it no longer there? Trying to invoke it just makes tweak fart out a command list like I was typing gibberish at it.
That bug has been fixed, don't try to run it even if it's still there. Uhm, was that fixed?
Title: Re: DFHack 0.40.08-r2
Post by: SeelenJägerTee on August 15, 2014, 03:49:37 pm
Is there a way to save a dwarfs attributes (traits, soul, sex, caste, etc. etc.) and reload them later onto another dwarf?
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 15, 2014, 03:53:12 pm
How do I see the cursor coordinates?
Title: Re: DFHack 0.40.08-r2
Post by: YAHG on August 15, 2014, 04:10:21 pm
How do I see the cursor coordinates?

If you mean mousequery,

Code: [Select]
enable mousequery
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 15, 2014, 04:14:10 pm
He's asking how to find df.global.cursor.

It's df.global.cursor.
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 15, 2014, 04:23:57 pm
He's asking how to find df.global.cursor.

It's df.global.cursor.

Well, I didn't know what the function was that showed the coordinates. Just type that into the command console? Or is it an onscreen display?
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 15, 2014, 04:33:17 pm
It's a structure. Here's a script:

printall(df.global.cursor)
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 15, 2014, 04:37:56 pm
Okay, thanks. I'm not an advanced user of DFhack like some of you guys are.
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 15, 2014, 10:29:53 pm
It's a structure. Here's a script:

printall(df.global.cursor)

Just tried that, not a recognized command.
Title: Re: DFHack 0.40.08-r2
Post by: mifki on August 15, 2014, 10:30:54 pm
It's a structure. Here's a script:

printall(df.global.cursor)

Just tried that, not a recognized command.

First, "lua" then "~df.global.cursor"
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 15, 2014, 10:46:44 pm
It's a structure. Here's a script:

printall(df.global.cursor)

Just tried that, not a recognized command.

First, "lua" then "~df.global.cursor"

Got it, now, how do I get the unit-info-viewer script thing to work? though I think it may also be a lua. I want to see stuff like adventurer stats, fame, and also look at other units to see if I can figure out what's going on with the reactions, etc.
Title: Re: DFHack 0.40.08-r2
Post by: expwnent on August 16, 2014, 12:20:39 am
It's a structure. Here's a script:

printall(df.global.cursor)

Just tried that, not a recognized command.

First, "lua" then "~df.global.cursor"

Also try ":lua ~df.global.cursor".
Title: Re: DFHack 0.40.08-r2
Post by: Urist Da Vinci on August 16, 2014, 12:34:25 am
After some testing, I think body_part_status unk19 is the "pulped" flag, and unk20 has a different meaning but is used in the logic somehow.
Title: Re: DFHack 0.40.08-r2
Post by: Blade312 on August 16, 2014, 01:25:40 am
How do you paint liquid magma with the paint plugin?
Title: Re: DFHack 0.40.08-r2
Post by: hagelund on August 16, 2014, 04:33:53 am
Is there a way to download dfhack, other than dffd? It has been down for me, for the past 3 days, I had to get the newet Linux lnp from a mirror..
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 16, 2014, 06:45:14 am
You can always build it yourself.

Takes a bit to setup, though.
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 16, 2014, 07:34:21 am
How do I get the unit-info-viewer to work?
Title: Re: DFHack 0.40.08-r2
Post by: expwnent on August 16, 2014, 07:46:23 am
You're using an old, unworking version of hackwish. Like, literally doesn't work. Here's one that does:

Updated. Will be in the next release.
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 16, 2014, 08:52:52 am
Anybody know how to get the unit-info viewer to work? I tried a couple ways and it doesn't work, also it's not in the command list that shows with ls.

Edit: Anyone??
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 16, 2014, 11:57:12 am
gui/unit-info-viewer
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 16, 2014, 12:03:59 pm
gui/unit-info-viewer

*with realization* OHhh. Why didn't I think of that, lol. I thought I had to do lua or script or something. Thank you.

Edit: It doesn't do what I thought it would do, just the name, description, and size. I thought there would be a way to view stuff like the reason for them acting in a certain way to stuff, like the conversations? Though maybe that isn't developed yet.

Also, how do I view the adventurer info like reputation/fame?
Title: Re: DFHack 0.40.08-r2
Post by: Euius on August 16, 2014, 01:22:18 pm
Spoiler (click to show/hide)

Have been noticing this problem in every pre-release, but as they weren't official I didn't report.  Simple fix, just wrap the statement in a "if v then"

(Of course, you have to completely restart because it's cached in memory)

Second issue: Alt-key keybindings are being applied to non-alt keypresses.  This is immediately noticeable when hitting r to turn on repeat in a workshop will bring up the room list

Third: Running showmood when the dwarf has already started construction hard crashes the game.
Title: Re: DFHack 0.40.08-r2
Post by: vjek on August 16, 2014, 02:06:06 pm
Thanks to the dfhack team and contributors for the new version!  :D

I've updated my scripts (http://dwarffortresswiki.org/index.php/User:Vjek) accordingly.

I've read through the scripting guidelines in the first post of this thread, and I'll do my best to try and follow the guidelines as time goes on.
Title: Re: DFHack 0.40.08-r2
Post by: yxe on August 16, 2014, 02:06:27 pm
first ... thanks for this utilitie =) ...

If you set more than a link to a stockpile, the linked list of "give: stockpile #1", "take: stockpile #2", ETC/ETC gets overlapped by: "J: No Job Selected" ??, its anybody else having this issue?


EDIT:
and this:
Code: [Select]
http://es.tinypic.com/view.php?pic=11lpoi0&s=8
my resolution is: 1920x1080
Title: Re: DFHack 0.40.08-r2
Post by: adgriff2 on August 16, 2014, 02:26:04 pm
Is there any way to export Workflow settings that were set using the gui? I'd like to save them to use with a different worldgen. Thanks!
Title: Re: DFHack 0.40.08-r2
Post by: Nopenope on August 16, 2014, 02:38:35 pm
An indirect method would be to save a list of dfhack workflow command-line instructions and paste them every time. Not sure if the gui can do that though.
Title: Re: DFHack 0.40.08-r2
Post by: adgriff2 on August 16, 2014, 02:57:48 pm
I currently have a small list of workflow settings I'd like to load. I tried adding them to dfhack.init but got spammed with "World is not loaded: please load a game first". Is there a way to run a batch of dfhack commands (preferably post world load)?

I saw that I can use 'dfhack-run' to execute dfhack commands from an OS console, so I can probably rig it up with:

dfhack-run workflow amount BLOCKS 256 64
dfhack-run workflow amount HATCH_COVER 10 5
.
.
.

in a *.bat file if I have to...
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 16, 2014, 03:05:11 pm
onLoad.init in the save should work, I think.
Title: Re: DFHack 0.40.08-r2
Post by: adgriff2 on August 16, 2014, 03:26:17 pm
I didn't have an onLoad.init file in the folder with dfhack.init, so I made one and added the items but it didn't try to run the commands on load.

After doing some research it looks like the LNP has it's own onLoad.init file named LNP_dfhack_onLoad.init. I added the commands to this file and it seems to work fine. I just hope this file doesn't get overwritten by the LNP from time to time.
Title: Re: DFHack 0.40.08-r2
Post by: Dirst on August 16, 2014, 05:31:39 pm
Thanks to everyone's really hard work, I got DFHack working, and even ported over a version of the old spawn-unit command which seems to function.  But I'm having two issues with it.

First, this bit throws an error

Code: [Select]
    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

saying "Cannot read field unit_soul.traits: not found."
For now I just commented that out since it probably doesn't even apply to animals... just thought it might be useful to any of the authors working on a fork of that thing.

The other error is specific to my application, where I wanted to extract the name of a unit.

Code: [Select]
local unit_name
if not unit_id then
unit_name = "Something" -- The player activated the script in an interactive window.
else
unit_name = dfhack.TranslateName(dfhack.units.getVisibleName(unit_id))
end

That one says "Cannot write field (global).getVisibleName(): incompatible pointer type."

I'm not trying to write to that field, I just want to read it.  The unit_id contains a number that I typed in by hand (from what cprobe showed me), since I'm guessing that would be passed in the interaction trigger I'll be using eventually.


Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 16, 2014, 05:33:44 pm
getVisibleName takes a unit, not the unit's ID. You want df.unit.find(unit_id) for that.
Title: Re: DFHack 0.40.08-r2
Post by: Dirst on August 16, 2014, 05:35:15 pm
getVisibleName takes a unit, not the unit's ID. You want df.unit.find(unit_id) for that.
Thanks.

I like it much better when your answer isn't just "No."
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 16, 2014, 05:41:29 pm
My answer isn't no when my answer is allowed to be no, heh. In this thread, that's usually the case.
Title: Re: DFHack 0.40.08-r2
Post by: Dirst on August 16, 2014, 05:46:49 pm
To update, that worked.  Now on to interaction triggers when I have some more time.

FYI, dfhack.gui.showAnnouncement(text, color) now seems to write into the gamelog all by itself.  The io commands shown in my script above are no longer required.
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 16, 2014, 05:48:38 pm
Now I wanna find a way to add sexual orientations to unit descriptions.

Or maybe I could just add it to unit-info-viewer somehow (if I can figure out what the hell all that code is supposed to be doing).
Title: Re: DFHack 0.40.08-r2
Post by: Dwarf_Fever on August 16, 2014, 06:17:38 pm
Are there any .init file collections, specifically one geared towards FPS optimization?

Edit: I guess that would be scripts, rather? Or does the default init already do all the fixes for this?

Edit Edit: Nevermind, 40_08 Starter Pack r03 has an option "Performance Tweaks" for DFHack so I will just copy that .init to the pack I am trying now. (Modest Accelerated)
Title: Re: DFHack 0.40.08-r2
Post by: PeridexisErrant on August 16, 2014, 07:10:37 pm
I didn't have an onLoad.init file in the folder with dfhack.init, so I made one and added the items but it didn't try to run the commands on load.

After doing some research it looks like the LNP has it's own onLoad.init file named LNP_dfhack_onLoad.init. I added the commands to this file and it seems to work fine. I just hope this file doesn't get overwritten by the LNP from time to time.

It will be overwritten by the launcher every time you launch DF or close the launcher.  Your onLoad.init needs to go in the /data/save/regionX/raw/ folder. 
Title: Re: DFHack 0.40.08-r2
Post by: adgriff2 on August 16, 2014, 07:13:07 pm
It will be overwritten by the launcher every time you launch DF or close the launcher.  Your onLoad.init needs to go in the /data/save/regionX/raw/ folder.

I'll try that. Thanks!
Title: Re: DFHack 0.40.08-r2
Post by: Treefingers on August 16, 2014, 08:04:14 pm
dfhack is failing to start, giving me this:
Code: [Select]
./libs/Dwarf_Fortress: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _Z10lua_gettopP9lua_State
I was previously getting the usual libstdc++ errors, which I fixed by (as usual) removing the libstdc++ file from "/libs". The above error only appeared after making the fix. Other than that, I've only done some basic changes to "dfhack.init". DF itself is the most recent v.

Workaround? Fix? Please/thanks!
Title: Re: DFHack 0.40.08-r2
Post by: samanato on August 16, 2014, 08:18:48 pm
How would one go about expanding the embark tools plugin? 

In my major mod, smelter reactions are all custom reactions with additional reagents to the ore itself.  For example, tetrahedrite smelting needs a flux in rough green glass which you can get in several ways, lead and tin ores need another coal bar to reduce the oxide, and ironworking is done entirely outside of the smelter.  This means, metal ores are no longer considered as such by the vanilla game, so that they no longer appear on the embark screen as "Shallow Metal" and "Deep Metal". 

I want to restore something like that to the embark screen, which I think would work in a similar way to the sand indicator.  As groundwork I've prefixed all the ore names with METAL_ORE_ (so, METAL_ORE_HEMATITE and so on).  How would such a script work, so that for example, the string to search would be "METAL_ORE_"? Ideally I would like for it to work like vanilla (with plurals and depth and all) though that is too much wizardry for me (I can't into DFHack programming  :()
Title: Re: DFHack 0.40.08-r2
Post by: samanato on August 16, 2014, 08:19:54 pm
!!double post, sorry!!
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 16, 2014, 08:33:29 pm
gui/unit-info-viewer

*with realization* OHhh. Why didn't I think of that, lol. I thought I had to do lua or script or something. Thank you.

Edit: It doesn't do what I thought it would do, just the name, description, and size. I thought there would be a way to view stuff like the reason for them acting in a certain way to stuff, like the conversations? Though maybe that isn't developed yet.

Also, how do I view the adventurer info like reputation/fame?

Why are you guys not answering my new questions?
Title: Re: DFHack 0.40.08-r2
Post by: Dirst on August 16, 2014, 10:57:53 pm
So the onLoad.init can be in the raw folder, but am I correct that any scripts you're using still need to get tucked into the /hack/scripts folder?

I was hoping to keep everything in the raw folder.
Title: Re: DFHack 0.40.08-r2
Post by: PeridexisErrant on August 16, 2014, 11:09:19 pm
What's New
  • Internals
    • Support for per save script folders. DFHack will now look for scripts in raw/scripts before checking for scripts in hack/scripts. This will help portability of  savegames between people who have different mods.
Title: Re: DFHack 0.40.08-r2
Post by: breadman on August 16, 2014, 11:28:05 pm
If you set more than a link to a stockpile, the linked list of "give: stockpile #1", "take: stockpile #2", ETC/ETC gets overlapped by: "J: No Job Selected" ??, its anybody else having this issue?

This one's my fault.  I'm open to suggestions on a better place for the stockflow lines.  Part of the trickiness is that the position of the links depends on the size of the window, and part is that I was working around Falconne's auto-trade/auto-melt/auto-dump plugin.

EDIT:
and this:
http://es.tinypic.com/view.php?pic=11lpoi0&s=8 (http://es.tinypic.com/view.php?pic=11lpoi0&s=8)

Those locations made sense in 0.34.11, when the trade screen was limited to the top 25 lines.  That can be fixed, probably for the next release.

dfhack is failing to start, giving me this:
Code: [Select]
./libs/Dwarf_Fortress: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _Z10lua_gettopP9lua_State
I was previously getting the usual libstdc++ errors, which I fixed by (as usual) removing the libstdc++ file from "/libs". The above error only appeared after making the fix. Other than that, I've only done some basic changes to "dfhack.init". DF itself is the most recent v.

Workaround? Fix? Please/thanks!

This sounds like it's failing to load ./hack/liblua.so for some reason.  Has that file been deleted?  Do you have another liblua.so on your system?

Edit: It doesn't do what I thought it would do, just the name, description, and size. I thought there would be a way to view stuff like the reason for them acting in a certain way to stuff, like the conversations? Though maybe that isn't developed yet.

Also, how do I view the adventurer info like reputation/fame?

Why are you guys not answering my new questions?

When we don't know an answer, we tend to stay silent in case someone with more expertise in that particular area can chime in.  Unfortunately, there isn't always a good answer, and we can't always tell when that's the case.  Frequently, the experts are doing something else, such as playing the game or updating DFHack to the new version, instead of paying close attention to the thread.

In this case, it doesn't sound like there's a good script anywhere that does exactly what you want.  However, you could try launching lua and poking around in the memory structures to see if something sounds like what you're looking for.  In this case, historical_figure_info.reputation sounds promising.
Title: Re: DFHack 0.40.08-r2
Post by: IndigoFenix on August 17, 2014, 01:59:51 am
Well, I'm glad that most of the new structures are added on instead of removed outright.  Most of the old scripts should still work.

That being said, has anyone been playing with trees?  I've worked out how to change the tiles of a tree provided they are already part of that tree, but how does the game determine the tree's current shape?  It doesn't seem to be all tree tiles within a cube, since adding new tree tiles within a tree's cube just creates a species-less 'tree' tile.  Stranger still, trees don't seem to have ID numbers.  How does the game determine which tiles belong to which tree if the tree has no ID?
Title: Re: DFHack 0.40.08-r2
Post by: Treefingers on August 17, 2014, 02:51:51 am
dfhack is failing to start, giving me this:
Code: [Select]
./libs/Dwarf_Fortress: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _Z10lua_gettopP9lua_State
This sounds like it's failing to load ./hack/liblua.so for some reason.  Has that file been deleted?  Do you have another liblua.so on your system?

./hack/liblua.so exists. I tried removing it just to see what would happen. I got the exact same result: no change to that error and no new errors.

I have packages lua (5.2.3-1) and lua51 (5.1.5-4) installed. Can't remove either because important stuff depends on them. And I never had lua problems with dfhack for DF 0.34.11. OS is 32-bit Arch, but I'm not using the repos for DF/dfhack. I'm just downloading from the sites.
Title: Re: DFHack 0.40.08-r2
Post by: mifki on August 17, 2014, 05:54:30 am
ui_advmode_menu values are all wrong now..
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 17, 2014, 10:52:58 am
Well, I'm glad that most of the new structures are added on instead of removed outright.  Most of the old scripts should still work.

That being said, has anyone been playing with trees?  I've worked out how to change the tiles of a tree provided they are already part of that tree, but how does the game determine the tree's current shape?  It doesn't seem to be all tree tiles within a cube, since adding new tree tiles within a tree's cube just creates a species-less 'tree' tile.  Stranger still, trees don't seem to have ID numbers.  How does the game determine which tiles belong to which tree if the tree has no ID?

There's a list of trees in the first map_block_column of the embark square, each of which has a list of all the branches in the tree, and their sizes. You have to modify that if you want to add new tiles to the tree. Keep in mind that the bounding box of the tree is kinda fixed after the tree is made, so you can't easily make ygdrassil, as far as I know.
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 17, 2014, 10:59:35 am
Edit: It doesn't do what I thought it would do, just the name, description, and size. I thought there would be a way to view stuff like the reason for them acting in a certain way to stuff, like the conversations? Though maybe that isn't developed yet.

Also, how do I view the adventurer info like reputation/fame?

Why are you guys not answering my new questions?

When we don't know an answer, we tend to stay silent in case someone with more expertise in that particular area can chime in.  Unfortunately, there isn't always a good answer, and we can't always tell when that's the case.  Frequently, the experts are doing something else, such as playing the game or updating DFHack to the new version, instead of paying close attention to the thread.

In this case, it doesn't sound like there's a good script anywhere that does exactly what you want.  However, you could try launching lua and poking around in the memory structures to see if something sounds like what you're looking for.  In this case, historical_figure_info.reputation sounds promising.

The first one was kind of a semi-question since I'm pretty sure such a thing doesn't exist to analyze the new reactions regarding the new conversation system.

Also, I swear there was already some script or tool to view the numbers of the adventurer stats and stuff like that. The whole reputation thing is different from the previous version since the rep isn't civ wide anymore, so you probably have to build new scripts for that anyway.
Title: Re: DFHack 0.40.08-r2
Post by: dariopnc on August 17, 2014, 12:10:30 pm
Hello everyone!

I installed DFHack on my debian machine amd64 (df 40.08) but cannot get stonesense to work

I removed libstdc++ to use system one, installed liballegro:i386 but still no luck

now stderr says: df_linux/hack/plugins/stonesense.plug.so: undefined symbol: al_color_rgb_to_hsv

hints?
Title: Re: DFHack 0.40.08-r2
Post by: fricy on August 17, 2014, 12:59:59 pm
Hello everyone!
I installed DFHack on my debian machine amd64 (df 40.08) but cannot get stonesense to work
I removed libstdc++ to use system one, installed liballegro:i386 but still no luck
now stderr says: df_linux/hack/plugins/stonesense.plug.so: undefined symbol: al_color_rgb_to_hsv
hints?
https://github.com/DFHack/dfhack/issues/282
https://github.com/DFHack/stonesense/pull/22/files
Title: Re: DFHack 0.40.08-r2
Post by: breadman on August 17, 2014, 03:42:15 pm
If you set more than a link to a stockpile, the linked list of "give: stockpile #1", "take: stockpile #2", ETC/ETC gets overlapped by: "J: No Job Selected" ??, its anybody else having this issue?

This one's my fault.  I'm open to suggestions on a better place for the stockflow lines.  Part of the trickiness is that the position of the links depends on the size of the window, and part is that I was working around Falconne's auto-trade/auto-melt/auto-dump plugin.

So, it turns out that I was remembering the 0.34.11 behavior of the stockpile links.  Now, they start at the top and work their way down the page, leaving one blank line before the "Done" line at the bottom.  This leaves four blank lines on the screen: above the menu, between the menu and the links, between the links and Done, and below Done.  Granted, the Done line is short, and less likely to be missed.

Stockflow wants two lines, preferably together, though I might be able to squeeze one to the right of the Done line given default keybindings.
The stocks plugin uses one line when enabled, though it's not obvious at first that the resulting screen differs from running "stocks show" globally.
The autotrade plugin wants another line, as do Falconne's autodump modification and automelt plugin, though it might be possible to combine the three with some work.

So, where should we put these four to six extra lines?  Should we overwrite the bottom of the link list, assuming that most people run in windows large enough, with few enough links, to not run into problems?  Should we try to squeeze everything into the blank lines?  Should we overwrite the Done line?

For aesthetic reasons, I'm leaning toward overwriting the bottom of the link list.  As long as lines are counted from the bottom, any overwritten lines are accessible by changing the window size, or by deleting a few links.
Title: Re: DFHack 0.40.08-r2
Post by: Heretic on August 18, 2014, 12:48:51 am
I have a question about this version of dfhack:
Can i use it with 0.40.03 df?
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 18, 2014, 01:00:20 am
You might be able to, but there's no guarentees at all.

I'd give it a one in twenty chance of not wrecking your savegames.
Title: Re: DFHack 0.40.08-r2
Post by: dariopnc on August 18, 2014, 01:20:39 am
now stderr says: df_linux/hack/plugins/stonesense.plug.so: undefined symbol: al_color_rgb_to_hsv
hints?
https://github.com/DFHack/dfhack/issues/282
https://github.com/DFHack/stonesense/pull/22/files

the way I get it is that there's a build error. seen that I don't/wont build my dfhack install, I'll have to watch for a new compiled version (r3?)
Title: Re: DFHack 0.40.08-r2
Post by: gunpowdertea on August 18, 2014, 03:29:57 am
[ ... ]
For aesthetic reasons, I'm leaning toward overwriting the bottom of the link list.  As long as lines are counted from the bottom, any overwritten lines are accessible by changing the window size, or by deleting a few links.

I regularly get into trouble with the link list as I only have a netbook. I know I am sort of in the tails of the curve :/ (oh, and that was already with .34, though it continues with .40). I favor the "overwirte the DONE line" solution, though this might look more messy. Combining all three plugins would likely be a bit of a nightmare for you and Falconne, since you would create interdependencies between the three plugins. While that would probably result in the shortest (and potentially nicest) result, "you don't want to" [see his identification] (because of trouble).

This is unfortunately not the first program where updated versions ceased to work well with my screen due to the developers assuming everybody to have huge displays... (QLandkarteGT is the worst offender, almost unusable now).
Title: Re: DFHack 0.40.08-r2
Post by: Quietust on August 18, 2014, 06:23:34 am
I have a question about this version of dfhack:
Can i use it with 0.40.03 df?
No, you cannot - it will only work with 0.40.07 and 0.40.08, and the next version will only work with 0.40.09 and later (because of the new POLE worldgen parameter).

Why would you want to use an old and buggy version, anyways?
Title: Re: DFHack 0.40.08-r2
Post by: Hesperid on August 18, 2014, 08:46:18 am
Advfort got broken by the new trees. You cannot fell trees anymore since the GUI simply complains that felling can only be performed on trees, and trunks apparently aren't good enough.
Title: Re: DFHack 0.40.08-r2
Post by: TV4Fun on August 18, 2014, 11:22:09 am
I'm having a problem with the DFHack patched version of DF 40.08 that I am not having with the vanilla version. Here is a new save in fortress mode from a newly created world. The patched version of DF crashes on loading this, but it loads fine in the vanilla version. http://dffd.wimbli.com/file.php?id=9425
Title: Re: DFHack 0.40.08-r2
Post by: Euius on August 18, 2014, 06:17:23 pm
Anyway to access the feature list in a region before embarking?

I can cobble some information from df.global.world.world_data.region_details[0].features[ x ][y] that's valid for the region I have up on the pre-embark site selector, but that just provides an index into a table that's not populated pre-embark, not a description, and the values change worldgen to worldgen.

And after embark, df.global.world.features.map_features is an easier way to access it anyways.
Title: Re: DFHack 0.40.08-r2
Post by: breadman on August 18, 2014, 07:04:27 pm
I regularly get into trouble with the link list as I only have a netbook. I know I am sort of in the tails of the curve :/ (oh, and that was already with .34, though it continues with .40). I favor the "overwirte the DONE line" solution, though this might look more messy.

Dwarf Fortress can be played on a netbook‽

My current pull request (https://github.com/DFHack/dfhack/pull/290) overwrites the last three lines of the list, and sometimes the blank line below them, when all three plugins (stockflow, stocks, and autotrade) are enabled.  At the minimum height of 25 lines, that leaves at least five links visible.  Given a valid objection as the only response, though, I should consider alternatives.

Would it be okay if I squish the extra lines out of the way only when they would overwrite a link?  I should be able to figure out how many links there are to/from the selected stockpile...

Quote
Combining all three plugins would likely be a bit of a nightmare for you and Falconne, since you would create interdependencies between the three plugins. While that would probably result in the shortest (and potentially nicest) result, "you don't want to" [see his identification] (because of trouble).

Currently, I'm considering something like "Auto: Trade  Dump  Melt" where the three word colors indicate their selection status.  That way, each of the three plugins could write the "Auto:" part and its own word, leaving blank space where the other two plugins would write theirs.

The point is currently moot, though, unless and until auto-melting (https://github.com/falconne/dfhack/tree/plugin_automelt) and auto-dumping (https://github.com/falconne/dfhack/tree/plugin_autodump) from stockpiles get pulled from Falconne's fork into the main DFHack repository.
Title: Re: DFHack 0.40.08-r2
Post by: gunpowdertea on August 19, 2014, 01:09:17 am
I regularly get into trouble with the link list as I only have a netbook. I know I am sort of in the tails of the curve :/ (oh, and that was already with .34, though it continues with .40). I favor the "overwirte the DONE line" solution, though this might look more messy.

Dwarf Fortress can be played on a netbook‽

Well... sort of. If people complain about their "low" FPS of only 100 or so, I just smile and nod... it is playable until year 10 of a fort (well, was in .34.xx). I usually leave it running while doing other stuff and every hour or so see what the Dorfs are up to.

Quote
My current pull request (https://github.com/DFHack/dfhack/pull/290) overwrites the last three lines of the list, and sometimes the blank line below them, when all three plugins (stockflow, stocks, and autotrade) are enabled.  At the minimum height of 25 lines, that leaves at least five links visible.  Given a valid objection as the only response, though, I should consider alternatives.
Five links should be ok, if they were visible ...
checking, I believe some screen layout changed...
Wait a minute, wasn't the link list at the very bottom or am I confusing stuff? Sorry for causing the confusion, but I was sure (unable to check since the save is inaccessible at the moment) that the links were at the bottom and having more than, dunno, five or so would make the last ones disappear. In .40.09 the links start really at the top. Sorry for ( the confusion caused ) OR ( being confused myself )

Quote
Would it be okay if I squish the extra lines out of the way only when they would overwrite a link?  I should be able to figure out how many links there are to/from the selected stockpile...

Quote
Combining all three plugins would likely be a bit of a nightmare for you and Falconne, since you would create interdependencies between the three plugins. While that would probably result in the shortest (and potentially nicest) result, "you don't want to" [see his identification] (because of trouble).

Currently, I'm considering something like "Auto: Trade  Dump  Melt" where the three word colors indicate their selection status.  That way, each of the three plugins could write the "Auto:" part and its own word, leaving blank space where the other two plugins would write theirs.

The point is currently moot, though, unless and until auto-melting (https://github.com/falconne/dfhack/tree/plugin_automelt) and auto-dumping (https://github.com/falconne/dfhack/tree/plugin_autodump) from stockpiles get pulled from Falconne's fork into the main DFHack repository.

Actually the above solution sounds quite nice...
Title: Re: DFHack 0.40.08-r2
Post by: Rumrusher on August 19, 2014, 10:53:23 am
I notice something odd about the second world gen but it seems to generate nothing but Wars and conquering towns don't know if this is a case of say every night creature and forgotten beast up and dying but there's just a influx of war stories for the secondary world gen. sorry the second world gen just generates nothing but Conquests which are different from wars from that Conquest doesn't list armies.
So it's pretty much political figures moving into a spot saying they own the place and murdering the other figure head.
Title: Re: DFHack 0.40.08-r2
Post by: breadman on August 19, 2014, 11:40:50 am
My current pull request (https://github.com/DFHack/dfhack/pull/290) overwrites the last three lines of the list, and sometimes the blank line below them, when all three plugins (stockflow, stocks, and autotrade) are enabled.  At the minimum height of 25 lines, that leaves at least five links visible.  Given a valid objection as the only response, though, I should consider alternatives.
Five links should be ok, if they were visible ...
checking, I believe some screen layout changed...
Wait a minute, wasn't the link list at the very bottom or am I confusing stuff? Sorry for causing the confusion, but I was sure (unable to check since the save is inaccessible at the moment) that the links were at the bottom and having more than, dunno, five or so would make the last ones disappear. In .40.09 the links start really at the top. Sorry for ( the confusion caused ) OR ( being confused myself )

No, you're right, the layout changed.  In .34, the Done line was always on line 23, and the links started some number of lines from the bottom and worked their way up.  Yes, that means that even the default interface had collisions for certain screen sizes, and stockflow was well positioned up near the main menu.

Now in .40, the Done line is always near the bottom, and the links start just below the main menu and work their way down, paging before they would hit the Done line.  Nicer overall, but subtle enough that you don't notice the difference unless something else is being drawn on top.
Title: Re: DFHack 0.40.08-r2
Post by: kr0pper on August 19, 2014, 02:08:57 pm
A little question about stockpiles and lua.

As I can see in stockflow.lua - stockpile is a bunch of tiles with special flags.
So, if I want to get all items in selected stockpile - I must flow through all "df.global.world.items.all" and compare their position/on_ground with coords of my stockpile' tiles?
There's no easiest way?
Title: Re: DFHack 0.40.08-r2
Post by: Deon on August 19, 2014, 02:12:32 pm
Hi guys, can someone please update me which DFHack scripts were already updated to 0.40.08? Is advfort up to date? It would help my Wanderer mod a lot.
Title: Re: DFHack 0.40.08-r2
Post by: Meph on August 19, 2014, 03:51:19 pm
I'd like to add a second question to that: Does this r2 release only have ReactiobTrigger using registration, or does it have both this new system abd the old AutoSyndrome and SyndromeTrigger together?
Title: Re: DFHack 0.40.08-r2
Post by: Deon on August 19, 2014, 03:53:45 pm
What happened to your 'n' key, Meph? :)
Title: Re: DFHack 0.40.08-r2
Post by: Meph on August 19, 2014, 03:59:32 pm
I am the worlds crappiest typer when I have to use my phone. Large hands vs tiny phone, hands win, phone loses. ;)
Title: Re: DFHack 0.40.08-r2
Post by: Eko on August 19, 2014, 07:56:10 pm
So, I know it has been said so many times that it can't be done, but I just want to keep banging my head against a wall with this.  I really want to explore all options to see what I can do with it.

I want to invalidate buildings when they aren't where I want them. 
This has a very specific purpose for me, I really want to force buildings to be built over water.  I thought with DFHack, that maybe if I grabbed building location, used some stuff from tiletypes to see if there is a water source under the building, and then (if I can find the hex) invalidate/validate the building appropriately. 

I know, a lot to do, and running it on every building placement might slow things down, but I really want to get this, if it is possible. 
Title: Re: DFHack 0.40.08-r2
Post by: palu on August 19, 2014, 08:05:00 pm
Try looking at the outsideonly plugin, see if that helps.
Title: Re: DFHack 0.40.08-r2
Post by: PotatoHaulerBlu on August 19, 2014, 08:36:13 pm
help friends, stonesense overlay command freezes :(
Title: Re: DFHack 0.40.08-r2
Post by: expwnent on August 19, 2014, 09:09:12 pm
I'd like to add a second question to that: Does this r2 release only have ReactiobTrigger using registration, or does it have both this new system abd the old AutoSyndrome and SyndromeTrigger together?

Right now it's only the new system with registration. When I get around to it I'll make a temporary port of the old system.
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 19, 2014, 09:53:01 pm
help friends, stonesense overlay command freezes :(
Yeah, stonesense is really buggy right nw.

Does it freeze on the first or second ime you open it?
Title: Re: DFHack 0.40.08-r2
Post by: PotatoHaulerBlu on August 20, 2014, 12:09:54 am
help friends, stonesense overlay command freezes :(
Yeah, stonesense is really buggy right nw.

Does it freeze on the first or second ime you open it?

stonesense works but not the in-game overlay it just crashes dunno why. also it doesnt work with the newest version of masterwork either for me. so I dunno. but regular stonesense works for both. I guess thats somethin,
Title: Re: DFHack 0.40.08-r2
Post by: gunpowdertea on August 20, 2014, 01:49:47 am
My current pull request (https://github.com/DFHack/dfhack/pull/290) overwrites the last three lines of the list, and sometimes the blank line below them, when all three plugins (stockflow, stocks, and autotrade) are enabled.  At the minimum height of 25 lines, that leaves at least five links visible.  Given a valid objection as the only response, though, I should consider alternatives.
Five links should be ok, if they were visible ...
checking, I believe some screen layout changed...
Wait a minute, wasn't the link list at the very bottom or am I confusing stuff? Sorry for causing the confusion, but I was sure (unable to check since the save is inaccessible at the moment) that the links were at the bottom and having more than, dunno, five or so would make the last ones disappear. In .40.09 the links start really at the top. Sorry for ( the confusion caused ) OR ( being confused myself )

No, you're right, the layout changed.  In .34, the Done line was always on line 23, and the links started some number of lines from the bottom and worked their way up.  Yes, that means that even the default interface had collisions for certain screen sizes, and stockflow was well positioned up near the main menu.

Now in .40, the Done line is always near the bottom, and the links start just below the main menu and work their way down, paging before they would hit the Done line.  Nicer overall, but subtle enough that you don't notice the difference unless something else is being drawn on top.

... which means it is overwritten by dfhack now:
j: no job selected

overwrites the second link

Edit: I don't want to come across like an overly demanding maddwarf, soon to be drowned in MAGMA...
To all developers and testers: Thank you very much, you make the world better (and less productive ;) )
Title: Re: DFHack 0.40.08-r2
Post by: Meph on August 20, 2014, 02:51:56 am
So, I know it has been said so many times that it can't be done, but I just want to keep banging my head against a wall with this.  I really want to explore all options to see what I can do with it.

I want to invalidate buildings when they aren't where I want them. 
This has a very specific purpose for me, I really want to force buildings to be built over water.  I thought with DFHack, that maybe if I grabbed building location, used some stuff from tiletypes to see if there is a water source under the building, and then (if I can find the hex) invalidate/validate the building appropriately. 

I know, a lot to do, and running it on every building placement might slow things down, but I really want to get this, if it is possible.
I have a script that restricts reactions, they only work if water is under or next to the workshop. You can still build the building where you like, but the reactions wont work. Would that help you?

expwnent: Before you do extra work, I will try with registration and see how it goes. You mentioned a script a while ago that automatically reads out raws and creates the correct syntax? That would be fine, no need for you to port stuff before I at least have tested the new system. If you and Roses say its amazing, who am I to not us it. ;)
Title: Re: DFHack 0.40.08-r2
Post by: Armeleon on August 20, 2014, 03:26:20 am
I tried installing DF Hack on my Windows a while back, never could get it to work. But I want to try again. I don't know how I can mess up simple instructions, but somehow I do. If anyone can help that would be great!

Here's what I've done: 1-Downloaded the File. 2-Extracted into the DF main file level (so the DF 40_08_legacy runnable and most recent Hack runnable are at the same file level). 3-Ran DF like normal.

Nothing happens. DF loads, but there is no Hack. I don't know why. Any suggestions?
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 20, 2014, 03:42:57 am
At any time, did it ask you if you want to overwrite sdl.dll?
Title: Re: DFHack 0.40.08-r2
Post by: Armeleon on August 20, 2014, 03:52:48 am
At any time, did it ask you if you want to overwrite sdl.dll?

Ah, no. I downloaded Legacy. Downloading the SDL version had it work. I must have missed that little bit. Thanks for clearing that up. It works great now.
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 20, 2014, 04:06:17 am
Yeah, legacy won't work at all with it.
Title: Re: DFHack 0.40.08-r2
Post by: breadman on August 20, 2014, 01:20:24 pm
A little question about stockpiles and lua.

As I can see in stockflow.lua - stockpile is a bunch of tiles with special flags.
So, if I want to get all items in selected stockpile - I must flow through all "df.global.world.items.all" and compare their position/on_ground with coords of my stockpile' tiles?
There's no easiest way?

There are more optimized ways than the method stockflow uses, but I haven't found an easier one.  Granted, stockflow is also interested in how many spaces are available for new items; most stockpile applications would be happy with a simple list of stored items.

For example, autotrade.cpp goes through a list of IN_PLAY items and checks each one against a list of stockpiles it cares about.  But that check involves comparing the item's coordinates with the stockpile's extents.  It also omits checking the stockpile settings, where stockflow makes a token attempt to ignore stone at the very least.

It should also be possible to to speed things up even more by checking the items vector of each overlapping 16x16 map block, but that requires some calculations.  It may well be worthwhile to add a function that does so to DFHack, where it can become the obvious way to check stockpile contents.  Doing so as an iterator (http://www.cplusplus.com/reference/iterator/iterator/) would be ideal, but requires a bit more C++ hackery than I'm familiar with.

There is an unnamed vmethod in df.buildings.xml, and several in df.items.xml; perhaps one of them might be helpful.  Unfortunately, there are also vmethods that sound related, but aren't: stockpile.getFreeCapacity, stockpile.canStoreItem, item.getStockpile, item.isAssignedToStockpile, item.isAssignedToThisStockpile, item.getStockpile2, and probably others.

No, you're right, the layout changed.  In .34, the Done line was always on line 23, and the links started some number of lines from the bottom and worked their way up.  Yes, that means that even the default interface had collisions for certain screen sizes, and stockflow was well positioned up near the main menu.

Now in .40, the Done line is always near the bottom, and the links start just below the main menu and work their way down, paging before they would hit the Done line.  Nicer overall, but subtle enough that you don't notice the difference unless something else is being drawn on top.

... which means it is overwritten by dfhack now:
j: no job selected

overwrites the second link

Yes, that's exactly what pull request #290 fixes.  I'm hoping to see it in the next DFHack release, which might be a bit due to the new fields in 0.40.09 making alignment tricky again.

Until then, feel free to disable stockflow when you need to see the overwritten link(s).
Title: Re: DFHack 0.40.08-r2
Post by: kr0pper on August 20, 2014, 05:02:47 pm
most stockpile applications would be happy with a simple list of stored items.

I'm a newbie in c++, so lua is my way.
For example, need to create "cut gems" jobs in linked workshop according stored rough gems in stockpile.

There's a some ways I tested:
1. check stockpile's settings and iterate items in df.global.world.items.other.[TYPE]
2. iterate items from highest to lower id
3. cache items, and use an EventManager.onItemCreated for update cache

checking the items vector of each overlapping 16x16 map block, but that requires some calculations

Interesting. Via dfhack.maps.getTileBlock(coords).items ?
And find items via df.item.find(X) ? I'll try it.

There is an unnamed vmethod in df.buildings.xml
How to call a numbered vmethod in lua? All vmethods in *.h are protected.




ADDED:

checking the items vector of each overlapping 16x16 map block, but that requires some calculations


Brilliant!

A little change in hack/lua/plugins/stockflow.lua.
For test, I replaced function findItemsAtTile by this:

Code: [Select]
function findItemsAtTile2(x, y, z)
local found = {}
local items = dfhack.maps.getTileBlock(x, y, z).items
for _, item_id in ipairs(items) do
local item = df.item.find(item_id)
if item.pos.x == x and item.pos.y == y and
item.pos.z == z and item.flags.on_ground then
found[#found+1] = item
end
end
return found
end

and run check_pile(stockpile, true)

Was: 101 sec.
Now:  1 sec.

Much better now 8)
Title: Re: DFHack 0.40.08-r2
Post by: expwnent on August 20, 2014, 06:55:21 pm
expwnent: Before you do extra work, I will try with registration and see how it goes. You mentioned a script a while ago that automatically reads out raws and creates the correct syntax? That would be fine, no need for you to port stuff before I at least have tested the new system. If you and Roses say its amazing, who am I to not us it. ;)

It should be named something obvious in modtools. It might be slightly wrong, but it should be close enough that you can tweak it or just find/replace the things that are wrong so that they're right. Unless I fixed it and forgot about it. I remember having some doubts.
Title: Re: DFHack 0.40.08-r2
Post by: shaver on August 20, 2014, 07:09:27 pm
Curious, though I'm probably not the only person to be curious in this way: have people considered asking Toady for him to give the debug symbols for each build to the dfhack team? If he doesn't object to the work then he wouldn't divulge much. A tool could be written to even strip out everything but the structure definitions (so no function names, f.e.) to restrict it further. (I think so, at least. For Linux and OS X it's definitely possible, windows could be trickier, but the structure defs should be the same or determinable given the information there.)
Title: Re: DFHack 0.40.08-r2
Post by: Satlan_Leng on August 20, 2014, 07:17:52 pm
How long till the update for 40.09? Got my taste of DFhack with 40.08 but dwarfs that wouldn't marry killed the fortress(migrants stopped due to dead civ, king and all dwarfs single in fortress, no babies)
Title: Re: DFHack 0.40.08-r2
Post by: Eko on August 20, 2014, 07:23:45 pm
palu, Meph -

Thanks for your suggestions.  I still think I want to explore a binary patch or something to enable building over water similar to how building over magma is handled right now.  I'll build out the workshops and test using the hermit needs water for now, though.  I really want a way to build over an AIR, EMPTY tile, but it invalidates the building area.  If I can change that, then with the outdoor only script and a small change to test for water, that would work too.

Title: Re: DFHack 0.40.08-r2
Post by: Quietust on August 20, 2014, 07:50:36 pm
There is an unnamed vmethod in df.buildings.xml
How to call a numbered vmethod in lua? All vmethods in *.h are protected.
If vmethods are unnamed, then it means we don't know what they do (and, in some cases, what parameters they take), so attempting to call them could just make DF crash. Experimenting with unnamed vmethods from DFHack is also completely pointless - if you want to figure out what it does and how it's used, you disassemble the entire game (e.g. in IDA Pro) and then analyze the vmethod code directly (and, if possible, track down and identify the places that call it).

Besides, there's no reason why Toady would put a stockpile-specific operation in a virtual method available within the base class - he'd put it as a non-virtual method directly within stockpile itself (which I'm pretty sure is what he's already doing).
Title: Re: DFHack 0.40.08-r2
Post by: expwnent on August 20, 2014, 11:14:40 pm
Meph: Let me know if you have trouble with the conversion script. It's probably a lot easier for me to tweak it than for you to manually do 500 registrations or however many there are.
Title: Re: DFHack 0.40.08-r2
Post by: PotatoHaulerBlu on August 20, 2014, 11:26:03 pm
keep up the good work perhaps work on the overlay problems too because it is fun to have. anyway good work
Title: Re: DFHack 0.40.08-r2
Post by: Euius on August 21, 2014, 01:50:37 am
So I've identified  those annoying (to me, anyways) leaf/fruit circles under trees as spatter structures in block_events, but deleting the structures (with erase()) does nothing, they're still quite visible.

Where else might these be defined?
Title: Re: DFHack 0.40.08-r2
Post by: Meph on August 21, 2014, 03:47:26 am
Meph: Let me know if you have trouble with the conversion script. It's probably a lot easier for me to tweak it than for you to manually do 500 registrations or however many there are.
I am on vacation. ;) Beginning next month with it, I'll let you know.
Title: Re: DFHack 0.40.08-r2
Post by: Rumrusher on August 21, 2014, 11:39:22 am
learn something about armies well the adventurer is a floating array in a pool of it unlike before where it was set to 0. this means the adventurer will swap around in the army list if you keep moving.
kinda means any travel mode script has to search for the adventurer every time the player moves

in good news here have a experimental script that allows you to dive through the 3 layers of the travel menu
Code: [Select]
http://pastebin.com/RCqzsd1Z
so far it does nothing for players since you can't fast travel unless there is a tunnel... and I haven't figure out how to give players access to travel freely... or spawn tunnels or build roads.
Title: Re: DFHack 0.40.08-r2
Post by: Quietust on August 21, 2014, 02:00:45 pm
So I've identified  those annoying (to me, anyways) leaf/fruit circles under trees as spatter structures in block_events, but deleting the structures (with erase()) does nothing, they're still quite visible.

Where else might these be defined?
They aren't defined anywhere else - if you remove them from map_block.block_events[], they should disappear.

The next version of DFHack will have an option to remove them with the "clean map" command.
Title: Re: DFHack 0.40.08-r2
Post by: Shuuya on August 21, 2014, 03:12:20 pm
I'm having problems using stonesense. I installed DFHack 40_08 over DF Starter Pack 40_08 and when I open stonesense, it crashes my game.
Here is the crash thing.
Spoiler (click to show/hide)
EDIT: Just for further clarification, I believe that since it's that specific dll file, it has to do with my graphics card. I have an ATi Mobility Radeon x1400, which is pretty out of date and only supports OpenGL 2.0
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 22, 2014, 12:23:29 am
Stonesense is forced to OpenGL by default, at least in that release.

Try forcing it to DirectX. I have more luck with that.
Title: Re: DFHack 0.40.08-r2
Post by: TheKaspa on August 22, 2014, 02:22:02 pm
Since I just want to use showmood and prospect, is there a way to make it compatible with .09 or do I have to wait for the actual release of dfhack .09?
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 22, 2014, 02:47:17 pm
DFHack for 0.40.08 won't work with 0.40.09 due to a few structure changes, so you'll have to wait or compile it on your own. Also, there's a showmood crash in 0.40.08-r2 that should be fixed in the next version.
Title: Re: DFHack 0.40.08-r2
Post by: TheKaspa on August 22, 2014, 02:51:24 pm
Is there an ETA for the release?
Title: Re: DFHack 0.40.08-r2
Post by: ag on August 22, 2014, 03:22:57 pm
Whenever expwnent will have time?..  ;)
Title: Re: DFHack 0.40.08-r2
Post by: breadman on August 22, 2014, 04:16:51 pm
most stockpile applications would be happy with a simple list of stored items.

I'm a newbie in c++, so lua is my way.

I'm not that hot at C++ myself, though I'm decent with straight C or a number of other languages.  But I might have just enough example code to pull off an iterator that could be called from Lua...

For example, need to create "cut gems" jobs in linked workshop according stored rough gems in stockpile.

Hmm.  This shows a limitation in the design of stockflow.  By duplicating the manager job entry screen, I precluded a generic "cut gems" job.  So the only way to do this with straight stockflow is to have a separate stockpile for each type of gem, which would be insane.

I wonder if it would let me create such an order anyway?

There is an unnamed vmethod in df.buildings.xml
How to call a numbered vmethod in lua? All vmethods in *.h are protected.

This would require modifying and compiling DFHack on your own.  It also risks crashing the game, perhaps corrupting your save, and maybe worse.

A little change in hack/lua/plugins/stockflow.lua.
For test, I replaced function findItemsAtTile by this:

Spoiler: Code (click to show/hide)

and run check_pile(stockpile, true)

Was: 101 sec.
Now:  1 sec.

Wow.  I expected an improvement, but not that much; I must not have been testing on mature enough forts.  I'll have to see if I can slip this in before the next release.

If vmethods are unnamed, then it means we don't know what they do (and, in some cases, what parameters they take), so attempting to call them could just make DF crash. Experimenting with unnamed vmethods from DFHack is also completely pointless - if you want to figure out what it does and how it's used, you disassemble the entire game (e.g. in IDA Pro) and then analyze the vmethod code directly (and, if possible, track down and identify the places that call it).

My disassembly skills are rusty enough that just trying it to see what happens sounds much more fun, and potentially more fruitful.  I never did get around to determining how the "xx% done" bit on the bookkeeper settings page gets calculated.  (I found the viewscreen variable that caches it, but nothing else holds the same value consistently.)

And I'm not opposed to a few crashes.  Even if something goes wrong with the save, I can always git reset.

Besides, there's no reason why Toady would put a stockpile-specific operation in a virtual method available within the base class - he'd put it as a non-virtual method directly within stockpile itself (which I'm pretty sure is what he's already doing).

Oh.  So there's no way we can call such a method once the symbols have been stripped?
Title: Re: DFHack 0.40.08-r2
Post by: Quietust on August 22, 2014, 07:38:00 pm
My disassembly skills are rusty enough that just trying it to see what happens sounds much more fun, and potentially more fruitful.  I never did get around to determining how the "xx% done" bit on the bookkeeper settings page gets calculated.  (I found the viewscreen variable that caches it, but nothing else holds the same value consistently.)

And I'm not opposed to a few crashes.  Even if something goes wrong with the save, I can always git reset.
In all likelihood, random probing of vmethods will be totally fruitless, since even if they don't crash, they may appear to do nothing at all while instead having some obscure side effect on the game which will ruin any further testing efforts unless you test each one in complete isolation and monitor the entire game's memory for changes, by which point you'd be better off just disassembling it and seeing exactly what it does.

And God help you if the vmethod you're tinkering with takes a pointer as a parameter, because you're never going to figure out what type it is through experimentation. As an example, out of all the known Building vmethods, these are the types of pointers that can be provided as parameters:
* Hospital supply data
* Machine power information
* Machine connection data
* Unit
* Item
* File compressor
* Map viewport
* Map draw buffer
* STL String
* STL Vector of Squad Use information

If you get into Items, you'll get to deal with pointers to Flagarrays, Item Filter specifications, Jobs, Historical Figures, Civilizations, Sites, Wounds, Caravan states, and Squad uniforms. Good luck figuring out which is which without looking at a disassembly.

Oh.  So there's no way we can call such a method once the symbols have been stripped?

Non-virtual class methods are infeasible to call on Windows due to whole program optimization (http://msdn.microsoft.com/en-us/library/0zza0de8.aspx), which stuffs function parameters (including "this") into random registers rather than putting them on the stack (and ECX), making it impossible to just call them as if they were function pointers (as we can for virtual class methods). There's also the issue that the compiler is allowed to inline non-virtual class methods, so if it's only used in one place (e.g. inside a loop), the compiler may decide to dump it in there exclusively and leave you with nothing to call (unless you want to do everything else the outer function was trying to do).

You really need to understand that the work done with DFHack is not just smashing things together randomly until they stick - it's more like carefully cutting the game apart and examining the pieces under a microscope, something best left to people who are experienced in doing such things (or are willing to learn a lot to figure out how to do it themselves).
Title: Re: DFHack 0.40.08-r2
Post by: mifki on August 23, 2014, 04:40:47 am
Non-virtual class methods are infeasible to call on Windows due to whole program optimization (http://msdn.microsoft.com/en-us/library/0zza0de8.aspx), which stuffs function parameters (including "this") into random registers rather than putting them on the stack (and ECX), making it impossible to just call them as if they were function pointers (as we can for virtual class methods).

Oh that's why I was finding parameters in completely "wrong" places on Windows... Of course we can call such functions anyway, but that doesn't matter since it's much harder (or impossible if they've been inlined) to find them compared to vmethods.
Title: Re: DFHack 0.40.08-r2
Post by: Roses on August 24, 2014, 08:05:41 am
Couple questions:

1. This one may be a silly one, but does addReactionToShop(reaction_name,shop_name) work the way I think it does? Meaning can you add a reaction to a workshop mid-game? And will those reactions stay post-save-quit-reload?
2. Is there a script to allow only one of a particular building to be built? If not I can write one, but I figured I would ask first.
3. Is there an eventful command for triggering every season?
Title: Re: DFHack 0.40.08-r2
Post by: expwnent on August 24, 2014, 08:34:48 am
Couple questions:

1. This one may be a silly one, but does addReactionToShop(reaction_name,shop_name) work the way I think it does? Meaning can you add a reaction to a workshop mid-game? And will those reactions stay post-save-quit-reload?
2. Is there a script to allow only one of a particular building to be built? If not I can write one, but I figured I would ask first.
3. Is there an eventful command for triggering every season?

There is no such script for one of a kind buildings.

There is no eventful command, but there is the repeat-util.lua module.
Title: Re: DFHack 0.40.08-r2
Post by: IndigoFenix on August 24, 2014, 10:07:34 am
Well, I'm glad that most of the new structures are added on instead of removed outright.  Most of the old scripts should still work.

That being said, has anyone been playing with trees?  I've worked out how to change the tiles of a tree provided they are already part of that tree, but how does the game determine the tree's current shape?  It doesn't seem to be all tree tiles within a cube, since adding new tree tiles within a tree's cube just creates a species-less 'tree' tile.  Stranger still, trees don't seem to have ID numbers.  How does the game determine which tiles belong to which tree if the tree has no ID?

There's a list of trees in the first map_block_column of the embark square, each of which has a list of all the branches in the tree, and their sizes. You have to modify that if you want to add new tiles to the tree. Keep in mind that the bounding box of the tree is kinda fixed after the tree is made, so you can't easily make ygdrassil, as far as I know.

I've been experimenting with this, but still no luck.

While df.global.world.map.map_block_columns[c].plants does indeed contain a list of plants in that map column, their data seems to be identical to those found under df.global.world.plants.

In both cases, most of the variables are very basic and seem to be carryovers from the last version, so I'd expect everything tree-related to be in the new variable, tree_info.

Tree_info contains a handful of integers, mainly related to the tree's boundaries.  The body and roots variables could be expected to hold the tiles...but that's where I'm stuck.  There is just one variable per tree (value), which contains a handful of promising-looking variables (trunk, thick_branches, twigs)... but these are booleans, rather than the array of tiles I would expect.  Changing them doesn't seem to do anything.

So where is the list of branches you speak of?
Title: Re: DFHack 0.40.08-r2
Post by: lukesleftleg on August 24, 2014, 11:09:05 am
Hi all, and thanks once again for all your hard work on DFHack.

Just a quick question....

I realise it makes me a bad person, but I can't help it, children really annoy me, and dwarf children are no better.

I've been experimenting with editing the Rejuvenate script (disabling the under 20 y/o check in my version), and I've discovered that just making a kid twenty just gives you a twenty year old kid, but if I make them eleven, and wait for their next birthday, then they seem to mature into an adult properly.

Now I undertsand how the script works. It simply changes the unit's birth year to twenty years before the current one, which is gets with df.global.cur_year, and that's all well and good, but what I'd really like to do is to make it so that their birthday is tomorrow, so I don't have to wait too long before putting them to work and can still face looking myself in the mirror.

So my first question is, do functions such as df.global.cur_month or df.global.cur_day exist? (I've a feeling there's one for season, but not sure).

And actually, my second question is this: is there a list of DF structures anywhere, something like an API, so that I don't have to hassle you guys every time I have an idea for a script?
For instance, what other toys might there be to play with under df.global, or other similar structures?

Thanks very much in advance, and thanks again for all your work in making the masterpiece that is Dwarf Fortress actually playable. :)
Title: Re: DFHack 0.40.08-r2
Post by: IndigoFenix on August 24, 2014, 11:14:07 am
Now I undertsand how the script works. It simply changes the unit's birth year to twenty years before the current one, which is gets with df.global.cur_year, and that's all well and good, but what I'd really like to do is to make it so that their birthday is tomorrow, so I don't have to wait too long before putting them to work and can still face looking myself in the mirror.

A simpler method: just change their profession.  BABY and CHILD are simply professions that automatically change into DEFAULT (adult peasant) when the creature reaches their adult age.  You can do this at any age.
Title: Re: DFHack 0.40.08-r2
Post by: lukesleftleg on August 24, 2014, 11:24:18 am
Hi IndigoFenix, and thanks for the prompt reply.

A simpler method: just change their profession.  BABY and CHILD are simply professions that automatically change into DEFAULT (adult peasant) when the creature reaches their adult age.  You can do this at any age.

Oh that sounds like it might work. How would I go about doing this though, I'm not sure I've ever tried to assign 'Peasant' to a dorf?
Do I do it through DF itself, or maybe Therapist, or is there a DFHack command to do it?

Also, any intelligence on some sort of API refernce for all this stuff, or maybe a command to dump the names of all the stuctures, something like that?

Thanks again, and thanks again in advance. :)
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 24, 2014, 11:31:01 am
In Lua: unit.profession = df.profession.STANDARD
(Edit: Fixed)
Title: Re: DFHack 0.40.08-r2
Post by: Quietust on August 24, 2014, 11:36:49 am
In Lua: unit.profession = df.profession.NONE
Setting profession to NONE (-1) is bound to cause all sorts of problems - if you want to reset it to its default state, you want STANDARD (i.e. Peasant).
Title: Re: DFHack 0.40.08-r2
Post by: lukesleftleg on August 24, 2014, 11:37:29 am
In Lua: unit.profession = df.profession.NONE

Yep, that's done it. Thanks lethosor. :)

Edit:

Oh, STANDARD. Ok.
Now that's looking like a fine young teenager, ready to get into all sorts of adolescent hijinks.
Thanks Quietust. :)
Title: Re: DFHack 0.40.08-r2
Post by: Philii on August 24, 2014, 03:52:47 pm
Now, df 0.40.10 released  :o
I am waiting dfhack since 0.40.09. :( :-X
Title: Re: DFHack 0.40.08-r2
Post by: notfood on August 24, 2014, 05:01:08 pm
Quietust fork have been working under 0.40.09 Linux for a while now. At least the basic commands. I've been using it without many issues.
Title: Re: DFHack 0.40.08-r2
Post by: Agdune on August 24, 2014, 06:53:01 pm
Quote
I am waiting dfhack since 0.40.09.

Heh, same. Important lesson has been learned; just because there’s a new version of DF doesn’t mean you should upgrade straight away!

I only started using DF hack when, what… 40.06 was out? Only a couple of weeks anyway. Became a must-have tool the moment I learned how to use the autobutcher script. Now my new 40.09 fortress is being overrun with livestock and I’m beginning to wish I’d stuck with programming after highschool instead of doing psychology. At least then I could contribute something meaningful to the development rather than just wait around expecting someone else to do all the work.

I... can write a 'hello world' Javascript page if that'll help anyone out? I kinda remember that from computer science class!

...

...okay, well, fine, I can write 'hello world' in HTML, loudly talk about how smart I am for accomplishing the same thing with less effort, then spend an hour looking at pictures of Eva Habermann during the topless phase of her career. Close enough.
Title: Re: DFHack 0.40.08-r2
Post by: BigD145 on August 24, 2014, 07:07:36 pm
Important lesson has been learned; just because there’s a new version of DF doesn’t mean you should upgrade straight away!

Except when you have game crashing bugs that have been fixed.
Title: Re: DFHack 0.40.08-r2
Post by: Agdune on August 24, 2014, 07:22:29 pm
Guess I’ve been lucky so far. I haven’t had a single crash since the first 2014 release; biggest problem I’ve hit was dwarves not re-calculating paths and the hanging bird wildlife. Everything else just kinda worked itself out without any real issue, or was so minor I could ignore it, like my machinegunning marksmen, who were kinda cute.

(I upgraded halfway through a training cycle; the little guys went from laboriously loading/firing their crossbows to uncontrollable streams of bone bolts. I imagined their crossbows had actually been awesome mechanical crossbows the whole time and someone had just accidently switched them all from ‘single shot’ to ‘full auto’ without telling anyone. There were suddenly erratic cones of bolts flying all over the training rooms, dwarves running around frantically trying to find more ammunition… naaw. Irresponsible little guys.)
Title: Re: DFHack 0.40.08-r2
Post by: StagnantSoul on August 25, 2014, 12:01:47 am
Ugh... I'm trying to learn how to run DFHack... All I really know is reveal and prospect. Can someone give me a step by step instruction on how to drop a masterwork steel longsword inside my wagon? I got a dwarf to make a steel long sword, so I'd like to only hack in (at least in that world) what already exists. Thanks!
Title: Re: DFHack 0.40.08-r2
Post by: robertheinrich on August 25, 2014, 01:22:02 am
Ugh... I'm trying to learn how to run DFHack... All I really know is reveal and prospect.

There is a documentation inside the dfhack folder (DF/dfhack/readme.html) which should be a good start for that. It's a long file, but at the top you can find a list of most plugins/commands, and look up those with interesting names :)

Quote
Can someone give me a step by step instruction on how to drop a masterwork steel longsword inside my wagon? I got a dwarf to make a steel long sword, so I'd like to only hack in (at least in that world) what already exists. Thanks!
If you already have a steel longsword crafted, you can use dfhack to change its quality to 'masterpiece':
Select the item in the DF interface, for example with the 'k' cursor. Then type into the dfhack console:
Code: [Select]
changeitem q 5
If you want to create the resources necessary for crafting, you can use the createitem command:
For example, to create 5 steel bars at the feet of a selected unit:
Select one of your dwarfs in the DF interface, for example with the 'k' or 'v' cursor. Then type into the dfhack console:
Code: [Select]
createitem BAR STEEL 5
For more info on createitem, check the readme.html and the wiki (for item and material tokens etc):
http://dwarffortresswiki.org/index.php/Utility:DFHack/createitem
http://dwarffortresswiki.org/index.php/DF2014:Item_token
http://dwarffortresswiki.org/index.php/DF2014:Material_token
Title: Re: DFHack 0.40.08-r2
Post by: StagnantSoul on August 25, 2014, 02:01:40 am
Thanks a lot! I had the create item thing totally wrong, I thought it went
CREATEITEM:Sword_LONG:STEEL
Title: Re: DFHack 0.40.08-r2
Post by: robertheinrich on August 25, 2014, 02:15:42 am
Thanks a lot! I had the create item thing totally wrong, I thought it went
CREATEITEM:Sword_LONG:STEEL

If you want to directly create a long sword, the command would look like this:
Code: [Select]
createitem WEAPON:ITEM_WEAPON_SWORD_LONG STEEL
The colon ':' is for seperating type/subtype/ID in cases where the type isn't precise enough... like here, type weapon, ID long sword. Without looking through examples and RAWs it can be a bit tricky to find the correct tokens. Looking at existing items with the command 'changeitem info' can be helpful; for example if you want to clone some of your stocks.
Title: Re: DFHack 0.40.08-r2
Post by: Simca on August 25, 2014, 10:21:35 am
A few bugs I noticed in Quietust's develop branch for DF 40.09: 'probe' crashes the game, and 'digv' seems to think you're looking at a different zlevel than you actually are (making it very difficult to use, since I had to be looking 28 zlevels below the vein I wanted to dig out, hehe).

Might not even be bugs - could be a result of this save game not being made with DFHack enabled or something.

Also, it's still much better than remaining on 40.08.
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 25, 2014, 10:31:52 am
I'm not experiencing those problems on 0.40.09 or 0.40.10. What commits (dfhack and df-structures) are you building from?
Title: Re: DFHack 0.40.08-r2
Post by: jwhite.df on August 25, 2014, 11:07:27 am
Also, it's still much better than remaining on 40.08.

Oh? Why?
Title: Re: DFHack 0.40.08-r2
Post by: int_ua on August 25, 2014, 11:18:18 am
Also, it's still much better than remaining on 40.08.

Oh? Why?
Because there is a newer version, obviously.
Title: Re: DFHack 0.40.08-r2
Post by: Philii on August 25, 2014, 02:39:11 pm
Is there dfhack for 0.40.10 windows?.???
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 25, 2014, 03:10:04 pm
There isn't an official release of DFHack for 0.40.09 or 0.40.10 yet.
Title: Re: DFHack 0.40.08-r2
Post by: Philii on August 25, 2014, 03:54:23 pm
There isn't an official release of DFHack for 0.40.09 or 0.40.10 yet.
any unofficial for 0.40.10?
Title: Re: DFHack 0.40.08-r2
Post by: Simca on August 25, 2014, 05:05:51 pm
I'm not experiencing those problems on 0.40.09 or 0.40.10. What commits (dfhack and df-structures) are you building from?
dfhack: https://github.com/quietust/dfhack/tree/eb221e1165ab4bdaebd6da3fccc47d90fdd8aa1d
I used git submodule init/git submodule update to get the df-structures stuff.

Could be a bug with how I built it - I was using Visual Studio 2013, and I had to add includes for <algorithm> and <functional> to different spots and remove a few "using namespace std"s (because dfhack uses a bunch of variables named "count" which conflicted with <algorithm>'s std::count).
Also, it's still much better than remaining on 40.08.

Oh? Why?
Because of this change "Made people not so eager to jump in on the side of their relatives and friends if the relative/friend is berserk/etc."
Lost two rather progressed fortresses to tantrum spirals because of that in 40.08. Maybe it's my fortress design: all my dwarves tend to stick together in large public areas, so they see a friend going berserk and suddenly the entire fortress is fighting, death is everywhere, and everyone is mad as hell because all their friends died.
Title: Re: DFHack 0.40.08-r2
Post by: StagnantSoul on August 25, 2014, 05:28:39 pm
Quote
Could be a bug with how I built it - I was using Visual Studio 2013, and I had to add includes for
Lost two rather progressed fortresses to tantrum spirals because of that in 40.08. Maybe it's my fortress design: all my dwarves tend to stick together in large public areas, so they see a friend going berserk and suddenly the entire fortress is fighting, death is everywhere, and everyone is mad as hell because all their friends died.
I hate tantrum spirals... One dwarf couldn't find a shell for a strange mood, so he freaks out and starts punching a nearby dwarf. Then their friends hopped in. Then the guys hauling equipment by hopped in. Then I sent my military to "handle it" by stationing ten marksdwarves nearby. Then a forgotten beast showed up. Then a thief gets in and steals an artifact adamantine short sword. Then the beast burns down the bedrooms. Then my military goes by the fight from the tantrum. They get involved. I start hitting my head off the table. And every last one of my dwarves get assigned to squads, given spears, and rushed at the beast. But they stop to join the tantrum. A little over one hundred armed dwarves fighting in one large room, a third of them dead already, so I just gave up and let everyone kill each other. Turns out I had a werebeast in the mix. That was a twelve game year old fortress.
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 25, 2014, 05:45:13 pm
I'm not experiencing those problems on 0.40.09 or 0.40.10. What commits (dfhack and df-structures) are you building from?
dfhack: https://github.com/quietust/dfhack/tree/eb221e1165ab4bdaebd6da3fccc47d90fdd8aa1d
I used git submodule init/git submodule update to get the df-structures stuff.

Could be a bug with how I built it - I was using Visual Studio 2013, and I had to add includes for <algorithm> and <functional> to different spots and remove a few "using namespace std"s (because dfhack uses a bunch of variables named "count" which conflicted with <algorithm>'s std::count).
Yeah, you'll need Visual Studio 2010 on Windows - that's what DF uses, and using a different compiler version on Windows tends to cause difficult-to-diagnose crashes.
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 25, 2014, 10:21:11 pm
Um, no, they're pretty easy to diagnose.
DFHack simply 100% guaranteed doesn't work with anything but vs2010.
Thankfully, if you have both installed, you can use the newer ide with the older compiler.
Title: Re: DFHack 0.40.08-r2
Post by: Roses on August 25, 2014, 11:02:58 pm
Is there a way to trigger a script to only run once on initial world load instead of on every load?
Title: Re: DFHack 0.40.08-r2
Post by: expwnent on August 25, 2014, 11:36:52 pm
You could store a persistent thing in the save and only trigger if it doesn't exist yet.
Title: Re: DFHack 0.40.08-r2
Post by: Euius on August 25, 2014, 11:37:27 pm
Is there a way to trigger a script to only run once on initial world load instead of on every load?

In lua

Spoiler (click to show/hide)

'value' could be any true value, it's not actually even saving the boolean 'true', but rather an empty string.  Which is a true value.
Title: Re: DFHack 0.40.08-r2
Post by: StagnantSoul on August 26, 2014, 03:23:36 am
I can't seem to get DFHack to make me dragon bones. I'm trying to test out a reaction, but I don't have the needed dragon bones. I followed the steps from the wiki, create-items BONE CREATURE_MAT:DRAGON:BONE 10, but it'd just come up with another of the incredibly unhelpful how-to's of DFHack. Can I make dragon bones, or are they one of the items you can't make?
Title: Re: DFHack 0.40.08-r2
Post by: robertheinrich on August 26, 2014, 03:50:47 am
I can't seem to get DFHack to make me dragon bones. I'm trying to test out a reaction, but I don't have the needed dragon bones. I followed the steps from the wiki, create-items BONE CREATURE_MAT:DRAGON:BONE 10, but it'd just come up with another of the incredibly unhelpful how-to's of DFHack. Can I make dragon bones, or are they one of the items you can't make?

I might be wrong (so feel free to correct me), but as I understand it, you can't create body parts with createitem. Meaning, you could create finished (crafted) items made out of dragon bone, but not the 'raw' bones themselves.
Title: Re: DFHack 0.40.08-r2
Post by: StagnantSoul on August 26, 2014, 03:52:18 am
Dammit... Guess I'll have to get the bones the old fashion way... Can I turn a creature into a different one? Maybe I could make a flying bird turn into a dragon and fall to it's death.
Title: Re: DFHack 0.40.08-r2
Post by: robertheinrich on August 26, 2014, 05:48:14 am
Can I turn a creature into a different one?

Creatures/units in Dwarf Fortress consist of pretty complex data structures, for example their individual bodyplan based on race/caste definitions and whatnot else. Converting into another race will be quite complicated, if not outright impossible.
Title: Re: DFHack 0.40.08-r2
Post by: Dirst on August 26, 2014, 08:59:14 am
Can I turn a creature into a different one?

Creatures/units in Dwarf Fortress consist of pretty complex data structures, for example their individual bodyplan based on race/caste definitions and whatnot else. Converting into another race will be quite complicated, if not outright impossible.
There is a way to do it with syndrome that has a CE_BODY_TRANSFORMATION tag in it.

Tip: nerf the dragon creature raws (e.g., comment out the firebreath attack) before you start poofing keas into dragons.
Title: Re: DFHack 0.40.08-r2
Post by: YAHG on August 26, 2014, 09:57:14 am
Spoiler (click to show/hide)
Something like this should do ya for testing if df hack isn't being friendly:
Spoiler (click to show/hide)

edit: don't use that no good  :-[ :P  :-X
Title: Re: DFHack 0.40.08-r2
Post by: Quietust on August 26, 2014, 10:45:19 am
Something like this should do ya for testing if df hack isn't being friendly:
Spoiler (click to show/hide)
Next time, try actually testing your sample reaction, since that reaction will not work in any version of Dwarf Fortress - in fact, attempting it in version 0.40.09 caused the game to CRASH.

Some useful excerpts from errorlog.txt:

> DRAGON_BONE_FOR_TESTING:Unrecognized Item Token: BONE
Bones have not been a distinct item type since version 0.28.181.40d, and it was BONES, not BONE. Since 0.31.01, bones use the item type CORPSEPIECE, and it is impossible for a custom reaction to produce a valid corpsepiece item.

> DRAGON_BONE_FOR_TESTING:Unrecognized Material Token: DRAGON
DRAGON:BONE is not a valid material - if you want a creature material, you have to specify CREATURE_MAT first.
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 26, 2014, 11:44:24 am
I can't seem to get DFHack to make me dragon bones. I'm trying to test out a reaction, but I don't have the needed dragon bones. I followed the steps from the wiki, create-items BONE CREATURE_MAT:DRAGON:BONE 10, but it'd just come up with another of the incredibly unhelpful how-to's of DFHack. Can I make dragon bones, or are they one of the items you can't make?
You want createitem - create-items is an entirely different script that only supports bars, boulders, plants, logs, webs, and anvils (from its documentation).
Also, I believe the first argument should be CORPSEPIECE (see http://dwarffortresswiki.org/index.php/DF2014:Item_token ); however, CORPSEPIECE items aren't possible to create (in addition to CORPSE and FOOD items). I've added a note about this to the wiki.
Title: Re: DFHack 0.40.08-r2
Post by: Putnam on August 26, 2014, 03:34:46 pm
Can I turn a creature into a different one?

Creatures/units in Dwarf Fortress consist of pretty complex data structures, for example their individual bodyplan based on race/caste definitions and whatnot else. Converting into another race will be quite complicated, if not outright impossible.

Code: [Select]
unit.enemy.normal_race=0
unit.enemy.normal_caste=0
unit.enemy.were_race=0
unit.enemy.were_caste=0

This will transform the unit into a female toad without much associated weirdness except for the whole "vermin acting like a creature" thing that is to be expected even when doing it through DF normally.

I believe my shapechange script might be included in the latest versions of DFHack as well, which allows you to transform a unit into any creature arbitrarily without much fuss.
Title: Re: DFHack 0.40.08-r2
Post by: StagnantSoul on August 26, 2014, 03:57:59 pm
Agh... Always some problem... I guess I could switch the dragon bone to cat bones, just to see if it works. Oddly, no catsplosians since 0.40.05 for me.
Title: Re: DFHack 0.40.08-r2
Post by: jwhite.df on August 26, 2014, 05:27:06 pm
Copy the raws from dragon bones over to cats?
Title: Re: DFHack 0.40.08-r2
Post by: Dirst on August 26, 2014, 07:35:29 pm
Copy the raws from dragon bones over to cats?
The game isn't smart enough to tell if two different items are indistinguishable, it would treat CREATURE_MAT:CAT:BONE and CREATURE_MAT:DRAGON:BONE as completely different.  I suppose you try throwing a reaction class onto the material and dispense with the item ID.
Title: Re: DFHack 0.40.08-r2
Post by: StagnantSoul on August 26, 2014, 07:48:57 pm
Oh, just for the test. To see if the reaction works. I'd definitely put it back to dragon bones after testing the reaction with cat bones.
Title: Re: DFHack 0.40.08-r2
Post by: jwhite.df on August 26, 2014, 10:28:42 pm
Copy the raws from dragon bones over to cats?
The game isn't smart enough to tell if two different items are indistinguishable, it would treat CREATURE_MAT:CAT:BONE and CREATURE_MAT:DRAGON:BONE as completely different.  I suppose you try throwing a reaction class onto the material and dispense with the item ID.

Just looked at the raws. Bones aren't defined the way I thought.
Title: Re: DFHack 0.40.08-r2
Post by: PeridexisErrant on August 26, 2014, 10:42:03 pm
Is there an ETA or release plan for 40.10?
Title: Re: DFHack 0.40.08-r2
Post by: notfood on August 26, 2014, 10:50:49 pm
Asking for ETAs never works.

On the bright side, 40.10 already works... somewhat, just check github forks and compile.
Title: Re: DFHack 0.40.08-r2
Post by: kebab4you on August 27, 2014, 04:56:57 am
Asking for ETAs never works.

On the bright side, 40.10 already works... somewhat, just check github forks and compile.

There's what? 7 different branches? None which have been extremely active from what I can tell(Most recent activity on any of the branches was 11 days ago).
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 27, 2014, 05:05:56 am
The activity that updates DFHack to the new version isn't actually on the DFHack repo, it's on the df-structures repo
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 27, 2014, 06:33:20 am
In addition, https://github.com/quietust/dfhack/tree/develop contains the change(s) needed to compile DFHack with 0.40.09-10 at the moment.
Title: Re: DFHack 0.40.08-r2
Post by: salithus on August 27, 2014, 08:52:58 am
I think PE's looking for something stable to include in the Starter Pack, not a "user beware" version.
Title: Re: DFHack 0.40.08-r2
Post by: Xerberus on August 27, 2014, 09:50:57 am
I think PE's looking for something stable to include in the Starter Pack, not a "user beware" version.

think so too, having at least some basics in like search functions and mouse-control would be nice.
Title: Re: DFHack 0.40.08-r2
Post by: Dervish on August 27, 2014, 11:06:08 am
I had an idea for a plugin I wanted to share. Something like an auto-mandate, or mandate-manager, that would check if nobles had active construction mandates, and if they did, set up a manager job que for it. Maybe be able to specify materials for jobs with multiple possible. I know workflow does something similar, with item counts, but I'm not sure if mandates are something you can tie into.

I'm also having an issue (http://pastebin.com/z9zBVcVJ) compiling dfhack. Not sure if I installed the wrong visual studio 2010 express pack or what. I installed the sp1 pack, ruby and it's librarys as well, and am compiling off quietus' branch. google seems to say afxwin.h is only in the retail versions of VS.
Title: Re: DFHack 0.40.08-r2
Post by: khearn on August 27, 2014, 12:03:56 pm
In addition, https://github.com/quietust/dfhack/tree/develop contains the change(s) needed to compile DFHack with 0.40.09-10 at the moment.

I just tried building from Quietust's branch (git clone https://github.com/quietust/dfhack.git), and it compiles fine, but when I run dfhack (using df 40.10) I don't get a dfhack console prompt, and when I exit and look at stderr.log, I see that it reports a bunch of dummy symbol entries, then:

Loaded 6 DF symbol tables.
Unable to retrieve version information.
File: /proc/self/exe
MD5: 0b7185da37ac3a729f0972c9aff512ca
working dir: /home/khearn/Desktop/df_linux_40.10
length:17994664
1KB hexdump follows:
<dump snipped>
Not a known DF version.
DFHack will now deactivate.


I've untarred a fresh copy of 40.10 and done the dfhack make install, just to make sure I didn't have any remnants from earlier builds around. Any idea what's going on?

Edit: I guess it would help to mention that this is on Unbuntu Linux 14.04.
Title: Re: DFHack 0.40.08-r2
Post by: fricy on August 27, 2014, 12:26:04 pm
I just tried building from Quietust's branch (git clone https://github.com/quietust/dfhack.git), and it compiles fine, but when I run dfhack (using df 40.10) I don't get a dfhack console prompt, and when I exit and look at stderr.log, I see that it reports a bunch of dummy symbol entries, then:
Code: [Select]
Loaded 6 DF symbol tables.
Unable to retrieve version information.
MD5: 0b7185da37ac3a729f0972c9aff512ca
Not a known DF version.
Did you update the xml submodules? Check the symbols.xml in df/hack to see if it contains the 40.10 structures for linux.

Code: [Select]
git clone git://github.com/quietust/dfhack.git
cd dfhack
git submodule init
git submodule update

EDIT: I looked at quietust's repo, make sure you clone develop, not master.
Title: Re: DFHack 0.40.08-r2
Post by: khearn on August 27, 2014, 01:00:29 pm
Yeah, I did the submodule init and update.  Here are the commands I ran:

Spoiler (click to show/hide)

Then I go to my df_linux_40.10 directory and there is a shiny new dfhack script. I then remove libs/libstdc++.so.6 and run dfhack.

Looking in hack/symbols.xml, there isn't anything newer than 40.08. The same in my source tree in library/xml/symbols.xml. So I'm evidently not getting the right stuff from github. I was using the "HTTPS clone URL" from https://github.com/quietust/dfhack/tree/develop so I'd expect that would get me the develop, not the master.

This is why it's not really sufficient to say "just check github forks and compile." I'm a software engineer with about 25 years of experience, most of that doing build/release engineering, so I'm fairly experienced at  building stuff from source. And even I'm having trouble with it.  It took me a couple of hours to figure out which 32-bit libs I needed and get them all installed so it would build, plus figuring out that cmake was consistently finding the wrong zlib and figuring out how to override that. Heaven help someone with no experience building stuff.

Hmmm, looking on github, I see that library/xml was updated 3 hours ago. I guess I'll try a fresh clone and see if it works any better. The last clone I did was probably shortly before that.

   Keith

Edit: Ok, I just discovered that I get the same HTTPS clone URL whether I'm on https://github.com/quietust/dfhack/tree/develop or https://github.com/quietust/dfhack/tree/master. So how do I tell git to grab the develop branch, not the master?
Title: Re: DFHack 0.40.08-r2
Post by: salithus on August 27, 2014, 01:11:17 pm
This is why it's not really sufficient to say "just check github forks and compile." I'm a software engineer with about 25 years of experience, most of that doing build/release engineering, so I'm fairly experienced at  building stuff from source. And even I'm having trouble with it.  It took me a couple of hours to figure out which 32-bit libs I needed and get them all installed so it would build, plus figuring out that cmake was consistently finding the wrong zlib and figuring out how to override that. Heaven help someone with no experience building stuff.

Agreed (just shy of 10 years exp here ;)). If it's stable enough to "just check github forks and compile", why doesn't someone who's successfully done that publish a stable release so there's no guess work?
Title: Re: DFHack 0.40.08-r2
Post by: fricy on August 27, 2014, 01:30:01 pm
Edit: Ok, I just discovered that I get the same HTTPS clone URL whether I'm on https://github.com/quietust/dfhack/tree/develop or https://github.com/quietust/dfhack/tree/master. So how do I tell git to grab the develop branch, not the master?

Code: [Select]
git fetch origin
git checkout develop
or
Code: [Select]
git clone git://github.com/quietust/dfhack.git -b develop
Agreed (just shy of 10 years exp here ;)). If it's stable enough to "just check github forks and compile", why doesn't someone who's successfully done that publish a stable release so there's no guess work?
Cough, zero years of experience here, cough. And I do publish, just get a mac. :D
Title: Re: DFHack 0.40.08-r2
Post by: khearn on August 27, 2014, 01:36:29 pm
Edit: Ok, I just discovered that I get the same HTTPS clone URL whether I'm on https://github.com/quietust/dfhack/tree/develop or https://github.com/quietust/dfhack/tree/master. So how do I tell git to grab the develop branch, not the master?

git checkout develop
or
git clone git://github.com/quietust/dfhack.git -b develop


Thanks, I just found the same answer on stackoverflow, after searching on github's help section for half an hour in vain. I'm trying a new build, but this one does have 40.10 in library/xml/symbols.xml, so hopefully it'll work better.

   Keith


Edit: Yup, that fixed it. I now have a dfhack prompt and got the warning message about not having a dfhack.init file, so it's at least working at a basic level. I'll make a post in a little while with the steps I had to take to get it to build, so others don't have to repeat my pain.
Title: Re: DFHack 0.40.08-r2
Post by: Nopenope on August 27, 2014, 03:10:32 pm
Yes it seems that with his latest commit Quietust's develop branch builds and hooks with no needed additional changes.

Also lethosor, am I missing something or are your own scripts (load-screen settings-manager etc.) missing from the main repo? They're pretty nifty though.
Title: Re: DFHack 0.40.08-r2
Post by: salithus on August 27, 2014, 03:13:03 pm
Cough, zero years of experience here, cough. And I do publish, just get a mac. :D
OP's current Mac release still points to 08.r2 :-P

Really the thing that bothers me most is the fact that the place Keith is having to pull from isn't what's linked in the OP, which is what makes this whole github approach obnoxious to my centralized svn brain.
Title: Re: DFHack 0.40.08-r2
Post by: Nopenope on August 27, 2014, 03:27:07 pm
The OP only contains official releases and there's hasn't been one for .10 yet, even though you can still easily build your own once you're set up. But yeah, trying to find the one commit from the one tree from the one repo that will build, hook and run is a little bit like playing hide-and-seek. That's part of a decentralized project I guess, it has ups and downs.
Title: Re: DFHack 0.40.08-r2
Post by: PeridexisErrant on August 27, 2014, 04:58:45 pm
I think PE's looking for something stable to include in the Starter Pack, not a "user beware" version.

Yeah. If I wanted a version for myself, that would probably work, but I'd expect to be dealing with errors caused by my inexperience / incompetence for a while. For the people who use the starter packs, that's not really good enough.
Title: Re: DFHack 0.40.08-r2
Post by: Meph on August 27, 2014, 05:01:50 pm
I think PE's looking for something stable to include in the Starter Pack, not a "user beware" version.

Yeah. If I wanted a version for myself, that would probably work, but I'd expect to be dealing with errors caused by my inexperience / incompetence for a while. For the people who use the starter packs, that's not really good enough.
Same thing for MDF. But I will start doing the Raws in the meantime. :)
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 27, 2014, 05:10:06 pm
The changes in Quietust's develop branch have been merged into DFHack:develop, so this should work now (assuming 'origin' points to DFHack/dfhack and develop tracks origin/develop):
Code: [Select]
git checkout develop && git pull


Edit: Ok, I just discovered that I get the same HTTPS clone URL whether I'm on https://github.com/quietust/dfhack/tree/develop or https://github.com/quietust/dfhack/tree/master. So how do I tell git to grab the develop branch, not the master?

Code: [Select]
git fetch origin
git checkout develop
or
Code: [Select]
git clone git://github.com/quietust/dfhack.git -b develop
Instead of making a separate clone, you can add another remote pointing to Quietust's fork (merging changes from different forks is easier with a single clone):
Code: [Select]
git remote add quietust https://github.com/quietust/dfhack
git fetch quietust
git checkout -b newbranch  # optional
git merge quietust/develop

Yes it seems that with his latest commit Quietust's develop branch builds and hooks with no needed additional changes.

Also lethosor, am I missing something or are your own scripts (load-screen settings-manager etc.) missing from the main repo? They're pretty nifty though.
I don't consider them complete enough to include in DFHack officially yet, but you're certainly welcome to test them out. :)
Title: Re: DFHack 0.40.08-r2
Post by: khearn on August 27, 2014, 05:30:32 pm
I've created a wiki page with what I did to get it to build on linux.

http://dwarffortresswiki.org/index.php/User:Khearn/DfhackLinuxBuild#HOWTO_build_dfhack_on_linux

It's a first draft, and is no doubt missing stuff, particularly what packages are needed. Please let me know if you notice stuff that's missing. But I do know that the commands work, once you have all the dependencies installed.

I see that some alternate method of getting the sources from github have been posted while I was writing it. I'll take a look at them and possibly update my instructions.

Thanks for all the help,

    Keith
Title: Re: DFHack 0.40.08-r2
Post by: jwhite.df on August 27, 2014, 07:28:21 pm
Also, it's still much better than remaining on 40.08.

Oh? Why?
Because there is a newer version, obviously.

I understand that it's newer. I'm not clear about what's much better.
Title: Re: DFHack 0.40.08-r2
Post by: kebab4you on August 27, 2014, 08:00:44 pm
The OP only contains official releases and there's hasn't been one for .10 yet, even though you can still easily build your own once you're set up. But yeah, trying to find the one commit from the one tree from the one repo that will build, hook and run is a little bit like playing hide-and-seek. That's part of a decentralized project I guess, it has ups and downs.

Sorry but if you have to hunt for what repo to pull someone somewhere have done an awful job with keeping things clean.
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 27, 2014, 08:36:19 pm
The OP only contains official releases and there's hasn't been one for .10 yet, even though you can still easily build your own once you're set up. But yeah, trying to find the one commit from the one tree from the one repo that will build, hook and run is a little bit like playing hide-and-seek. That's part of a decentralized project I guess, it has ups and downs.

Sorry but if you have to hunt for what repo to pull someone somewhere have done an awful job with keeping things clean.
Quietust's fork is only necessary when compiling DFHack for a new DF version before Quietust's changes are merged into DFHack/dfhack (which they were approximately 12 hours ago - dfhack:dfhack and quietust:dfhack are now identical (https://github.com/DFHack/dfhack/compare/quietust:develop...dfhack:develop)). DFHack:develop (https://github.com/dfhack/dfhack/tree/develop) should compile for 0.40.10 now.
Title: Re: DFHack 0.34.11 r5
Post by: Justiceface on August 27, 2014, 08:39:52 pm
Hi. I can't get dfhack to work. I am on a fresh install of Debian "Jessie" testing, the upcoming Debian release. My Linux is 64bit but I installed all the libraries I need (I think) in 32bit. Vanilla DF works fine. But when I try to start dfhack I get:

sander@porky:/opt/df_linux$ ./dfhack
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /opt/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./hack/libprotobuf-lite.so)
-e


Any help? I have libstdc++6 installed in both 32bit and 64bit versions so I'm not sure what the problem is. Is this a problem with the libstdc++.so.6 file shipped by DF?

EDIT: I think I worked around it for now, but I haven't properly tested yet. dfhack starts, but I haven't run any game yet. What I did was move the provided libs/libstdc++.so.6 out of the way and replace it with a symlink to /usr/lib/gcc/i586-linux-gnu/4.9/libstdc++.so

I have this same set of error messages in Ubuntu 12.04LTS 32-bit.  I tried the DFHack versions with both gcc versions and neither worked.  I still get the same error.  Not sure what to do next... will setting up a symbolic link to my libstdc in /usr/lib do any good? My libstdc version appears to be 4.6 (/usr/lib/gcc/i686-linux-gnu/4.6/libstdc++.so), which is the version the alternative DFHack package is supposed to use.
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 27, 2014, 08:42:37 pm
Did you remove libstdc++ from DF/libs?
Title: Re: DFHack 0.40.08-r2
Post by: Astarch on August 27, 2014, 08:48:12 pm
I had the bright idea to convert .dfmap files to .pngs so people could use them with the various blueprint utilities, but mapexport isn't showing up in the list of plugins when I run dfhack. The last commit to it is over two years old, has it been discontinued?
Title: Re: DFHack 0.40.08-r2
Post by: Justiceface on August 27, 2014, 08:55:08 pm
Did you remove libstdc++ from DF/libs?

I had not.  I just tried removing it, and now DF runs when I run ./dfhack, but DFHack itself is not running.  It doesn't throw an error of any kind.
Title: Re: DFHack 0.40.08-r2
Post by: mifki on August 27, 2014, 09:17:17 pm
Did you remove libstdc++ from DF/libs?

I had not.  I just tried removing it, and now DF runs when I run ./dfhack, but DFHack itself is not running.  It doesn't throw an error of any kind.

Check that md5 sum of DF executable is in dfhack's symbols.xml for your DF version number.
Title: Re: DFHack 0.40.08-r2
Post by: khearn on August 27, 2014, 09:39:45 pm
Also look for a stderr.log file in your df_linux directory. It will be the error output from dfhack.
Title: Re: DFHack 0.40.08-r2
Post by: Justiceface on August 27, 2014, 09:45:16 pm
It looks like my dfhack is expecting version 40.07 of DF.  The md5sums don't match because I'm running 40.10.  stderr.log shows an unknown version of DF.  I'm guessing that's why hack quits. :)

Will it be helpful to edit symbols.xml with the correct version and md5sum, or does hack need to re-generate that file itself?

Title: Re: DFHack 0.40.08-r2
Post by: mifki on August 27, 2014, 10:03:40 pm
It looks like my dfhack is expecting version 40.07 of DF.  The md5sums don't match because I'm running 40.10.  stderr.log shows an unknown version of DF.  I'm guessing that's why hack quits. :)

Will it be helpful to edit symbols.xml with the correct version and md5sum, or does hack need to re-generate that file itself?

Well I suppose if you're compiling the correct repo/branch/etc. then .10 should be there. At least .08 definitely should be, not .07
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 27, 2014, 10:11:58 pm
Did you remember to run "git submodule update"?
Title: Re: DFHack 0.40.08-r2
Post by: mifki on August 27, 2014, 10:41:40 pm
Did you remember to run "git submodule update"?

F**ing git. It seems xml submodule in dfhack master is still pointing to an old commit of df-structures. So he needs to do git pull in library/xml folder.
Title: Re: DFHack 0.40.08-r2
Post by: Simca on August 27, 2014, 10:42:06 pm
Not sure if this is an old bug or new or not a DFHack bug at all (DF seems to have some screen resizing issues atm), but the text for the DFHack-added UI functions displays as if the window has never been resized: http://i.imgur.com/A1JxrWk.png

This is not a big problem usually, but on certain screens (trading with merchants) it blocks entire rows of information. If you anchor the text to the bottom-right of the UI instead of the top-right, it may solve this issue, since DF seems to redraw the UI from top-left to bottom-right. Dunno if that is exclusively a Windows fix though.
Title: Re: DFHack 0.40.08-r2
Post by: mifki on August 27, 2014, 10:45:06 pm
Not sure if this is an old bug or new or not a DFHack bug at all (DF seems to have some screen resizing issues atm), but the text for the DFHack-added UI functions displays as if the window has never been resized: http://i.imgur.com/A1JxrWk.png

This is not a big problem usually, but on certain screens (trading with merchants) it blocks entire rows of information.

I wonder what they will do with the trade screen because now there's no space left below the item list for search options. Don't see a problem on your screenshot though.
Title: Re: DFHack 0.40.08-r2
Post by: ancient_vampire on August 28, 2014, 04:33:17 am
dfh text might cover stockpile links on that screen
Title: Re: DFHack 0.40.08-r2
Post by: runforitkyle on August 28, 2014, 05:19:45 am
I'm a simple guy with no software experience, would it be [possible] for me to download and compile df hack for 0.40.10 from github? And if so how?
Title: Re: DFHack 0.40.08-r2
Post by: jeancallisti on August 28, 2014, 05:41:14 am
I finally got to upload the DFHack plugin tutorial I wrote mast year : http://dwarffortresswiki.org/index.php/Utility:DFHack/Programming

Reminder: I'm not a DFHack specialist so it might contain inaccuracies, but it's an excellent start for any DFHack plugin programmer noob.
Title: Re: DFHack 0.40.08-r2
Post by: mifki on August 28, 2014, 06:13:10 am
I'm a simple guy with no software experience, would it be [possible] for me to download and compile df hack for 0.40.10 from github? And if so how?

It's not that hard, but requires installation of number of tools like Visual Studio, Perl... You can do that if you really want, otherwise you can ask somebody to upload Windows build somewhere, or just wait, I think dfhack for .10 soon will be out.
Title: Re: DFHack 0.40.08-r2
Post by: JonathanCR on August 28, 2014, 06:15:06 am
I hope so, because I too am a complete uninitiate to all of this and I'd very much like to make a couple of fixes to my 40.10 game.
Title: Re: DFHack 0.40.08-r2
Post by: Nimrod on August 28, 2014, 07:42:45 am
I greatly appreciate all the work you guys put into this tool! Thank you.

That said, since I am just able to understand what you are talking about ... I am in no way able to compile "my own" windows build for 40.10 ... if someone has already done so, could he/she maybe put it up for download somewhere?
I would gladly take a "may crash be careful" build ;)

cheers
Title: Re: DFHack 0.40.08-r2
Post by: PaleBlueHammer on August 28, 2014, 10:17:47 am
I greatly appreciate all the work you guys put into this tool! Thank you.

That said, since I am just able to understand what you are talking about ... I am in no way able to compile "my own" windows build for 40.10 ... if someone has already done so, could he/she maybe put it up for download somewhere?
I would gladly take a "may crash be careful" build ;)

cheers

Agreed, I also would make use of this if anyone has had success with a 40.10 compile for Windows.

I only ever use a couple of DFHack functions, like PROSPECT and REVEAL, so I figure I'm unlikely to bork up my game.  I'll manage without WORKFLOW as well.
Title: Re: DFHack 0.40.08-r2
Post by: khearn on August 28, 2014, 11:31:09 am
You're having the same problem I had yesterday morning. You need to make sure you're getting a copy of the develop branch, not the master branch. If you look back at the messages from yesterday morning, you can see a few different options for the command to grab the correct branch.

   Keith
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 28, 2014, 12:56:25 pm
It'd be great if you guys could make tools that look at creatures to find out why stuff happened like a random fight that broke out in a mead hall a moment ago.
Title: Re: DFHack 0.40.08-r2
Post by: khearn on August 28, 2014, 01:40:30 pm
Check the dwarf's thoughts (v->z->enter) and you'll probably see that he/she is very unhappy for one reason or another.
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 28, 2014, 01:46:38 pm
Check the dwarf's thoughts (v->z->enter) and you'll probably see that he/she is very unhappy for one reason or another.

I meant adventure mode.
Title: Re: DFHack 0.40.08-r2
Post by: khearn on August 28, 2014, 02:23:00 pm
Have you tried asking someone in the mead hall? I haven't played much adventure mode in 40.XX, but there seems to be a vastly greater opportunity to ask questions about nearly everything.
Title: Re: DFHack 0.40.08-r2
Post by: Simca on August 28, 2014, 02:30:38 pm
Not sure if this is an old bug or new or not a DFHack bug at all (DF seems to have some screen resizing issues atm), but the text for the DFHack-added UI functions displays as if the window has never been resized: http://i.imgur.com/A1JxrWk.png

This is not a big problem usually, but on certain screens (trading with merchants) it blocks entire rows of information.

Don't see a problem on your screenshot though.
Ah, yeah. Bad example pic - the DFHack text should be at the bottom of the screen though because it runs over the lists of 'give' entries: http://i.imgur.com/9AEI6DB.png
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on August 28, 2014, 02:34:31 pm
The trade screen was changed to take advantage of the entire screen height in 0.40.01, and that plugin (autotrade) hasn't been updated yet - see https://github.com/DFHack/dfhack/pull/289 for a fix. Also, https://github.com/DFHack/dfhack/pull/290 fixes the stockflow layout issue.
Title: Re: DFHack 0.40.08-r2
Post by: Simca on August 28, 2014, 09:43:44 pm
Compiling DFHack for Windows is actually really easy if explained, and it doesn't require a zillion programs, just four.

You need:
CMake (http://www.cmake.org/cmake/resources/software.html)
Git - I prefer Github (https://windows.github.com/) or mysysgit (http://msysgit.github.io/) for these purposes (simple command line stuff).
Perl - Strawberry Perl (http://strawberryperl.com/) is simplest
Visual Studio 2010 Express for C# (http://go.microsoft.com/?linkid=9709939)
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 28, 2014, 10:05:46 pm
You forget that you need cmake and perl as well.
As for git, I can't live without tortoisegit.
Title: Re: DFHack 0.40.08-r2
Post by: Simca on August 28, 2014, 10:22:57 pm
You forget that you need cmake and perl as well.
Oh right.
As for git, I can't live without tortoisegit.
TortoiseGit is the only reason I still use Git at all, but in this case it's probably simpler to explain the command line.
(And I forget if TortoiseGit adds itself to PATH automatically like Github and mysysgit do.)
Title: Re: DFHack 0.40.08-r2
Post by: smjjames on August 28, 2014, 10:56:37 pm
Have you tried asking someone in the mead hall? I haven't played much adventure mode in 40.XX, but there seems to be a vastly greater opportunity to ask questions about nearly everything.

You still can't ask 'why are you fighting' or why did you kill ____' or 'why are you attacking me'. There is a greater opportunity, yes, but still not enough.
Title: Re: DFHack 0.40.08-r2
Post by: Rose on August 28, 2014, 11:14:14 pm
You forget that you need cmake and perl as well.
Oh right.
As for git, I can't live without tortoisegit.
TortoiseGit is the only reason I still use Git at all, but in this case it's probably simpler to explain the command line.
(And I forget if TortoiseGit adds itself to PATH automatically like Github and mysysgit do.)
Actually, TortoiseGit is just a front-end for whatever commandline git program is in your PATH. It won't work without one of the other two installed.
Title: Re: DFHack 0.40.08-r2
Post by: robertheinrich on August 29, 2014, 01:32:00 am
Compiling DFHack for Windows is actually really easy if explained, and it doesn't require a zillion programs, just four.
[...]
You need:
[...]
Visual Studio 2010 Express for C# (http://go.microsoft.com/?linkid=9709939)

Getting Visual C++ 2010 Express (http://go.microsoft.com/?linkid=9709949) might prove useful as well, considering that most of dfhack is written in C++, and not C#.
Title: Re: DFHack 0.40.08-r2
Post by: Nimrod on August 29, 2014, 03:46:12 am
Compiling DFHack for Windows is actually really easy if explained, and it doesn't require a zillion programs, just four.

You need:
CMake (http://www.cmake.org/cmake/resources/software.html)
Git - I prefer Github (https://windows.github.com/) or mysysgit (http://msysgit.github.io/) for these purposes (simple command line stuff).
Perl - Strawberry Perl (http://strawberryperl.com/) is simplest
Visual Studio 2010 Express for C# (http://go.microsoft.com/?linkid=9709939)
  • Install all four of the above programs.
  • Hold down Shift and right-click in an empty space on your desktop. Select "Open command window here".
  • Type "git clone -b develop git://github.com/dfhack/dfhack.git" and hit Enter. (Remove the "-b develop" part if you don't want the development branch version, but you usually will.)
  • Type "cd dfhack" and hit Enter.
  • Type "git submodule init" and hit Enter.
  • Type "git submodule update" and hit Enter.
  • Close the command prompt and open the DFHack folder you just made and then open the Build folder inside of that.
  • Double-click on 'generate-MSVC-gui.bat'.
  • In the window that pops up, uncheck the box that says "DL_RUBY", then click Configure, and lastly click Generate.
  • Close that window and enter the new VC2010 directory that was created and double-click on dfhack.sln.
  • Open the "Solution Explorer" tab to the right, scroll down to "PACKAGE", and then right-click on it and hit "Build".
  • When it eventually finishes running, open the new folder "_CPack_Packages", then the folder "win32", then the folder "ZIP", and you will have your very own zipped-up DFHack build.

Thank you for trying to teach a man to fish here! :D
" .. it doesn't require a zillion programs, just four." That part made me laugh. ;)
Don't get me wrong, I think your step by step manual would probably help. I am looking for something in the difficult level of "Right click, save as... ; unzip; start up; siren (to get the bugged dwarfes to walk again) ; drybuckets and then some autodump" (and god I love the autoselect building) :)

cheers
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on August 29, 2014, 05:15:20 am
New release!
Title: Re: DFHack 0.40.10-r1
Post by: Philii on August 29, 2014, 05:23:42 am
New release!
Thank.It is 5 days after df 0.40.10 release.
Title: Re: DFHack 0.40.10-r1
Post by: Rose on August 29, 2014, 05:53:31 am
Attention: Stonesense will most likely not work properly in this release. At least not properly.
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on August 29, 2014, 06:06:53 am
Looks fine to me at least at first glance.
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 29, 2014, 07:13:41 am
OS X build of 0.40.10-r1 (http://dffd.wimbli.com/file.php?id=9555)
Title: Re: DFHack 0.40.10-r1
Post by: Nimrod on August 29, 2014, 11:20:44 am
New release!

You have forever a place in my heart, mate! ;)
Title: Re: DFHack 0.40.10-r1
Post by: Shazbot on August 29, 2014, 01:39:02 pm
*dumps a Finished Goods bin full of golden crafts on the heads of the project members, fracturing the skull and tearing the brain!*

*Shazbot flees in horror!*
Title: Re: DFHack 0.40.10-r1
Post by: YAHG on August 29, 2014, 01:52:04 pm
*dumps a Finished Goods bin full of golden crafts on the heads of the project members, fracturing the skull and tearing the brain!*

*Shazbot flees in horror!*

It is terrifying
Title: Re: DFHack 0.40.10-r1
Post by: shadus on August 29, 2014, 03:21:56 pm
Two words:

THANK GOD.

I've had a massive bloodbath to clean up for a few days... so ready to have dfhack again (fort has done fine due to an entrance bath.. but the blood elsewhere is astounding.)
Title: Re: DFHack 0.40.10-r1
Post by: LeoCean on August 29, 2014, 04:15:57 pm
You could have just transferred the save back to dfhack 40_08r2. There weren't that many changes that'd break raws(in save games). Besides the one in dinit. Besides you may have to wait a while when you reload with 40_10 for some of the exe changes to bounce back in (morale and all that). It should have been do able anyways.
Title: Re: DFHack 0.40.10-r1
Post by: Quietust on August 29, 2014, 04:48:54 pm
You could have just transferred the save back to dfhack 40_08r2. There weren't that many changes that'd break raws(in save games). Besides the one in dinit. Besides you may have to wait a while when you reload with 40_10 for some of the exe changes to bounce back in (morale and all that). It should have been do able anyways.
Wrong - once you upgrade a save to a newer version (by loading and saving), you cannot load it in an older version anymore.
Title: Re: DFHack 0.40.10-r1
Post by: notfood on August 29, 2014, 05:21:14 pm
For some reason this doesn't work:
Code: [Select]
keybinding add Ctrl-Shift-Z@dwarfmode/Default "stocks show"but this one does
Code: [Select]
keybinding add Ctrl-Shift-S@dwarfmode/Default "stocks show"
DFHack for Linux. Something to do with Z?
Title: Re: DFHack 0.40.10-r1
Post by: smjjames on August 29, 2014, 07:11:43 pm
Any idea if it would be feaseable to have some kind of tool to analyze NPCs in adventure mode to better understand what's going on? No idea what such a tool would do exactly though.
Title: Re: DFHack 0.40.10-r1
Post by: thistleknot on August 29, 2014, 07:17:00 pm
my favorite script startdwarf.rb doesn't seem to work.

I type in startdwarf 13 on the map, but I still only pre-embark preperations with 7
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 29, 2014, 07:21:47 pm
The required offset for startdwarf (start_dwarf_count) is only available on OS X for 0.40.10-r1, but you can find the other two here (https://github.com/DFHack/df-structures/commit/b259a55e9ee9f1aa162af39757cfacc4bcf88527) (for Windows and Linux, in that order).
Title: Re: DFHack 0.40.10-r1
Post by: thistleknot on August 29, 2014, 07:43:25 pm
I don't know if I edited the script right, I tried this... same thing

Spoiler (click to show/hide)

On further note, the 3dveins is broken as well (causes my modded version of the game to crash).

I have an empty errolog other than notices about camping forever.
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 29, 2014, 08:07:38 pm
You should add the line from here (https://github.com/DFHack/df-structures/commit/b259a55e9ee9f1aa162af39757cfacc4bcf88527) for your OS to DF/hack/symbols.xml, under the correct <symbol-table> tag ("0.40.10 SDL" for Windows or "0.40.10 linux" for Linux) instead of editing the script. I'm not sure what the problem is if neither of those work, though.

DFHack errors are logged to stderr.log, not errorlog.txt, although a crash usually won't log anything.
Title: Re: DFHack 0.40.10-r1
Post by: Treefingers on August 29, 2014, 08:43:21 pm
Getting this again:
Code: [Select]
./libs/Dwarf_Fortress: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _Z10lua_gettopP9lua_StateApart from recognizing some file paths, I don't know what this means or how I might fix/avoid it. Ideas?

I'm running 0.40.10 (from site, not repo) in Arch Linux (32). No changes to raws; removed DF's c++ lib to avoid that error; some changes to init files (nothing uncommon); default dfhack.init, but error showed without it;

edit: just DLed 0.34.11 with the old dfhack. Getting the same error there, too.
Title: Re: DFHack 0.40.10-r1
Post by: Euius on August 29, 2014, 09:57:50 pm
Curious why this doesn't work

Spoiler (click to show/hide)

And whats the proper to way to force a building to give up its contents, without actually disassembling the building.
Title: Re: DFHack 0.40.10-r1
Post by: thistleknot on August 29, 2014, 10:44:20 pm
You should add the line from here (https://github.com/DFHack/df-structures/commit/b259a55e9ee9f1aa162af39757cfacc4bcf88527) for your OS to DF/hack/symbols.xml, under the correct <symbol-table> tag ("0.40.10 SDL" for Windows or "0.40.10 linux" for Linux) instead of editing the script. I'm not sure what the problem is if neither of those work, though.

DFHack errors are logged to stderr.log, not errorlog.txt, although a crash usually won't log anything.

thanks, that did it.

At first I thought you were telling me I had to [re]build it after code changes or something. 

I never knew about that symbols.xml file. 

Very handy.  It's like an offline pointer list that doesn't need to be converted to binary code at runtime.
Title: Re: DFHack 0.40.10-r1
Post by: smjjames on August 29, 2014, 10:53:09 pm
Any idea if it would be feaseable to have some kind of tool to analyze NPCs in adventure mode to better understand what's going on? No idea what such a tool would do exactly though.

Do you guys know anything on this? Although probably only the real expert coders around here would know how feaseable it is.
Title: Re: DFHack 0.40.10-r1
Post by: Putnam on August 29, 2014, 10:59:02 pm
I have no idea what you mean by "analyze" or "what's going on".
Title: Re: DFHack 0.40.10-r1
Post by: Greiger on August 30, 2014, 01:33:03 am
I love you guys.  I never realized how much I miss digv until playing for 9 versions without it.

My fortress metal production has quadrupled now that I don't have to manually designate every single tile of ore a few at a time.  I shall throw a... (looks over animal pens) ...puppy into the volcano in the dev team's honor.
Title: Re: DFHack 0.40.10-r1
Post by: Rumrusher on August 30, 2014, 03:09:05 am
Curious why this doesn't work

Spoiler (click to show/hide)

And whats the proper to way to force a building to give up its contents, without actually disassembling the building.
you might need to set a X/Y/Z coord for where the items go.
Title: Re: DFHack 0.40.10-r1
Post by: Xerberus on August 30, 2014, 07:57:24 am
hey, i use the current starter pack with dfhack and during my play i saw that red text appears in the dfhack console:

(http://s1.directupload.net/images/140830/temp/6um4y6pl.png) (http://www.directupload.net/file/d/3730/6um4y6pl_png.htm)

are these some errors i should be aware of or are these harmless? thx!
Title: Re: DFHack 0.40.10-r1
Post by: smjjames on August 30, 2014, 09:21:20 am
I have no idea what you mean by "analyze" or "what's going on".

I have no idea what exactly I want either or how it would possibly work.
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 30, 2014, 09:26:59 am
hey, i use the current starter pack with dfhack and during my play i saw that red text appears in the dfhack console:

(http://s1.directupload.net/images/140830/temp/6um4y6pl.png) (http://www.directupload.net/file/d/3730/6um4y6pl_png.htm)

are these some errors i should be aware of or are these harmless? thx!
It looks like a problem with repeat.lua - can you try replacing it with https://raw.githubusercontent.com/Furcube/dfhack/master/scripts/repeat.lua?
Title: Re: DFHack 0.40.10-r1
Post by: Xerberus on August 30, 2014, 09:44:25 am
hey, i use the current starter pack with dfhack and during my play i saw that red text appears in the dfhack console:

(http://s1.directupload.net/images/140830/temp/6um4y6pl.png) (http://www.directupload.net/file/d/3730/6um4y6pl_png.htm)

are these some errors i should be aware of or are these harmless? thx!
It looks like a problem with repeat.lua - can you try replacing it with https://raw.githubusercontent.com/Furcube/dfhack/master/scripts/repeat.lua?

sorry, noob here....how do i do that? first thinks first, if i try to rightclick-download your link then it gives me repeat.txt. ....i imagine simply renaming it to repeat.lua will do the job. where is the repeat.lua located? thx for your help btw :)
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 30, 2014, 09:56:34 am
Replace DF/hack/scripts/repeat.lua with that script, renaming it to repeat.lua if necessary. (It might be a good idea to make a copy of your current hack/scripts/repeat.lua, in case it doesn't work.)
Title: Re: DFHack 0.40.10-r1
Post by: Xerberus on August 30, 2014, 10:03:11 am
Replace DF/hack/scripts/repeat.lua with that script, renaming it to repeat.lua if necessary. (It might be a good idea to make a copy of your current hack/scripts/repeat.lua, in case it doesn't work.)

thanks, one last question: how can i find out if it doesn't work? crashes? more red text? dwarves starting to kill each other? :D
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on August 30, 2014, 10:27:30 am
Replace DF/hack/scripts/repeat.lua with that script, renaming it to repeat.lua if necessary. (It might be a good idea to make a copy of your current hack/scripts/repeat.lua, in case it doesn't work.)

thanks, one last question: how can i find out if it doesn't work? crashes? more red text? dwarves starting to kill each other? :D
If you change one thing (the repeat.lua script) and suddenly the game starts crashing on launch or when you use repeat, then yeah that would be evidence of it not working.  Same thing for red text.  Dwarves killing each other is typical tantrum behavior and probably unrelated :)
Title: Re: DFHack 0.40.10-r1
Post by: Xerberus on August 30, 2014, 10:59:42 am
hey, i use the current starter pack with dfhack and during my play i saw that red text appears in the dfhack console:

(http://s1.directupload.net/images/140830/temp/6um4y6pl.png) (http://www.directupload.net/file/d/3730/6um4y6pl_png.htm)

are these some errors i should be aware of or are these harmless? thx!
It looks like a problem with repeat.lua - can you try replacing it with https://raw.githubusercontent.com/Furcube/dfhack/master/scripts/repeat.lua?

i replaced the repeat.lua with the one from you but after loading the game i get exactly theb same red error lines as before.
Title: Re: DFHack 0.40.10-r1
Post by: jwhite.df on August 30, 2014, 12:14:32 pm
I want a pony.
Title: Re: DFHack 0.40.10-r1
Post by: danaris on August 30, 2014, 12:47:15 pm
I want a pony.

Ask, and ye shall receive.

(http://topazgryphon.org/~tcollett/ponies.jpg)
Title: Re: DFHack 0.40.10-r1
Post by: Meph on August 30, 2014, 01:15:07 pm
No, its not. Please keep it about dfhack.
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on August 30, 2014, 01:25:54 pm
No, its not. Please keep it about dfhack.

slayrace ponies

Now, back to DFHack.  lethosor, was this (http://www.bay12forums.com/smf/index.php?topic=126076.msg5619102) the fix you just tried for Xerberus?
Title: Re: DFHack 0.40.10-r1
Post by: Treefingers on August 30, 2014, 01:31:11 pm
Getting this again:
Code: [Select]
./libs/Dwarf_Fortress: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _Z10lua_gettopP9lua_State
If anyone's interested, I went into /usr/lib and renamed liblua.so (it was a link to liblua.so.5.2, itself a link to liblua.so.5.2.3) to hide it and see what happens. DF/dfhack works fine.

Problem is, I currently have no idea what to expect from my other lua-dependent programs now (conky, vlc, geany, etc). If they've been written to look directly for liblua.5.2, I should be fine, right? Might I get anything worse than failed scripts or a program crash? Or is this the sort of file that will always be replaced when it's not found? Would be a royal pain to have to rename it every time I want to dwarf.
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 30, 2014, 02:04:53 pm
Now, back to DFHack.  lethosor, was this (http://www.bay12forums.com/smf/index.php?topic=126076.msg5619102) the fix you just tried for Xerberus?
The fix for repeat.lua I suggested was from https://github.com/DFHack/dfhack/pull/308, which appears to have worked for Xerberus.
Title: Re: DFHack 0.40.10-r1
Post by: PaleBlueHammer on August 30, 2014, 02:39:24 pm
Now, back to DFHack.  lethosor, was this (http://www.bay12forums.com/smf/index.php?topic=126076.msg5619102) the fix you just tried for Xerberus?
The fix for repeat.lua I suggested was from https://github.com/DFHack/dfhack/pull/308, which appears to have worked for Xerberus.

Did he PM you?  The last I saw from him, he was saying this did not work.

I'm seeing the same issue and can confirm something is still broken after replacing that script.
Title: Re: DFHack 0.40.10-r1
Post by: Rafatio on August 30, 2014, 03:14:24 pm
Yay dfhack for 40.10, thanks everyone!

Can workflow watch for filled sand bags? And what would the command look like if it can, my guesses led to nothing so far.

(Is that supposed to be a forward slash in repeat.lua's path? I know nothing of that stuff, it just sticks out in the sea of red)
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 30, 2014, 03:24:44 pm
(Is that supposed to be a forward slash in repeat.lua's path? I know nothing of that stuff, it just sticks out in the sea of red)
Yes. The use of forward slashes there is intentional because they will work on all platforms in Lua (and usually C++).

Now, back to DFHack.  lethosor, was this (http://www.bay12forums.com/smf/index.php?topic=126076.msg5619102) the fix you just tried for Xerberus?
The fix for repeat.lua I suggested was from https://github.com/DFHack/dfhack/pull/308, which appears to have worked for Xerberus.

Did he PM you?  The last I saw from him, he was saying this did not work.

I'm seeing the same issue and can confirm something is still broken after replacing that script.
Did you change "1 months" to "1 -timeUnits months"?
Title: Re: DFHack 0.40.10-r1
Post by: Xerberus on August 30, 2014, 03:38:09 pm
Now, back to DFHack.  lethosor, was this (http://www.bay12forums.com/smf/index.php?topic=126076.msg5619102) the fix you just tried for Xerberus?
The fix for repeat.lua I suggested was from https://github.com/DFHack/dfhack/pull/308, which appears to have worked for Xerberus.

well like i already posted, i still get the same red error messages, even with the repeat.lua file you recommended.

now i see different recommendations in the last few posts which fix the problem, care to give the newbie in the room (me) a tip which one to apply now and how...thanks!

Edit: ok i tested the fix from Furcube and it removes the old red error text but adds a new one:
(http://s14.directupload.net/images/140830/temp/95vwnj2d.png) (http://www.directupload.net/file/d/3730/95vwnj2d_png.htm)

it also seems the "LNP_dfhack_onLoad.init" reverts back to default once you start DF, so changing it beforehand is pointless. like Furcube said, i had to change the file after starting DF but before loading the savegame. but still, the error messages before were kinda gibberish for me, the new one saying anything about caravans is slightly worrying me :/.

Edit2: i deselected "pure bugfixes" from the DF starter pack in the dfhack tab and this has removed the red error messages.
Title: Re: DFHack 0.40.10-r1
Post by: Xerberus on August 30, 2014, 04:18:12 pm
sorry for double post but this is another question / topic dfhack related.

in my last fort in DF 40.09 i gave up duo to the FPS being kinda creepy slow (22 FPS), i had around 122 dwarves and at the time around 100 undead elves attacking me (which undoubtly was the reason for my lack). i have a intel core i5 4440 (4 x 3.2 ghz), i know DF runs on a single core but i would love to improve the FPS without drastically changing the gameplay experience. i know that in the old dfhack version (and in the masterwork mod) there is the option to simplify materials which seemed to increase the FPS drastically. now my question is if this option is already available in the current version (i just have to enter i command i don't know) or if this is still in developement for the current version.

thanks!
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 30, 2014, 04:23:58 pm
sorry for double post but this is another question / topic dfhack related.

in my last fort in DF 40.09 i gave up duo to the FPS being kinda creepy slow (22 FPS), i had around 122 dwarves and at the time around 100 undead elves attacking me (which undoubtly was the reason for my lack). i have a intel core i5 4440 (4 x 3.2 ghz), i know DF runs on a single core but i would love to improve the FPS without drastically changing the gameplay experience. i know that in the old dfhack version (and in the masterwork mod) there is the option to simplify materials which seemed to increase the FPS drastically. now my question is if this option is already available in the current version (i just have to enter i command i don't know) or if this is still in developement for the current version.

thanks!
I believe this is only part of the MDF mod (and another mod), but you may be thinking of other performance improvements - take a look at Readme.rst (https://github.com/DFHack/dfhack/blob/master/Readme.rst#cleanup-and-garbage-disposal).
Title: Re: DFHack 0.40.10-r1
Post by: thistleknot on August 30, 2014, 04:55:49 pm
Anyone know of some symbol offsets I can manipulate to emulate nanofortress?
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 30, 2014, 04:56:34 pm
Anyone know of some symbol offsets I can manipulate to emulate nanofortress?
Use "embark-tools".
Edit: To be specific, "embark-tools enable nano".
Title: Re: DFHack 0.40.10-r1
Post by: LeoCean on August 30, 2014, 08:29:56 pm
sorry for double post but this is another question / topic dfhack related.

in my last fort in DF 40.09 i gave up duo to the FPS being kinda creepy slow (22 FPS), i had around 122 dwarves and at the time around 100 undead elves attacking me (which undoubtly was the reason for my lack). i have a intel core i5 4440 (4 x 3.2 ghz), i know DF runs on a single core but i would love to improve the FPS without drastically changing the gameplay experience. i know that in the old dfhack version (and in the masterwork mod) there is the option to simplify materials which seemed to increase the FPS drastically. now my question is if this option is already available in the current version (i just have to enter i command i don't know) or if this is still in developement for the current version.

thanks!

I don't think that there are any mods with simplified materials that you can activate for a current save as it would change quite a few things. Quantum stockpiles does help keep fps low but also standardized materials makes a big difference to. What I mean is instead of different types of animal parts and different types of meat and leathers and so on you just have one creature type. Most people like to have more than one leather type though. I have a version I made for 40_07 that I updated to 40_08 and am planning on updating at some point to 40.10 or so. I was just going to wait till I finished with the twbt version but its really not that hard for me to update that and upload it for you. It'll have one type of leather and a few types of wood, I haven't messed with plants or metals/ materials yet though. It's basically that mod http://www.bay12forums.com/smf/index.php?topic=141715.0 but without all the extra mods except for the leather one.
Title: Re: DFHack 0.40.10-r1
Post by: Euius on August 31, 2014, 12:50:15 am
Can workflow watch for filled sand bags? And what would the command look like if it can, my guesses led to nothing so far.

workflow amount POWDER_MISC/SAND 105 10

In the future, you can use the gui to add a limit and then "workflow list-commands" to get the command you'd use in a world-start script




Title: Re: DFHack 0.40.10-r1
Post by: Rafatio on August 31, 2014, 04:41:35 am
Can workflow watch for filled sand bags? And what would the command look like if it can, my guesses led to nothing so far.

workflow amount POWDER_MISC/SAND 105 10

In the future, you can use the gui to add a limit and then "workflow list-commands" to get the command you'd use in a world-start script
Thanks! Never used the gui before, I search for the names in the forum and raws, but this one had me stumped, your system sounds a lot easier.
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on August 31, 2014, 06:13:46 am
By the way, the solution in that pull request is wrong. It will work only for single-word repeating commands. The problem is that the documentation is wrong. You're supposed to put [ brackets ] around the command that's being repeated.
Title: Re: DFHack 0.40.10-r1
Post by: Eko on August 31, 2014, 09:57:38 am
I don't know if this goes here, if not, sorry.

I am wondering if there's a way in dfhack to get the offset or address of a function in df, if known?  I'm making an underwater civ, and while it was a simple hack to get the buildings to be able to be placed underwater, the build fails with "build site submerged". I've located five locations where the designation flags are checked by the game when that action fails, but going through all of them to narrow down the instruction I need to change is daunting.  If dfhack can point me to the address of the function df uses to build a workshop, I can more easily narrow down my scope, and more quickly find the right instruction. 

I am not a great disassembler, so I don't know exactly what I'm doing, but I was also thinking of finding the point in the program that calls MSVCR to display the "submerged" message might help.  I can't figure out how to do that though.  I found the function in the dll that sends the message, but can't figure out how to get IDA to give me the calling function in df.  I hope I'm just missing something simple.

Thanks for any and all help.
Title: Re: DFHack 0.40.10-r1
Post by: Arumba on August 31, 2014, 10:17:32 am
Can workflow watch for filled sand bags? And what would the command look like if it can, my guesses led to nothing so far.

workflow amount POWDER_MISC/SAND 105 10

In the future, you can use the gui to add a limit and then "workflow list-commands" to get the command you'd use in a world-start script

Could you direct me to some references/guide how to use workflow in a world start script?  I tried using workflow list-commands and then set it into a "LNP_dfhack_onLoad" init file but it didn't work.  workflow list-commands gave me this:
workflow drink 9999 9000
And when I loaded in it said 'cannot find "drink"'
Why would it give me what it calls the item with workflow list-commands but then not be able to use it's own info in an init script?

I constantly set the same initial workflow parameters and would love to get these settings working automatically when I start a new world. 

Thanks
Title: Re: DFHack 0.40.10-r1
Post by: kr0pper on August 31, 2014, 12:55:10 pm
set it into a "LNP_dfhack_onLoad" init

As i know, this file overwrites automatically.

I just create dfhack_onLoad.init in df folder and put next line to my dfhack.init:
Code: [Select]
:lua dfhack.onStateChange.onloadscript = function(state) if state == SC_WORLD_LOADED then print(dfhack.run_command('script dfhack_onLoad.init')) end end

Spoiler (click to show/hide)
Title: Re: DFHack 0.40.10-r1
Post by: Arumba on August 31, 2014, 01:05:57 pm
set it into a "LNP_dfhack_onLoad" init

As i know, this file overwrites automatically.

I just create dfhack_onLoad.init in df folder and put next line to my dfhack.init:
Code: [Select]
:lua dfhack.onStateChange.onloadscript = function(state) if state == SC_WORLD_LOADED then print(dfhack.run_command('script dfhack_onLoad.init')) end end

Spoiler (click to show/hide)

Interesting, so you prefer for your dwarves to just continue digging as they find interesting material... do you ever run into issues where they dig new access points to the fortress?  Undefended ones?

And do you know why workflow drink doesn't work?
Title: Re: DFHack 0.40.10-r1
Post by: kr0pper on August 31, 2014, 02:10:12 pm
Interesting, so you prefer for your dwarves to just continue digging as they find interesting material... do you ever run into issues where they dig new access points to the fortress?  Undefended ones?
And do you know why workflow drink doesn't work?

I'm always can do "digFlood digAll0", and back again with "script digflood.txt"

Maybe you need use "workflow amount DRINK 10000 1" (with caps) because it it raw token?
Taken from my working workflow.txt script loaded from my dfhack_onLoad.init
Title: Re: DFHack 0.40.10-r1
Post by: Arumba on August 31, 2014, 02:44:02 pm
Interesting, so you prefer for your dwarves to just continue digging as they find interesting material... do you ever run into issues where they dig new access points to the fortress?  Undefended ones?
And do you know why workflow drink doesn't work?

I'm always can do "digFlood digAll0", and back again with "script digflood.txt"

Maybe you need use "workflow amount DRINK 10000 1" (with caps) because it it raw token?
Taken from my working workflow.txt script loaded from my dfhack_onLoad.init

Excellent, this worked great and I can now set things to load into workflow from the start.  One more thing, if possible... I'd like workflow to load set parameters on initial embark, but not every time I load the game up.  (This is so that I can have a default state for new fortresses, but if I change things manually while playing it doesn't undo my changes every time I reload) 

Do you know of a way to modify the script so it only fires on initial embark?
Title: Re: DFHack 0.40.10-r1
Post by: kr0pper on August 31, 2014, 03:11:44 pm
Do you know of a way to modify the script so it only fires on initial embark?

Hmmm, don't understand.

Do you want to load script only one time when you desired?
Create a file named my_embark.txt in df folder, add all your wishes there, like:
Spoiler (click to show/hide)

and just run it in dfhack console after embark, eg:
Code: [Select]
script my_embark.txt

PS: And you don't need "load into workflow from the start" - workflow saves all jobs into df save.
Title: Re: DFHack 0.40.10-r1
Post by: fricy on August 31, 2014, 03:19:11 pm
Do you know of a way to modify the script so it only fires on initial embark?
Hmmm, don't understand.
Do you want to load script only one time when you desired?
Create a file named my_embark.txt in df folder, add all your wishes there, like:
Spoiler (click to show/hide)
and just run it in dfhack console after embark, eg:
Code: [Select]
script my_embark.txtPS: And you don't need "load into workflow from the start" - workflow saves all jobs into df save.

Like this:

Is there a way to trigger a script to only run once on initial world load instead of on every load?
In lua
Spoiler (click to show/hide)
'value' could be any true value, it's not actually even saving the boolean 'true', but rather an empty string.  Which is a true value.
Title: Re: DFHack 0.40.10-r1
Post by: jwhite.df on August 31, 2014, 08:10:06 pm
Is 3dveins supposed to work? I've run it in the latest Starter Pack and it looks like it's frozen the app (I've let it sit for over an hour at this point).
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on August 31, 2014, 08:18:39 pm
Is 3dveins supposed to work? I've run it in the latest Starter Pack and it looks like it's frozen the app (I've let it sit for over an hour at this point).
I haven't had any problems with it. Is it displaying any progress? What's your local map size?
Title: Re: DFHack 0.40.10-r1
Post by: jwhite.df on August 31, 2014, 09:36:46 pm
Is 3dveins supposed to work? I've run it in the latest Starter Pack and it looks like it's frozen the app (I've let it sit for over an hour at this point).
I haven't had any problems with it. Is it displaying any progress? What's your local map size?

No progress. 129x129 (medium) with a 4x4 embark.

Just tried again. Same thing. Grey'd out screen, "collecting statistics" on the dfhack window, and ... no action.
Title: Re: DFHack 0.40.10-r1
Post by: vjek on August 31, 2014, 10:10:40 pm
Regarding forum-dwarves.lua included in DFHack 0.40.10-r1, with vanilla DF 0.40.10:
Code: [Select]
[DFHack]# forum-dwarves
<viewscreen_textviewerst: 0x15481930>
child                    = nil
parent                   = <viewscreen_itemst: 0x14d2da10>
breakdown_level          = 0
option_key_pressed       = 0
title                    =   (prepared llama heart [5])
title_colors             =
src_text                 = <vector<string*>: 0x15481978>
outvar_type              =
outvar_name              =
meeting_context          = <meeting_context: 0x154819c0>
help_filename            = text_viewer
page_filename            =
formatted_text           = <vector<viewscreen_textviewerst.T_formatted_text*>: 0x15481a08>
hyperlinks               = <vector<char*>: 0x15481a18>
logged_error             = 0
scroll_pos               = 0
cursor_line              = 0
pause_depth              = 0
<viewscreen_textviewerst.T_formatted_text: 0x16dd8c60>
text                     = <char: 0x155ef618>
format                   = <char: 0x155ef420>
flags                    = <viewscreen_textviewerst.T_formatted_text.T_flags: 0x16dd8c68>
pause_depth              = 0
return_val               = -1
indent                   = 0
<char: 0x155ef618>
value                    = 84
...Documents\df\df_40_10_win\hack\scripts/forum-dwarves.lua:73: bad argument #1 to 'find' (string ex
pected, got userdata)
stack traceback:
        [C]: in function 'find'
        ...Documents\df\df_40_10_win\hack\scripts/forum-dwarves.lua:73: in function 'format_for_foru
m'
        ...Documents\df\df_40_10_win\hack\scripts/forum-dwarves.lua:116: in main chunk
        (...tail calls...)
That happens regardless of the item being examined; the script just fails.
Title: Re: DFHack 0.40.10-r1
Post by: muppet9876 on September 01, 2014, 08:00:49 am
3dveins had never worked for me in DFHack40.08-r2 or DFHack40.10-r1. I always use a 4x4 embark (I honestly never thought of trying another lol). It output "Collecting statistics" in the dfhack console then 2-5 secs later the windows crash screen came up for Dwarf Fortress.exe. I've tried it on 6 embarks over 2 (medium all the way) worlds, that were genned on 40.08, using PE's starter packs.

I've downloaded PE's starter pack 40.10 r4 and genned a new medium world on it. Tried 1 3x3 embark(at the place the cursor starts) 3dveins completes successfully. Tried 1 4x4 embark(same place), completes successfully. Tried 2 more embarks 4x4 at some random places on the 40.10 genned world with no issues too.

I tried copying over my 40.08 genned map, loaded up a just arrived save, same old crash. Maybe it is just a problem with some worlds or something that was fixed in 40.10 either in DF or dfhack or the plugin.
Title: Re: DFHack 0.40.10-r1
Post by: IndigoFenix on September 01, 2014, 08:10:37 am
So... has anyone figured out how to add new tiles to a tree yet?

I can change a tile to a branch/twig/trunk tile, but I can't find where the trees themselves store their shape data, so the new tiles are just generic branches/twigs/trunks without a species, not actually a part of any tree.

The most promising spot I've found is df.global.world.map.map_block_columns[c].plants[p].tree_info.body.value, but that's just a list of booleans where it looks like there ought to be arrays...

Anyone able to help?  I want to make a tree-manipulating magic system but right now I'm stumped...
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on September 01, 2014, 09:02:23 am
3dveins had never worked for me in DFHack40.08-r2 or DFHack40.10-r1. I always use a 4x4 embark (I honestly never thought of trying another lol). It output "Collecting statistics" in the dfhack console then 2-5 secs later the windows crash screen came up for Dwarf Fortress.exe. I've tried it on 6 embarks over 2 (medium all the way) worlds, that were genned on 40.08, using PE's starter packs.

I've downloaded PE's starter pack 40.10 r4 and genned a new medium world on it. Tried 1 3x3 embark(at the place the cursor starts) 3dveins completes successfully. Tried 1 4x4 embark(same place), completes successfully. Tried 2 more embarks 4x4 at some random places on the 40.10 genned world with no issues too.

I tried copying over my 40.08 genned map, loaded up a just arrived save, same old crash. Maybe it is just a problem with some worlds or something that was fixed in 40.10 either in DF or dfhack or the plugin.
It could be a world-specific issue - there's no difference between the DFHack build from this thread and the one included in PE's pack.

So... has anyone figured out how to add new tiles to a tree yet?
I don't think so - the only solution I'm aware of for growing trees is to set a timer to one tick before they should grow. https://github.com/DFHack/df-structures/blob/master/df.plants.xml#L49 seems relevant.
Title: Re: DFHack 0.40.10-r1
Post by: Rose on September 01, 2014, 09:59:30 am
So... has anyone figured out how to add new tiles to a tree yet?

I can change a tile to a branch/twig/trunk tile, but I can't find where the trees themselves store their shape data, so the new tiles are just generic branches/twigs/trunks without a species, not actually a part of any tree.

The most promising spot I've found is df.global.world.map.map_block_columns[c].plants[p].tree_info.body.value, but that's just a list of booleans where it looks like there ought to be arrays...

Anyone able to help?  I want to make a tree-manipulating magic system but right now I'm stumped...
df.global.world.map.map_block_columns[c].plants[p].tree_info.body is the right place, but you can't really properly access it in lua, because lua can't really do two dimensional arrays. it's actually tree_info.body[z][x+y*width].bits.whatever
The bits correspond to the thickness of the branches on that tile, ranging from twigs, up to trunk. the game will show the biggest size of the branches there, and there's a blocked flag for when there should be a branch there but there's something in the way.
I'm not sure what's the difference between the different thick branches, but they might be directions, I'm not sure.
Title: Re: DFHack 0.40.10-r1
Post by: jwhite.df on September 01, 2014, 10:07:56 am
3dveins had never worked for me in DFHack40.08-r2 or DFHack40.10-r1. I always use a 4x4 embark (I honestly never thought of trying another lol). It output "Collecting statistics" in the dfhack console then 2-5 secs later the windows crash screen came up for Dwarf Fortress.exe. I've tried it on 6 embarks over 2 (medium all the way) worlds, that were genned on 40.08, using PE's starter packs.

I've downloaded PE's starter pack 40.10 r4 and genned a new medium world on it. Tried 1 3x3 embark(at the place the cursor starts) 3dveins completes successfully. Tried 1 4x4 embark(same place), completes successfully. Tried 2 more embarks 4x4 at some random places on the 40.10 genned world with no issues too.

I tried copying over my 40.08 genned map, loaded up a just arrived save, same old crash. Maybe it is just a problem with some worlds or something that was fixed in 40.10 either in DF or dfhack or the plugin.

Interesting. I'm using r3, so maybe I'll try an increment.
Title: Re: DFHack 0.40.10-r1
Post by: jwhite.df on September 01, 2014, 11:50:29 am
3dveins had never worked for me in DFHack40.08-r2 or DFHack40.10-r1. I always use a 4x4 embark (I honestly never thought of trying another lol). It output "Collecting statistics" in the dfhack console then 2-5 secs later the windows crash screen came up for Dwarf Fortress.exe. I've tried it on 6 embarks over 2 (medium all the way) worlds, that were genned on 40.08, using PE's starter packs.

I've downloaded PE's starter pack 40.10 r4 and genned a new medium world on it. Tried 1 3x3 embark(at the place the cursor starts) 3dveins completes successfully. Tried 1 4x4 embark(same place), completes successfully. Tried 2 more embarks 4x4 at some random places on the 40.10 genned world with no issues too.

I tried copying over my 40.08 genned map, loaded up a just arrived save, same old crash. Maybe it is just a problem with some worlds or something that was fixed in 40.10 either in DF or dfhack or the plugin.

Interesting. I'm using r3, so maybe I'll try an increment.

Nope. Same problem.
Title: Re: DFHack 0.40.10-r1
Post by: Teneb on September 01, 2014, 01:04:54 pm
Could anyone explain how I go about using item-trigger in the RAWs? I can't seem to find anything on it other than an explanation of its function. My apologies if I am missing anything.

EDIT: More broadly, are there examples or a how-to-use the modtools (https://github.com/DFHack/dfhack/blob/master/Readme.rst#modtools) mentioned in the readme? Because the readme itself only explains what they do, not how to apply them.
Title: Re: DFHack 0.40.10-r1
Post by: Roses on September 01, 2014, 02:05:09 pm
Could anyone explain how I go about using item-trigger in the RAWs? I can't seem to find anything on it other than an explanation of its function. My apologies if I am missing anything.

EDIT: More broadly, are there examples or a how-to-use the modtools (https://github.com/DFHack/dfhack/blob/master/Readme.rst#modtools) mentioned in the readme? Because the readme itself only explains what they do, not how to apply them.

The various modtools were discussed here (http://www.bay12forums.com/smf/index.php?topic=139781.0). I don't believe that there has been much other information about them, but you basically don't modify anything in the raws, you put everything into onLoad.init now, example syntax from expwnent's post

Code: [Select]
# example syntax
modtools/item-trigger -material INORGANIC:GOLD -command [ devel/printArgs "gold item equipped!" ] -onEquip
modtools/item-trigger -material CREATURE_MAT:DWARF:SKIN -command [ devel/printArgs "dwarf skin item? gross. put it back down." ] -onEquip
modtools/item-trigger -itemType ITEM_WEAPON_SPEAR -onStrike -command [ devel/printArgs "spear strikes target!" ]
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on September 01, 2014, 02:38:10 pm
Basically the only documentation right now is modtools/blah -help and the readme. Do you have any specific questions about how to use them? I'm not sure what you want.
Title: Re: DFHack 0.40.10-r1
Post by: thistleknot on September 01, 2014, 05:36:41 pm
Anyone know of some symbol offsets I can manipulate to emulate nanofortress?
Use "embark-tools".
Edit: To be specific, "embark-tools enable nano".

Code: [Select]
embark_site is not a recognized command.
Invalid hotkey command: 'embark_site nano'


actually... seems to not error out, but I still don't end up with a 1x1

I'm looking at how I used it in mw v5.10

dfhack.init

Code: [Select]
keybinding add Alt-N@choose_start_site "embark_site nano"
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on September 01, 2014, 05:44:46 pm
I said "embark-tools enable nano", not "embark_site nano". embark-tools is a plugin new in r5 (an improved version of embark_site, plus a few other features).
Title: Re: DFHack 0.40.10-r1
Post by: thistleknot on September 01, 2014, 05:47:39 pm
I know what you said... [miscommunication on what I was stuck on.  I tried your command, and then looked at how pre version was implemented... then you noted the command line change]

It's working.

Pasting the command in, and resizing **down** my embark size seemed to work.

Glad to know the command line updates :)
Title: Re: DFHack 0.40.10-r1
Post by: Teneb on September 01, 2014, 05:54:21 pm
Basically the only documentation right now is modtools/blah -help and the readme. Do you have any specific questions about how to use them? I'm not sure what you want.
Just wanted to know how to use them. Thanks for the help.

Actually, another question:
Could anyone explain how I go about using item-trigger in the RAWs? I can't seem to find anything on it other than an explanation of its function. My apologies if I am missing anything.

EDIT: More broadly, are there examples or a how-to-use the modtools (https://github.com/DFHack/dfhack/blob/master/Readme.rst#modtools) mentioned in the readme? Because the readme itself only explains what they do, not how to apply them.

The various modtools were discussed here (http://www.bay12forums.com/smf/index.php?topic=139781.0). I don't believe that there has been much other information about them, but you basically don't modify anything in the raws, you put everything into onLoad.init now, example syntax from expwnent's post

Code: [Select]
# example syntax
modtools/item-trigger -material INORGANIC:GOLD -command [ devel/printArgs "gold item equipped!" ] -onEquip
modtools/item-trigger -material CREATURE_MAT:DWARF:SKIN -command [ devel/printArgs "dwarf skin item? gross. put it back down." ] -onEquip
modtools/item-trigger -itemType ITEM_WEAPON_SPEAR -onStrike -command [ devel/printArgs "spear strikes target!" ]
Where is onLoad.init located? Checked the dfhack files and couldn't find it. Assuming I have to create it, where does it go?
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on September 01, 2014, 06:07:49 pm
data/save/regionX/raw/onLoad.init
Title: Re: DFHack 0.40.10-r1
Post by: Teneb on September 01, 2014, 06:09:50 pm
But if it only appears after genning a world, how can I, for example, set a specific god to be created for every world with moddable-gods?
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on September 01, 2014, 06:20:07 pm
But if it only appears after genning a world, how can I, for example, set a specific god to be created for every world with moddable-gods?
You could create an onLoad.init in DF/raw, which should be copied to the 'raw' folder of new saves, but this won't apply to existing saves. I'm hoping to implement a global onLoadWorld.init in the next version of DFHack, but something like this should work for now (placed in dfhack.init, which loads onLoad.init in the main DF directory):
Code: [Select]
:lua dfhack.onStateChange.foo = function(state) if state == SC_WORLD_LOADED then print((dfhack.run_command('script onLoad.init'))) end end
Title: Re: DFHack 0.40.10-r1
Post by: Roses on September 01, 2014, 06:35:20 pm
Placing it in dfhack.init will work as a global onLoad.init, placing onLoad.init into the objects/raw/onLoad.init will mean that any world you generate will get a copy of it put into that worlds file.
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on September 01, 2014, 06:54:35 pm
Placing it in dfhack.init will work as a global onLoad.init, placing onLoad.init into the objects/raw/onLoad.init will mean that any world you generate will get a copy of it put into that worlds file.
If moddable-gods needs to be run when a world is loaded, it won't work in dfhack.init (I'm not sure if this is the case, though).
Also, it's "raw/onLoad.init", not "raw/objects/onLoad.init" (see here (https://github.com/DFHack/dfhack/blob/master/library/Core.cpp#L1435)). Assuming this was a typo.
Title: Re: DFHack 0.40.10-r1
Post by: Teneb on September 01, 2014, 07:34:07 pm
My thanks for your help. I think I understand now. Are there any side effects of both creating a onLoad.int in raw and placing the command on dfhack.init as well?
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on September 02, 2014, 04:20:40 am
It would run twice if you do it that way.
Title: Re: DFHack 0.40.10-r1
Post by: vjek on September 02, 2014, 10:00:22 am
I'm looking for information regarding if it's possible to enumerate the effects of Evil biomes via DFHack, and/or if anyone has done any investigation into how this might be possible.

Specifically, I'm looking to determine, proir to embark, if a region/tile/area with an evil biome has blood rain, nasty clouds, re-animation, husking, etc.  Much the same way that prospect and probe provide information, today, ideally.

Even if there is currently no script or tool that does it, does anyone know of where in the structures one might start to look to enumerate or identify these effects?  Thanks in advance for any direction or advice.
Title: Re: DFHack 0.40.10-r1
Post by: Teneb on September 02, 2014, 11:16:32 am
Apologies if I am overlooking something extremely simple, but I am having a problem with the moddable-gods script. More specifically, dfhack claims that "template god" is missing. This template, however, is nowhere to be seen, nor are there any hints of how to create it in the file. Keep in mind I tried to use the script both through onLoad.init as well as dfhack.init (not at the same time, however).
Title: Re: DFHack 0.40.10-r1
Post by: Putnam on September 02, 2014, 11:25:21 am
The template god is the first god that is found through a linear search of the hist fig vector.

Basically, either your world's got no gods or the flag that determines whether a god is a god has been changed in 0.40.
Title: Re: DFHack 0.40.10-r1
Post by: Teneb on September 02, 2014, 11:36:55 am
The template god is the first god that is found through a linear search of the hist fig vector.

Basically, either your world's got no gods or the flag that determines whether a god is a god has been changed in 0.40.
The worlds genned to test wheter or not I had used the script correctly had gods, so I guess the latter.
Title: Re: DFHack 0.40.10-r1
Post by: AMTiger on September 02, 2014, 10:59:42 pm
 Can you use DFHack to add a syndrome to the selected dwarf?
i.e. to turn a dwarf into a vampire
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on September 03, 2014, 03:19:41 am
Yes, but the syndrome has to have a name. See the modtools/add-syndrome script for details.
Title: Re: DFHack 0.40.10-r1
Post by: AMTiger on September 03, 2014, 03:25:11 am
Yes, but the syndrome has to have a name. See the modtools/add-syndrome script for details.

 Thanks, I'm assuming the name given in the LegendsViewer would work.
 Also, it was called add-syndrome?!
 I ctrl-f'd all over the place, well sorry for having missed it with so obvious a name.
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on September 03, 2014, 09:09:10 am
It's fine. A lot of things are obvious once you know them.
Title: Re: DFHack 0.40.10-r1
Post by: ancient_vampire on September 03, 2014, 09:20:06 am
does anybody know, how to turn off those "urist is now a rusty ..." announcements?
Title: Re: DFHack 0.40.10-r1
Post by: fricy on September 03, 2014, 09:46:56 am
does anybody know, how to turn off those "urist is now a rusty ..." announcements?
I think those announcements are generated by the soundsense script. Open dfhack.init, and deactivate the line with #. Or change it to soundsense-season.
Title: Re: DFHack 0.40.10-r1
Post by: ancient_vampire on September 03, 2014, 10:04:14 am
does anybody know, how to turn off those "urist is now a rusty ..." announcements?
I think those announcements are generated by the soundsense script. Open dfhack.init, and deactivate the line with #. Or change it to soundsense-season.

thanks, found those messages in soundsense.lua
Title: Re: DFHack 0.40.10-r1
Post by: Nimrod on September 04, 2014, 01:31:36 am
Hey guys!

Since I dont seem to get any more sieges i would like to trigger one (or more) via dfhack.
I found old scripts "force" and "callsiege" but they don't seem to work anymore.

Am I missing something? Any help will be appreciated.

Here is the error 'force' gives me
Spoiler (click to show/hide)

cheers
Title: Re: DFHack 0.40.10-r1
Post by: Putnam on September 04, 2014, 02:04:10 am
Siege forcing doesn't work anymore.
Title: Re: DFHack 0.40.10-r1
Post by: Nimrod on September 04, 2014, 02:18:53 am
Siege forcing doesn't work anymore.

Meh. Thanks for the answer!

Since I havent gotten any more sieges after the first one (I am the capital and naughty rich by now) I guess I am bugged :(
Title: Re: DFHack 0.40.10-r1
Post by: Timeless Bob on September 04, 2014, 02:23:14 am
'mapexport' doesn't seem to be recognized in 40.10 any more.  Ah well.  I guess the venerable 'Overseer 0.7' has to be shelved for good now.
Title: Re: DFHack 0.40.10-r1
Post by: Quietust on September 04, 2014, 08:56:28 am
'mapexport' doesn't seem to be recognized in 40.10 any more.  Ah well.  I guess the venerable 'Overseer 0.7' has to be shelved for good now.
That's because it was disabled due to large trees changing the map format significantly - even if you were able to export it, those old programs wouldn't understand the new tiles anyways.
Title: Re: DFHack 0.40.10-r1
Post by: Roses on September 04, 2014, 10:07:53 am
Is it possible to add an entity to an on-going game (not a completely new one, one that was in the raws but just didn't have a biome set or some such)? I know they can be accessed and changed through DFHack, but was wondering if new ones could be created.
Title: Re: DFHack 0.40.10-r1
Post by: vjek on September 04, 2014, 11:59:45 am
I've done some experimentation and discovered the following (in 40.10):
If a plant is not found on an embark, that is, if the biome doesn't support it, even if you have seeds, you can't plant it.

In particular, if you have Hemp seeds, they don't appear in the list of plants you can sow on a surface field, unless Hemp could grow there "naturally".

I'd like to know if DFHack can adjust/expand the list of available plants that can be sown, currently, or if this would be new functionality?  In short, I'd like to be able to plant with the seeds I have.

Specifics:
These crops seem to always be available to be sown, on the surface/above ground, even if you don't have seeds:
Alfalfa
Barley
Blade Weed
Caper bushes
Fisher berries
Hide root
Lentil plants
Longland grass
Potato plants
Prickle berries
Rat weed
Red spinach
Rope reeds
Rye
Sliver barbs
Strawberry plants
Sun Berries
Whip vines

while others (like cotton, hemp, and others) are biome dependent (or have some other key to unlock their availability)
Title: Re: DFHack 0.40.10-r1
Post by: danaris on September 04, 2014, 01:44:54 pm
I believe I now have reasonably working builds of DFHack both with and without Stonesense for 0.40.11.

With Stonesense (http://topazgryphon.org/~tcollett/df/dfhack-0.40.11-b1-Darwin-stonesense.zip)
Plain DFHack (http://topazgryphon.org/~tcollett/df/dfhack-0.40.11-b1-Darwin.zip)

I think I've chased down and squashed all the bugs that were plaguing the OS X build of Stonesense previously. However, I would appreciate some feedback on it, whether it works or not.
Title: Re: DFHack 0.40.10-r1
Post by: Roses on September 04, 2014, 01:48:42 pm
I've done some experimentation and discovered the following (in 40.10):
If a plant is not found on an embark, that is, if the biome doesn't support it, even if you have seeds, you can't plant it.

In particular, if you have Hemp seeds, they don't appear in the list of plants you can sow on a surface field, unless Hemp could grow there "naturally".

I'd like to know if DFHack can adjust/expand the list of available plants that can be sown, currently, or if this would be new functionality?  In short, I'd like to be able to plant with the seeds I have.

Specifics:
These crops seem to always be available to be sown, on the surface/above ground, even if you don't have seeds:
Alfalfa
Barley
Blade Weed
Caper bushes
Fisher berries
Hide root
Lentil plants
Longland grass
Potato plants
Prickle berries
Rat weed
Red spinach
Rope reeds
Rye
Sliver barbs
Strawberry plants
Sun Berries
Whip vines

while others (like cotton, hemp, and others) are biome dependent (or have some other key to unlock their availability)

Thats how it has always been, there is the [BIOME] token in the plant_standard.txt raws. Changing those will allow you to plant in different biomes.
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on September 04, 2014, 02:24:10 pm
I've done some experimentation and discovered the following (in 40.10):
If a plant is not found on an embark, that is, if the biome doesn't support it, even if you have seeds, you can't plant it.

In particular, if you have Hemp seeds, they don't appear in the list of plants you can sow on a surface field, unless Hemp could grow there "naturally".

I'd like to know if DFHack can adjust/expand the list of available plants that can be sown, currently, or if this would be new functionality?  In short, I'd like to be able to plant with the seeds I have.

Specifics:
These crops seem to always be available to be sown, on the surface/above ground, even if you don't have seeds:
Alfalfa
Barley
Blade Weed
Caper bushes
Fisher berries
Hide root
Lentil plants
Longland grass
Potato plants
Prickle berries
Rat weed
Red spinach
Rope reeds
Rye
Sliver barbs
Strawberry plants
Sun Berries
Whip vines

while others (like cotton, hemp, and others) are biome dependent (or have some other key to unlock their availability)

Thats how it has always been, there is the [BIOME] token in the plant_standard.txt raws. Changing those will allow you to plant in different biomes.

I think vjek was asking if there is a way for DFHack to insert BIOME tags into the plants during a game.  Though that might be possible, it would be much simpler to save the game, edit the raws, and resume.
Title: Re: DFHack 0.40.10-r1
Post by: fricy on September 04, 2014, 03:32:37 pm
I believe I now have reasonably working builds of DFHack both with and without Stonesense for 0.40.11.
I think I've chased down and squashed all the bugs that were plaguing the OS X build of Stonesense previously. However, I would appreciate some feedback on it, whether it works or not.
Can't load plugin. :(
Title: Re: DFHack 0.40.10-r1
Post by: danaris on September 04, 2014, 03:33:28 pm
I believe I now have reasonably working builds of DFHack both with and without Stonesense for 0.40.11.
I think I've chased down and squashed all the bugs that were plaguing the OS X build of Stonesense previously. However, I would appreciate some feedback on it, whether it works or not.
Can't load plugin. :(

Can you look in stderr.log and tell me what it says about failing to load the plugin?
Title: Re: DFHack 0.40.10-r1
Post by: lethosor on September 04, 2014, 03:33:42 pm
I believe I now have reasonably working builds of DFHack both with and without Stonesense for 0.40.11.
I think I've chased down and squashed all the bugs that were plaguing the OS X build of Stonesense previously. However, I would appreciate some feedback on it, whether it works or not.
Can't load plugin. :(
Anything in stderr.log? Do you have libfreetype accessible?
(Edit: Ninja'd)
Title: Re: DFHack 0.40.10-r1
Post by: fricy on September 04, 2014, 03:46:14 pm
Errorlog:
dlopen(/Dwarf Fortress/hack/plugins/stonesense.plug.so, 2): Library not loaded: @executable_path/hack/libs/libfreetype.6.dylib
Can't load plugin /Dwarf Fortress/hack/plugins/stonesense.plug.so

libfreetye is at the correct location, tried replacing with another one, no change.

Code: [Select]
otool -L stonesense.plug.so:
libdfhack.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
@executable_path/hack/libs/liballegro.5.0.dylib (compatibility version 5.0.0, current version 5.0.9)
@executable_path/hack/libs/liballegro_primitives.5.0.dylib (compatibility version 5.0.0, current version 5.0.9)
@executable_path/hack/libs/liballegro_font.5.0.dylib (compatibility version 5.0.0, current version 5.0.9)
@executable_path/hack/libs/liballegro_color.5.0.dylib (compatibility version 5.0.0, current version 5.0.9)
@executable_path/hack/libs/liballegro_image.5.0.dylib (compatibility version 5.0.0, current version 5.0.9)
@executable_path/hack/libs/liballegro_ttf.5.0.dylib (compatibility version 5.0.0, current version 5.0.9)
libprotobuf-lite.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/opt/local/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.20.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 2577.0.0)
/opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
Title: Re: DFHack 0.40.10-r1
Post by: Euius on September 04, 2014, 11:46:29 pm
Does anybody know where the dwarf assigned a a trainer to an animal is stored (and/or when it's "Any")

It doesn't appear to be anywhere on the unit itself. 

unit.relations.following isn't it. (that's just which ever dwarf last drug them to the pasture)
unit.specific_refs is empty
unit.general_refs just has a reference for the pasture (and oddly, nemesis, which is not a dwarf)

Nor is it in df.global.ui (which is where kitchen and stone lists are)

I even checked the job list, but there is no job created except during the actual training.
Title: Re: DFHack 0.40.10-r1
Post by: Putnam on September 04, 2014, 11:51:17 pm
Nemesis is probably the animal itself; not sure exactly why it's called that, but it is called that by DF itself.

I would also look in the dwarf.
Title: Re: DFHack 0.40.10-r1
Post by: Quietust on September 05, 2014, 08:08:38 am
Nemesis is probably the animal itself; not sure exactly why it's called that, but it is called that by DF itself.
In Dwarf Fortress, a "nemesis" record is what binds a Unit and a Historical Figure together and keeps track of where the unit can be found (namely, which unit-*.dat file contains it). If a unit-*.dat file gets corrupted or deleted, then when the game tries to load a particular unit from it (and fails) it terminates with a "Nemesis Unit Load Failed" error message.
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on September 05, 2014, 10:06:09 am
Nemesis is probably the animal itself; not sure exactly why it's called that, but it is called that by DF itself.
In Dwarf Fortress, a "nemesis" record is what binds a Unit and a Historical Figure together and keeps track of where the unit can be found (namely, which unit-*.dat file contains it). If a unit-*.dat file gets corrupted or deleted, then when the game tries to load a particular unit from it (and fails) it terminates with a "Nemesis Unit Load Failed" error message.

Ah, thanks for that.  When I pared down a spawn-unit script to make just animals, I just removed the entire nemesis portion because I didn't think an unintelligent creature could consciously decide that someone is an enemy (Jaws and Moby Dick notwithstanding).  Some animals commit enough mischief to get named, though I'm not sure if that makes them historical figures or not.

Spoiler: tesb-spawn.lua (click to show/hide)
Title: Re: DFHack 0.40.10-r1
Post by: Quietust on September 05, 2014, 10:46:25 am
When I pared down a spawn-unit script to make just animals, I just removed the entire nemesis portion because I didn't think an unintelligent creature could consciously decide that someone is an enemy (Jaws and Moby Dick notwithstanding).
If you're going to remove the Nemesis portion, then you must also remove the Historical Figure information with it, since the game will likely get very confused if it finds a historical figure with no nemesis record, potentially by crashing outright. Once your animal kills a historical figure, the game will automatically make it into one (and create a Nemesis record for it as well).
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on September 05, 2014, 11:04:30 am
When I pared down a spawn-unit script to make just animals, I just removed the entire nemesis portion because I didn't think an unintelligent creature could consciously decide that someone is an enemy (Jaws and Moby Dick notwithstanding).
If you're going to remove the Nemesis portion, then you must also remove the Historical Figure information with it, since the game will likely get very confused if it finds a historical figure with no nemesis record, potentially by crashing outright. Once your animal kills a historical figure, the game will automatically make it into one (and create a Nemesis record for it as well).
Thanks for the help, crashing makes for a poor player experience.  I'm fine with these guys being simple non-historical animals, so I'll wade through the script and see if I can prune out all of the historical figure parts.

Eventually, I'll try to generalize this into a generic animal spawner and release it as a stand-alone script.  But first I'm trying to get the rest of the mod released, and then I'll need to figure out how to extract castes and population ratios without hard-coding them into the script.
Title: Re: DFHack 0.40.10-r1
Post by: Roses on September 05, 2014, 11:30:51 am
Couple questions...

1. Is it possible to pause world generation and run a script in the middle of it? Namely in between when civilizations are placed and history starts running.
2. Has anyone played with adding noble positions using DFHack? It seems like all the pertinent information is there, but I am unsure how it would effect gameplay and if the position would be used by the computer or would even be usable by the players.
3. Similarly, Ethics, is there any effect on gameplay, changing them in game?
4. I know there is a quick way to find material id and index using df.mat_find (or whatever the function is, not at my DF computer right now), is there a similar way to find a creatures id and caste id? How about for things like leathers? (I am looking to be able to add and remove all the different types of items and materials from an entity using DFHack, and to do that I need to be able to find the correct indices for the things to add/remove).
Title: Re: DFHack 0.40.10-r1
Post by: Euius on September 05, 2014, 01:08:36 pm
When I pared down a spawn-unit script to make just animals, I just removed the entire nemesis portion because I didn't think an unintelligent creature could consciously decide that someone is an enemy (Jaws and Moby Dick notwithstanding).
If you're going to remove the Nemesis portion, then you must also remove the Historical Figure information with it, since the game will likely get very confused if it finds a historical figure with no nemesis record, potentially by crashing outright. Once your animal kills a historical figure, the game will automatically make it into one (and create a Nemesis record for it as well).


FWIW, the animal I was referring too is not a historical figure. In fact, it was a wild boar piglet, which was born on the map and is guaranteed to not have killed anything, much less anything historical.  However, the wild boar does in fact have a hist_figure_id set

I thought I had tracked down the training info in unit.status.misc_traits, where there is 3 undefined traits that are on the animal (ids 31, 54, and 61) but then I found that they are set on purely domestic animals as well - but not all of them, not even all of the same breed/caste
Title: Re: DFHack 0.40.10-r1
Post by: Quietust on September 05, 2014, 01:41:37 pm
FWIW, the animal I was referring too is not a historical figure. In fact, it was a wild boar piglet, which was born on the map and is guaranteed to not have killed anything, much less anything historical.  However, the wild boar does in fact have a hist_figure_id set
If a creature's hist_figure_id is not equal to -1, then by definition it is a historical figure. It's possible that the act of training it makes it into a hist figure, perhaps in order to assign entity/site membership to it.
Title: Re: DFHack 0.40.10-r1
Post by: Putnam on September 05, 2014, 01:44:13 pm
Yeah, not sure where people get this idea that hist figures have to be legendary in some way (I.E flashing or having killed something important). It's certainly not the case--all of your fortress citizens are hist figures, every single person your adventurer talks to becomes a hist figure right then and there if they weren't already, among other things.
Title: Re: DFHack 0.40.10-r1
Post by: Rumrusher on September 05, 2014, 02:33:26 pm
Yeah, not sure where people get this idea that hist figures have to be legendary in some way (I.E flashing or having killed something important). It's certainly not the case--all of your fortress citizens are hist figures, every single person your adventurer talks to becomes a hist figure right then and there if they weren't already, among other things.
also the whole historical figure nemesis bit is there in case you want to jump into their bodies for adventure mode and not having the game horribly bug out doing so.
oh and I thought I already fix spawn units?
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on September 05, 2014, 03:40:40 pm
Yeah, not sure where people get this idea that hist figures have to be legendary in some way (I.E flashing or having killed something important). It's certainly not the case--all of your fortress citizens are hist figures, every single person your adventurer talks to becomes a hist figure right then and there if they weren't already, among other things.
also the whole historical figure nemesis bit is there in case you want to jump into their bodies for adventure mode and not having the game horribly bug out doing so.
oh and I thought I already fix spawn units?

That is entirely possible.  I was working off an old 34.11r3 script that I then pruned (incorrectly it turns out) and then tacked on a couple bits specific to the mod I'm working on.

Is there a unit spawning script for 40?
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on September 05, 2014, 03:44:31 pm
Yeah, not sure where people get this idea that hist figures have to be legendary in some way (I.E flashing or having killed something important). It's certainly not the case--all of your fortress citizens are hist figures, every single person your adventurer talks to becomes a hist figure right then and there if they weren't already, among other things.
So these creatures might be spawned as wild animals (civ -1) or already tame (members of the player's civ).  If I understand you and Quietust correctly, they should spawn historical with nemesis data.  Having a few wild animals in there won't crash Legends.

For the stretch goal, I'd like Legends to say that the creature "emerged" in year X rather than "was born" but that is about eighty-third on the priority list.
Title: Re: DFHack 0.40.10-r1
Post by: Hetairos on September 05, 2014, 04:37:27 pm
Is there a DFHack 0.34.11 r5-compatible script which makes injured but conscious dwarves take care of themselves?
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on September 05, 2014, 05:08:49 pm
There's fix/feeding-timers.
Title: Re: DFHack 0.40.10-r1
Post by: StagnantSoul on September 05, 2014, 07:19:03 pm
Umm... What do I put in DFHack to embark anywhere?
Title: Re: DFHack 0.40.10-r1
Post by: Nopenope on September 05, 2014, 07:55:44 pm
Use embark-tools in the console. But it's not enable by default, so you have to type "embark-tools enable" first.

Speaking of which, the default dfhack.init-example file is severely outdated. The hotkeys plugin is simply missing, workflow and embark-tools aren't enabled by default, the zone/mousequery/etc. line is commented out for no reason; it would make things much less tedious for the end user if most features that objectively add to the game were enabled by default (and better yet, had default keybindings associated to them so they'd be documented somewhere).
Title: Re: DFHack 0.40.10-r1
Post by: Rumrusher on September 07, 2014, 02:15:36 am
Yeah, not sure where people get this idea that hist figures have to be legendary in some way (I.E flashing or having killed something important). It's certainly not the case--all of your fortress citizens are hist figures, every single person your adventurer talks to becomes a hist figure right then and there if they weren't already, among other things.
also the whole historical figure nemesis bit is there in case you want to jump into their bodies for adventure mode and not having the game horribly bug out doing so.
oh and I thought I already fix spawn units?

That is entirely possible.  I was working off an old 34.11r3 script that I then pruned (incorrectly it turns out) and then tacked on a couple bits specific to the mod I'm working on.

Is there a unit spawning script for 40?
yes (https://gist.github.com/Rumrusher/f4d0ba18ba6868d38221)
Title: Re: DFHack 0.40.10-r1
Post by: Troas on September 07, 2014, 10:10:59 am
Couple questions...

1. Is it possible to pause world generation and run a script in the middle of it? Namely in between when civilizations are placed and history starts running.
2. Has anyone played with adding noble positions using DFHack? It seems like all the pertinent information is there, but I am unsure how it would effect gameplay and if the position would be used by the computer or would even be usable by the players.
3. Similarly, Ethics, is there any effect on gameplay, changing them in game?
4. I know there is a quick way to find material id and index using df.mat_find (or whatever the function is, not at my DF computer right now), is there a similar way to find a creatures id and caste id? How about for things like leathers? (I am looking to be able to add and remove all the different types of items and materials from an entity using DFHack, and to do that I need to be able to find the correct indices for the things to add/remove).

for question 2:  The Dwarven Higher learning mod does this, although I don't think the librarian position has any actual duties.  The mod was created for 34.x but if you manually apply the raw file changes it appears to work in 40.x (I only use the medical ward part of the mod - I don't like the thought of subjecting patients to a surgeon with rusty skills).
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on September 07, 2014, 11:32:44 am
yes (https://gist.github.com/Rumrusher/f4d0ba18ba6868d38221)

Thank you very much!  It lists historical figure and nemesis data in the "to do" part of the comments, but the script already has code to do those things.  Are you referring to fleshing out more details for the historical figure and nemesis data?
Title: Re: DFHack 0.40.10-r1
Post by: Aloriel on September 07, 2014, 04:40:38 pm
There's something strange going on in my fort...

I have dwarves that are ignoring their assigned labors entirely. For example, I have a brewer who idles instead of constructing a still. And now, he's gone off to hunt for a small creature despite no one in the fortress at all having the hunting labor set. I have no burrows.

I also have had dwarves ignoring mining above them, even though stairs reach the ceiling.

Similarly, I have several idle dwarves who have nothing but hauling labors set, and there is SO much to haul right now.

Any guesses as to what is going on here? Is it DFHack causing this, or DF doing this on its own?
Title: Re: DFHack 0.40.10-r1
Post by: Greiger on September 07, 2014, 05:01:14 pm
Hunt small creature means he is starving and cannot find any food.  He is basically starving to death and looking for any rats or bugs to eat.   It sounds like something may have happened to cut him off from the fortress proper.  If any workshops were built might want to make sure they aren't blocking the only exit or something.

From everything you are describing it sounds like -something- is blocking passage to the locations where work needs to be done.  DFHack can cause stuff like that iirc when using certain tools but it should not be doing that if it's just sitting idle.
Title: Re: DFHack 0.40.10-r1
Post by: Aloriel on September 07, 2014, 05:46:58 pm
Nothing is blocking the way at the moment. Everyone else is behaving normally. Actually, the stairs issue was so early in my fort, that was practically all there was to it. When I approached the stair issue from above, it worked fine.

The starving dwarf was standing literally next to food barrels before she went off hunting for small creatures.

As far as DFHack, I downloaded it today and installed it. The only features I ever use from it are digv and workflow (two items that I simply cannot play without!). So, unless something is enabled by default, it shouldn't be DFHack... except that DFHack is the only mod I am using (unless you count Therapist).

Anyway, the dwarves with the issues have all died, and now I have only normal functioning dwarves. Well, except if I try to dig upwards again...
Title: Re: DFHack 0.40.10-r1
Post by: LeoCean on September 07, 2014, 06:41:44 pm
You're telling them to dig a stairs upwards above the current one right? Not just mine that area above the stairs right?
Title: Re: DFHack 0.40.10-r1
Post by: Aloriel on September 07, 2014, 07:46:03 pm
Yep. I had them dig out X marks (up/down stairs), and above that I had designated X marks.

Its usually not an issue, of course. I usually only dig down. However, in this particular case, I had hematite above my entry point (about 10 Z levels up). I wanted to dig up to it.

I'm in a particularly mountainous area, and have a lovely valley with high cliff walls. It seems that I have found a sedimentary layer up high, but down lower I have igneous intrusive and metamorphic layers. Honestly, this place is a treasure trove.
Title: Re: DFHack 0.40.10-r1
Post by: LeoCean on September 07, 2014, 07:56:16 pm
Can you upload the save? Dropbox/mediafire/dffd.
Title: Re: DFHack 0.40.10-r1
Post by: tikiking1 on September 07, 2014, 08:22:08 pm
I'm using a custom-built unstripped custom build of libgraphics.so with dwarf_fortress_unfuck, but dfhack continues to not work in the same way it didn't with a stripped build. Is there any way to run dfhack with a custom libgraphics.so build?
Title: Re: DFHack 0.40.10-r1
Post by: Aloriel on September 07, 2014, 09:02:40 pm
I will upload it to Dropbox later. Currently, the fort is pretty busy. ;) I also want to 100% verify that the dig up issue still exists.

UPDATE:
I can't duplicate it now. Whatever was blocking before doesn't seem to be happening now.
If you would still like my save file, I can provide it anyway. Let me know :)
Title: Re: DFHack 0.40.10-r1
Post by: Roses on September 08, 2014, 11:07:36 am
Couple questions...

1. Is it possible to pause world generation and run a script in the middle of it? Namely in between when civilizations are placed and history starts running.
2. Has anyone played with adding noble positions using DFHack? It seems like all the pertinent information is there, but I am unsure how it would effect gameplay and if the position would be used by the computer or would even be usable by the players.
3. Similarly, Ethics, is there any effect on gameplay, changing them in game?
4. I know there is a quick way to find material id and index using df.mat_find (or whatever the function is, not at my DF computer right now), is there a similar way to find a creatures id and caste id? How about for things like leathers? (I am looking to be able to add and remove all the different types of items and materials from an entity using DFHack, and to do that I need to be able to find the correct indices for the things to add/remove).

for question 2:  The Dwarven Higher learning mod does this, although I don't think the librarian position has any actual duties.  The mod was created for 34.x but if you manually apply the raw file changes it appears to work in 40.x (I only use the medical ward part of the mod - I don't like the thought of subjecting patients to a surgeon with rusty skills).

Thanks, I will look into that mod. Anyone have any ideas about the other questions? (Primarily 1 and 4?) Also, I will throw in another couple questions;

5. addReactionToShop(reaction_name,shop_name), I am assuming reaction name is [REACTION:THIS_IS_THE_REACTION_NAME] and shop name is [BUILDING:THIS_IS_THE_SHOP_NAME]. Will this persist through save-quit-load cycles or does it have to be run each load? Does the entity need to have the reactions set as permitted in their raws as well?
6. removeNative(shop_name), what does this do? Does it remove the access to the building from the build list? Does it work on vanilla un-moddable buildings?
7. Does the current spawn-unit allow for specifying friendly versus invader versus wild creatures? (Also can you spawn a unit and have it set as a pet of a unit, like how cats take owners?)
8. Is it possible to change a wild roaming creature to be a friendly tamed creature using just DFHack?
9. This may be more for just a general modding questions, but since I already have this list I might as well put it here. Do fliers still stay at the edge of the map when they invade? (Wondering if it would be possible to create a caste of a race that stays at the edge and attempts to summon more guys unless you go kill them)
Title: Re: DFHack 0.40.10-r1
Post by: Warmist on September 08, 2014, 11:45:53 am
5. does not persist. Need to run each load (also just had an idea to extend this to run some code and check some prerequisites). No need for permissions (iirc)
6. removes native reactions. To be used for disabling hardcoded workshops or replacing (with 5.) their reactions
7. no. it needs a bit more tweaking after creation. I'm a bit rusty on this front... and still haven't finished "THE IMPLEMENTATION THAT WILL BE USED FOR EVERYTHING" of this (i.e. more stable, more features, other plugins could use it, etc...)
8. yes (i think) there is tame level, also there is civ id and a few flags (hopefully somebody has more info)


2. it's possible (have been doing that) but never with any intention of real use.
3. i'm pretty sure they don't have any effect on game
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on September 08, 2014, 01:59:13 pm
1 might be possible, but you'd have to be careful to catch worldgen fast enough and use a CoreSuspend object in C++.
Title: Re: DFHack 0.40.11-r1
Post by: expwnent on September 08, 2014, 03:33:59 pm
New release!

To developers: please keep the NEWS file updated with new versions. Documentation is important too.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 08, 2014, 05:02:30 pm
OS X build (http://dffd.wimbli.com/file.php?id=9647)
Title: Re: DFHack 0.40.11-r1
Post by: Euius on September 08, 2014, 06:46:56 pm
So in every 40.xx version including 40.11, utils.lua crashes out in the function parse_bitfield_int because the value of v in the ipairs loop can be nil, yet it attempts to set res[v]

I know I've reported this before, and I can't imagine I'm the only one seeing this.

Title: Re: DFHack 0.40.11-r1
Post by: Nopenope on September 08, 2014, 07:01:10 pm
For some reason I can't fathom falconne's hotkeys plugin has been wiped out from the latest repos, so I went ahead and built it for GNU/Linux: http://a.pomf.se/aaryqr.so

Remember to add the following to your dfhack.init file:
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 08, 2014, 08:10:53 pm
For some reason I can't fathom falconne's hotkeys plugin has been wiped out from the latest repos
As far as I can tell, it has never been in DFHack/dfhack (at least, not in 0.34.11-r1, 0.34.11-r3, 0.34.11-r5, 0.40.08-r1, or 0.40.11-r1).
Edit: Falconne's plugins are in this thread (http://www.bay12forums.com/smf/index.php?topic=119575.0), although they were last updated for 0.34.11-r5 - only some of them are included in the official DFHack repo (and I'm not sure if the ones in Falconne's thread contain unmerged changes).
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 08, 2014, 08:31:59 pm
For some reason I can't fathom falconne's hotkeys plugin has been wiped out from the latest repos
As far as I can tell, it has never been in DFHack/dfhack (at least, not in 0.34.11-r1, 0.34.11-r3, 0.34.11-r5, 0.40.08-r1, or 0.40.11-r1).
Edit: Falconne's plugins are in this thread (http://www.bay12forums.com/smf/index.php?topic=119575.0), although they were last updated for 0.34.11-r5 - only some of them are included in the official DFHack repo (and I'm not sure if the ones in Falconne's thread contain unmerged changes).
can't remember where, but Falconne posted within the last week or so saying life's been hectic and/or (s)he's been waiting on the DF updates to slow down before tackling upgrading the plugins to .40.
Title: Re: DFHack 0.40.11-r1
Post by: Nopenope on September 08, 2014, 09:25:02 pm
As far as I can tell, it has never been in DFHack/dfhack (at least, not in 0.34.11-r1, 0.34.11-r3, 0.34.11-r5, 0.40.08-r1, or 0.40.11-r1).
Edit: Falconne's plugins are in this thread (http://www.bay12forums.com/smf/index.php?topic=119575.0), although they were last updated for 0.34.11-r5 - only some of them are included in the official DFHack repo (and I'm not sure if the ones in Falconne's thread contain unmerged changes).

Oh. Is there any reason as to why some plugins were included and not the other ones (namely hotkeys and automelt)? Because they build and run fine on .40.11 for me, I could provide binaries for various OSes if people are interested.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 08, 2014, 09:35:43 pm
As far as I can tell, it has never been in DFHack/dfhack (at least, not in 0.34.11-r1, 0.34.11-r3, 0.34.11-r5, 0.40.08-r1, or 0.40.11-r1).
Edit: Falconne's plugins are in this thread (http://www.bay12forums.com/smf/index.php?topic=119575.0), although they were last updated for 0.34.11-r5 - only some of them are included in the official DFHack repo (and I'm not sure if the ones in Falconne's thread contain unmerged changes).

Oh. Is there any reason as to why some plugins were included and not the other ones (namely hotkeys and automelt)? Because they build and run fine on .40.11 for me, I could provide binaries for various OSes if people are interested.
I think just because no one is aware they work, officially or otherwise.

Here's the falconne weighing in that I mentioned above:
Sorry about the lack of updates, I've been busy on some other projects. Will try to get on it soon. I was hoping to wait till the DF updates slowed down.

Here's....you?....asking where to get the source for hotkey (and not getting an answer that I saw):

Unless I'm missing something this plugin is absent in the latest repo for .40.x. Is the source available so we can at least build it ourselves? I find this hotkey plugin very useful and very much miss it in the latest version.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 08, 2014, 09:38:06 pm
As far as I can tell, it has never been in DFHack/dfhack (at least, not in 0.34.11-r1, 0.34.11-r3, 0.34.11-r5, 0.40.08-r1, or 0.40.11-r1).
Edit: Falconne's plugins are in this thread (http://www.bay12forums.com/smf/index.php?topic=119575.0), although they were last updated for 0.34.11-r5 - only some of them are included in the official DFHack repo (and I'm not sure if the ones in Falconne's thread contain unmerged changes).

Oh. Is there any reason as to why some plugins were included and not the other ones (namely hotkeys and automelt)? Because they build and run fine on .40.11 for me, I could provide binaries for various OSes if people are interested.
I think just because no one is aware they work, officially or otherwise.
That, and the fact that nobody has merged them into the official DFHack repo yet - feel free to submit a pull request (https://github.com/dfhack/dfhack/pulls).
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 08, 2014, 09:41:14 pm
And by "feel free" he means "dear god hurry up and do one" because I'd really like to see those plugins too... :ohdear:
Title: Re: DFHack 0.40.11-r1
Post by: Nopenope on September 08, 2014, 10:27:39 pm
Quote
Here's....you?....asking where to get the source for hotkey (and not getting an answer that I saw):
I looked further and the source was actually buried in falconne's repos. So since no one knew what happened to the missing plugins I just built them myself.

Quote
And by "feel free" he means "dear god hurry up and do one" because I'd really like to see those plugins too... :ohdear:
Huh I don't have a github account but here are binaries:

Single link: http://a.pomf.se/qtdkef.tar.gz

Windows (hotkeys, automelt, dfterm3): http://a.pomf.se/yswsac.rar
GNU/Linux (hotkeys, automelt, dfterm3): http://a.pomf.se/nvyefw.tar.gz
OS X (hotkeys, automelt): http://a.pomf.se/belxgw.zip
Title: Re: DFHack 0.40.11-r1
Post by: breadman on September 09, 2014, 12:14:59 am
I've opened a pull request (https://github.com/DFHack/dfhack/pull/323) for the hotkeys plugin, but automelt could benefit from an update to handle the new stockpile menu behavior of 0.40; I'll probably get to that tomorrow.

Meanwhile, I've also uploaded an older Linux build of DFHack 0.40.11-r1 (http://dffd.wimbli.com/file.php?id=9651).  I included Stonesense this time, but haven't convinced it to actually work yet.  Unless someone lets me know that it works for them, I'll probably omit it in future builds, given that it's about two thirds of the package by size.
Title: Re: DFHack 0.40.11-r1
Post by: Nopenope on September 09, 2014, 01:48:16 am
Well, I'm at lost. whether it's freshly compiled libraries straight from the Allegro site or debian repos, the plugin simply won't load. What's weird is that "load stonesense" doesn't trigger an error or even debug information.
Title: Re: DFHack 0.40.11-r1
Post by: PeridexisErrant on September 09, 2014, 03:31:45 am
I've just fixed exportlegends.lua (https://github.com/DFHack/dfhack/pull/324), which can export the detailed maps, and optionally the legends files and xml too.  It would be awesome if it could be extended to export all the site maps too, now that they're so much more interesting.  If it was easy to export them, I can imagine uses popping up - improvements to legends viewers, visualisers for towns and cities, all kinds of cool stuff.  I'd love to do this, but my attempts never got anywhere - can anyone help?

The other thing which would be cool is if a script could force DF to export .png images (call optipng on each image as it was exported and delete the .bmp).  The space savings are massive; I routinely get 95-99.9 percent savings.  If dfhack can detect image export, worst case is an inelegant wrapper for local shell/cmd commands.  Thoughts?
Title: Re: DFHack 0.40.11-r1
Post by: Saiko Kila on September 09, 2014, 08:25:50 am
I have question regarding binpatch on Windows. I had an idea to use dfhack binpatch instead of manually patching every DF executable, so it remains unchanged (I archive whole directories together with saves of interesting worlds, so I can return to it in a year or two) plus I would know exactly what was changed. Currently I patch only a string regarding pressure plates, to correctly show the trigger weight (which is lowered one order of magnitude in vanilla DF).

However, I cannot actually achieve patching. I try to use following line in dfhack.init:
binpatch apply pressureplate_04011.dif

I also tried explicitly targeting the executable,  but there's no difference:
binpatch apply "Dwarf Fortress.exe" pressureplate_04011.dif

It says patch applied, but I see no change.

pressureplate_04011.dif itself looks like this:
Code: [Select]
009B6D10: 4B 30
009B6D11: 00 4B

Isn't that supposed to work?
Title: Re: DFHack 0.40.10-r1
Post by: Roses on September 09, 2014, 08:43:34 am
5. does not persist. Need to run each load (also just had an idea to extend this to run some code and check some prerequisites). No need for permissions (iirc)
6. removes native reactions. To be used for disabling hardcoded workshops or replacing (with 5.) their reactions
7. no. it needs a bit more tweaking after creation. I'm a bit rusty on this front... and still haven't finished "THE IMPLEMENTATION THAT WILL BE USED FOR EVERYTHING" of this (i.e. more stable, more features, other plugins could use it, etc...)
8. yes (i think) there is tame level, also there is civ id and a few flags (hopefully somebody has more info)

2. it's possible (have been doing that) but never with any intention of real use.
3. i'm pretty sure they don't have any effect on game
1 might be possible, but you'd have to be careful to catch worldgen fast enough and use a CoreSuspend object in C++.
Thanks for all the responses, two more slightly specific questions

9. If I have two scripts that enable the same eventful event type (e.g. events.enableEvent(events.eventType.UNIT_DEATH,100)) will both get run, or will one be overwritten/ignored?
10. Is there any way to make tile temperature changes more permanent? It seems like every time I change the tiles temperature (both temperature1 and temperature2) it just reverts back to the surrounding, even if I set temperature update to false.

EDIT: Heres another one just for expwnent;
11. The old LUA_HOOK system allowed us access to the items used in a reaction, have you given any thought to trying the same functionality in the new reaction-trigger system?
Title: Re: DFHack 0.40.11-r1
Post by: 0x517A5D on September 09, 2014, 12:00:09 pm
However, I cannot actually achieve patching. I try to use following line in dfhack.init:
binpatch apply pressureplate_04011.dif

I also tried explicitly targeting the executable,  but there's no difference:
binpatch apply "Dwarf Fortress.exe" pressureplate_04011.dif

It says patch applied, but I see no change.

pressureplate_04011.dif itself looks like this:
Code: [Select]
009B6D10: 4B 30
009B6D11: 00 4B

Isn't that supposed to work?

It works for me.  I did this:
I concluded that the patch does change the weight strings.

I suggest checking your patch file.  Are you using the right command?  Is the file in the right place?  Do you have multiple copies scattered around, with different contents?  Do you have a file named pressureplate_04011.dif.dif ?  (Note the doubled extension.)
Title: Re: DFHack 0.40.11-r1
Post by: Seagoon on September 09, 2014, 12:32:09 pm
Im rather new to DF hack, how would i go about applying the armory fixes? Also ensuring they are applied automatically every time i load the game?
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 09, 2014, 02:03:24 pm
fix-armory hasn't been updated to 0.40.xx yet, as far as I can tell - its line in CMakeLists.txt is currently commented out (https://github.com/DFHack/dfhack/blob/master/plugins/CMakeLists.txt#L118), so it's not included in any 0.40.xx builds of DFHack.
Title: Re: DFHack 0.40.11-r1
Post by: Seagoon on September 09, 2014, 02:18:57 pm
fix-armory hasn't been updated to 0.40.xx yet, as far as I can tell - its line in CMakeLists.txt is currently commented out (https://github.com/DFHack/dfhack/blob/master/plugins/CMakeLists.txt#L118), so it's not included in any 0.40.xx builds of DFHack.

Ah ok, thanks
Title: Re: DFHack 0.40.11-r1
Post by: Saiko Kila on September 10, 2014, 03:37:48 am
However, I cannot actually achieve patching. I try to use following line in dfhack.init:
binpatch apply pressureplate_04011.dif

I also tried explicitly targeting the executable,  but there's no difference:
binpatch apply "Dwarf Fortress.exe" pressureplate_04011.dif

It says patch applied, but I see no change.

pressureplate_04011.dif itself looks like this:
Code: [Select]
009B6D10: 4B 30
009B6D11: 00 4B

Isn't that supposed to work?

It works for me.  I did this:
  • Extracted df_40_11_win_s.zip to a new test directory,
  • Extracted dfhack-0.40.11-r1-Windows.7z there,
  • Created a subdirectory named hack\patches\v0.40.11 SDL ,
  • In that subdirectory, created a file named pressureplate_04011.dif ,
  • Pasted your patch content into that file,
  • And started DF to the main menu.
  • At the DFHack commandline,
  • binpatch check pressureplate_04011
    • Note that I did not append the .dif extension.
  • binpatch apply pressureplate_04011
  • binpatch remove pressureplate_04011
  • DFHack did not complain about any of that, which surprised me a bit.
  • Then I created a pocket world and started a new embark, crafted a few mechanisms,
  • And began to construct a creature-triggered pressure plate.  I noted the min weight of 5K.
  • I backed out of all the menus, and again did:
  • binpatch apply pressureplate_04011
  • And constructed a pressure plate.  I noted the min weight of 50K.
I concluded that the patch does change the weight strings.

I suggest checking your patch file.  Are you using the right command?  Is the file in the right place?  Do you have multiple copies scattered around, with different contents?  Do you have a file named pressureplate_04011.dif.dif ?  (Note the doubled extension.)

Thank you for answers and suggestion. I have no idea why it doesn't work for me, I even tried the steps you describe, starting with downloading df_40_11_win_s.zip. Could you please tell what "check" function of binpatch returns after successfully applying the patch?

When I apply the patch, like this
Code: [Select]
binpatch apply pressureplate_04011the prompt says that the patch was applied (if it doesn't find the file it clearly states in red that it can't find the patch). But when I check for changes like this
Code: [Select]
binpatch check pressureplate_04011it always says that the patch is removed, which means that no changes were actually made.

What worries me is if I deliberately put a wrong value in the patch file, like changing expected original value of 4B to 4A for example, then applying the patch also says that it was applied. Which means the function returned success even though it shouldn't/couldn't, instead it that example it should write something like "conflict at address" I think.
Title: Re: DFHack 0.40.11-r1
Post by: 0x517A5D on September 10, 2014, 10:16:09 am
Thank you for answers and suggestion. I have no idea why it doesn't work for me, I even tried the steps you describe, starting with downloading df_40_11_win_s.zip. Could you please tell what "check" function of binpatch returns after successfully applying the patch?

When I apply the patch, like this
Code: [Select]
binpatch apply pressureplate_04011the prompt says that the patch was applied (if it doesn't find the file it clearly states in red that it can't find the patch). But when I check for changes like this
Code: [Select]
binpatch check pressureplate_04011it always says that the patch is removed, which means that no changes were actually made.

What worries me is if I deliberately put a wrong value in the patch file, like changing expected original value of 4B to 4A for example, then applying the patch also says that it was applied. Which means the function returned success even though it shouldn't/couldn't, instead it that example it should write something like "conflict at address" I think.

Luckily, I didn't delete that install yet.

[DFHack]# binpatch check pressureplate_04011
pressureplate_04011: patch is removed
[DFHack]# binpatch apply pressureplate_04011
pressureplate_04011: applied the patch
[DFHack]# binpatch check pressureplate_04011
pressureplate_04011: patch is applied
[DFHack]# binpatch remove pressureplate_04011
pressureplate_04011: removed the patch
[DFHack]# binpatch check pressureplate_04011
pressureplate_04011: patch is removed
[DFHack]#


No errors.

Editing the original 4B to 4A:

[DFHack]# binpatch check pressureplate_04011
pressureplate_04011: conflict at address db8310
[DFHack]#



Let's see... you apply the patch, no complaints, but check says it's removed.  Same thing when you deliberately corrupt the patch.

The file is being treated as garbage.

Lines in a patch file that don't have three hexnumbers, with a colon between the first and the second, are silently ignored.

And binpatch doesn't give a warning if no valid patch lines are found.

Check that the contents are exactly as you posted, and check that it's an ASCII text file instead of Unicode or word-processor formatted.  Open it in Notepad Wordpad, then Save-As and make sure the Encoding is ANSI or UTF-8.

Another thing I just noticed: you can't edit the patch file while Dwarf Fortress is still running.  You have to stop and restart DF every time.  (Or use an editor that can overwrite a locked file.)  That's due to a bug in binpatch.luaEDIT: I've reported the bug on the Github tracker.

So your tests may be invalid.

Title: Re: DFHack 0.40.10-r1
Post by: expwnent on September 10, 2014, 10:27:44 am
5. does not persist. Need to run each load (also just had an idea to extend this to run some code and check some prerequisites). No need for permissions (iirc)
6. removes native reactions. To be used for disabling hardcoded workshops or replacing (with 5.) their reactions
7. no. it needs a bit more tweaking after creation. I'm a bit rusty on this front... and still haven't finished "THE IMPLEMENTATION THAT WILL BE USED FOR EVERYTHING" of this (i.e. more stable, more features, other plugins could use it, etc...)
8. yes (i think) there is tame level, also there is civ id and a few flags (hopefully somebody has more info)

2. it's possible (have been doing that) but never with any intention of real use.
3. i'm pretty sure they don't have any effect on game
1 might be possible, but you'd have to be careful to catch worldgen fast enough and use a CoreSuspend object in C++.
Thanks for all the responses, two more slightly specific questions

9. If I have two scripts that enable the same eventful event type (e.g. events.enableEvent(events.eventType.UNIT_DEATH,100)) will both get run, or will one be overwritten/ignored?
10. Is there any way to make tile temperature changes more permanent? It seems like every time I change the tiles temperature (both temperature1 and temperature2) it just reverts back to the surrounding, even if I set temperature update to false.

EDIT: Heres another one just for expwnent;
11. The old LUA_HOOK system allowed us access to the items used in a reaction, have you given any thought to trying the same functionality in the new reaction-trigger system?

The one that registers the event to be checked more frequently is the one that counts.

There really isn't a way to make temperature updates permanent other than turning temperature off and reimplementing it yourself.

I would have to rejigger EventManager. It's on the list of things to do.
Title: Re: DFHack 0.40.10-r1
Post by: Roses on September 10, 2014, 01:45:05 pm
The one that registers the event to be checked more frequently is the one that counts.

There really isn't a way to make temperature updates permanent other than turning temperature off and reimplementing it yourself.

I would have to rejigger EventManager. It's on the list of things to do.

So if one is checked every 100 and another every 1000, the one that gets checked every 1000 will never be checked? Or will it instead be checked every 100?

That's too bad, at least it works some of the time.

And now for a new batch of questions!

12. In df.global.world.entities.all.x.resources there is a vector called 'discovered_creatures' is that a list of all the creatures an entity has encountered? And if so, is it updated as you play fortress mode? Meaning if a megabeast or semimegabeast attacks, or a sieger brings a new creature will they be added to that list? If that's not what that vector tracks, is there another vector that does track which animals a civilization has encountered?
13. What is the df.global.world.entities.all.x.training_knowledge.level vector telling me? It seems there is an entry for each creature, I am assuming 0 means your civ does not have access to them?
14. Is there an easy function (like dfhack.matinfo.find) for looking up creatures? For instance if I wanted to find the creature id for TOAD is there a dfhack.creatureinfo.find(TOAD,MALE) or something?
15. Similarily, is there some way to find the mat type and index of organic mats? matinfo.find works great for inorganics, but I can't say matinfo.find(TOAD:LEATHER) or matinfo.find(COTTON:FIBER) etc...

There are a couple others that I thought of when I was going through everything, but they escape me at the moment.
Title: Re: DFHack 0.40.11-r1
Post by: Putnam on September 10, 2014, 02:10:43 pm
It will check all of them on the smallest check interval.

EDIT: You may just want to replace df.global.world.entities.all[\#].x there with df.historical_entity.x so that the syntax isn't so wonky

Anyway, as for 14: no, I think the fastest way would be a binary search in the alphabetic creatures vector using the NAME instead of the ID
15. matinfo.find does work for that, last I checked
Title: Re: DFHack 0.40.11-r1
Post by: Saiko Kila on September 10, 2014, 03:07:26 pm
[spoiler]Thank you for answers and suggestion. I have no idea why it doesn't work for me, I even tried the steps you describe, starting with downloading df_40_11_win_s.zip. Could you please tell what "check" function of binpatch returns after successfully applying the patch?

When I apply the patch, like this
Code: [Select]
binpatch apply pressureplate_04011the prompt says that the patch was applied (if it doesn't find the file it clearly states in red that it can't find the patch). But when I check for changes like this
Code: [Select]
binpatch check pressureplate_04011it always says that the patch is removed, which means that no changes were actually made.

What worries me is if I deliberately put a wrong value in the patch file, like changing expected original value of 4B to 4A for example, then applying the patch also says that it was applied. Which means the function returned success even though it shouldn't/couldn't, instead it that example it should write something like "conflict at address" I think.
/spoiler]
[

Luckily, I didn't delete that install yet.

[DFHack]# binpatch check pressureplate_04011
pressureplate_04011: patch is removed
[DFHack]# binpatch apply pressureplate_04011
pressureplate_04011: applied the patch
[DFHack]# binpatch check pressureplate_04011
pressureplate_04011: patch is applied
[DFHack]# binpatch remove pressureplate_04011
pressureplate_04011: removed the patch
[DFHack]# binpatch check pressureplate_04011
pressureplate_04011: patch is removed
[DFHack]#


No errors.

Editing the original 4B to 4A:

[DFHack]# binpatch check pressureplate_04011
pressureplate_04011: conflict at address db8310
[DFHack]#



Let's see... you apply the patch, no complaints, but check says it's removed.  Same thing when you deliberately corrupt the patch.

The file is being treated as garbage.

Lines in a patch file that don't have three hexnumbers, with a colon between the first and the second, are silently ignored.

And binpatch doesn't give a warning if no valid patch lines are found.

Check that the contents are exactly as you posted, and check that it's an ASCII text file instead of Unicode or word-processor formatted.  Open it in Notepad Wordpad, then Save-As and make sure the Encoding is ANSI or UTF-8.

Thank you, that was it - it wasn't ANSI but Unicode BOM format, as reported by Notepad2. I normally use other editor, probably pressed some non-standard character accidentally and it changed the coding.

Quote
Another thing I just noticed: you can't edit the patch file while Dwarf Fortress is still running.  You have to stop and restart DF every time.  (Or use an editor that can overwrite a locked file.)  That's due to a bug in binpatch.luaEDIT: I've reported the bug on the Github tracker.

So your tests may be invalid.

Well, for most tests I used HxD, which bypasses lock protection, unless explicitly called in read only mode. It even doesn't inform me that the file is write-locked, just renames the old file as *.bak. So when I remove patch with binpatch I can edit the file on-fly, without restarts. Actually, I don't even have to exit the building menu, and can see the string changing when I press enter.

Other thing I can still edit (with any editor) is binpatch.lua from \hack\scripts itself (so I can edit some warnings for binpatch while in session) - I used it to test if binpatch.lua is really invoked every time, and not some copy in memory. The binpatch.lua from \hack\lua can be edited too, but this one is apparently loaded only when invoked for the first time since DFhack started. I suppose ability to edit scripts while DF runs is intended though.
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on September 10, 2014, 03:44:38 pm
I have a question about customizing the spawn (https://gist.github.com/Rumrusher/f4d0ba18ba6868d38221) script: How can you tell "what time it is" to set the spawned creature's birth time exactly?  In my case, the creature comes into being the moment the script is called (no backdated birthdays), so unit.relations.birth_year=df.global.cur_year gets the year right.  Is it unit.relations.birth_time=df.global.curr_year_ticks to set the birth time?  The historical figure data seems to want hf.born_seconds and I'm not sure how "ticks" relate to "seconds" here.
Title: Re: DFHack 0.40.11-r1
Post by: Euius on September 10, 2014, 05:15:32 pm
Is there any way to resolve this alt key mis-registered as pressed problem?  I know why it happens, when alt-tabbing out of the game it's never receiving the keyup

The problem is that alt-tabbing out of the game is pretty much constant for me, which means everytime I enter text in a search list or similar, it becomes quite annoying.  Effectively, this means that two entire modifier keysets can't be used (Alt-x can't be used and Cntrl-Alt-x has to duplicate Cntrl-x)

For instance, I'd like to bind gui/unit-info-viewer to Alt-I, but that setup is absolutely unplayable due to this issue.
Title: Re: DFHack 0.40.11-r1
Post by: Nopenope on September 10, 2014, 05:31:23 pm
You could use the F9 to F12 keys, as far as I know they're not taken by the game.

In other news, DFHack appears to build and run fine for .40.12, except for falconne's plugins (and hotkey hooks) who somehow don't initialize. Here's a "bleeding-edge" binary for GNU/Linux (with DF included): http://a.pomf.se/gzajej.tar.gz

Use at own risk, etc.
Title: Re: DFHack 0.40.10-r1
Post by: expwnent on September 11, 2014, 08:36:41 am
So if one is checked every 100 and another every 1000, the one that gets checked every 1000 will never be checked? Or will it instead be checked every 100?

It will check for events every 100 ticks. When that happens, all listeners will be notified, regardless of how often or rarely they requested EventManager to check for events.

As for the rest, I don't know.
Title: Re: DFHack 0.40.11-r1
Post by: Ovg on September 11, 2014, 03:12:05 pm
You could use the F9 to F12 keys, as far as I know they're not taken by the game.

F11 is full screen
F12 is true type
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 11, 2014, 03:20:10 pm
Also, F10 resets the zoom level, and DFHack only supports F1-F9 in keybindings.
It might be possible to reset modifier keys when the window focus changes through DFHack, but it would require interposing additional SDL functions (and would only be necessary on Windows, and possibly some Linux distributions).
Title: Re: DFHack 0.40.11-r1
Post by: PeridexisErrant on September 11, 2014, 05:09:27 pm
It might be possible to reset modifier keys when the window focus changes through DFHack, but it would require interposing additional SDL functions (and would only be necessary on Windows, and possibly some Linux distributions).

That would definitely be worth doing if it's possible, since this is one of the most common problems new players have with dfhack.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 11, 2014, 05:11:10 pm
It might be possible to reset modifier keys when the window focus changes through DFHack, but it would require interposing additional SDL functions (and would only be necessary on Windows, and possibly some Linux distributions).

That would definitely be worth doing if it's possible, since this is one of the most common problems new players have with dfhack.
I just assumed I was doing something incompetent until it got brought up in this thread. D:
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 11, 2014, 05:47:29 pm
It might be possible to reset modifier keys when the window focus changes through DFHack, but it would require interposing additional SDL functions (and would only be necessary on Windows, and possibly some Linux distributions).

That would definitely be worth doing if it's possible, since this is one of the most common problems new players have with dfhack.
Wait, is this only a DFHack-specific bug? I was under the impression that this occurs with any key combinations that use 'Alt' on Windows.
Title: Re: DFHack 0.40.11-r1
Post by: LeoCean on September 11, 2014, 05:52:45 pm
It's mainly a dfhack one, you can change keyboard language by pressing something a few times but that's about it. I believe you only need to press ALT again to get rid of the bug with dfhack so it isn't that big of a deal.
Title: Re: DFHack 0.40.11-r1
Post by: PeridexisErrant on September 11, 2014, 06:22:45 pm
It might be possible to reset modifier keys when the window focus changes through DFHack, but it would require interposing additional SDL functions (and would only be necessary on Windows, and possibly some Linux distributions).

That would definitely be worth doing if it's possible, since this is one of the most common problems new players have with dfhack.
Wait, is this only a DFHack-specific bug? I was under the impression that this occurs with any key combinations that use 'Alt' on Windows.

It's not strictly limited to DFHack, but almost all cases I see are people confused when, for example, trying to make a job repeat brings up the rooms menu.  Between the Starter Pack and all the people who use dfhack, a fix would be widely appreciated - even if it's not always dfhack causing the problem!
Title: Re: DFHack 0.40.11-r1
Post by: breadman on September 11, 2014, 11:14:08 pm
It might be possible to reset modifier keys when the window focus changes through DFHack, but it would require interposing additional SDL functions (and would only be necessary on Windows, and possibly some Linux distributions).

It might even be possible through the existing Core::DFH_SDL_Event().

Code: [Select]
diff --git a/library/Core.cpp b/library/Core.cpp
index 0196413..fc63fc1 100644
--- a/library/Core.cpp
+++ b/library/Core.cpp
@@ -1605,6 +1605,15 @@ int Core::DFH_SDL_Event(SDL::Event* ev)
             hotkey_states[ke->ksym.sym] = false;
         }
     }
+    else if (ev->type == SDL::ET_ACTIVEEVENT && ev->active.state == 2)
+    {
+        // There's probably a good enum or macro for that state value somewhere.
+        // Basically, state == 1 means mouse moved in or out of the window,
+        // state == 2 means the window gained or lost focus.
+        // At least on Linux, anyway...
+        fprintf(stderr, "Window Focus Event.\n");
+        fflush(stderr);
+    }
     return true;
     // do stuff with the events...
 }

Unfortunately, I don't know how to reset the modifier keys once I get to that point, though it looks like modState in g_src/enabler_input.cpp just needs to be cleared.  (Can we get away with calling enabler_inputst::clear_input() somehow?)  The worst part is that I can't reproduce the problem on my Linux system, and can't currently compile for Windows, so I can't test any possible solution myself.

If we're lucky, the result will basically be a no-op on the unaffected operating systems.
Title: Re: DFHack 0.40.11-r1
Post by: splinterz on September 12, 2014, 04:32:10 am
what's the correct, most accurate way of getting a unit's body size? is it from body_size_info.size_cur, or size_base, or is it necessary to calculate it by taking the caste's average size and applying appearance modifiers?

another method i've seen was in unit-info-viewer where it appears to report strength:agility as the size?
Title: Re: DFHack 0.40.11-r1
Post by: gunpowdertea on September 12, 2014, 06:00:33 am
It might be possible to reset modifier keys when the window focus changes through DFHack, but it would require interposing additional SDL functions (and would only be necessary on Windows, and possibly some Linux distributions).

That would definitely be worth doing if it's possible, since this is one of the most common problems new players have with dfhack.
Wait, is this only a DFHack-specific bug? I was under the impression that this occurs with any key combinations that use 'Alt' on Windows.

It's not strictly limited to DFHack, but almost all cases I see are people confused when, for example, trying to make a job repeat brings up the rooms menu.  Between the Starter Pack and all the people who use dfhack, a fix would be widely appreciated - even if it's not always dfhack causing the problem!

It counts (under linux, with some terminals) as an intended behaviour. It is all a matter of which keys are caught by which program first. Ticks me off, many utilities designed for terminals have hotkeys F1 or F10 in use, that get caught by (I believe) e.g. gnome-terminal (probably gnome, which passes it on to gnome-terminal, which then brings up some config menu or help or somesuch). This is not a dfhack bug (unless you would count "using keys that the OS is likely to catch and not pass down to the program" as a bug).
Title: Re: DFHack 0.40.11-r1
Post by: PeridexisErrant on September 12, 2014, 06:25:33 am
It counts (under linux, with some terminals) as an intended behaviour. It is all a matter of which keys are caught by which program first. Ticks me off, many utilities designed for terminals have hotkeys F1 or F10 in use, that get caught by (I believe) e.g. gnome-terminal (probably gnome, which passes it on to gnome-terminal, which then brings up some config menu or help or somesuch). This is not a dfhack bug (unless you would count "using keys that the OS is likely to catch and not pass down to the program" as a bug).

We're not talking about Fx keys or the dfhack terminal window (or at least I'm not).  I'm referring to the vanilla DF bug which has been traced to an old version of the SDL library, where if you alt-tab away the game thinks alt is still held when it comes back into focus.  Which results in pressing "r" being interpreted as "alt-r", which brings up something confusing and unexpected. 

In short, fixing this bug (http://www.bay12games.com/dwarves/mantisbt/view.php?id=6455), since dfhack arguably makes it worse. 
Title: Re: DFHack 0.40.11-r1
Post by: GenericOverusedName on September 12, 2014, 09:42:40 am
Do we have the memory layouts for .12 yet?
Title: Re: DFHack 0.40.11-r1
Post by: Dirst on September 12, 2014, 09:51:25 am
Do we have the memory layouts for .12 yet?
Zohan just posted this (http://www.bay12forums.com/smf/index.php?topic=143632.0) under General Discussion.  Not sure if this is a big or small fraction of the layouts needed for DFHack, but it's a start.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 12, 2014, 02:08:50 pm
Do we have the memory layouts for .12 yet?
Yes: https://github.com/dfhack/df-structures. In fact, DT offsets are often generated from df-structures. Official DFHack releases simply take longer to put together.
Title: Re: DFHack 0.40.11-r1
Post by: tase on September 12, 2014, 08:03:04 pm
Still no Windows symbols for 40.12 ?
Title: Re: DFHack 0.40.11-r1
Post by: Quietust on September 12, 2014, 09:27:47 pm
Still no Windows symbols for 40.12 ?
Last I checked, df-structures has all of them...
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 12, 2014, 09:31:28 pm
Still no Windows symbols for 40.12 ?
Last I checked, df-structures has all of them...
The \windows folder says the last change was 9 days ago, vs \linux and \osx being 2 days ago and saying "Update version to v0.40.12".

Note: I have no idea what that means.
Title: Re: DFHack 0.40.08-r2
Post by: salithus on September 12, 2014, 09:49:34 pm
Compiling DFHack for Windows is actually really easy if explained, and it doesn't require a zillion programs, just four.

You need:
CMake (http://www.cmake.org/cmake/resources/software.html)
Git - I prefer Github (https://windows.github.com/) or mysysgit (http://msysgit.github.io/) for these purposes (simple command line stuff).
Perl - Strawberry Perl (http://strawberryperl.com/) is simplest
Visual Studio 2010 Express for C# (http://go.microsoft.com/?linkid=9709939)
  • Install all four of the above programs.
  • Hold down Shift and right-click in an empty space on your desktop. Select "Open command window here".
  • Type "git clone -b develop git://github.com/dfhack/dfhack.git" and hit Enter. (Remove the "-b develop" part if you don't want the development branch version, but you usually will.)
  • Type "cd dfhack" and hit Enter.
  • Type "git submodule init" and hit Enter.
  • Type "git submodule update" and hit Enter.
  • Close the command prompt and open the DFHack folder you just made and then open the Build folder inside of that.
  • Double-click on 'generate-MSVC-gui.bat'.
  • In the window that pops up, uncheck the box that says "DL_RUBY", then click Configure, and lastly click Generate.
  • Close that window and enter the new VC2010 directory that was created and double-click on dfhack.sln.
  • Open the "Solution Explorer" tab to the right, scroll down to "PACKAGE", and then right-click on it and hit "Build".
  • When it eventually finishes running, open the new folder "_CPack_Packages", then the folder "win32", then the folder "ZIP", and you will have your very own zipped-up DFHack build.
also I just tried this and it worked, but no idea how I'd make it even try to generate something for 40.12 ("96>  CPack: - package: C:/Users/salithus/Desktop/dfhack/build/VC2010/dfhack-0.40.11-r1-Windows.zip generated.")

E: figured it out - dunno if it matters but symbols.xml on github shows "<symbol-table name='v0.40.11 SDL' os-type='windows'>", but I replaced the file the above generated with the github one and it fired up just fine on .40.12
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 12, 2014, 10:03:06 pm
Still no Windows symbols for 40.12 ?
Last I checked, df-structures has all of them...
The \windows folder says the last change was 9 days ago, vs \linux and \osx being 2 days ago and saying "Update version to v0.40.12".

Note: I have no idea what that means.
Those folders only contain generated files (e.g. DT layouts and CSV files). The changes in the rest of the repo include globals for all platforms (see symbols.xml (https://github.com/DFHack/df-structures/blob/master/symbols.xml)).
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 12, 2014, 10:04:27 pm
Still no Windows symbols for 40.12 ?
Last I checked, df-structures has all of them...
The \windows folder says the last change was 9 days ago, vs \linux and \osx being 2 days ago and saying "Update version to v0.40.12".

Note: I have no idea what that means.
Those folders only contain generated files (e.g. DT layouts and CSV files). The changes in the rest of the repo include globals for all platforms (see symbols.xml (https://github.com/DFHack/df-structures/blob/master/symbols.xml)).
yeah - what confused me is that it still says .40.11 in it
Title: Re: DFHack 0.40.08-r2
Post by: lethosor on September 12, 2014, 10:09:46 pm
Compiling DFHack for Windows is actually really easy if explained, and it doesn't require a zillion programs, just four.

You need:
CMake (http://www.cmake.org/cmake/resources/software.html)
Git - I prefer Github (https://windows.github.com/) or mysysgit (http://msysgit.github.io/) for these purposes (simple command line stuff).
Perl - Strawberry Perl (http://strawberryperl.com/) is simplest
Visual Studio 2010 Express for C# (http://go.microsoft.com/?linkid=9709939)
  • Install all four of the above programs.
  • Hold down Shift and right-click in an empty space on your desktop. Select "Open command window here".
  • Type "git clone -b develop git://github.com/dfhack/dfhack.git" and hit Enter. (Remove the "-b develop" part if you don't want the development branch version, but you usually will.)
  • Type "cd dfhack" and hit Enter.
  • Type "git submodule init" and hit Enter.
  • Type "git submodule update" and hit Enter.
  • Close the command prompt and open the DFHack folder you just made and then open the Build folder inside of that.
  • Double-click on 'generate-MSVC-gui.bat'.
  • In the window that pops up, uncheck the box that says "DL_RUBY", then click Configure, and lastly click Generate.
  • Close that window and enter the new VC2010 directory that was created and double-click on dfhack.sln.
  • Open the "Solution Explorer" tab to the right, scroll down to "PACKAGE", and then right-click on it and hit "Build".
  • When it eventually finishes running, open the new folder "_CPack_Packages", then the folder "win32", then the folder "ZIP", and you will have your very own zipped-up DFHack build.
also I just tried this and it worked, but no idea how I'd make it even try to generate something for 40.12 ("96>  CPack: - package: C:/Users/salithus/Desktop/dfhack/build/VC2010/dfhack-0.40.11-r1-Windows.zip generated.")

E: figured it out - dunno if it matters but symbols.xml on github shows "<symbol-table name='v0.40.11 SDL' os-type='windows'>", but I replaced the file the above generated with the github one and it fired up just fine on .40.12
The develop (https://github.com/dfhack/dfhack/tree/develop) branch of DFHack/dfhack still points to the df-structures commit used in 0.40.11-r1. If you want to use the latest df-structures commit, you'll have to run the following commands in <DFHack directory>/library/xml before building:
Code: [Select]
git fetch origin
git checkout origin/master
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 12, 2014, 10:38:23 pm
ok, did that and it grabbed the new symbols, but it says this about twbt:

Quote
Plugin twbt was not built for this version of DFHack.
Plugin: 0.40.12-r1, DFHack: 0.40.11-r1
Title: Re: DFHack 0.40.11-r1
Post by: Putnam on September 12, 2014, 10:42:50 pm
That error is pretty much self-explanatory...

If you want to know why, I'm not entirely sure; I assume it's so that the thing doesn't crash every time you start up DF with the plugin activated.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 12, 2014, 10:43:49 pm
That error is pretty much self-explanatory...

If you want to know why, I'm not entirely sure; I assume it's so that the thing doesn't crash every time you start up DF with the plugin activated.
except, I'm running DF .40.12...
Title: Re: DFHack 0.40.11-r1
Post by: Putnam on September 12, 2014, 10:45:30 pm
And twbt was built for 0.40.11-r1, just like the error says.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 12, 2014, 10:49:30 pm
And twbt was built for 0.40.11-r1, just like the error says.
?

it says the plugin is built for .40.12 and that dfhack itself is .40.11, although I'm running DF .40.12.

Title: Re: DFHack 0.40.11-r1
Post by: int_ua on September 12, 2014, 11:05:45 pm
FYI: dfhack from 0.40.11-r1 branch looks like working fine with 0.40.12 after adding latest df-structures to library/xml on linux too.

UPD: moderators, please delete this post
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 12, 2014, 11:24:50 pm
mifki pointed me in the right direction:

Just change .11 to .12 in cmakelist.txt in dfhack root folder.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 13, 2014, 12:43:22 am
It counts (under linux, with some terminals) as an intended behaviour. It is all a matter of which keys are caught by which program first. Ticks me off, many utilities designed for terminals have hotkeys F1 or F10 in use, that get caught by (I believe) e.g. gnome-terminal (probably gnome, which passes it on to gnome-terminal, which then brings up some config menu or help or somesuch). This is not a dfhack bug (unless you would count "using keys that the OS is likely to catch and not pass down to the program" as a bug).

We're not talking about Fx keys or the dfhack terminal window (or at least I'm not).  I'm referring to the vanilla DF bug which has been traced to an old version of the SDL library, where if you alt-tab away the game thinks alt is still held when it comes back into focus.  Which results in pressing "r" being interpreted as "alt-r", which brings up something confusing and unexpected. 

In short, fixing this bug (http://www.bay12games.com/dwarves/mantisbt/view.php?id=6455), since dfhack arguably makes it worse.
I just discovered that this is only an issue for me when I have QuickFort running - as soon as I close out of that, the Alt key works just fine. Windows 8.1 x64 w/ .40.12
Title: Re: DFHack 0.40.11-r1
Post by: aiseant on September 13, 2014, 02:26:09 am
Is there a known problem with fastdwarf and military ? I used it to teleport my soldiers on the battlefield, and they just stood there doing nothing, not attacking nor being attacked by ennemies. Reports says nothing, no wounds appear on anyone but the u screen tells me they are on the right job.
Title: Re: DFHack 0.40.11-r1
Post by: StagnantSoul on September 13, 2014, 04:35:59 am
A moody dwarf is demanding silk and yarn, two things I wont be getting for an entire year probably. I tried using the createitem page on the wiki, but it's not really working.
createitem CLOTH CREATURE_MAT:GIANT_CAVE_SPIDER:SILK
And
createitem CLOTH CREATURE_MAT:GOAT_MOUNTAIN:HAIR
They both just bring up
Unrecognized material!
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 13, 2014, 09:26:18 am
A moody dwarf is demanding silk and yarn, two things I wont be getting for an entire year probably. I tried using the createitem page on the wiki, but it's not really working.
createitem CLOTH CREATURE_MAT:GIANT_CAVE_SPIDER:SILK
And
createitem CLOTH CREATURE_MAT:GOAT_MOUNTAIN:HAIR
They both just bring up
Unrecognized material!

This worked for me:

[DFHack]# createitem CLOTH CREATURE_MAT:GOAT_MOUNTAIN:HAIR 1

e: although it's not being recognized as "any yarn cloth" by my similarly moody dwarf
e2: this gave me what he wanted:

[DFHack]# createitem CLOTH CREATURE_MAT:SHEEP:HAIR 1
Title: Re: DFHack 0.40.11-r1
Post by: vjek on September 13, 2014, 09:36:05 am
likewise..

createitem CLOTH CREATURE_MAT:SPIDER_CAVE_GIANT:SILK 10

works.
Title: Re: DFHack 0.40.11-r1
Post by: Ovg on September 13, 2014, 04:58:24 pm
Could somebody who already compiled this *unofficial 40.12* build be so kind as to upload it? I can't for the life of me compile it on my own.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 13, 2014, 05:20:42 pm
Could somebody who already compiled this *unofficial 40.12* build be so kind as to upload it? I can't for the life of me compile it on my own.

here's what I built for Windows: http://1drv.ms/XeJL4V

e: or magnet link if you prefer: magnet:?xt=urn:btih:ABE54CAC04119D46A77450475876A347D0894DCD
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 13, 2014, 07:03:10 pm
Here (http://dffd.wimbli.com/file.php?id=9693) is a Linux build of 0.40.11-r1 with GCC 4.5.4, which should work with DF's included libstdc++.
Title: Re: DFHack 0.40.11-r1
Post by: Chevaleresse on September 13, 2014, 10:50:49 pm
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./hack/libprotobuf-lite.so)
-e

wat do?
Title: Re: DFHack 0.40.11-r1
Post by: breadman on September 13, 2014, 11:28:28 pm
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/dkm/Documents/df/df2014/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./hack/libprotobuf-lite.so)
-e

wat do?

This means the dfhack you're trying to use has been compiled against a newer libstdc++ than the one shipped with Dwarf Fortress.  Deleting the shipped library might work, as long as your system's libstdc++ is sufficiently new.  If that still fails, and you're using DF version 0.40.11, you can use Lethosor's GCC 4.5 version (http://dffd.wimbli.com/file.php?id=9693), which is expected to work with the shipped libstdc++ as well as any newer versions.  Otherwise, you'll have to wait for an official release or compile your own.

I feel like this has been answered before, several times.  Where did you search for an answer before posting?  Which search terms did you use?
Title: Re: DFHack 0.40.11-r1
Post by: Chevaleresse on September 13, 2014, 11:33:10 pm
And I just realized the answer to my question is directly above my post.

I didn't search, I apologize. I'm used to a forum where the search function is thoroughly broken.
Title: Re: DFHack 0.40.11-r1
Post by: PeridexisErrant on September 13, 2014, 11:54:11 pm
Could somebody who already compiled this *unofficial 40.12* build be so kind as to upload it? I can't for the life of me compile it on my own.

here's what I built for Windows: http://1drv.ms/XeJL4V

e: or magnet link if you prefer: magnet:?xt=urn:btih:ABE54CAC04119D46A77450475876A347D0894DCD

Neat.  I've got this working for myself, but I'd prefer an official release for the Starter Pack.  Is there an ETA for dfhack 40.12-r1?   If it's not going to be out in the next day or two I'll just use the unofficial version.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 12:16:56 am
Could somebody who already compiled this *unofficial 40.12* build be so kind as to upload it? I can't for the life of me compile it on my own.

here's what I built for Windows: http://1drv.ms/XeJL4V

e: or magnet link if you prefer: magnet:?xt=urn:btih:ABE54CAC04119D46A77450475876A347D0894DCD

Neat.  I've got this working for myself, but I'd prefer an official release for the Starter Pack.  Is there an ETA for dfhack 40.12-r1?   If it's not going to be out in the next day or two I'll just use the unofficial version.
so far it works pretty well - only thing missing from your dfhack.init is lethosor's scripts, I think. I haven't tested your custom onload scripts yet.

I've also got some weirdness going on with workflow - nothing completely broken, but I'm getting errors showing up about something missing in a table - I'll post details tomorrow (just closed out everything). I don't know where to start troubleshooting, so I haven't worried too much about it.
Title: Re: DFHack 0.40.11-r1
Post by: PeridexisErrant on September 14, 2014, 12:28:15 am
Neat.  I've got this working for myself, but I'd prefer an official release for the Starter Pack.  Is there an ETA for dfhack 40.12-r1?   If it's not going to be out in the next day or two I'll just use the unofficial version.
so far it works pretty well - only thing missing from your dfhack.init is lethosor's scripts, I think. I haven't tested your custom onload scripts yet.

I've also got some weirdness going on with workflow - nothing completely broken, but I'm getting errors showing up about something missing in a table - I'll post details tomorrow (just closed out everything). I don't know where to start troubleshooting, so I haven't worried too much about it.

Right, I'll wait on the official version if that kind of thing is showing up.  ;)   My dfhack.init makes a few changes - adding Lethosor's scripts (which are amazing), adding some keybindings that I think should be default (https://github.com/DFHack/dfhack/pull/325), and de-commenting the UI plugins (seriously, why were those ever disabled?).  All but the last are in a single section:

Spoiler: start of init (click to show/hide)
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 09:37:33 am
Neat.  I've got this working for myself, but I'd prefer an official release for the Starter Pack.  Is there an ETA for dfhack 40.12-r1?   If it's not going to be out in the next day or two I'll just use the unofficial version.
so far it works pretty well - only thing missing from your dfhack.init is lethosor's scripts, I think. I haven't tested your custom onload scripts yet.

I've also got some weirdness going on with workflow - nothing completely broken, but I'm getting errors showing up about something missing in a table - I'll post details tomorrow (just closed out everything). I don't know where to start troubleshooting, so I haven't worried too much about it.

Right, I'll wait on the official version if that kind of thing is showing up.  ;)   My dfhack.init makes a few changes - adding Lethosor's scripts (which are amazing), adding some keybindings that I think should be default (https://github.com/DFHack/dfhack/pull/325), and de-commenting the UI plugins (seriously, why were those ever disabled?).  All but the last are in a single section:

Spoiler: start of init (click to show/hide)

Here's the error I'm getting - seems harmless so far, and may be an issue with my save (migrated from .40.11):

Just noticed this showed up right after it in stderr.log:

UNKNOWN CLASS 'dfhack_lua_viewscreen@DFHack': vtable = 0xf4577fc

Save file: http://1drv.ms/1uxf1c8

Also, here's my dfhack.init - I basically went through the StarterPack one and tweaked it to my preferences, but the key thing is that the title-version and load-screen plugins won't load on .40.12 (at least when I first built that package above): http://pastebin.com/mM6TgBjC
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 14, 2014, 10:18:01 am
The "table index is nil" error is a simple fix (https://github.com/DFHack/dfhack/pull/332/files) (make that change to <DF>/hack/lua/plugins/workflow.lua).

Quote
Also, here's my dfhack.init - I basically went through the StarterPack one and tweaked it to my preferences, but the key thing is that the title-version and load-screen plugins won't load on .40.12 (at least when I first built that package above): http://pastebin.com/mM6TgBjC
They appear to be working just fine on 0.40.11 and 0.40.12 for me. Are there errors that show up in the console, or do those scripts just fail silently? What platform and DFHack version are you using?
Title: Re: DFHack 0.40.11-r1
Post by: PeridexisErrant on September 14, 2014, 10:25:42 am
Also working fine for me, with the above init and Salithus' build.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 11:07:30 am
The "table index is nil" error is a simple fix (https://github.com/DFHack/dfhack/pull/332/files) (make that change to <DF>/hack/lua/plugins/workflow.lua).
Worked like a charm. I've updated my build (r1a): http://1drv.ms/1pfAakN

Quote
Also, here's my dfhack.init - I basically went through the StarterPack one and tweaked it to my preferences, but the key thing is that the title-version and load-screen plugins won't load on .40.12 (at least when I first built that package above): http://pastebin.com/mM6TgBjC
They appear to be working just fine on 0.40.11 and 0.40.12 for me. Are there errors that show up in the console, or do those scripts just fail silently? What platform and DFHack version are you using?
In dfhack:
title-version is not a recognized command.
load-screen is not a recognized command.


Using the above DFHack build I posted and DF .40.12, on Win 8.1x64.

Note: that vtable error still shows up in stderr.log, no idea if it's important.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 14, 2014, 11:18:07 am
You need to obtain those scripts from here (https://github.com/lethosor/dfhack-scripts) - they're not included in DFHack by default.
Also, it would be nice if you could use "r0" for pre-releases to avoid confusion (and possible incompatibilities) with the official r1 release.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 11:25:33 am
You need to obtain those scripts from here (https://github.com/lethosor/dfhack-scripts) - they're not included in DFHack by default.
Also, it would be nice if you could use "r0" for pre-releases to avoid confusion (and possible incompatibilities) with the official r1 release.
will do as soon as I'm back at my computer (out running errands now)
Title: Re: DFHack 0.40.11-r1
Post by: fricy on September 14, 2014, 11:32:48 am
You need to obtain those scripts from here (https://github.com/lethosor/dfhack-scripts) - they're not included in DFHack by default.
Also, it would be nice if you could use "r0" for pre-releases to avoid confusion (and possible incompatibilities) with the official r1 release.
Understood, and I usually do this, however mifki's plugins were complied with 40.12-r1 string, so they won't work r0 unless you recompile or hexedit them. And I couldn't locate the sources of his forked dfhack plugins.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 12:57:58 pm
You need to obtain those scripts from here (https://github.com/lethosor/dfhack-scripts) - they're not included in DFHack by default.
Also, it would be nice if you could use "r0" for pre-releases to avoid confusion (and possible incompatibilities) with the official r1 release.
Understood, and I usually do this, however mifki's plugins were complied with 40.12-r1 string, so they won't work r0 unless you recompile or hexedit them. And I couldn't locate the sources of his forked dfhack plugins.
this is my excuse also <_<

e: those scripts worked great - is there any git voodoo I can do to include them automagically in the build process?

e2: I got the Hotkeys plugin working with this release too (literally did nothing except figure out where the source was and how to add a plugin to the cmake jaunts):

I just built it to work with the .40.12 release I have (it's actually r0, but I had to build as r1 for compatibility with TwbT):

https://github.com/Falconne/dfhack/blob/f7640811990f5d8c0638fff960fa977019d161ed/plugins/hotkeys.cpp is where I got the source.

dll: http://1drv.ms/1D82Y99

e3: I also got automelt working HOWEVER - there's got to be a better way to find spots to add text than what I did.


I copied this to both stocks.cpp and pulled the automelt.cpp from here: https://github.com/Falconne/dfhack/blob/5f611ec48b65aacf8e9f55a1de579e76087330bf/plugins/automelt.cpp

I changed the int y = dims.y2 - n line to be 4, 5, and 6. Is there a better way to "inject" a row? It looks ok, but if anyone else were to use the same exact code it would end up with one of the lines being overwritten unless each plugin manages to have unique values of n.
Title: Re: DFHack 0.40.11-r1
Post by: expwnent on September 14, 2014, 03:48:01 pm
Unofficial releases should always use a different release string to avoid incompatibilities and so that if people have problems they can accurately report what version they have, which is impossible if they have the same name as an official release.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 03:51:37 pm
Unofficial releases should always use a different release string to avoid incompatibilities and so that if people have problems they can accurately report what version they have, which is impossible if they have the same name as an official release.
If I understand the build/load process correctly, we'd need less stringent version checking for loaded modules. fricy and I have to compile DFHack as a .40.12r1 release because the latest .40.12 TwbT was compiled as that release. If I compile as r0, TwbT won't load.
Title: Re: DFHack 0.40.11-r1
Post by: expwnent on September 14, 2014, 04:36:46 pm
Extra plugins can just be recompiled for different releases.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 04:38:04 pm
Extra plugins can just be recompiled for different releases.
Not if we don't have the source, like fricy mentioned.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 14, 2014, 04:38:33 pm
Unofficial releases should always use a different release string to avoid incompatibilities and so that if people have problems they can accurately report what version they have, which is impossible if they have the same name as an official release.
If I understand the build/load process correctly, we'd need less stringent version checking for loaded modules. fricy and I have to compile DFHack as a .40.12r1 release because the latest .40.12 TwbT was compiled as that release. If I compile as r0, TwbT won't load.
The compatibility check is essential - if there are any structure changes between pre-release builds and r1, plugins built with the older structures could crash when using the official r1 structures. It would be safer to recompile TwbT (changing the release number of an existing binary might work, assuming it was built for the same version of DF, since I don't think TwbT relies on specific structures).
Edit: Ninja'd
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 04:48:50 pm
Unofficial releases should always use a different release string to avoid incompatibilities and so that if people have problems they can accurately report what version they have, which is impossible if they have the same name as an official release.
If I understand the build/load process correctly, we'd need less stringent version checking for loaded modules. fricy and I have to compile DFHack as a .40.12r1 release because the latest .40.12 TwbT was compiled as that release. If I compile as r0, TwbT won't load.
The compatibility check is essential - if there are any structure changes between pre-release builds and r1, plugins built with the older structures could crash when using the official r1 structures. It would be safer to recompile TwbT (changing the release number of an existing binary might work, assuming it was built for the same version of DF, since I don't think TwbT relies on specific structures).
Edit: Ninja'd

It would be better than to version the structure/API changes and check plugins against that (yes I realize that would be a large undertaking). The upside would be that you wouldn't have to have a separate compiled DLL for each DFHack release, which would I hope mean troubleshooting plugins would be easier.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 14, 2014, 04:50:48 pm
It would be better than to version the structure/API changes and check plugins against that (yes I realize that would be a large undertaking). The upside would be that you wouldn't have to have a separate compiled DLL for each DFHack release, which would I hope mean troubleshooting plugins would be easier.
Isn't this what the existing system accomplishes?
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 04:59:24 pm
It would be better than to version the structure/API changes and check plugins against that (yes I realize that would be a large undertaking). The upside would be that you wouldn't have to have a separate compiled DLL for each DFHack release, which would I hope mean troubleshooting plugins would be easier.
Isn't this what the existing system accomplishes?
No? The existing system assumes nothing can be forwards compatible, ever, as illustrated by the issue with TwbT. Despite the code being exactly the same, I have to have a version # that matches the build of DFHack. If I understood what I did above correctly, I'm using the exact same structures/API as .40.11 but with symbols.xml for .40.12 and building from source with a .40.12.r1 version number.

Versioning your structures/APIs allows you to be selective about what is/isn't compatible. The TwbT plugin, for example, would load because DFHack would see it using structure/API version that's compatible with the current code, rather than seeing that it wasn't built with the exact same version # specified in a makefile.

(fakeedit: also any input on my q above about adding text from the automelt/stocks/autotrade plugins?)
Title: Re: DFHack 0.40.11-r1
Post by: LeoCean on September 14, 2014, 06:09:00 pm
Well mifki is on now and it'd be easier for him to just add that change so you can have dfhack r0 but twbt does release source code if you look at the latest release builds.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 14, 2014, 06:17:04 pm
I think Fricy is referring to Mifki's modifications to other plugins (e.g. mousequery) to make them work better with TwbT.
Title: Re: DFHack 0.40.11-r1
Post by: breadman on September 14, 2014, 10:21:25 pm
e2: I got the Hotkeys plugin working with this release too (literally did nothing except figure out where the source was and how to add a plugin to the cmake jaunts):

e3: I also got automelt working HOWEVER - there's got to be a better way to find spots to add text than what I did.

It appears that we have duplicated (https://github.com/DFHack/dfhack/pull/323) effort (https://github.com/DFHack/dfhack/pull/326); sorry for not being more vocal about the latter progress.  (At least this provides more evidence of their desirability.)  For automelt, I rearranged the lines again to put it and autotrade together, and made the two merge at the bottom when there isn't enough room for the stockpile links.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 10:42:33 pm
I think Fricy is referring to Mifki's modifications to other plugins (e.g. mousequery) to make them work better with TwbT.
Either way, there's no good reason (other than, as I conceded earlier, the effort required to make the change now), for plugins to have to be compiled against a specific version of DFHack as a whole. Without that requirement, the same exact twbt.plugin.dll could load against .40.11r1 or .40.12r0 without any work by anyone, which in turn means that people compiling starter packs and whatnot won't have to wait for as many updates with each release of anything.

Current process:
* DF updates.
* Symbol updates.
* DF hack updates.
* 3rd party plugins updates.
* Starter pack release.

New process could (should) be:
* DF updates.
* Symbol updates.
* IF new/changed symbols, DF hack updates to structs/API.
* IF DF hack updates to structs/API, 3rd party plugins updates.
* Starter pack release.

In this case, unless I just don't understand something about the symbols update process, I'm effectively running the exact same code as DFHack 0.40.11r1 with symbols from DF 0.40.12. I'm completely at a loss as to why, if only symbols.xml updates were really what was needed in the first place, I had to jump through so many hoops to get to TwbT on DF 0.40.12 in the first place - I should be able to just update the DFHack 0.40.11r1 with the new symbols file and go, not recompile every plugin just so it can convince DFHack that everything is 0.40.12r0.

e2: I got the Hotkeys plugin working with this release too (literally did nothing except figure out where the source was and how to add a plugin to the cmake jaunts):

e3: I also got automelt working HOWEVER - there's got to be a better way to find spots to add text than what I did.

It appears that we have duplicated (https://github.com/DFHack/dfhack/pull/323) effort (https://github.com/DFHack/dfhack/pull/326); sorry for not being more vocal about the latter progress.  (At least this provides more evidence of their desirability.)  For automelt, I rearranged the lines again to put it and autotrade together, and made the two merge at the bottom when there isn't enough room for the stockpile links.

No worries! I've done 0 development on plugins - just got to the point today where I know enough to be dangerous.
Title: Re: DFHack 0.40.11-r1
Post by: mifki on September 14, 2014, 11:12:02 pm
Sometimes there can be changes that break compatibility, there was such between 0.34.11r3 and r5 not so long ago.
However of course I'd prefer not to recompile twbt for each minor dfhack update.
So in general version check is good but probably it should include only major changes.

That said, all other plugins are included in dfhack source tree and built together with it, so it's a problem for twbt only, so I don't expect anything to change here.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 11:20:46 pm
Sometimes there can be changes that break compatibility, there was such between 0.34.11r3 and r5 not so long ago.
However of course I'd prefer not to recompile twbt for each minor dfhack update.
So in general version check is good but probably it should include only major changes.

That said, all other plugins are included in dfhack source tree and built together with it, so it's a problem for twbt only, so I don't expect anything to change here.
Yeah I don't expect it will change either, but I'm still right that my way is better ;)

Actually, I wonder how big of a change it would to just change DFHack's version to be separate from DF itself. That way you could do regular major/minor/revision versioning for DFHack (I'd call it 6.whatever at this point and consider 0.34.11r5 5.0) and then the DF version check would go against the contents of symbols.xml.
Title: Re: DFHack 0.40.11-r1
Post by: mifki on September 14, 2014, 11:36:28 pm
Sometimes there can be changes that break compatibility, there was such between 0.34.11r3 and r5 not so long ago.
However of course I'd prefer not to recompile twbt for each minor dfhack update.
So in general version check is good but probably it should include only major changes.

That said, all other plugins are included in dfhack source tree and built together with it, so it's a problem for twbt only, so I don't expect anything to change here.
Yeah I don't expect it will change either, but I'm still right that my way is better ;)

Actually, I wonder how big of a change it would to just change DFHack's version to be separate from DF itself. That way you could do regular major/minor/revision versioning for DFHack (I'd call it 6.whatever at this point and consider 0.34.11r5 5.0) and then the DF version check would go against the contents of symbols.xml.

I will have to update twbt for each df version anyway (but not dfhack release).
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 14, 2014, 11:46:49 pm
Sometimes there can be changes that break compatibility, there was such between 0.34.11r3 and r5 not so long ago.
However of course I'd prefer not to recompile twbt for each minor dfhack update.
So in general version check is good but probably it should include only major changes.

That said, all other plugins are included in dfhack source tree and built together with it, so it's a problem for twbt only, so I don't expect anything to change here.
Yeah I don't expect it will change either, but I'm still right that my way is better ;)

Actually, I wonder how big of a change it would to just change DFHack's version to be separate from DF itself. That way you could do regular major/minor/revision versioning for DFHack (I'd call it 6.whatever at this point and consider 0.34.11r5 5.0) and then the DF version check would go against the contents of symbols.xml.

I will have to update twbt for each df version anyway (but not dfhack release).
Things like the Hotkeys plugin, though, wouldn't - source I used for that was from before DF 0.40 so there's really no reason the dll from before shouldn't work, other than the version check that fails.
Title: Re: DFHack 0.40.11-r1
Post by: whitecold on September 15, 2014, 11:55:43 am
I just got an interesting result with 3d veins. I reshuffled the map, which contains an aquifer and a waterfall, as a result the cliffs where the aquifer came out began to leak; somehow the outermost-layer-doesn't-leak has gotten lost somewhere.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 15, 2014, 01:58:44 pm
Sometimes there can be changes that break compatibility, there was such between 0.34.11r3 and r5 not so long ago.
However of course I'd prefer not to recompile twbt for each minor dfhack update.
So in general version check is good but probably it should include only major changes.

That said, all other plugins are included in dfhack source tree and built together with it, so it's a problem for twbt only, so I don't expect anything to change here.
Yeah I don't expect it will change either, but I'm still right that my way is better ;)

Actually, I wonder how big of a change it would to just change DFHack's version to be separate from DF itself. That way you could do regular major/minor/revision versioning for DFHack (I'd call it 6.whatever at this point and consider 0.34.11r5 5.0) and then the DF version check would go against the contents of symbols.xml.

I will have to update twbt for each df version anyway (but not dfhack release).
Things like the Hotkeys plugin, though, wouldn't - source I used for that was from before DF 0.40 so there's really no reason the dll from before shouldn't work, other than the version check that fails.
Using the same source doesn't guarantee compatibility - if a structure used by a plugin changes at all, that plugin will have to be recompiled, even if it doesn't need to be updated. For example, here (https://www.diffchecker.com/e5zvlv3j) is a diff of the viewscreen_loadgamest.h changes between 0.34.11 and 0.40.12. Note the addition of the "unk_v40_1a" and "unk_v40_1b" fields - any plugin compiled before these fields were introduced will almost certainly crash when attempting to access other fields (e.g. "saves").

Edit: In addition to structure changes, DFHack changes can break compatibility - for example, this change (https://github.com/dfhack/dfhack/commit/896cd11fe92c5a069c0cdf14bdda17c7e286f0b0) broke compatibility with all plugins that interpose vmethods.
Title: Re: DFHack 0.40.10-r1
Post by: Roses on September 15, 2014, 02:29:49 pm
So if one is checked every 100 and another every 1000, the one that gets checked every 1000 will never be checked? Or will it instead be checked every 100?

It will check for events every 100 ticks. When that happens, all listeners will be notified, regardless of how often or rarely they requested EventManager to check for events.

As for the rest, I don't know.

Thanks for all the help (and Putnam too!), I will be doing some tests regarding many of the values found in the entities tables to see what is able to be changed and what effects it has on game play. I know that the force script no longer works for sieges in the new DF version, but can it still generate caravans? That would greatly help my testing abilities.
Title: Re: DFHack 0.40.11-r1
Post by: TheDorf on September 15, 2014, 05:23:29 pm
I've got a few ideas for plugins that I would love to see. I would love to eventually get into script coding, but I don't think I'll have the time before my winter break.

Anyway, I was just thinking I would go ahead and ask if it would be possible to give a material template (in this case blood) the effect of satisfying bloodthirst? If there are already any plugins that could be used for this, it'd be awesome, and if not, I guess I'll have something to do this winter.

While I'm at it, I might as well ask if there are any plugins that can give artifacts itemsyndromes (or something similar) when they are created? IIRC itemsyndromes could only be assigned to materials, but I read that a while ago, so it could have changed.
Title: Re: DFHack 0.40.11-r1
Post by: Hades on September 15, 2014, 06:17:53 pm

It looks like the exterminate script may be broke for 0.40.12, assuming it's not something I am doing. Works fine on a clean install in 0.40.11 (Dwarf Fortress and DFHack only), but does nothing in a clean install of 0.40.12. Running the script gives nothing for output, and the same for any switches you try with it. Just FYI.


Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 15, 2014, 06:28:25 pm
Sometimes there can be changes that break compatibility, there was such between 0.34.11r3 and r5 not so long ago.
However of course I'd prefer not to recompile twbt for each minor dfhack update.
So in general version check is good but probably it should include only major changes.

That said, all other plugins are included in dfhack source tree and built together with it, so it's a problem for twbt only, so I don't expect anything to change here.
Yeah I don't expect it will change either, but I'm still right that my way is better ;)

Actually, I wonder how big of a change it would to just change DFHack's version to be separate from DF itself. That way you could do regular major/minor/revision versioning for DFHack (I'd call it 6.whatever at this point and consider 0.34.11r5 5.0) and then the DF version check would go against the contents of symbols.xml.

I will have to update twbt for each df version anyway (but not dfhack release).
Things like the Hotkeys plugin, though, wouldn't - source I used for that was from before DF 0.40 so there's really no reason the dll from before shouldn't work, other than the version check that fails.
Using the same source doesn't guarantee compatibility - if a structure used by a plugin changes at all, that plugin will have to be recompiled, even if it doesn't need to be updated. For example, here (https://www.diffchecker.com/e5zvlv3j) is a diff of the viewscreen_loadgamest.h changes between 0.34.11 and 0.40.12. Note the addition of the "unk_v40_1a" and "unk_v40_1b" fields - any plugin compiled before these fields were introduced will almost certainly crash when attempting to access other fields (e.g. "saves").

Edit: In addition to structure changes, DFHack changes can break compatibility - for example, this change (https://github.com/dfhack/dfhack/commit/896cd11fe92c5a069c0cdf14bdda17c7e286f0b0) broke compatibility with all plugins that interpose vmethods.
I'm not sure what you're saying by this. I see the first type of change as just bad design and the whole reason we're having this discussion in the first place - yes I know it would take a lot of work to fix and there are ~reasons~ it evolved the way it did, but it doesn't change the fact that it's bad practice when designing an API. Additive changes shouldn't break compatibility and plugins that don't use changed functionality shouldn't need to recompile just to get a new version number.

The second one I'm not sure what "interposing" means for this, but looking at the comment text of the change, "Track readable names of vmethod hooks for diagnostic messages.". If its' not making a mandatory functionality change, then the methods should have been overloaded, and possibly marked as deprecated, instead of changed. That would have given better stability for existing plugins, while making any future compiles aware of the new method for better debugging output.

All that's really happening by requiring a recompile with the same version # specified is you get a poor man's unit test - if it at least compiles against the code you've got some belief that the plugin might work. But with just enough knowledge to be dangerous, a plugin could be compiled against any set of DFHack code and the wrong version # specified and you get a DLL that DFHack thinks should load against its version but won't if there are breaking changes. Yes, it's better than no system. No, having a system doesn't mean there's no room for improvement.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 15, 2014, 06:36:29 pm

It looks like the exterminate script may be broke for 0.40.12, assuming it's not something I am doing. Works fine on a clean install in 0.40.11 (Dwarf Fortress and DFHack only), but does nothing in a clean install of 0.40.12. Running the script gives nothing for output, and the same for any switches you try with it. Just FYI.
It's working for me. What platform are you using? Is Ruby available?
Title: Re: DFHack 0.40.11-r1
Post by: Hades on September 15, 2014, 06:51:09 pm

It looks like the exterminate script may be broke for 0.40.12, assuming it's not something I am doing. Works fine on a clean install in 0.40.11 (Dwarf Fortress and DFHack only), but does nothing in a clean install of 0.40.12. Running the script gives nothing for output, and the same for any switches you try with it. Just FYI.
It's working for me. What platform are you using? Is Ruby available?

Windows 7 64. Have ruby installed. I tried running someone else's compilation of DFHack (0.40.12) for comparison and have the same issue.
Title: Re: DFHack 0.40.11-r1
Post by: urmane on September 16, 2014, 08:01:12 am
Not sure this is the right place to ask this - is the 0.34.11-r5 source, with all the submodules, still available?  I'm trying to compile a MDF version for linux, and it's still using the old dfhack.
Title: Re: DFHack 0.40.11-r1
Post by: Rose on September 16, 2014, 08:50:02 am
I'm not sure what you're saying by this. I see the first type of change as just bad design and the whole reason we're having this discussion in the first place - yes I know it would take a lot of work to fix and there are ~reasons~ it evolved the way it did, but it doesn't change the fact that it's bad practice when designing an API. Additive changes shouldn't break compatibility and plugins that don't use changed functionality shouldn't need to recompile just to get a new version number.

Sorry, but if there was an actual modding API for DF, this would be valid, but unfortunately, there isn't one. If something changes in the DF memory stuctures, there's no way for a plugin to necessarily know that.
Title: Re: DFHack 0.40.11-r1
Post by: expwnent on September 16, 2014, 09:27:52 am
Not sure this is the right place to ask this - is the 0.34.11-r5 source, with all the submodules, still available?  I'm trying to compile a MDF version for linux, and it's still using the old dfhack.

https://github.com/DFHack/dfhack/tree/0.34.11-r5

Just do a git checkout 0.34.11-r5 and it should work hopefully. git submodule update also to use the old df-structures.
Title: Re: DFHack 0.40.11-r1
Post by: Quietust on September 16, 2014, 09:49:59 am
I'm not sure what you're saying by this. I see the first type of change as just bad design and the whole reason we're having this discussion in the first place - yes I know it would take a lot of work to fix and there are ~reasons~ it evolved the way it did, but it doesn't change the fact that it's bad practice when designing an API. Additive changes shouldn't break compatibility and plugins that don't use changed functionality shouldn't need to recompile just to get a new version number.

Sorry, but if there was an actual modding API for DF, this would be valid, but unfortunately, there isn't one. If something changes in the DF memory stuctures, there's no way for a plugin to necessarily know that.
It helps to realize that there is effectively no abstraction between DFHack plugins and DF itself - memory addresses for globals are determined on program startup (based on data inside symbols.xml), but structure layouts are defined in C++ header files (which are generated by a Perl script prior to compiling DFHack itself) so that plugins are able to directly access DF's internals as if they were part of DF itself (which, for all intents and purposes, they are). Once a plugin is compiled, an access to "viewscreen_loadgamest.loading" simply becomes "BYTE PTR [ecx+10h]", so if a new int32 field named "unk_v40_1a" gets added, it will end up reading the wrong data.

If you want something you don't need to recompile between releases, you need to use scripts, since those are effectively recompiled every time you run them and will thus know where to get that new field since they can ask DFHack where it is, and while DFHack has the same issue described above, recompiling it for new versions of DF is acceptable and expected by most people. Of course, scripts are also slower, but that's the cost you pay for increased flexibility.
Title: Re: DFHack 0.40.11-r1
Post by: urmane on September 16, 2014, 01:27:05 pm
Not sure this is the right place to ask this - is the 0.34.11-r5 source, with all the submodules, still available?  I'm trying to compile a MDF version for linux, and it's still using the old dfhack.

https://github.com/DFHack/dfhack/tree/0.34.11-r5

Just do a git checkout 0.34.11-r5 and it should work hopefully. git submodule update also to use the old df-structures.

Thanks, expwnent.  I actually went back to r4, to get a working stonesense, and so far it's looking good.
Title: Re: DFHack 0.40.11-r1
Post by: 0x517A5D on September 16, 2014, 01:54:50 pm
I've been experimenting with an automated way to figure out binary patch locations.  I have a Perl script that uses regexps to find the raw file locations for the weaponrack-unassign patch.  I have those locations for DF in 0.40.08, .11, and .12 for all of Windows, Linux (untested), and OSX (untested).

Would the raw binpatches for these versions be useful to anyone?  Only weaponrack-unassign at the moment.

(I'm not going to release the Perl script as-is; it's really nasty right now, it needs cleanup.)

I am considering porting to Lua or Ruby so that patches can be installed at runtime, similar to the binpatch console command.  I've got problems because Lua doesn't have a full Regexp engine, and the Ruby implementation doesn't have a way to feed the entire getMemRanges() list back to a script.  I'm considering my path at the moment.  Suggestions?

Also, it appears that the DF OSX image has two entire versions of DF in it, what's up with that?  Something about OS version, or maybe old 680x0/new x86 architectures?
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 16, 2014, 01:57:17 pm
Are you referring to the "binpatch" external executable or the "binpatch" Lua script (included in DFHack)? It sounds like what you're describing is already covered by the latter.
Title: Re: DFHack 0.40.11-r1
Post by: 0x517A5D on September 16, 2014, 02:04:13 pm
Are you referring to the "binpatch" external executable or the "binpatch" Lua script (included in DFHack)? It sounds like what you're describing is already covered by the latter.

lethosor, my Perl script generates patches that can be applied with either binpatch.exe or with the binpatch runtime script.  For my testing, I've been using the binpatch script.

My hypothetical patcher script would be a console script only, not a standalone.

It would not be covered by the binpatch script, because the binpatch script just applies a pre-generated list of byte changes.  I want to scan memory for patterns, figure out the proper replacements, and put them in place.  The hard part here is scanning memory.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 16, 2014, 02:16:12 pm
Ah, that makes more sense. DFHack contains some memory-scanning tools available to Lua, which may be useful (see devel/find-offsets.lua for an example).

Also, it appears that the DF OSX image has two entire versions of DF in it, what's up with that?  Something about OS version, or maybe old 680x0/new x86 architectures?

It doesn't appear to contain multiple architectures:
Code: [Select]
$ file dwarfort.exe
dwarfort.exe: Mach-O executable i386
$ file /usr/lib/libz.dylib
/usr/lib/libz.dylib: Mach-O universal binary with 2 architectures
/usr/lib/libz.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
/usr/lib/libz.dylib (for architecture i386): Mach-O dynamically linked shared library i386
Title: Re: DFHack 0.40.11-r1
Post by: 0x517A5D on September 16, 2014, 02:27:45 pm
Ah, that makes more sense. DFHack contains some memory-scanning tools available to Lua, which may be useful (see devel/find-offsets.lua for an example).
Thank you very much; I'll take a close look at that.

Quote
Also, it appears that the DF OSX image has two entire versions of DF in it, what's up with that?  Something about OS version, or maybe old 680x0/new x86 architectures?

It doesn't appear to contain multiple architectures:
Code: [Select]
$ file dwarfort.exe
dwarfort.exe: Mach-O executable i386
$ file /usr/lib/libz.dylib
/usr/lib/libz.dylib: Mach-O universal binary with 2 architectures
/usr/lib/libz.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
/usr/lib/libz.dylib (for architecture i386): Mach-O dynamically linked shared library i386

In that case, I'm wondering why the image is twice the size of the Linux image, and three times that of the Windows image.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 16, 2014, 02:43:38 pm
I'm not sure what you're saying by this. I see the first type of change as just bad design and the whole reason we're having this discussion in the first place - yes I know it would take a lot of work to fix and there are ~reasons~ it evolved the way it did, but it doesn't change the fact that it's bad practice when designing an API. Additive changes shouldn't break compatibility and plugins that don't use changed functionality shouldn't need to recompile just to get a new version number.

Sorry, but if there was an actual modding API for DF, this would be valid, but unfortunately, there isn't one. If something changes in the DF memory stuctures, there's no way for a plugin to necessarily know that.
It helps to realize that there is effectively no abstraction between DFHack plugins and DF itself - memory addresses for globals are determined on program startup (based on data inside symbols.xml), but structure layouts are defined in C++ header files (which are generated by a Perl script prior to compiling DFHack itself) so that plugins are able to directly access DF's internals as if they were part of DF itself (which, for all intents and purposes, they are). Once a plugin is compiled, an access to "viewscreen_loadgamest.loading" simply becomes "BYTE PTR [ecx+10h]", so if a new int32 field named "unk_v40_1a" gets added, it will end up reading the wrong data.

If you want something you don't need to recompile between releases, you need to use scripts, since those are effectively recompiled every time you run them and will thus know where to get that new field since they can ask DFHack where it is, and while DFHack has the same issue described above, recompiling it for new versions of DF is acceptable and expected by most people. Of course, scripts are also slower, but that's the cost you pay for increased flexibility.
The first bolded statement is my whole point, and like I mentioned above - depending on a end-user configured version string to determine compatibility isn't giving much assurance of actual compatibility.

And I'd say "acceptable and expected" is not quite the same as "accepted because they're not given any other options". Like I've already mentioned repeatedly, I appreciate that putting in that layer of abstraction now that should have been there all along to prevent the issue you described is a significant undertaking. This doesn't change the fact that the state of DF is very different now than it was 6 months ago when it had been 18 months since the last update and that dependence on DFHack, especially in starter packs and the like, is significant enough to warrant finding better ways to do things.
Title: Re: DFHack 0.40.12-r1
Post by: expwnent on September 16, 2014, 05:02:00 pm
New release!
Title: Re: DFHack 0.40.12-r1
Post by: Putnam on September 16, 2014, 05:06:33 pm
I only a few minutes ago finally packaged a version of Fortbent for 0.40.11 DFHack. Oi. I am so, so glad that I've specifically designed it to be easy to port to new versions.
Title: Re: DFHack 0.40.11-r1
Post by: IRIS_EYE_AZURE on September 16, 2014, 05:28:08 pm
Anyone want to take on the challenge of adding script triggers for the following to modtools? I have visions of modding in various things, from a whoopee cushion all the way to a dragonfire trap.
Note: lever pull can be already be done through the job complete event, but I included it in the list for the purposes of a consistent interface.
Title: Re: DFHack 0.40.12-r1
Post by: StagnantSoul on September 16, 2014, 05:47:18 pm
What would I have to put in to DHPFHack to force a strange mood to happen? Can I control what type of mood?
Title: Re: DFHack 0.40.12-r1
Post by: lethosor on September 16, 2014, 05:54:44 pm
OS X build (0.40.12-r1) (http://dffd.wimbli.com/file.php?id=9719)

What would I have to put in to DHPFHack to force a strange mood to happen? Can I control what type of mood?
"strangemood"
"strangemood -t TYPE" allows you to specify a type of mood (see "help strangemood" for more information).

Edit: Linux build of 0.40.12-r1 (GCC 4.5.4) (http://dffd.wimbli.com/file.php?id=9720) (which should now include Stonesense - whether it works on certain distros is another question entirely).
Title: Re: DFHack 0.40.11-r1
Post by: Hades on September 16, 2014, 07:00:16 pm

It looks like the exterminate script may be broke for 0.40.12, assuming it's not something I am doing. Works fine on a clean install in 0.40.11 (Dwarf Fortress and DFHack only), but does nothing in a clean install of 0.40.12. Running the script gives nothing for output, and the same for any switches you try with it. Just FYI.
It's working for me. What platform are you using? Is Ruby available?

Windows 7 64. Have ruby installed. I tried running someone else's compilation of DFHack (0.40.12) for comparison and have the same issue.

Just to follow up my post. Works fine in the new release. Must have been something I did compiling it (be nice to know what but alas). And thanks for the new release! Appreciate all the work you all do!
Title: Re: DFHack 0.40.12-r1
Post by: ohgoditburns on September 16, 2014, 11:37:34 pm
OS X build (0.40.12-r1) (http://dffd.wimbli.com/file.php?id=9719)

I'm not able to issue any commands in this version. It says "resetting textures" and gives notices if I resize the window or zoom in, but no commands are working, and hotkeys appear to not be working either.
Title: Re: DFHack 0.40.12-r1
Post by: StagnantSoul on September 17, 2014, 12:01:55 am
Dammit... I can only seem to get "strangemood -force" to work. Could someone give me the exact words to force a secretive armour smith mood going? I want to have my king be a steel artifact-covered killing machine. I already have a giant lion leather, ruby and faint yellow diamond spiked cloak that he wears. I may give him the steel studded thong too.
Title: Re: DFHack 0.40.12-r1
Post by: idgarad on September 17, 2014, 12:08:42 am
Can we get an EggWatch similar to seedwatch to toggle cooking eggs if there are more then say 30 eggs for a species?
Title: Re: DFHack 0.40.12-r1
Post by: Max™ on September 17, 2014, 01:59:14 am
Dammit... I can only seem to get "strangemood -force" to work. Could someone give me the exact words to force a secretive armour smith mood going? I want to have my king be a steel artifact-covered killing machine. I already have a giant lion leather, ruby and faint yellow diamond spiked cloak that he wears. I may give him the steel studded thong too.

Pick a unit who isn't on a job of course, then try:

strangemood -unit -type secretive -skill armorsmith -force

I just do fey when I'm forcing though, managed to get a retroactive loop by not examining items, so I had a pair of boots which were in the art on a war hammer made before both of them, though I messed up and saved after examining the second boot by mistake.

Also: all of my love to you folks for getting the linux versions updated, you are bloodgods among mendorfs.
Title: Re: DFHack 0.40.12-r1
Post by: StagnantSoul on September 17, 2014, 02:16:57 am
Thanks! Now on to making him a ton of steel artifacts. Make sure the only gems are star ruby and sapphire, only metal is steel, featherwood for wood, obsidian for stone, and giant lion for bones and leather. You have to have matching artifacts, you know.
Title: Re: DFHack 0.40.12-r1
Post by: lethosor on September 17, 2014, 05:47:26 am
OS X build (0.40.12-r1) (http://dffd.wimbli.com/file.php?id=9719)

I'm not able to issue any commands in this version. It says "resetting textures" and gives notices if I resize the window or zoom in, but no commands are working, and hotkeys appear to not be working either.
That's strange - it sounds like you're not using DF 0.40.12 (or 0.40.11). If that's not the case, have you made any patches to dwarfort.exe?
Title: Re: DFHack 0.40.12-r1
Post by: mifki on September 17, 2014, 06:01:15 am
OS X build (0.40.12-r1) (http://dffd.wimbli.com/file.php?id=9719)

I'm not able to issue any commands in this version. It says "resetting textures" and gives notices if I resize the window or zoom in, but no commands are working, and hotkeys appear to not be working either.
That's strange - it sounds like you're not using DF 0.40.12 (or 0.40.11). If that's not the case, have you made any patches to dwarfort.exe?

Or just ran `df` script instead of `dfhack`.
Title: Re: DFHack 0.40.12-r1
Post by: Max™ on September 17, 2014, 09:59:53 am
I know one of the first times I tried to get dfhack working I had to manually allow the dfhack script to be executed, maybe it was just defaulting to the df due to a similar problem?
Title: Re: DFHack 0.40.12-r1
Post by: ohgoditburns on September 17, 2014, 10:00:38 am
OS X build (0.40.12-r1) (http://dffd.wimbli.com/file.php?id=9719)

I'm not able to issue any commands in this version. It says "resetting textures" and gives notices if I resize the window or zoom in, but no commands are working, and hotkeys appear to not be working either.
That's strange - it sounds like you're not using DF 0.40.12 (or 0.40.11). If that's not the case, have you made any patches to dwarfort.exe?


Welp, that was a silly mistake. I accidentally unpacked dfhack for 0.40.11 into my df 0.40.12 folder. It does work for me after all. Sorry bout that!
Title: Re: DFHack 0.40.11-r1
Post by: expwnent on September 17, 2014, 10:44:17 am
Anyone want to take on the challenge of adding script triggers for the following to modtools? I have visions of modding in various things, from a whoopee cushion all the way to a dragonfire trap.
  • lever pull
  • pressure plate activation
  • gear/shaft/roller power status change
  • door status change
  • bridge/hatch/floor bars/vertical bars/floodgate status change
  • trap status change
  • minecart friction (from stop) applied; minecart dump activation
Note: lever pull can be already be done through the job complete event, but I included it in the list for the purposes of a consistent interface.

That sort of thing is easy enough to do. I'll add it to the list.
Title: Re: DFHack 0.40.11-r1
Post by: Quietust on September 17, 2014, 12:44:41 pm
depending on a end-user configured version string to determine compatibility isn't giving much assurance of actual compatibility.
There is a version string, but it isn't "end-user configured" - it's set inside the project makefiles (by the DFHack developers).

And I'd say "acceptable and expected" is not quite the same as "accepted because they're not given any other options". Like I've already mentioned repeatedly, I appreciate that putting in that layer of abstraction now that should have been there all along to prevent the issue you described is a significant undertaking. This doesn't change the fact that the state of DF is very different now than it was 6 months ago when it had been 18 months since the last update and that dependence on DFHack, especially in starter packs and the like, is significant enough to warrant finding better ways to do things.
Long ago, there was an "abstraction layer" with that level of detail. It was called "memory.xml", and it contained individual addresses and offsets for the small handful of variables that DFHack commands wanted to use. It was also very messy to deal with.

When we switched to df-structures and loading into DF itself (instead of acting like a debugger and using ReadProcessMemory/WriteProcessMemory), we did away with that because the new system was much simpler to code for - rather than having to call special functions inside DFHack to fetch an object of a particular type (from one of the specific lists it knew about at the time) and then lookup the offset of each individual field within the object it wanted to access, it could offload all of that to the C++ compiler.

And like I already said, Lua scripts do have the "layer of abstraction" you're so insistent on having - you can access fields by name, and as long as those field names don't change then you can run the script in whatever version of DF you want. Hell, I've run some DFHack Lua scripts written for 0.34.11 in 0.28.181.40d and even 0.23.130.23a, and they worked just fine as long as they weren't trying to access things that didn't exist.

If you think you can do better, then by all means do so.
Title: Re: DFHack 0.40.12-r1
Post by: Roses on September 17, 2014, 01:09:26 pm
I'll add it to the list.

You should probably trade mark that.

Long ago, there was an "abstraction layer" with that level of detail. It was called "memory.xml", and it contained individual addresses and offsets for the small handful of variables that DFHack commands wanted to use. It was also very messy to deal with.
Man, I remember when DFHack used memory.xml, so few people used it because there were only a handful of things, and hardly any modders had it in their mods. The df-structures method is so much nicer. I shudder to think of those days.
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 17, 2014, 01:27:32 pm
depending on a end-user configured version string to determine compatibility isn't giving much assurance of actual compatibility.
There is a version string, but it isn't "end-user configured" - it's set inside the project makefiles (by the DFHack developers).
I'm an end user - I set it to get DFHack to recognize mifki's build of the TwbT plugin, which is what brought up this whole discussion in the first place. If I want to compile just a plugin, I can set that version string to whatever I feel like, and DFHack will think the DLL was compiled for that version of DFHack, regardless of what is actually happening in the source.

And I'd say "acceptable and expected" is not quite the same as "accepted because they're not given any other options". Like I've already mentioned repeatedly, I appreciate that putting in that layer of abstraction now that should have been there all along to prevent the issue you described is a significant undertaking. This doesn't change the fact that the state of DF is very different now than it was 6 months ago when it had been 18 months since the last update and that dependence on DFHack, especially in starter packs and the like, is significant enough to warrant finding better ways to do things.
Long ago, there was an "abstraction layer" with that level of detail. It was called "symbols.xml", and it contained individual addresses and offsets for the small handful of variables that DFHack commands wanted to use. It was also very messy to deal with.

When we switched to df-structures and loading into DF itself (instead of acting like a debugger and using ReadProcessMemory/WriteProcessMemory), we did away with that because the new system was much simpler to code for - rather than having to call special functions inside DFHack to fetch an object of a particular type (from one of the specific lists it knew about at the time) and then lookup the offset of each individual field within the object it wanted to access, it could offload all of that to the C++ compiler.

And like I already said, Lua scripts do have the "layer of abstraction" you're so insistent on having - you can access fields by name, and as long as those field names don't change then you can run the script in whatever version of DF you want. Hell, I've run some DFHack Lua scripts written for 0.34.11 in 0.28.181.40d and even 0.23.130.23a, and they worked just fine as long as they weren't trying to access things that didn't exist.

If you think you can do better, then by all means do so.
That doesn't make any sense in the context of the discussion so far. My whole reason for thinking that there's got to be a better way of doing things is that I used:
DFHack source from .40.11r1
symbols.xml for DF .40.12
DF .40.12

And everything worked fine. If symbols.xml isn't that abstraction layer anymore, why was updating it enough to get everything working? Why was it needed at all? Those are the questions that kickstarted this whole thing. Waiting on the DFHack team to put together for a release when there are bug fixes or breaking changes makes sense. Waiting on them when all that was required to get DF .40.12 up and running, which has a critical fix for dwarves getting stuck unconscious, doesn't make sense if the only two things required were updating symbols.xml and making DFHack and the plugins all think they had been changed to work with .40.12.

As a result, an update to DF .04.12 for the Starter Pack PE maintains could not be released until the DFHack developers put together a release. For whatever reason, this took 6 days to do. Considering that the DF update from .10->.11 took 7 days and Toady's notes say a .13 release could be today or tomorrow, continuing this cycle makes starter packs effectively worthless. We have gone from a system where, 6 months ago, the starter pack was constantly at the latest version of DF to now, where it never can be.

 I don't particularly care how we get that gap closed, what's important to that me is we figure out a way to do it. Yours is the first post since this conversation began that wasn't completely "well we've always done it this way so get over it" and actually started discussing why the roadblocks exist and what it would take to overcome them. With that in mind, unless the DFHack team intends to completely obsolete non-Lua plugins, that's not an effective approach as things like the Starter Pack depend on a ton of existing plugins - TwbT, Falconne's jaunts, etc.

It seems to me that if just updating symbols.xml was enough to get things moving from .40.11 to .40.12, there's got to be some way to eliminate the wait on the DFHack team to do an r1 release if the only thing that is required for an update is symbols.xml.
Title: Re: DFHack 0.40.12-r1
Post by: ag on September 17, 2014, 01:50:16 pm
The main reason symbols.xml is still loaded at runtime is that the values in it cannot ever carry over to a new release and must be found one way or another anew. Keeping the file loaded at runtime allows adding more values to it without recompiling as we work on it.

However the bulk of the knowledge about DF is all the rest of xml files, and they are in effect compiled into both dfhack core and any plugins. If anything at all other than symbols.xml changes everything must be recompiled.

On the other hand if symbols.xml is truly the only thing that changed like with 0.40.12, then you can just get a new version of it and drop into the old dfhack, and it will work just fine.
Title: Re: DFHack 0.40.12-r1
Post by: Rumrusher on September 17, 2014, 01:55:38 pm
Wait isn't the whole convo started from the idea of separating dfhack from DF?
Which long time ago was how dfhack originally was? most of the problems with dfhack back then was it needed to hook into the game and that tick off anti-virus software pretty bad.
Like most of the scripts/plugins had to run 'look and poke' functions to get anything done. we couldn't even touch graphics of DF back then either since we kinda looking through on the outside.
like now the same problems still exist and kinda never go away, also there's no per tick effects or scripts since well dfhack had to stop dwarf fortress and scan the whole game to run those addons.
and running stuff like that tank the fps. so if you're crazy enough you could do what AG said.
Title: Re: DFHack 0.40.11-r1
Post by: lethosor on September 17, 2014, 02:32:47 pm
depending on a end-user configured version string to determine compatibility isn't giving much assurance of actual compatibility.
There is a version string, but it isn't "end-user configured" - it's set inside the project makefiles (by the DFHack developers).
I'm an end user - I set it to get DFHack to recognize mifki's build of the TwbT plugin, which is what brought up this whole discussion in the first place. If I want to compile just a plugin, I can set that version string to whatever I feel like, and DFHack will think the DLL was compiled for that version of DFHack, regardless of what is actually happening in the source.
If you set the DFHack version when compiling DFHack, that's not what Quietust is referring to by "end user". If you want a plugin to be compatible with a specific version of DFHack, it's safer to compile DFHack and that plugin with an accurate version (or ask the plugin's author to build for that DFHack version), rather than changing the DFHack version to match a plugin. The version check is in place to prevent problems resulting from incompatibilities between DFHack versions - it may have been safe to bypass in this case (by changing the DFHack version), but that doesn't guarantee that it will be safe in the future.

Quote
...
That doesn't make any sense in the context of the discussion so far. My whole reason for thinking that there's got to be a better way of doing things is that I used:
DFHack source from .40.11r1
symbols.xml for DF .40.12
DF .40.12

And everything worked fine. If symbols.xml isn't that abstraction layer anymore, why was updating it enough to get everything working? Why was it needed at all? Those are the questions that kickstarted this whole thing. Waiting on the DFHack team to put together for a release when there are bug fixes or breaking changes makes sense. Waiting on them when all that was required to get DF .40.12 up and running, which has a critical fix for dwarves getting stuck unconscious, doesn't make sense if the only two things required were updating symbols.xml and making DFHack and the plugins all think they had been changed to work with .40.12.
When you built your version of "0.40.12-r1", there hadn't been any DFHack changes made to the main repo since 0.40.11-r1 - the only changes were made to df-structures. Expwnent merged in around a dozen pull requests an hour or so before making an official release. This brings up another point: there are now multiple "0.40.12-r1" builds floating around that have different behaviors and features. Among other things, "hack-wish" no longer crashes in certain cases, "search" has been updated for 0.40.12, and workflow no longer produces repeating error messages. However, since builds built before these changes identify themselves as "0.40.12-r1", there's no easy way to tell which build of "0.40.12-r1" that specific bug reports apply to, for example.
Quote
As a result, an update to DF .04.12 for the Starter Pack PE maintains could not be released until the DFHack developers put together a release. For whatever reason, this took 6 days to do. Considering that the DF update from .10->.11 took 7 days and Toady's notes say a .13 release could be today or tomorrow, continuing this cycle makes starter packs effectively worthless. We have gone from a system where, 6 months ago, the starter pack was constantly at the latest version of DF to now, where it never can be.
Why exactly do starter packs "require" DFHack? If playing the latest version is necessary, it's entirely possible to play the latest version without DFHack (or any other utilities, for that matter) for a few days. An alternative is to build DFHack independently, as Fricy did for his pack (and Beautato attempted to). (Admittedly, doing so brings up DFHack versioning issues again, but my point is that the delays in updating some packs are primarily due to the authors of those packs choosing not to update until certain utilities are updated.)

Quote
I don't particularly care how we get that gap closed, what's important to that me is we figure out a way to do it. Yours is the first post since this conversation began that wasn't completely "well we've always done it this way so get over it" and actually started discussing why the roadblocks exist and what it would take to overcome them. With that in mind, unless the DFHack team intends to completely obsolete non-Lua plugins, that's not an effective approach as things like the Starter Pack depend on a ton of existing plugins - TwbT, Falconne's jaunts, etc.

From what I've heard on IRC, Expwnent plans to release 0.40.13-r1 within a day of df-structures being updated. (If you take a look at the old DFHack thread, updates were often available a day or so after a release, except for major/new-feature releases).
I'm not sure what you mean by obsoleting non-Lua plugins - Lua plugins don't necessarily work with new DFHack releases without modification (they don't need to be recompiled, but that leads to problems being encountered at runtime instead).
Title: Re: DFHack 0.40.12-r1
Post by: expwnent on September 17, 2014, 02:43:12 pm
I try to keep such predictions to the irc channel so people don't get mad if I fail to live up to them. I hope to get it done that fast but something could always go wrong.
Title: Re: DFHack 0.40.12-r1
Post by: khearn on September 17, 2014, 02:44:42 pm
I want it NOWWWWW!!!

You PROMISED!!!!!

Waaaaah!!!






;)
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 03:05:16 pm
that doesn't guarantee that it will be safe in the future.

When you built your version of "0.40.12-r1", there hadn't been any DFHack changes made to the main repo since 0.40.11-r1 - the only changes were made to df-structures. Expwnent merged in around a dozen pull requests an hour or so before making an official release. This brings up another point: there are now multiple "0.40.12-r1" builds floating around that have different behaviors and features. Among other things, "hack-wish" no longer crashes in certain cases, "search" has been updated for 0.40.12, and workflow no longer produces repeating error messages. However, since builds built before these changes identify themselves as "0.40.12-r1", there's no easy way to tell which build of "0.40.12-r1" that specific bug reports apply to, for example.

My point exactly: This is why basing compatibility on the version string specified during compilation does nothing. At the time I compiled DFHack and posted a zip for other users:

A) All I did was follow the instructions (http://www.bay12forums.com/smf/index.php?topic=139553.msg5614774#msg5614774) posted (http://www.bay12forums.com/smf/index.php?topic=139553.msg5655714#msg5655714) by others (http://www.bay12forums.com/smf/index.php?topic=138754.msg5655860#msg5655860) on how to compile DFHack for Windows.
B) I had no idea that it should have been marked r0.
C) Even after knowing it should have been marked r0, there were other plugins (in this case TwbT) that I didn't know how to recompile separately that were marked for r1.

Why exactly do starter packs "require" DFHack? If playing the latest version is necessary, it's entirely possible to play the latest version without DFHack (or any other utilities, for that matter) for a few days. An alternative is to build DFHack independently, as Fricy did for his pack (and Beautato attempted to). (Admittedly, doing so brings up DFHack versioning issues again, but my point is that the delays in updating some packs are primarily due to the authors of those packs choosing not to update until certain utilities are updated.)
It's asinine to think that starter packs, which are specifically geared towards new/inexperienced DF players, aren't dependent on the functionality that DFHack and commonly used plugins bring. Saying it's entirely up to the pack author's choice is like blaming the restaurant industry for people getting hungry.

From what I've heard on IRC, Expwnent plans to release 0.40.13-r1 within a day of df-structures being updated. (If you take a look at the old DFHack thread, updates were often available a day or so after a release, except for major/new-feature releases).
I'm not sure what you mean by obsoleting non-Lua plugins - Lua plugins don't necessarily work with new DFHack releases without modification (they don't need to be recompiled, but that leads to problems being encountered at runtime instead).
What I mean is that, per Quietust's posts, Lua scripts are currently the only way to have a layer of abstraction in that would have prevented needing DFHack plugins recompiled between .40.11 and .40.12. Unless you plan to make that the only option for plugins (which we all realize is not the right way to fix this gap), we need to consider other options.

Also, can we please quit approaching this with the "it won't fix this every time" mentality? I know that there are going to be times between versions that compatibility will break. My point is that it is not every release as evidenced by being able to use .40.11-r1 source with .40.12 symbols, so there is clearly an opportunity to improve the process.
Title: Re: DFHack 0.40.12-r1
Post by: peterix on September 17, 2014, 03:10:02 pm
Then I urge you to GO and IMPROVE the process yourself.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 03:48:25 pm
http://1drv.ms/1wqBhDR - salithus_dfhack-0.40.13-r0-Windows.zip (http://1drv.ms/1wqBhDR)

Here's the steps I'm using:
Spoiler: compile on Windows (click to show/hide)

e: corrected which repo I used (master, not develop)
Title: Re: DFHack 0.40.11-r1
Post by: 0x517A5D on September 17, 2014, 03:53:20 pm
[...] This brings up another point: there are now multiple "0.40.12-r1" builds floating around that have different behaviors and features. Among other things, "hack-wish" no longer crashes in certain cases, "search" has been updated for 0.40.12, and workflow no longer produces repeating error messages. However, since builds built before these changes identify themselves as "0.40.12-r1", there's no easy way to tell which build of "0.40.12-r1" that specific bug reports apply to, for example.

That.  That's been a persistent problem for the past month, month and a half.

Not only is it causing confusion, it's also against the DFHack license.

Quote from: the license boilerplate
[...]
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
[...]

Now in the current mess, salithus didn't exactly alter the source; he mixed-and-matched code from the official repo, part of it at a time when the repo was between official releases.  As I understand it.

It's still a problem.

Maybe the actual repo master branch should always have a DFHACK_RELEASE string with "-unofficial" appended to it?  (EDIT: in the file CMakeLists.txt)

And to make an official release, branch the master and change only that one string?

How about it, Peterix, expwnent, lethosor ?
Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 17, 2014, 03:55:50 pm
Maybe the actual repo master branch should always have a DFHACK_RELEASE string with "-unofficial" appended to it?

And to make an official release, branch the master and change only that one string?

How about it, Peterix, expwnent, lethosor ?
To clarify in case it matters:

* When I did the .12 release, I used the develop branch because I was just copypasta-ing instructions.
* When I did the .13 release (just now) I used the master branch to make sure I didn't pull anything that wasn't released yet.
Title: Re: DFHack 0.40.12-r1
Post by: Octopusfluff on September 17, 2014, 04:35:04 pm
Also, can we please quit approaching this with the "it won't fix this every time" mentality? I know that there are going to be times between versions that compatibility will break. My point is that it is not every release as evidenced by being able to use .40.11-r1 source with .40.12 symbols, so there is clearly an opportunity to improve the process.

The intensity with which you are approaching this almost suggests you see some kind of moral or ethical failing, which I find curious.

An important element to remember for working on a project like this is there's more than just the "can we do it" question. Yes, it's possible to /sometimes/ provide the capability to transition from one version to the next without source alteration. The next question is, "how often can we do it?"

We don't know. Toady provides the complete absence of any kind of guarantee as to when there will be changes that require more than a new symbol table. It might be major releases. It might be minor releases. It might be every time he updates a typo.

Consequently, there's absolutely no way to set useful expectations for actual end users. This is not a problem to be dismissed lightly; providing a mechanism will to most users imply a promise, and if that promise is not kept, people react in silly ways. From a social standpoint, it's often easier to not imply that promise.

As Peterix noted, if you want to try to improve things in the way you feel they should be improved, there's no real barrier to doing so, beyond you needing to choose to be responsible for it.
Title: Re: DFHack 0.40.12-r1
Post by: Putnam on September 17, 2014, 04:37:39 pm
Toady's gone a bit farther than that; he provides the guarantee of a complete absence of guarantee. He's said before that he doesn't want to have to keep 3rd party programs in mind when he writes Dwarf Fortress; it's pretty much the same problem as a UI API.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 04:46:53 pm
Also, can we please quit approaching this with the "it won't fix this every time" mentality? I know that there are going to be times between versions that compatibility will break. My point is that it is not every release as evidenced by being able to use .40.11-r1 source with .40.12 symbols, so there is clearly an opportunity to improve the process.
The intensity with which you are approaching this almost suggests you see some kind of moral or ethical failing, which I find curious.
I find it absurd that lethosor keeps insisting that since we can't guarantee non-breaking changes every time a new DF is released, we can't improve the DFHack versioning approach. If you find that curious...ok?


Consequently, there's absolutely no way to set useful expectations for actual end users. This is not a problem to be dismissed lightly; providing a mechanism will to most users imply a promise, and if that promise is not kept, people react in silly ways. From a social standpoint, it's often easier to not imply that promise.

That's a poor argument for not trying to improve the release cycle, especially considering the attitude prior to this discussion was largely "well if the DFHack team isn't going fast enough for you, build it yourself". Which I did. Which caused this discussion.

As Peterix noted, if you want to try to improve things in the way you feel they should be improved, there's no real barrier to doing so, beyond you needing to choose to be responsible for it.
That's disingenuous. There is a very real barrier to changing, fundamentally, how DFHack versioning works. It's got to be accepted by both the core DFHack team and the people developing plugins as both an improvement to the existing system and easier to use. No point in me wasting time writing anything in code if the current viewpoint of the DFHack team doesn't change to accept both the possibility and necessity of making this kind of improvement.
Title: Re: DFHack 0.40.12-r1
Post by: Octopusfluff on September 17, 2014, 05:36:03 pm
The intensity with which you are approaching this almost suggests you see some kind of moral or ethical failing, which I find curious.
I find it absurd that lethosor keeps insisting that since we can't guarantee non-breaking changes every time a new DF is released, we can't improve the DFHack versioning approach. If you find that curious...ok?
You act as though some moral wrong has been perpetrated. The dfhack team has opted not to take responsibility for a thing they CANNOT take responsibility for, and for you it's some kind of crime against release policies or something. That's what I find curious.

Consequently, there's absolutely no way to set useful expectations for actual end users. This is not a problem to be dismissed lightly; providing a mechanism will to most users imply a promise, and if that promise is not kept, people react in silly ways. From a social standpoint, it's often easier to not imply that promise.

That's a poor argument for not trying to improve the release cycle, especially considering the attitude prior to this discussion was largely "well if the DFHack team isn't going fast enough for you, build it yourself". Which I did. Which caused this discussion.
You built it yourself, you got what you wanted, and you have a viable pattern for doing so again in the future, so as far as I can tell, your actual technical problem has been solved, and now you're attacking a social problem. This leads to...

As Peterix noted, if you want to try to improve things in the way you feel they should be improved, there's no real barrier to doing so, beyond you needing to choose to be responsible for it.
That's disingenuous. There is a very real barrier to changing, fundamentally, how DFHack versioning works. It's got to be accepted by both the core DFHack team and the people developing plugins as both an improvement to the existing system and easier to use. No point in me wasting time writing anything in code if the current viewpoint of the DFHack team doesn't change to accept both the possibility and necessity of making this kind of improvement.

Disingenuous? How? The team, at present, doesn't consider the benefits worth the effort, but is open to contributions. You've provided steps for solving the problem locally. If you want the problem solved on a larger scope, then put in the legwork to solve it on a larger scope. If it's good work, and it does what you think it will do, it's likely to get merged.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 05:55:23 pm
You act as though some moral wrong has been perpetrated. The dfhack team has opted not to take responsibility for a thing they CANNOT take responsibility for, and for you it's some kind of crime against release policies or something. That's what I find curious.
That is not an accurate description of what has happened and you know that. You sound sillier each time you try and act like this is a morality crusade, though, which is amusing at least, so keep it up I guess?

You built it yourself, you got what you wanted, and you have a viable pattern for doing so again in the future, so as far as I can tell, your actual technical problem has been solved, and now you're attacking a social problem. This leads to...
No I have not - Starter Pack still depends on an official DFHack release only because that's what it currently takes to get a release that is considered stable and works with the latest DF version. There is, based on the discussions so far, an opportunity to change that since both 11->12 and 12->13 only required a symbols.xml update, but due to the way DFHack is currently maintained this requires everything to be recompiled by the DFHack team to make the versions aligned and it to be considered stable, which is what is required for inclusion in the Starter Pack. What I want is to separate DF versioning from DFHack versioning from plugin versioning so that when DF makes non-breaking changes in an upgrade, the's no need for an unsupported "at your own risk" build in order to update.

Disingenuous? How? The team, at present, doesn't consider the benefits worth the effort, but is open to contributions. You've provided steps for solving the problem locally. If you want the problem solved on a larger scope, then put in the legwork to solve it on a larger scope. If it's good work, and it does what you think it will do, it's likely to get merged.
I described it already, but given your other posts it's not surprising that you'll ignore both that and the implications of a core change like this, given your above approach to replying to me. This isn't creating a new plugin - it would require DFHack and all the plugins to be updated to use a new system - that's not something that just gets done off on a branch and suddenly everyone becomes accepting of it.
Title: Re: DFHack 0.40.11-r1
Post by: IRIS_EYE_AZURE on September 17, 2014, 06:09:08 pm
[...] This brings up another point: there are now multiple "0.40.12-r1" builds floating around that have different behaviors and features. Among other things, "hack-wish" no longer crashes in certain cases, "search" has been updated for 0.40.12, and workflow no longer produces repeating error messages. However, since builds built before these changes identify themselves as "0.40.12-r1", there's no easy way to tell which build of "0.40.12-r1" that specific bug reports apply to, for example.

That.  That's been a persistent problem for the past month, month and a half.

Not only is it causing confusion, it's also against the DFHack license.

Quote from: the license boilerplate
[...]
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
[...]

Now in the current mess, salithus didn't exactly alter the source; he mixed-and-matched code from the official repo, part of it at a time when the repo was between official releases.  As I understand it.

It's still a problem.

Maybe the actual repo master branch should always have a DFHACK_RELEASE string with "-unofficial" appended to it?  (EDIT: in the file CMakeLists.txt)

And to make an official release, branch the master and change only that one string?

How about it, Peterix, expwnent, lethosor ?

I'd rather the DFHack developers not worry about unofficial builds. And I think those willing to build DFHack on their own should be hesitant to provide those builds to others -- do we really want to encourage others to download and run unknown executable's? 

But I can see the need to provide bleeding edge builds for lazy eager die-hards who want to run Toady's latest and have their DFHack too. Here's my solution: If someone wants to post a link or reference to an unofficial build, just do so in a separate message thread. Anyone wanting the official build can come here (or the latest thread), which is identified by the current version.

For those working on starter and mod packs, put whatever *you* want in those packs; just understand that users expect some level of testing on your part to identify any major issues or problems (and aren't likely to care at all about version identifiers).

Title: Re: DFHack 0.40.11-r1
Post by: salithus on September 17, 2014, 06:11:32 pm
[...] This brings up another point: there are now multiple "0.40.12-r1" builds floating around that have different behaviors and features. Among other things, "hack-wish" no longer crashes in certain cases, "search" has been updated for 0.40.12, and workflow no longer produces repeating error messages. However, since builds built before these changes identify themselves as "0.40.12-r1", there's no easy way to tell which build of "0.40.12-r1" that specific bug reports apply to, for example.

That.  That's been a persistent problem for the past month, month and a half.

Not only is it causing confusion, it's also against the DFHack license.

Quote from: the license boilerplate
[...]
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
[...]

Now in the current mess, salithus didn't exactly alter the source; he mixed-and-matched code from the official repo, part of it at a time when the repo was between official releases.  As I understand it.

It's still a problem.

Maybe the actual repo master branch should always have a DFHACK_RELEASE string with "-unofficial" appended to it?  (EDIT: in the file CMakeLists.txt)

And to make an official release, branch the master and change only that one string?

How about it, Peterix, expwnent, lethosor ?

I'd rather the DFHack developers not worry about unofficial builds. And I think those willing to build DFHack on their own should be hesitant to provide those builds to others -- do we really want to encourage others to download and run unknown executable's? 

But I can see the need to provide bleeding edge builds for lazy eager die-hards who want to run Toady's latest and have their DFHack too. Here's my solution: If someone wants to post a link or reference to an unofficial build, just do so in a separate message thread. Anyone wanting the official build can come here (or the latest thread), which is identified by the current version.

For those working on starter and mod packs, put whatever *you* want in those packs; just understand that users expect some level of testing on your part to identify any major issues or problems (and aren't likely to care at all about version identifiers).
Eh, 0x517A5D's suggestion makes sense for the current process at least - if you were to download and build a bleeding edge release now, it'd have the same DFHack version as the latest stable release. That's what causes the DFHack devs to have to worry about unofficial builds in the first place.
Title: Re: DFHack 0.40.12-r1
Post by: lethosor on September 17, 2014, 06:30:29 pm
No I have not - Starter Pack still depends on an official DFHack release only because that's what it currently takes to get a release that is considered stable and works with the latest DF version. There is, based on the discussions so far, an opportunity to change that since both 11->12 and 12->13 only required a symbols.xml update, but due to the way DFHack is currently maintained this requires everything to be recompiled by the DFHack team to make the versions aligned and it to be considered stable, which is what is required for inclusion in the Starter Pack. What I want is to separate DF versioning from DFHack versioning from plugin versioning so that when DF makes non-breaking changes in an upgrade, the's no need for an unsupported "at your own risk" build in order to update.
DF 0.40.13 does require structure changes, due to this commit (https://github.com/DFHack/df-structures/commit/3217bab75753c71b4393155cf6f062f01f6fc997).
Anyway, I'm not opposed to changes in DFHack's versioning system; I'm just not sure how best to implement them. There was a discussion about this earlier on IRC where replacing the DFHack version string with a reference to a Git commit was brought up:
Code: [Select]
$ git describe --tags --always
0.34.11-r5-338-g856a146
Unfortunately, defining this as a constant will require rebuilding everything DFHack-specific (DFHack core and plugins) after every commit, which is impractical. Using a reference to a df-structures commit instead will require rebuilding less often, but is still more inconvenient than the current method, which only rebuilds plugins (and core modules) that use structures that have changed since the last build. The problem, of course, is that there is no easy way to tell which df-structures commit a compiled plugin was built with without introducing some kind of unique identifier, and I'm not aware of a way to do this without causing CMake to unnecessarily rebuild all plugins.

Quote from: 0x517A5D
Maybe the actual repo master branch should always have a DFHACK_RELEASE string with "-unofficial" appended to it?  (EDIT: in the file CMakeLists.txt)

And to make an official release, branch the master and change only that one string?
Expwnent mentioned doing this after making a release, although it doesn't appear to have been changed yet. Generally, the master branch points to the latest release, but it would be easy to change the version string on the develop branch after making a release.
Title: Re: DFHack 0.40.12-r1
Post by: Octopusfluff on September 17, 2014, 06:34:48 pm
No I have not - Starter Pack still depends on an official DFHack release only because that's what it currently takes to get a release that is considered stable and works with the latest DF version. There is, based on the discussions so far, an opportunity to change that since both 11->12 and 12->13 only required a symbols.xml update, but due to the way DFHack is currently maintained this requires everything to be recompiled by the DFHack team to make the versions aligned and it to be considered stable, which is what is required for inclusion in the Starter Pack. What I want is to separate DF versioning from DFHack versioning from plugin versioning so that when DF makes non-breaking changes in an upgrade, the's no need for an unsupported "at your own risk" build in order to update.
There is an opportunity, yes. There is also an opportunity cost, which the team is not comfortable with at this time. That might change, particularly with a demonstration of implementation.

I described it already, but given your other posts it's not surprising that you'll ignore both that and the implications of a core change like this, given your above approach to replying to me. This isn't creating a new plugin - it would require DFHack and all the plugins to be updated to use a new system - that's not something that just gets done off on a branch and suddenly everyone becomes accepting of it.

I'm ignoring nothing. The implications of a change like that are significant, and someone has to actually do the work. A description is not sufficient. You're demanding someone else do it for you. This is not how to win friends and influence enemies.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 06:46:42 pm
DF 0.40.13 does require structure changes, due to this commit (https://github.com/DFHack/df-structures/commit/3217bab75753c71b4393155cf6f062f01f6fc997).
So, if I understand things right, that means the build I made above did processing of the structures during compile time that, if I included that commit (I think I did based on your instructions for the /library/xml folder), it "safely" updated all the DFHack-included plugins, but, despite being the same original source (master branch of DFHack), previous DLLs would not work (aside from the version string issue), due to those changes?

I really am trying to understand the process and how things currently work, despite any appearances to the contrary.

Anyway, I'm not opposed to changes in DFHack's versioning system; I'm just not sure how best to implement them. There was a discussion about this earlier on IRC where replacing the DFHack version string with a reference to a Git commit was brought up:
Code: [Select]
$ git describe --tags --always
0.34.11-r5-338-g856a146
Unfortunately, defining this as a constant will require rebuilding everything DFHack-specific (DFHack core and plugins) after every commit, which is impractical. Using a reference to a df-structures commit instead will require rebuilding less often, but is still more inconvenient than the current method, which only rebuilds plugins (and core modules) that use structures that have changed since the last build.
That makes sense - let me think on it. If I were doing this with SVN, I'd just reference an svn:externals and do some pre-build scripting based on that, but I'm not sure how that concept works in git. I can google my way around it, but any pointers on how you guys are doing it would be appreciated.

Quote from: 0x517A5D
Maybe the actual repo master branch should always have a DFHACK_RELEASE string with "-unofficial" appended to it?  (EDIT: in the file CMakeLists.txt)

And to make an official release, branch the master and change only that one string?
Expwnent mentioned doing this after making a release, although it doesn't appear to have been changed yet. Generally, the master branch points to the latest release, but it would be easy to change the version string on the develop branch after making a release.
It really comes down to how you want people who are compiling themselves to do it. When I did it with .40.12, I just followed the step by step instructions because it was my first time. With .40.13, I did the master branch thinking it'd prove more of a point about how close the DF code was across the 3 releases and I didn't want to unknowingly include active development that might address an issue I wasn't aware of. Whichever I should be compiling against, that's the one I recommend not have an official version string as the default. (Might even be worth taking those lines out of source control entirely somehow [addmittedly no idea how CMake works], so that it always has to be specified by whoever is doing the compiling to make sure it's done correctly.)

You're demanding someone else do it for you.
You gave yourself away here. Go troll someone else - I've never demanded or even asked anyone to undertake any work because of the reasons I already outlined for needing acceptance of the concept and direction from the DFHack team first.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 06:48:49 pm
Double post.
Title: Re: DFHack 0.40.12-r1
Post by: Rumrusher on September 17, 2014, 07:44:51 pm
It really comes down to how you want people who are compiling themselves to do it. When I did it with .40.12, I just followed the step by step instructions because it was my first time. With .40.13, I did the master branch thinking it'd prove more of a point about how close the DF code was across the 3 releases and I didn't want to unknowingly include active development that might address an issue I wasn't aware of. Whichever I should be compiling against, that's the one I recommend not have an official version string as the default. (Might even be worth taking those lines out of source control entirely somehow [addmittedly no idea how CMake works], so that it always has to be specified by whoever is doing the compiling to make sure it's done correctly.)

uhh through IRC? kinda find the idea that if anyone willingly set on building dfhack and compiling a (dev/branch/copy/early access) build should hang out with the devs and listen to them discuss builds and plugins.
like you cross the step from being a user of dfhack to being a developer and drank the darkspawn blood and finally become a Git Warden, now shall wait out your continuous life in Freenode dusting the giant ruins of DF to unearth more stuff for the wizards of the camp to craft wonderful spells or trinkets of either entertainment or ease of use. This quest is a long and repeating one that has it's ups and downs, but's thats the life of a git warden. jokes aside that sounds like alot of effort to do in the middle of a dev cycle that updates around in weeks and that whole dfhack shouldn't cause people to wait out for the new update of DFH to play the new update of DF.

then again this is a opinion from a guy who writes scripts(lua) all day and too lazy or/and incompetent to write a solution that doesn't end with rewriting everything. Take with a grain of salt.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 08:08:36 pm
It really comes down to how you want people who are compiling themselves to do it. When I did it with .40.12, I just followed the step by step instructions because it was my first time. With .40.13, I did the master branch thinking it'd prove more of a point about how close the DF code was across the 3 releases and I didn't want to unknowingly include active development that might address an issue I wasn't aware of. Whichever I should be compiling against, that's the one I recommend not have an official version string as the default. (Might even be worth taking those lines out of source control entirely somehow [addmittedly no idea how CMake works], so that it always has to be specified by whoever is doing the compiling to make sure it's done correctly.)

uhh through IRC? kinda find the idea that if anyone willingly set on building dfhack and compiling a (dev/branch/copy/early access) build should hang out with the devs and listen to them discuss builds and plugins.
like you cross the step from being a user of dfhack to being a developer and drank the darkspawn blood and finally become a Git Warden, now shall wait out your continuous life in Freenode dusting the giant ruins of DF to unearth more stuff for the wizards of the camp to craft wonderful spells or trinkets of either entertainment or ease of use. This quest is a long and repeating one that has it's ups and downs, but's thats the life of a git warden. jokes aside that sounds like alot of effort to do in the middle of a dev cycle that updates around in weeks and that whole dfhack shouldn't cause people to wait out for the new update of DFH to play the new update of DF.

then again this is a opinion from a guy who writes scripts(lua) all day and too lazy or/and incompetent to write a solution that doesn't end with rewriting everything. Take with a grain of salt.
throw in some Zolgar and count me in.
Title: Re: DFHack 0.40.12-r1
Post by: mifki on September 17, 2014, 09:32:21 pm
despite being the same original source (master branch of DFHack), previous DLLs would not work (aside from the version string issue), due to those changes?

Most of them will because they don't use changed structures.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 10:04:54 pm
despite being the same original source (master branch of DFHack), previous DLLs would not work (aside from the version string issue), due to those changes?

Most of them will because they don't use changed structures.
Sanity check - if I understand what you said:

Let's say there are 30 structures total and that 2 of them changed. Most of the DLLs could work, because those 2 structures aren't ones "typically" used?

So phase 1 would be: if 0 of the structures changed, we're ok to use all the same plugins from before. Versioning would need to be based off identifying a specific changeset used from the symbols project.

Phase 2 would be figuring out a registration system, or some other method to see what specific structures are used, and identify the specific changeset AND structure used, which would require stricter handling on the plugin side, but looser coupling on the DFHack side.

Does that make sense?
Title: Re: DFHack 0.40.12-r1
Post by: Rose on September 17, 2014, 10:06:47 pm
I have an idea:

Anybody that does an unofficial DFHack build that intends to release it should change the version number to reflect that.

So instead of being DFHack 40.12.r1, which is only for official builds, or 40.12.r0, which is ambiguous, it should be something like 40.12.whiny-and-impatient-noobs-version, to avoid confusion with the official releases.
Title: Re: DFHack 0.40.12-r1
Post by: LeoCean on September 17, 2014, 10:08:43 pm
I have an idea:

Anybody that does an unofficial DFHack build that intends to release it should change the version number to reflect that.

So instead of being DFHack 40.12.r1, which is only for official builds, or 40.12.r0, which is ambiguous, it should be something like 40.12.whiny-and-impatient-noobs-version, to avoid confusion with the official releases.

Then they couldn't use twbt so they'd throw a r1 on it.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 10:18:34 pm
I have an idea:

Anybody that does an unofficial DFHack build that intends to release it should change the version number to reflect that.

So instead of being DFHack 40.12.r1, which is only for official builds, or 40.12.r0, which is ambiguous, it should be something like 40.12.whiny-and-impatient-noobs-version, to avoid confusion with the official releases.
That doesn't really solve the problem presented though does it? The idea is to make the default that would be grabbed by anyone not paying close enough attention be something that's easily distinguishable from a supported build, given the advice when waiting for official releases is and has been:

you'll have to wait or compile it on your own

If that's going to be the stance, you've either got to accept the casualties from defaulting to a supported build number (admittedly a bad idea) or safeguard yourself from it.

What about CMake's capabilities - can you have it prompt the user each time?
Title: Re: DFHack 0.40.12-r1
Post by: Nopenope on September 17, 2014, 11:25:12 pm
Forgive me if it's obvious, but it seems the problem at hand is the necessity to recompile every plugin every time the version number changes. However there doesn't seem to be this problem with scripts; is there any dfhack magic involved (save for that of laziness which I understand perfectly, mind you) that would prevent people from rewriting said plugins into lua/ruby scripts?

Toady's gone a bit farther than that; he provides the guarantee of a complete absence of guarantee. He's said before that he doesn't want to have to keep 3rd party programs in mind when he writes Dwarf Fortress; it's pretty much the same problem as a UI API.
This is interesting; the way he releases a new version in a matter of hours after each dfhack release and focuses on dfhack-fixable bugs first makes me wonder if he doesn't want people to get used too much to dfhack magic.

I have an idea:

Anybody that does an unofficial DFHack build that intends to release it should change the version number to reflect that.

So instead of being DFHack 40.12.r1, which is only for official builds, or 40.12.r0, which is ambiguous, it should be something like 40.12.whiny-and-impatient-noobs-version, to avoid confusion with the official releases.
That's unfair, there are many legitimate reasons one would wish to compile from source, if one wants to add a port to Gentoo or a bleeding-edge package to the AUR. Maybe the version should be .40.12r1u2 (second unofficial build from the first dfhack release from the .40.12 version), .40.13r0u1 (first unofficial build from the .40.13 version) or even .34.11r5e1u1 for experimental builds expwnent has been known to release.
Title: Re: DFHack 0.40.12-r1
Post by: Putnam on September 17, 2014, 11:52:36 pm
Forgive me if it's obvious, but it seems the problem at hand is the necessity to recompile every plugin every time the version number changes. However there doesn't seem to be this problem with scripts; is there any dfhack magic involved (save for that of laziness which I understand perfectly, mind you) that would prevent people from rewriting said plugins into lua/ruby scripts?

Can't interpose vmethods in Lua; you need C++ to access events related to those.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 17, 2014, 11:54:56 pm
Forgive me if it's obvious, but it seems the problem at hand is the necessity to recompile every plugin every time the version number changes. However there doesn't seem to be this problem with scripts; is there any dfhack magic involved (save for that of laziness which I understand perfectly, mind you) that would prevent people from rewriting said plugins into lua/ruby scripts?

Can't interpose vmethods in Lua; you need C++ to access events related to those.
Plus as I understand it, there's a noticeable performance hit from running it as a Lua script instead of a compiled plugin, because it's compiled each time it's run + the abstraction to the memory addresses.
Title: Re: DFHack 0.40.12-r1
Post by: Nopenope on September 18, 2014, 12:04:55 am
Can't interpose vmethods in Lua; you need C++ to access events related to those.

From what I understand some events (the onSomething thingies) have been exported to lua, making it possible to use them in scripts, isn't that right?

Plus as I understand it, there's a noticeable performance hit from running it as a Lua script instead of a compiled plugin, because it's compiled each time it's run + the abstraction to the memory addresses.
I don't know if it's "noticeable", and I don't know whether performance is paramount when dealing with a script that will only be punctually used (such as a gui or various hack magic). There's only that much stuff that runs continuously along the game (like emigration, rendermax or twbt).
Title: Re: DFHack 0.40.12-r1
Post by: Putnam on September 18, 2014, 12:12:44 am
Yes, it's possible. That's what I meant by needing C++ to access them. I'm fairly sure that that needs to be recompiled on later versions.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 18, 2014, 12:15:28 am
Can't interpose vmethods in Lua; you need C++ to access events related to those.

From what I understand some events (the onSomething thingies) have been exported to lua, making it possible to use them in scripts, isn't that right?

Plus as I understand it, there's a noticeable performance hit from running it as a Lua script instead of a compiled plugin, because it's compiled each time it's run + the abstraction to the memory addresses.
I don't know if it's "noticeable", and I don't know whether performance is paramount when dealing with a script that will only be punctually used (such as a gui or various hack magic). There's only that much stuff that runs continuously along the game (like emigration, rendermax or twbt).
I don't have any first-hand knowledge here, just relaying what I took away from Quietust's posts.
Title: Re: DFHack 0.40.12-r1
Post by: vjek on September 18, 2014, 12:31:06 am
Regarding 0.40.12-r1 'forum-dwarves' script included with the release version, in vanilla df 0.40.12:
Spoiler (click to show/hide)
That's just from trying to use it to output the details of any object (in this case, cave spider silk trousers).
I don't know how to fix the problem, or I would.   :(
Title: Re: DFHack 0.40.12-r1
Post by: Putnam on September 18, 2014, 01:03:37 am
It looks like the "text" object there should be interpreted by Lua as a Lua string instead of the weird userdata C char[] or whatever it is now.
Title: Re: DFHack 0.40.12-r1
Post by: Malorn on September 18, 2014, 02:39:29 am
Seems like the stockflow is bugged.  Had a hard lockup when my recordkeeper went to update his records.  Crash does not occur if I insure there are no stockpiles with stockflow settings.  Nothing is printed to stdout or stderr.
Title: Re: DFHack 0.40.12-r1
Post by: danaris on September 18, 2014, 06:29:59 am
This is interesting; the way he releases a new version in a matter of hours after each dfhack release and focuses on dfhack-fixable bugs first makes me wonder if he doesn't want people to get used too much to dfhack magic.

I'm pretty sure the main reason Toady's fixed so many of the dfhack-fixable bugs in this cycle is because Quietust and ag have done a yeoman's job of figuring out exactly what those bugs are, where they are located, and what would be necessary to fix them, and provided that information in the bug notes.
Title: Re: DFHack 0.40.12-r1
Post by: Warmist on September 18, 2014, 06:38:42 am
This is interesting; the way he releases a new version in a matter of hours after each dfhack release and focuses on dfhack-fixable bugs first makes me wonder if he doesn't want people to get used too much to dfhack magic.

I'm pretty sure the main reason Toady's fixed so many of the dfhack-fixable bugs in this cycle is because Quietust and ag have done a yeoman's job of figuring out exactly what those bugs are, where they are located, and what would be necessary to fix them, and provided that information in the bug notes.
Actually it's even more impresive than that. Some bug had code snippets (e.g. "i think you did for(int x=0;x<t;t++)... where you meant for(int x=0;x<t;x++)) with approximate location where to find it.
Title: Re: DFHack 0.40.12-r1
Post by: PeridexisErrant on September 18, 2014, 07:00:24 am
Some bugs had code snippets (e.g. "i think you did for(int x=0;x<t;t++)... where you meant for(int x=0;x<t;x++)) with approximate location where to find it.
:o
Title: Re: DFHack 0.40.12-r1
Post by: indyofcomo on September 18, 2014, 08:25:12 am
I have recently downloaded the LNP for 40.12 and it of course comes with DFHack. Previously I started using DFHack on my last few 34.11 games and I don't use it for much. I like digx, cleanowned, fix/dead-units(?), and a few of the UI things (filters and cursor sticking).

Anyways, I started a new game with this latest version, and there is a new thing going on. I am getting some kind of intermediate display while I'm queueing work from workshops. This has happened in my kitchen, still, masonry, and carpentry workshops. If I recall correctly, it says something about the workshop not being assigned to a dwarf, and has an arrow on it pointing to the item I'm trying to build.

Again, it's not in front of me right now, so XXdescriptionXX and xaccuracyx, sorry. But if anyone could point me in the direction of a mod/fix/UI piece this might be, I'd appreciate it.
Title: Re: DFHack 0.40.12-r1
Post by: Quietust on September 18, 2014, 08:56:24 am
Plus as I understand it, there's a noticeable performance hit from running it as a Lua script instead of a compiled plugin, because it's compiled each time it's run + the abstraction to the memory addresses.
I don't know if it's "noticeable", and I don't know whether performance is paramount when dealing with a script that will only be punctually used (such as a gui or various hack magic). There's only that much stuff that runs continuously along the game (like emigration, rendermax or twbt).
I actually did a test about 2 years ago to see how much slower it would be to implement reveal as a script instead of a plugin. The script version took almost an entire minute to run, compared to the plugin which was pretty much instantaneous. It's made even worse by the fact that the script wasn't doing the extra work of saving unreveal information or avoiding revealing HFS - adding that would have made it even slower.

Most of the "fix" scripts also take a noticeable amount of time to run, and rewriting them as plugins would probably drop their execution times down to a few hundred milliseconds.
Title: Re: DFHack 0.40.12-r1
Post by: Nopenope on September 18, 2014, 09:20:17 am
I have recently downloaded the LNP for 40.12 and it of course comes with DFHack. Previously I started using DFHack on my last few 34.11 games and I don't use it for much. I like digx, cleanowned, fix/dead-units(?), and a few of the UI things (filters and cursor sticking).

Anyways, I started a new game with this latest version, and there is a new thing going on. I am getting some kind of intermediate display while I'm queueing work from workshops. This has happened in my kitchen, still, masonry, and carpentry workshops. If I recall correctly, it says something about the workshop not being assigned to a dwarf, and has an arrow on it pointing to the item I'm trying to build.

Again, it's not in front of me right now, so XXdescriptionXX and xaccuracyx, sorry. But if anyone could point me in the direction of a mod/fix/UI piece this might be, I'd appreciate it.

DFHack has this issue when you alt-tab out of the game, it still thinks you pressed alt and alt-r brings out a room gui. You probably set a workshop order to [r]epeat and it brought out this menu. Simply press alt again to resolve it.

Or something like that.
Title: Re: DFHack 0.40.12-r1
Post by: indyofcomo on September 18, 2014, 10:12:00 am
DFHack has this issue when you alt-tab out of the game, it still thinks you pressed alt and alt-r brings out a room gui. You probably set a workshop order to [r]epeat and it brought out this menu. Simply press alt again to resolve it.
Yes, I am having this problem. I found it through google-fu on why I couldn't access my (m)ilitary screen.

Is this seen as a DFHack bug that's being looked at? (Is there a link where I could have answered that question myself?)
Title: Re: DFHack 0.40.12-r1
Post by: expwnent on September 18, 2014, 10:16:43 am
Regarding 0.40.12-r1 'forum-dwarves' script included with the release version, in vanilla df 0.40.12:
Spoiler (click to show/hide)
That's just from trying to use it to output the details of any object (in this case, cave spider silk trousers).
I don't know how to fix the problem, or I would.   :(

Seems like the stockflow is bugged.  Had a hard lockup when my recordkeeper went to update his records.  Crash does not occur if I insure there are no stockpiles with stockflow settings.  Nothing is printed to stdout or stderr.

I have recently downloaded the LNP for 40.12 and it of course comes with DFHack. Previously I started using DFHack on my last few 34.11 games and I don't use it for much. I like digx, cleanowned, fix/dead-units(?), and a few of the UI things (filters and cursor sticking).

Anyways, I started a new game with this latest version, and there is a new thing going on. I am getting some kind of intermediate display while I'm queueing work from workshops. This has happened in my kitchen, still, masonry, and carpentry workshops. If I recall correctly, it says something about the workshop not being assigned to a dwarf, and has an arrow on it pointing to the item I'm trying to build.

Again, it's not in front of me right now, so XXdescriptionXX and xaccuracyx, sorry. But if anyone could point me in the direction of a mod/fix/UI piece this might be, I'd appreciate it.

If you could make bug reports here (https://github.com/DFHack/dfhack/issues) that would be useful for keeping track of bugs. I have my personal todo list but I generally stay away from plugins other people wrote when I don't know how they work.

There have been multiple issues with forum-dwarves before and I updated that one so I'll fix that when I get to it but I don't know about the others.
Title: Re: DFHack 0.40.12-r1
Post by: Dirst on September 18, 2014, 10:51:09 am
despite being the same original source (master branch of DFHack), previous DLLs would not work (aside from the version string issue), due to those changes?

Most of them will because they don't use changed structures.
Sanity check - if I understand what you said:

Let's say there are 30 structures total and that 2 of them changed. Most of the DLLs could work, because those 2 structures aren't ones "typically" used?

So phase 1 would be: if 0 of the structures changed, we're ok to use all the same plugins from before. Versioning would need to be based off identifying a specific changeset used from the symbols project.

Phase 2 would be figuring out a registration system, or some other method to see what specific structures are used, and identify the specific changeset AND structure used, which would require stricter handling on the plugin side, but looser coupling on the DFHack side.

Does that make sense?
The project could go to a 30-component version numbering scheme, but that seems stupid.  Maybe some meta-structure that holds version numbers for the DF structures, and use that to register dependencies.

Depending on what CMake can do, maybe sourcecode macros can be used to specify allowed version numbers for specific plug-ins.

A much more ambitious path is to include a plugin wrapper for experimental builds.  It would check the version string and throw up an obvious console warning in the event of a mis-match. 

********************************************************************
WARNING!
The plugin twbt.dll was compiled for DFHack version 0.40.12.r1
You are running DFHack version 0.40.13.i-cant-live-without-digv
********************************************************************
How do you want to proceed?
1. Do not load the plug-in (as if the DLL did not exist)
2. Load the plug-in this time
3. Load the plug-in and remember this decision (affects onLoad.init)

In any case, there are absolutely no guarantees about the behavior of a plug-in not designed specifically for that version.  It turns out that .12 stuff would run fine under .11, but some .13 stuff would cause magma to ooze out of your USB ports.  If someone is mucking around the sourcecode to make this compile, they should be aware of the risks.
Title: Re: DFHack 0.40.12-r1
Post by: Warmist on September 18, 2014, 10:55:24 am
Plus as I understand it, there's a noticeable performance hit from running it as a Lua script instead of a compiled plugin, because it's compiled each time it's run + the abstraction to the memory addresses.
I don't know if it's "noticeable", and I don't know whether performance is paramount when dealing with a script that will only be punctually used (such as a gui or various hack magic). There's only that much stuff that runs continuously along the game (like emigration, rendermax or twbt).
I actually did a test about 2 years ago to see how much slower it would be to implement reveal as a script instead of a plugin. The script version took almost an entire minute to run, compared to the plugin which was pretty much instantaneous. It's made even worse by the fact that the script wasn't doing the extra work of saving unreveal information or avoiding revealing HFS - adding that would have made it even slower.

Most of the "fix" scripts also take a noticeable amount of time to run, and rewriting them as plugins would probably drop their execution times down to a few hundred milliseconds.
As a counter argument I would provide an example of rendermax lighting mod. First implementation was in lua  yes verrrrryyyy slow, but I had something almost nice in matter of minutes. The c++ engine ( though to be fair a lot more complex) took way longer and with help from other people.
So in the end: quick iterations- lua/ruby. Best performance - c++
Title: Re: DFHack 0.40.12-r1
Post by: fricy on September 18, 2014, 11:35:08 am
@Dirst: Twbt is a bad example, as it doesn't (only?) depend on symbols.xml, but uses hard-coded memory adresses. So that's one that needs to be recompiled for every df version.

@Warmist: speaking of rendermax: any plans to update to 40.x?
Title: Re: DFHack 0.40.12-r1
Post by: Max™ on September 18, 2014, 11:50:02 am

A much more ambitious path is to include a plugin wrapper for experimental builds.  It would check the version string and throw up an obvious console warning in the event of a mis-match. 

********************************************************************
WARNING!
The plugin twbt.dll was compiled for DFHack version 0.40.12.r1
You are running DFHack version 0.40.13.i-cant-live-without-digv
********************************************************************
How do you want to proceed?
1. Do not load the plug-in (as if the DLL did not exist)
2. Load the plug-in this time
3. Load the plug-in and remember this decision (affects onLoad.init)

In any case, there are absolutely no guarantees about the behavior of a plug-in not designed specifically for that version.  It turns out that .12 stuff would run fine under .11, but some .13 stuff would cause magma to ooze out of your USB ports.  If someone is mucking around the sourcecode to make this compile, they should be aware of the risks.
*peep*
Just an end user on this project, though I am aware of the difficulties which can arise from doing stuff like that, but those sort of "just making sure you're informed before you bone everything up anyways" alerts are too often overlooked, and mostly appreciated by people who already know what they're getting into, sadly.
Title: Re: DFHack 0.40.12-r1
Post by: salithus on September 18, 2014, 12:06:47 pm

A much more ambitious path is to include a plugin wrapper for experimental builds.  It would check the version string and throw up an obvious console warning in the event of a mis-match. 

********************************************************************
WARNING!
The plugin twbt.dll was compiled for DFHack version 0.40.12.r1
You are running DFHack version 0.40.13.i-cant-live-without-digv
********************************************************************
How do you want to proceed?
1. Do not load the plug-in (as if the DLL did not exist)
2. Load the plug-in this time
3. Load the plug-in and remember this decision (affects onLoad.init)

In any case, there are absolutely no guarantees about the behavior of a plug-in not designed specifically for that version.  It turns out that .12 stuff would run fine under .11, but some .13 stuff would cause magma to ooze out of your USB ports.  If someone is mucking around the sourcecode to make this compile, they should be aware of the risks.
*peep*
Just an end user on this project, though I am aware of the difficulties which can arise from doing stuff like that, but those sort of "just making sure you're informed before you bone everything up anyways" alerts are too often overlooked, and mostly appreciated by people who already know what they're getting into, sadly.
That and the goal isn't to make plugins work with unofficial builds, but:

1) find a way to let a stable release of DFHack be updated to the latest DF version without needing to wait on the DFHack team to put together a new release
2) find a way to let plugins identify what they are compatible with structure-wise so that they don't have to be recompiled with each DFHack release

Title: Re: DFHack 0.40.12-r1
Post by: Quietust on September 18, 2014, 12:08:06 pm
@Dirst: Twbt is a bad example, as it doesn't (only?) depend on symbols.xml, but uses hard-coded memory adresses. So that's one that needs to be recompiled for every df version.
Indeed - if you tried editing the version string on TWBT to run it in a newer version than whatever it was compiled for, it would either refuse to run or crash the game entirely, neither of which are in any way useful. It also appears to contain a bunch of hardcoded binary patches, all of which were likely designed solely for version 0.34.11 and are thus nonfunctional in the current version anyways.

Needless to say, that plugin will never be accepted into the DFHack codebase in that state.
Title: Re: DFHack 0.40.12-r1
Post by: breadman on September 18, 2014, 01:31:39 pm
Seems like the stockflow is bugged.  Had a hard lockup when my recordkeeper went to update his records.  Crash does not occur if I insure there are no stockpiles with stockflow settings.  Nothing is printed to stdout or stderr.

That's probably my fault, unless you're using an unofficial DFHack release, or there's another structure change that we haven't noticed yet.  I'll fix it once I can reproduce the issue.  Which platform (OS, DF version, and DFHack version) are you using?  Could you upload an affected save for me?
Title: Re: DFHack 0.40.12-r1
Post by: Dirst on September 18, 2014, 01:49:15 pm
*peep*
Just an end user on this project, though I am aware of the difficulties which can arise from doing stuff like that, but those sort of "just making sure you're informed before you bone everything up anyways" alerts are too often overlooked, and mostly appreciated by people who already know what they're getting into, sadly.
The compile-time macros would allow bleeding-edge DFHacks to be tested with not-yet-updated plug-ins.  And yes TWBT would most likely crash the game and possibly take the region folder with it.  That console prompt is not intended as an end-user feature in an official release, just a way for people to figure out what needs to be updated and what doesn't.

Whatever the mechanism is, it needs to allow updates in the plug-ins as well.

Consider when 12r1 came out, and a plug-in has been compatible since 08r2 (excluding the version string).  The sourcecode could say that that specific named plug-in -- compiled for anything from 08r2 to 12r1 -- can run.  That way, the plug-in author can issue an update without requiring DFHack to be updated to run it.

Edit: grammar
Title: Re: DFHack 0.40.12-r1
Post by: lethosor on September 18, 2014, 02:05:10 pm
@Warmist: speaking of rendermax: any plans to update to 40.x?
Rendermax doesn't work with 0.40.xx because (if I understand correctly), the script that automatically locates <vtable-address> entries in symbols.xml doesn't check for 'renderer', which rendermax requires. Warmist has made changes that make rendermax compile with 0.40.xx, but I've been unable to test them without the required offsets.
Title: Re: DFHack 0.40.12-r1
Post by: Warmist on September 18, 2014, 02:19:17 pm
@Warmist: speaking of rendermax: any plans to update to 40.x?
Rendermax doesn't work with 0.40.xx because (if I understand correctly), the script that automatically locates <vtable-address> entries in symbols.xml doesn't check for 'renderer', which rendermax requires. Warmist has made changes that make rendermax compile with 0.40.xx, but I've been unable to test them without the required offsets.
Actually it "should" locate it automatically (in windows) but for some reason does not. Though it's probably one of the easiest things to do (finding vtables that is) i am a very lazy (read: busy) person. Also everybody is sad because new version has low fps, so rendermax (which takes away yet more fps) are not on top of people list of things they like :P
Title: Re: DFHack 0.40.12-r1
Post by: fricy on September 18, 2014, 02:44:59 pm
Also everybody is sad because new version has low fps, so rendermax (which takes away yet more fps) are not on top of people list of things they like :P
But it's soooooo preeeety!  ;D
Title: Re: DFHack 0.40.12-r1
Post by: Nopenope on September 18, 2014, 02:47:36 pm
Actually it "should" locate it automatically (in windows) but for some reason does not. Though it's probably one of the easiest things to do (finding vtables that is) i am a very lazy (read: busy) person. Also everybody is sad because new version has low fps, so rendermax (which takes away yet more fps) are not on top of people list of things they like :P
Actually rendermax is what got me into that whole dfhack business, along with falconne's plugins. It's really nifty. Plus I think the few people who are aware that dfhack is a thing also know how to use rendermax options.

By the way, if anyone ever got stonesense to work on Linux, I'd be more than grateful if they posted instructions about how they made it work (or their configuration if it worked out of the box).
Title: Re: DFHack 0.40.12-r1
Post by: lethosor on September 18, 2014, 02:54:34 pm
Is there anything Stonesense-related in stderr.log?
Title: Re: DFHack 0.40.12-r1
Post by: Nopenope on September 18, 2014, 03:23:15 pm
Well there does seem to be something as opposed to past versions, this is interesting:

Code: [Select]
stonesense.plug.so: undefined symbol: al_color_rgb_to_hsv
Can't load plugin stonesense.plug.so
Title: Re: DFHack 0.40.12-r1
Post by: lethosor on September 18, 2014, 03:45:15 pm
https://github.com/DFHack/dfhack/issues/282
I'll try to rebuild my Linux build (GCC 4.5.4) with Eswald's change when I get a chance.
Title: Re: DFHack 0.40.12-r1
Post by: Nopenope on September 18, 2014, 04:07:29 pm
Thanks, that solved it.

On a second note, I notice I have to fiddle with cmakelists more often than not; I'm not sure whether I have a weird configuration or if it's just a lack of devs that use Linux as their main OS (and thus lack of testing). If it's the latter, I could post the changes I made to make various things build (and occasionally run).
Title: Re: DFHack 0.40.12-r1
Post by: lethosor on September 18, 2014, 04:18:26 pm
There are certainly devs that use Linux (and OS X, where the build process is nearly the same). What changes are you referring to? I haven't had to make changes to CMakeLists.txt for things to build/run on either. (It's probably due to your configuration, but any fixes are welcome, provided they don't interfere with other platforms.)
Title: Re: DFHack 0.40.12-r1
Post by: Nopenope on September 18, 2014, 05:00:48 pm
Let's see, lately when building Isoworld I usually run into various issues, most of which have been solved by maijin:

The compilation was successful, the linking process failed. You need to modify dfhack/plugins/isoworld/CMakeLists.txt file and add agui to linker. Here is my patch:
Code: [Select]
--- plugins/isoworld/CMakeLists.txt 2014-09-11 19:32:10.998717669 +0200
+++ plugins/isoworld/CMakeLists.txt 2014-08-28 01:18:09.000000000 +0200
@@ -91,6 +92,11 @@
  allegro_image
  allegro_ttf
  ${PROJECT_LIBS}
+ /home/majiin/repos/Agui/build/libagui_allegro5.a
+ /home/majiin/repos/Agui/build/libagui.a
+ )
+ include_directories (
+ /home/majiin/repos/Agui/include
  )
  ENDIF()
  ENDIF()

Of course you need to change /home/majiin/repos/Agui/build/ and /home/majiin/repos/Agui/include to the location where you have those files. Maybe there is a simpler way to do this but this worked for me.
Where libagui_allegro5.a and libagui.a are 32-bit .a files that are absent from the main repo and had to be compiled manually.

Also, MapSection.h seems to have a weird line:
Code: [Select]
--- plugins/isoworld/MapSection.h 2014-09-11 17:47:18.331186059 +0200
+++ plugins/isoworld/MapSection.h 2014-09-09 12:12:36.000000000 +0200
@@ -32,7 +32,7 @@
  void pointToSprite(float *inx, float *iny, int inz);
  void load_heights(ALLEGRO_BITMAP * heightmap);
  void load_water_level(ALLEGRO_BITMAP * watermap);
- void MapSection::load_colors(s_maplist * map_list);
+ void load_colors(s_maplist * map_list);
  void load_level(ALLEGRO_BITMAP * levelmap, int level);
  void load_biome_tiles(s_maplist * maplist);
  void load_structure_tiles(ALLEGRO_BITMAP * structuremap);

Will post more as I recall along.
Title: Re: DFHack 0.40.11-r1
Post by: Hades on September 18, 2014, 05:13:44 pm

It looks like the exterminate script may be broke for 0.40.12, assuming it's not something I am doing. Works fine on a clean install in 0.40.11 (Dwarf Fortress and DFHack only), but does nothing in a clean install of 0.40.12. Running the script gives nothing for output, and the same for any switches you try with it. Just FYI.
It's working for me. What platform are you using? Is Ruby available?

Windows 7 64. Have ruby installed. I tried running someone else's compilation of DFHack (0.40.12) for comparison and have the same issue.

Just to follow up my post. Works fine in the new release. Must have been something I did compiling it (be nice to know what but alas). And thanks for the new release! Appreciate all the work you all do!

Figured out my issue. Silly mistake but I thought I would post it in case anyone else ever runs into something similar (the joys of learning). Either make sure to add Ruby when compiling DFHack (if following previous posted instructions, don't uncheck "DL_RUBY" and copy over the files needed), or make sure to add the libruby.dll to DFHack install afterwards. Thanks lethosor for pointing me in the right direction, it just didn't click until compiling DFHack again.
Title: Re: DFHack 0.40.12-r1
Post by: Rose on September 18, 2014, 10:29:14 pm
Let's see, lately when building Isoworld I usually run into various issues, most of which have been solved by maijin:

The compilation was successful, the linking process failed. You need to modify dfhack/plugins/isoworld/CMakeLists.txt file and add agui to linker. Here is my patch:
Code: [Select]
--- plugins/isoworld/CMakeLists.txt 2014-09-11 19:32:10.998717669 +0200
+++ plugins/isoworld/CMakeLists.txt 2014-08-28 01:18:09.000000000 +0200
@@ -91,6 +92,11 @@
  allegro_image
  allegro_ttf
  ${PROJECT_LIBS}
+ /home/majiin/repos/Agui/build/libagui_allegro5.a
+ /home/majiin/repos/Agui/build/libagui.a
+ )
+ include_directories (
+ /home/majiin/repos/Agui/include
  )
  ENDIF()
  ENDIF()

Of course you need to change /home/majiin/repos/Agui/build/ and /home/majiin/repos/Agui/include to the location where you have those files. Maybe there is a simpler way to do this but this worked for me.
Where libagui_allegro5.a and libagui.a are 32-bit .a files that are absent from the main repo and had to be compiled manually.

Also, MapSection.h seems to have a weird line:
Code: [Select]
--- plugins/isoworld/MapSection.h 2014-09-11 17:47:18.331186059 +0200
+++ plugins/isoworld/MapSection.h 2014-09-09 12:12:36.000000000 +0200
@@ -32,7 +32,7 @@
  void pointToSprite(float *inx, float *iny, int inz);
  void load_heights(ALLEGRO_BITMAP * heightmap);
  void load_water_level(ALLEGRO_BITMAP * watermap);
- void MapSection::load_colors(s_maplist * map_list);
+ void load_colors(s_maplist * map_list);
  void load_level(ALLEGRO_BITMAP * levelmap, int level);
  void load_biome_tiles(s_maplist * maplist);
  void load_structure_tiles(ALLEGRO_BITMAP * structuremap);

Will post more as I recall along.
If you have to change something in isoworld to make it compile, a github fork is probably easier to find than some patches in a forum thread.
Title: Re: DFHack 0.40.12-r1
Post by: Hetairos on September 19, 2014, 10:19:11 am
Is there a DFHack 0.34.11 r5-compatible script which makes injured but conscious dwarves take care of themselves?

There's fix/feeding-timers.

...but it doesn't seem to be included, I can't find it on this board, and I don't think it would've helped anyway. There is this (http://www.bay12forums.com/smf/index.php?topic=91166.msg4858685;topicseen#msg4858685), but for r3, and it doesn't appear to work in r5.
Title: Re: DFHack 0.40.12-r1
Post by: expwnent on September 19, 2014, 10:24:14 am
https://github.com/DFHack/dfhack/blob/master/scripts/fix/feeding-timers.lua
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on September 19, 2014, 04:29:22 pm
New release!
Title: Re: DFHack 0.40.13-r1
Post by: scamtank on September 19, 2014, 04:29:43 pm
You're all good people.
Title: Re: DFHack 0.40.13-r1
Post by: Beautato on September 19, 2014, 08:18:39 pm
New release!

Great job guys!
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on September 19, 2014, 08:41:45 pm
Is there a script which sets how many skill points dwarves have for skills at the start? like startdwarf.rb adds dwarves and points.rb adds points.
Title: Re: DFHack 0.40.13-r1
Post by: Probe1 on September 19, 2014, 09:43:57 pm
Is the superdwarf add command not working?  I went to toggle it on earlier and there was no effect.  When I tried superdwarf list I received this list of errors stemming from undefined method

 (http://puu.sh/bG5JF/2206be8e3e.png)
Title: Re: DFHack 0.40.13-r1
Post by: Nopenope on September 19, 2014, 10:30:43 pm
Is there a script which sets how many skill points dwarves have for skills at the start? like startdwarf.rb adds dwarves and points.rb adds points.
Pretty sure this can be set in the worldgen.txt file.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on September 19, 2014, 10:49:30 pm
Nah, skill points, of which there's a maximum of 10 (5 per skill) regardless of worldgen settings.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on September 19, 2014, 11:20:02 pm
Yeah I was just wondering as with points it's pretty easy to "change" when you at the "embark screen" but a bit more difficult since there isn't a script for it (yet) and you'd probably have to set it for x many dwarves which brings a bit more difficulty. Not as useful as the other 2 scripts that exist though.
Title: Re: DFHack 0.40.12-r1
Post by: Hetairos on September 20, 2014, 04:24:32 am
https://github.com/DFHack/dfhack/blob/master/scripts/fix/feeding-timers.lua

It's working, thank you! Although it has apparently fixed more citizens than I actually have.
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on September 20, 2014, 05:28:08 am
Amazing, didn't even have to fiddle with swapping the libs, just worked right the first time.

*Engraves a masterpiece here! It depicts a bloodsoaked candy-armored dorf holding a severed goblin arm which is giving a thumbs up to you wonderful folks*
Title: Re: DFHack 0.40.13-r1
Post by: TheKaspa on September 20, 2014, 06:11:21 am
Is there a plugin for highlights military dorfs off-duty?
I want to be able to assign them labours, but I want to be sure that the only blacksmith isn't a guarddwarf or I'll have troubles when he'll go training
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 20, 2014, 08:32:26 am
Yeah I was just wondering as with points it's pretty easy to "change" when you at the "embark screen" but a bit more difficult since there isn't a script for it (yet) and you'd probably have to set it for x many dwarves which brings a bit more difficulty. Not as useful as the other 2 scripts that exist though.

Code: [Select]
:lua for _, dwf in ipairs(dfhack.gui.getCurViewscreen().dwarf_info) do dwf.levels_remaining = 11 end

Edit: Here's a script (https://github.com/lethosor/dfhack-scripts/blob/master/embark-skills.lua)
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on September 20, 2014, 10:01:15 am
Yeah I was just wondering as with points it's pretty easy to "change" when you at the "embark screen" but a bit more difficult since there isn't a script for it (yet) and you'd probably have to set it for x many dwarves which brings a bit more difficulty. Not as useful as the other 2 scripts that exist though.

Code: [Select]
:lua for _, dwf in ipairs(dfhack.gui.getCurViewscreen().dwarf_info) do dwf.levels_remaining = 11 end

Edit: Here's a script (https://github.com/lethosor/dfhack-scripts/blob/master/embark-skills.lua)

Nice thanks for making that so quick and so many options. :P
Title: Re: DFHack 0.40.13-r1
Post by: danaris on September 20, 2014, 06:02:04 pm
Is the superdwarf add command not working?  I went to toggle it on earlier and there was no effect. 

I can confirm this on OS X. Superdwarf has been nonfunctional for me since 0.40 came out, I believe.
Title: Re: DFHack 0.40.13-r1
Post by: hagbard on September 21, 2014, 02:06:13 pm
Is it possible to get dfhack working with stonesense under linux? Stonesense doesn't seem to be included in the linux build, so I tried to compile it myself, but I don't get further than "Could NOT find Threads (missing:  Threads_FOUND)".
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on September 22, 2014, 09:42:32 am
If you're trying to compile it you might need pthreads. I don't really know the details about stonesense so I'm not sure.
Title: Re: DFHack 0.40.13-r1
Post by: Nopenope on September 22, 2014, 09:45:41 am
Is it possible to get dfhack working with stonesense under linux? Stonesense doesn't seem to be included in the linux build, so I tried to compile it myself, but I don't get further than "Could NOT find Threads (missing:  Threads_FOUND)".

When compiling dfhack, make sure to run "ccmake .." before running make install, so you can toggle what you want to build, you'll see there's a stonesense include option.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on September 22, 2014, 09:53:48 am
Oh, and delete all the CMake things like CMakeCache if you've been installing things. I couldn't figure out why it wasn't recognizing a prerequisite for hours my first time because the CMakeCache had wrong things in it from the first compile attempt. This is very rarely the problem but it might fix it I guess.
Title: Re: DFHack 0.40.13-r1
Post by: hagbard on September 22, 2014, 11:24:48 am
Quote
If you're trying to compile it you might need pthreads. I don't really know the details about stonesense so I'm not sure.
Quote
When compiling dfhack, make sure to run "ccmake .." before running make install, so you can toggle what you want to build, you'll see there's a stonesense include option.
Quote
Oh, and delete all the CMake things like CMakeCache if you've been installing things. I couldn't figure out why it wasn't recognizing a prerequisite for hours my first time because the CMakeCache had wrong things in it from the first compile attempt. This is very rarely the problem but it might fix it I guess.

Thanks for the replies. I finally managed to force that thing through the compiler. Cmake worked after taking care of this (http://stackoverflow.com/questions/15193785/how-to-get-cmake-to-recognize-pthread-on-ubuntu), this (https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/1155307), and that (http://stackoverflow.com/questions/24813827/cmake-failing-to-detect-pthreads-due-to-warnings/25130590#25130590). For stonesense this (https://github.com/DFHack/stonesense/pull/22/files) was needed. Also a bunch of undocumented dependencies. In short: It was a mayor PITA to get it working, but now it works: Stonesense natively under linux, yeah.
Title: Re: DFHack 0.40.13-r1
Post by: Nopenope on September 22, 2014, 04:24:19 pm
It may be a good idea to list said undocumented dependencies so hopefully this can be corrected in the building manual.
Title: Re: DFHack 0.40.13-r1
Post by: aiseant on September 23, 2014, 03:55:51 am
The box option for building things seems broken now (I tried for walls and floors, with different materials)
Title: Re: DFHack 0.40.13-r1
Post by: Eric Blank on September 23, 2014, 03:54:09 pm
Would anybody be able to provide a non-7zip file mirror, like a normal .zip file? Need admin rights to install 7zip, or anything, on public computers. :P
Title: Re: DFHack 0.40.13-r1
Post by: Euius on September 23, 2014, 09:16:32 pm
Using M)ark all in the trade window will double count any item in bins because it marks both the bin and the item itself for trading.  So long as no manual unmarking of an item in a bin is done, this will trade at that double value.  Normal operation would only mark the bin, not it's contents

This bug is present in the current 0.40.13-r1 release.  I know it's in falconne's autotrade plugin, but seeing as that plugin is in the dfhack release package, posting it here.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on September 23, 2014, 09:47:07 pm
Did you try that save in regular dwarf fortress without dfhack?
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 23, 2014, 10:03:32 pm
The [M]ark all feature is implemented in autotrade (a DFHack plugin), so the problem can't occur without DFHack.
Euius, could you upload a save for testing purposes?
Title: Re: DFHack 0.40.13-r1
Post by: salithus on September 23, 2014, 11:07:08 pm
The [M]ark all feature is implemented in autotrade (a DFHack plugin), so the problem can't occur without DFHack.
Euius, could you upload a save for testing purposes?
I can put up a save if needed too - I noticed this but forgot to follow up on it.
Title: Re: DFHack 0.40.13-r1
Post by: PeridexisErrant on September 24, 2014, 04:25:15 am
I'm trying to script exporting all site maps from legends mode, and I'm at a dead end.   Can anyone help?

From the lua interpreter at main legends screen, "for k,v in pairs(vs.sites) do print(k); end" will print "0 \n 1 \n 2 \n..." for the number of sites in that world. 

dfhack.gui.getCurViewscreen() returns "legends" for both the main screen, and also the site maps screen. 

"'LEGENDS_EXPORT_MAP'" is the key for both the world map or whatever site map is selected, and I've confirmed this by changing the binding. 

Any ideas?  My current code - based on exportlegends - is below.
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on September 24, 2014, 04:39:17 am
If you actually want to see the site structure whatsits, you want to print v ("value"), not k ("key"). Or you could just use printall, which gets me this:

Code: [Select]
0                        = userdata: 00000002
1                        = userdata: 00000003
2                        = userdata: 00000004
3                        = userdata: 00000005
4                        = userdata: 00000006
5                        = userdata: 00000007
6                        = userdata: 00000008
7                        = userdata: 00000009
8                        = userdata: 0000000A
9                        = userdata: 0000000B
10                       = userdata: 0000000C
11                       = userdata: 0000000D
12                       = userdata: 0000000E
13                       = userdata: 0000000F
14                       = userdata: 00000010
15                       = userdata: 00000011
16                       = userdata: 00000012

As you can see, sites are simply userdata to Lua (which I guess means the XML for them hasn't been filled out satisfactorily), so can't nothing be done with 'em.

The simplest way to do this is to tell the user to go into the sites screen, make them highlight the top one and then... press LEGENDS_EXPORT_MAP then down #vs.sites times:

Code: [Select]
for i=1,#vs.sites do
    gui.simulateInput(vs, 'LEGENDS_EXPORT_MAP')
    --I don't know what "down" is, so just put that here
end
Title: Re: DFHack 0.40.13-r1
Post by: PeridexisErrant on September 24, 2014, 05:35:06 am
Awesome, I've got it working *if* you start at the top of the sites screen. 

Code: [Select]
function export_site_maps()
    vs = dfhack.gui.getCurViewscreen()
    print('    Attempting to export site maps...')
    -- get to sites screen before the next bit
    for i=1,#vs.sites do
        gui.simulateInput(vs, 'LEGENDS_EXPORT_MAP')
        gui.simulateInput(vs, 'STANDARDSCROLL_DOWN')
    end
end

Now if I can just script the bit where you get to the sites screen...
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on September 24, 2014, 05:36:25 am
You might want to make vs local ("local vs =" instead of just "vs =") there, since it's in a function and all. Just good practice in programming.
Title: Re: DFHack 0.40.13-r1
Post by: PeridexisErrant on September 24, 2014, 06:15:38 am
Awesome, I've got it working - just went through changing the viewscreen values set to 0 and when it moved the cursor that worked. 

Incidentally, vs.anon_21 controls which item (sites, hist figs, structures, etc) is selected in the main legends mode view.  I've stuck it in for now, but once a name is assigned it'll need to change.

Spoiler: new exportlegends.lua (click to show/hide)
Title: Re: DFHack 0.40.13-r1
Post by: Trouserman on September 24, 2014, 08:15:57 am
You might want to make vs local ("local vs =" instead of just "vs =") there, since it's in a function and all. Just good practice in programming.

So, Lua isn't lexically scoped by default? I haven't really had a look at the language yet, but that's... disappointing.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on September 24, 2014, 09:11:35 am
A lot of things about Lua are disappointing.
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on September 24, 2014, 09:17:54 am
I'm feeling really confused about this whole onLoad.init file thing...

Am I supposed to place it in Dwarf Fortress 0.40.13\raw? This is what I did, but I can't seem to get it to work. I'm using PeridexisErran't DF Starter pack if that changes anything.

The thing is, there is a dfhack.init file in the main dwarf fortress folder, as well as a LNP_dfhack_onLoad.init file. The download didn't seem to come with any onLoad.init file, so I created one in the \raw folder, and it seems to be copied to any new worlds I create, just like I believe it should. But it just doesn't seem to work.

It could simply be that I failed with the syntax of launching the scripts, but I do believe I have the right syntax.

Spoiler (click to show/hide)
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on September 24, 2014, 10:04:22 am
Code: (In my Wizard Creature's raws) [Select]
[CAN_DO_INTERACTION:CONJURE]
[CDI:ADV_NAME:Conjure Bound Dagger]
(CDI:INTERACTION:CONJURE)
[CDI:TARGET:A:SELF_ONLY]
[CDI:MAX_TARGET_NUMBER:A:1]
[CDI:VERB:conjure a bound dagger:conjures a bound dagger:NA]
[CDI:WAIT_PERIOD:86400]
Not sure if this is the problem, but "(CDI:INTERACTION:CONJURE)" is not the same as "[CDI:INTERACTION:CONJURE]".
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on September 24, 2014, 10:25:07 am
Code: (In my Wizard Creature's raws) [Select]
[CAN_DO_INTERACTION:CONJURE]
[CDI:ADV_NAME:Conjure Bound Dagger]
(CDI:INTERACTION:CONJURE)
[CDI:TARGET:A:SELF_ONLY]
[CDI:MAX_TARGET_NUMBER:A:1]
[CDI:VERB:conjure a bound dagger:conjures a bound dagger:NA]
[CDI:WAIT_PERIOD:86400]
Not sure if this is the problem, but "(CDI:INTERACTION:CONJURE)" is not the same as "[CDI:INTERACTION:CONJURE]".

Yeah, I tried with the [] before, but then I "commented" the line out because I believe the CDI:INTERACTION token is only required in syndromes that allow the interaction. Thanks though :)
The verb prints out nicely and everything, so I'm pretty sure I've got bad syntax in my onLoad.init, or I've put the onLoad.init in the wrong place or something like that.
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on September 24, 2014, 12:28:49 pm
I'm pretty sure I've got bad syntax in my onLoad.init, or I've put the onLoad.init in the wrong place or something like that.
What happens if you load the game and then manually copy/paste the contents of onLoad.init into the DFHack console window?

If it works, then onLoad.init isn't being run; if it doesn't work, then you've got a syntax error.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 24, 2014, 12:46:07 pm
You can also invoke devel/print-args (e.g. "devel/print-args test") in onLoad.init to display a message if/when onLoad.init is run.
Also, have you verified that the file was saved as "onLoad.init" and not "onLoad.init.txt"?
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on September 24, 2014, 01:10:12 pm
You can also invoke devel/print-args (e.g. "devel/print-args test") in onLoad.init to display a message if/when onLoad.init is run.
Also, have you verified that the file was saved as "onLoad.init" and not "onLoad.init.txt"?

Thank you guys.

Spoiler (click to show/hide)

devel/print-args seems to be working, and nothing happens when I copy-paste the lua code into DFHack, so I guess I've got a bunch of syntax errors in every single line, seeing as none of them work :c You guys wouldn't happen to know what "too few actors" means? Every now and then, the following generates that message:
Code: [Select]
[CDI:VERB:conjure a bound dagger:conjures a bound dagger:NA]
Code: [Select]
modtools/interaction-trigger -onAttackStr "conjure a bound dagger" -command [ item/create -unit \\ATTACKER_ID -item WEAPON:ITEM_WEAPON_DAGGER_BOUND -mat SOUL_BOUND -inventory -dur 86400 ]
I've also tried
Code: [Select]
[CDI:VERB:summons a steel sword:summons a steel sword:summons a steel sword]
Code: [Select]
modtools/interaction-trigger -onAttackStr "summons a steel sword" -command [ item/create -unit \\ATTACKER_ID -item WEAPON:ITEM_WEAPON_SWORD -mat STEEL -inventory ]which is code given to me by roses, but I can't get that to work either. :s
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on September 24, 2014, 01:37:57 pm
Too few actors is something EventManager prints when it can figure out either the attacker or the defender but not both. Can you figure out what makes that happen?

Heh. I might have been silly and not tested self-interactions. Does it work if you cast it on someone else?
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on September 24, 2014, 01:53:50 pm
Too few actors is something EventManager prints when it can figure out either the attacker or the defender but not both. Can you figure out what makes that happen?

Heh. I might have been silly and not tested self-interactions. Does it work if you cast it on someone else?

I'm sorry, but I don't think I'd be able to. I can't seem to figure anything out at all xD

Well, the error is a bit weird, it seems to just show up really rarely. Casting on others doesn't seem to work either, but that hasn't generated any errors so far.


Edit: Got the error when casting on someone else. Also tried a bunch of different settings for the summoning of a steel sword.

Spoiler (click to show/hide)

Title: Re: DFHack 0.40.13-r1
Post by: Putnam on September 24, 2014, 02:22:55 pm
Too few actors is something EventManager prints when it can figure out either the attacker or the defender but not both. Can you figure out what makes that happen?

Heh. I might have been silly and not tested self-interactions. Does it work if you cast it on someone else?

I get it fairly consistently with announcements made by interactions that use VERBAL_SPEECH, since those don't actually have attackers/defenders.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on September 24, 2014, 02:27:09 pm
I forget but I might have set it up so it only prints the message once per run of DF, which makes it really awkward to test.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on September 24, 2014, 02:28:09 pm
Good thing VERBAL_SPEECH points to a text file and takes lines from it at random.

Try out, say, Fortbent, where there are a few creatures (ebubbles) that have hundreds of lines in their verbal_speech files for their interactions.
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on September 24, 2014, 02:34:51 pm
I forget but I might have set it up so it only prints the message once per run of DF, which makes it really awkward to test.

Yeah, this seems to be the case.

I just don't get why it doesn't work though... I've tried making it only possible to cast it on myself, I've tried casting on others, I have 12 different lines attempting to do very similar things. I've even gotten an example from the author of the script, but I can't even get that to work.

Does anyone have a working spell that uses create-item.lua? If anyone does, it would be greatly appreciated if you could share the onLoad.init, the interaction and the creature files with me. I'm starting to feel like giving up. :c

Good thing VERBAL_SPEECH points to a text file and takes lines from it at random.

Try out, say, Fortbent, where there are a few creatures (ebubbles) that have hundreds of lines in their verbal_speech files for their interactions.

Not sure if this was aimed at me, but I have no idea how to use VERBAL_SPEECH (or apparently anything else, for that matter) in scripts O_o



Edit: I remember reading something about activating the triggers somewhere (Something like "enable interaction-trigger"). Does this still have to be done? If yes, what exactly do I need to type?
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on September 24, 2014, 02:41:17 pm
Good thing VERBAL_SPEECH points to a text file and takes lines from it at random.

Try out, say, Fortbent, where there are a few creatures (ebubbles) that have hundreds of lines in their verbal_speech files for their interactions.

Not sure if this was aimed at me

It was for expwnent, heh. Should probably quote.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on September 24, 2014, 03:12:21 pm
I'll try to get an example up in a day or two. I'm a little busy at the moment.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 24, 2014, 04:09:55 pm
If anyone has been experiencing problems with box-select on Windows with 0.40.13-r1, please try the patch here (https://github.com/DFHack/dfhack/issues/338#issuecomment-56739172) (thanks to Quietust).
Title: Re: DFHack 0.40.13-r1
Post by: ptb_ptb on September 26, 2014, 05:44:09 am
The exterminate script appears to be broken. Or possibly I'm just doing something stupid.

I've tried
exterminate yak
exterminate yak bull
exterminate him (while 'v'iewing yak)

If you're wondering why the yak must die. It's mysteriously carrying plump helmets that my starving dwarves need.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 26, 2014, 05:49:40 am
Are you unpausing? 'exterminate' takes 1-2 in-game ticks to take effect.
Title: Re: DFHack 0.40.13-r1
Post by: ptb_ptb on September 26, 2014, 05:50:47 am
Are you unpausing? 'exterminate' takes 1-2 in-game ticks to take effect.

Yep. That yak was wandering happily around much longer than that.

I attacked him with three dwarves. He killed all three.
Title: Re: DFHack 0.40.13-r1
Post by: indyofcomo on September 26, 2014, 09:09:47 am
If I use "reveal", will the stores count be updated? I'm hoping to use reveal to discover if a particular stone is present on the map, without searching for it visually since I have no idea what it looks like.
Title: Re: DFHack 0.40.13-r1
Post by: scamtank on September 26, 2014, 09:18:00 am
Only mined-out rocks count as items. Use "prospect" instead.
Title: Re: DFHack 0.40.13-r1
Post by: khearn on September 26, 2014, 12:53:26 pm
Are you unpausing? 'exterminate' takes 1-2 in-game ticks to take effect.

Yep. That yak was wandering happily around much longer than that.

I attacked him with three dwarves. He killed all three.

Well, at least those 3 didn't starve to death. :)
Title: Re: DFHack 0.40.10-r1
Post by: LeoCean on September 26, 2014, 01:55:06 pm
Can you use DFHack to add a syndrome to the selected dwarf?
i.e. to turn a dwarf into a vampire

Yes, but the syndrome has to have a name. See the modtools/add-syndrome script for details.

 Thanks, I'm assuming the name given in the LegendsViewer would work.
 Also, it was called add-syndrome?!
 I ctrl-f'd all over the place, well sorry for having missed it with so obvious a name.

I tried a bunch of things with this and could not figure out how to make it work. Can anyone tell me the command you'd use to make a vampire.

Also superdwarf doesn't work, if you press superdwarf list you get a ruby error script and the other command to make someone a superdwarf doesn't do anything special to them like fastdwarf 1 does to all of them (I did it with fastdwarf off, actually before I tried that command). Not that I care I was just seeing what dfhack commands there were. But I really want a vampire, I made the world gen start with 300 but there's no historical ones so I've no idea if any survived 125 years, plus it made it to the age of heroes..  :'(
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 26, 2014, 02:00:51 pm
Superdwarf report (https://github.com/DFHack/dfhack/issues/337)
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on September 26, 2014, 02:30:14 pm
Superdwarf report (https://github.com/DFHack/dfhack/issues/337)

I added this fix (https://github.com/DFHack/dfhack/issues/337) and the Superdwarf add (https://github.com/hobotron-df/dfhack/commit/9fbdadfa487b0d013f86585c5586b7ab9648aaeb) one. But only the superdwarf add one worked the superdwarf list is still throwing an error.

Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 26, 2014, 02:32:25 pm
What's the error message? Does this commit (https://github.com/jjyg/dfhack/commit/eed684a8dfba80c04964a5b5ada1621fde3caaa5) work?
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on September 26, 2014, 02:42:33 pm
What's the error message? Does this commit (https://github.com/jjyg/dfhack/commit/eed684a8dfba80c04964a5b5ada1621fde3caaa5) work?

Yeah that one works if added to \hack\ruby\ruby.rb. With your superdwarf add fix, it's similar to your one but yours includes more, I don't know which of them would be better. 

Here's the error with your one.

Spoiler: Error other version (click to show/hide)
Title: Re: DFHack 0.40.13-r1
Post by: Mchl on September 27, 2014, 01:38:49 pm
I took some time to fix forum-dwarves script (if you don't know what's this: here's a sample of what it does)

Spoiler (click to show/hide)

It works for item and creature descriptions as well as a couple other screens (like manual).
If people are interested I can also add support for announcements and combat reports. Let me know.

You can get the fixed script here: https://github.com/Mchl/dfhack/blob/master/scripts/forum-dwarves.lua
Title: Re: DFHack 0.40.13-r1
Post by: vjek on September 27, 2014, 01:48:21 pm
I took some time to fix forum-dwarves script (if you don't know what's this: here's a sample of what it does)
 ...
Nicely done!  Thank you very much, Mchl.
Title: Re: DFHack 0.40.13-r1
Post by: jwhite.df on September 27, 2014, 02:55:37 pm
That's the script output? It gives more detail than the dwarf screen?
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 27, 2014, 03:15:45 pm
What sections are you referring to? That looks like the information available on the dwarf information screens in 0.40.xx to me.
Title: Re: DFHack 0.40.13-r1
Post by: Mchl on September 27, 2014, 04:19:24 pm
No, there is no additional information over what is available on dwarf information screen. This script pretty much only dumps the available text and adds forum compatible coloring in place of DF formatting symbols.
For announcements and reports I created a script that adds date and time to each entry. I can also add forum colouring if anyones interested. For now its output looks like this:

Spoiler (click to show/hide)

You can get it here: https://github.com/Mchl/dfhack/blob/master/scripts/markdown.lua

I can add this functionality (plus coloring) to forum-dwarves without much hassle.
Title: Re: DFHack 0.40.13-r1
Post by: Kirkegaard on September 28, 2014, 05:59:15 am
Anyone else have issues with the copy savegame option? It does not seem to do anything at all?

(using .13 starter pack r3)

Additionally can't "fixdiplomats and fixmerchants" be removed? the issue seem to be fixed.
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on September 28, 2014, 08:36:48 am
Anyone else have issues with the copy savegame option? It does not seem to do anything at all?

(using .13 starter pack r3)

Additionally can't "fixdiplomats and fixmerchants" be removed? the issue seem to be fixed.
Fixdiplomats can indeed be removed since Toady readded Elven diplomats, but he hasn't readded Human Guild Representatives so Fixmerchants is still useful.
Title: Re: DFHack 0.40.13-r1
Post by: Icefire2314 on September 28, 2014, 09:13:11 am
Small problem

I edited the init-example file before renaming it. Dunno if that changes anything.
Used Notepad
Renamed to dfhack.init
Won't identify the file on startup, keeps saying it will use init-example, but there is no init-example
Tried extracting just the init from the rar, it's still attuned to notepad and its name is just dfhack, no init or even init-example

No idea what to do :S Please help
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 28, 2014, 10:04:31 am
Did you save it as "dfhack.init.txt" accidentally? What do you see when you run "script dfhack.init" in the console?
Title: Re: DFHack 0.40.13-r1
Post by: Rose on September 29, 2014, 01:24:46 am
turn on showing file extensions in windows. If you see a .txt at the end of the file, get rid of it.
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on September 29, 2014, 02:40:33 pm
Do interaction-triggers work properly? The way I understood it, roses' spell scripts seem to work in the arena, but not with interaction-trigger.

Is there any quick way to test this? I am still getting the too few actors error for the create-item script, so I guess that's suggesting it's working.

Code: [Select]
modtools/interaction-trigger -onAttackStr "summons a steel sword" -command [ devel/print-args "Steel sword summoned" ]
modtools/interaction-trigger -onAttackStr "summons a steel sword" -command [ rendermax ]
Doesn't do anything at all though. Now, I'm not sure if using devel/print-args like this should work, but simply writing the command "rendermax" into the console generally throws an error. This doesn't though, and nothing happens.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on September 29, 2014, 02:44:33 pm
interaction-trigger does not work in the arena AFAIK, probably for the same reason most tick-based repeating loops don't.
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on September 29, 2014, 03:03:00 pm
interaction-trigger does not work in the arena AFAIK, probably for the same reason most tick-based repeating loops don't.

I'm testing it in adventure mode though. Should the commands that I posted work, or are they completely wrong?

Also, how would I go about launching scripts every time a new region is loaded? I'm writing a script that should log the beliefs of any historical figures the player meets, but I have no idea how to automate the launching of the script. I'm not sure if "region" is the right term, but I need to the script to run whenever a new historical figure might be loaded.
Title: Re: DFHack 0.40.13-r1
Post by: Icefire2314 on September 29, 2014, 04:32:56 pm
turn on showing file extensions in windows. If you see a .txt at the end of the file, get rid of it.

Thanks a million, I turned them on and changed it from dfhack.init.init-example to just dfhack.init. It works now :D
Title: Re: DFHack 0.40.13-r1
Post by: indyofcomo on September 29, 2014, 05:39:46 pm
If I understand my search results correctly, this screen is from stackflow, right?
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.13-r1
Post by: Icefire2314 on September 29, 2014, 05:41:27 pm
"After a polite discussion with a local rival, X has claimed the position of king of Y"

Unfortunately my only soldier was just cursed with nobility. I need him to help train the other soldiers and also don't want him to be cursed with this awful curse of nobility, worse than were or vampire. Is it possible to use DFHack to remove or change nobility? I didn't know he was elected leader of the site and would rather replace him with someone else.
Title: Re: DFHack 0.40.13-r1
Post by: nomad_delta on September 29, 2014, 05:49:42 pm
Does anyone know whether the stockpile "autodump" portion of Falconne's "UI Improvement Plugins" ever got updated for DF2014?  When I hit [q] on a stockpile I see the Shift-T for auto-trade and Shift-M for auto-melt from that stockpile and those are working great, but I don't see shift-D to set auto-dump from that stockpile.  It's supposed to look like this, but the auto-dump line is missing:

http://i.imgur.com/piJ06yt.png

Here's a link to the original thread for Falconne's plugins, not sure where the current versions included with the latest version of dfhack came from: http://www.bay12forums.com/smf/index.php?topic=119575.0

Thanks!

--nomad_delta
Title: Re: DFHack 0.40.13-r1
Post by: smjjames on September 29, 2014, 06:02:36 pm
How do I view my adventurers reputation while in an adventure game? Or rather, can I?
Title: Re: DFHack 0.40.10-r1
Post by: Dirst on September 29, 2014, 08:26:42 pm
Hi again everyone...

First, does anyone know the answer to this, or should I just risk creating a rift in the time-space continuum? :)
I have a question about customizing the spawn (https://gist.github.com/Rumrusher/f4d0ba18ba6868d38221) script: How can you tell "what time it is" to set the spawned creature's birth time exactly?  In my case, the creature comes into being the moment the script is called (no backdated birthdays), so unit.relations.birth_year=df.global.cur_year gets the year right.  Is it unit.relations.birth_time=df.global.curr_year_ticks to set the birth time?  The historical figure data seems to want hf.born_seconds and I'm not sure how "ticks" relate to "seconds" here.

Second, I thought I could spawn a tame creature by assigning it the same civ as the player.  It shows up as "Tame" on the units screen, but "Not tame" on the Z/Animals screen.  Is it possible to fiddle with the little bugger's tameness as he's being spawned?

Edit: Well for the first question, df.global.cur_year_tick runs without errors, though I don't know how to check the creature in detail to see if it really is just moments old.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 29, 2014, 08:42:33 pm
If I understand my search results correctly, this screen is from stackflow, right?
Spoiler (click to show/hide)
No, this is the "gui/room-list" script, accessible (by default) by pressing Alt-R when viewing a building. If you're using Windows and meant to press "R", it's possible that the "Alt" key is stuck - pressing and releasing it should fix the problem.
Title: Re: DFHack 0.40.13-r1
Post by: breadman on September 29, 2014, 10:59:07 pm
Does anyone know whether the stockpile "autodump" portion of Falconne's "UI Improvement Plugins" ever got updated for DF2014?

No, it hasn't.  It can be compiled in its current state, but would need a bit of work, just like stockflow, autotrade, and automelt did, to play nicely with the new behavior of the stockpile links.  I haven't done that, out of apathy, though I have found Falconne's source code for it.  I'm curious; what would an auto-dumping stockpile provide for you that minecarts don't?
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on September 30, 2014, 08:26:35 am
interaction-trigger does not work in the arena AFAIK, probably for the same reason most tick-based repeating loops don't.

I'm testing it in adventure mode though. Should the commands that I posted work, or are they completely wrong?

Also, how would I go about launching scripts every time a new region is loaded? I'm writing a script that should log the beliefs of any historical figures the player meets, but I have no idea how to automate the launching of the script. I'm not sure if "region" is the right term, but I need to the script to run whenever a new historical figure might be loaded.

Actually I think it has trouble in just adventure mode. It does things by searching through combat logs so unless your name is "you" it doesn't find the adventurer. I'll fix it when I can.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on September 30, 2014, 10:55:35 am
interaction-trigger does not work in the arena AFAIK, probably for the same reason most tick-based repeating loops don't.

I'm testing it in adventure mode though. Should the commands that I posted work, or are they completely wrong?

Also, how would I go about launching scripts every time a new region is loaded? I'm writing a script that should log the beliefs of any historical figures the player meets, but I have no idea how to automate the launching of the script. I'm not sure if "region" is the right term, but I need to the script to run whenever a new historical figure might be loaded.

Actually I think it has trouble in just adventure mode. It does things by searching through combat logs so unless your name is "you" it doesn't find the adventurer. I'll fix it when I can.

It also doesn't seem to be functioning in the arena, at least for me, whenever I try and initialize it it gives the "not enough actors" error. It's possible (or should I say probable) that I have done something wrong, but I haven't managed to get it to work yet.
Title: Re: DFHack 0.40.13-r1
Post by: arbarbonif on September 30, 2014, 01:23:42 pm
Is there a protocol to get a script/tool added to the main install?  I've got a couple ideas I'd like to try out (and learn myself some lua or ruby) and it would be nice to get them included in future versions (assuming I ever get them to that point and they would be useful).  I don't really see any documentation on "so you want to help develop for dfHack"...
Title: Re: DFHack 0.40.13-r1
Post by: nomad_delta on September 30, 2014, 02:03:09 pm
Does anyone know whether the stockpile "autodump" portion of Falconne's "UI Improvement Plugins" ever got updated for DF2014?

No, it hasn't.  It can be compiled in its current state, but would need a bit of work, just like stockflow, autotrade, and automelt did, to play nicely with the new behavior of the stockpile links.  I haven't done that, out of apathy, though I have found Falconne's source code for it.  I'm curious; what would an auto-dumping stockpile provide for you that minecarts don't?

Mostly the ability to automagically dump everything from my indoors refuse pile down the garbage chute (80z's down straight into the magma bath with all of those useless goblin clothes!) ... without having to learn how to use mine carts.  :D

I hadn't even considered using minecarts to do it.  I've just been manually sweeping the refuse pile with d-b-d whenever it gets full.

I suppose this would probably be a good time for me to learn how to use minecarts, eh? :P

Also: was it you that recompiled and updated the other plugins like automelt for the new version? If so, or if you've done any other work on dfhack at all -- thank you so much! dfhack makes my entire Dwarf Fortress experience much more enjoyable, and I really appreciate it.

--nomad_delta
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on September 30, 2014, 02:57:01 pm
Is there a protocol to get a script/tool added to the main install?  I've got a couple ideas I'd like to try out (and learn myself some lua or ruby) and it would be nice to get them included in future versions (assuming I ever get them to that point and they would be useful).  I don't really see any documentation on "so you want to help develop for dfHack"...
Most people make a PR (once a script is ready for inclusion), although this thread and #dfhack on irc.freenode.net also work. In order to make a PR, you'd need to fork DFHack/dfhack (https://github.com/dfhack/dfhack) on Github, create a new branch from the "develop" branch, add your script to it and create a PR based on "DFHack:develop" (i.e. the develop branch of DFHack/dfhack).
Title: Re: DFHack 0.40.13-r1
Post by: smjjames on September 30, 2014, 03:01:39 pm
How do I view my adventurers reputation while in an adventure game? Or rather, can I?

Anybody know anything on this?

Then again, relationships (and many other things) are really broken right now in adventure mode.
Title: Re: DFHack 0.40.13-r1
Post by: khearn on September 30, 2014, 03:23:02 pm
Is there a protocol to get a script/tool added to the main install?  I've got a couple ideas I'd like to try out (and learn myself some lua or ruby) and it would be nice to get them included in future versions (assuming I ever get them to that point and they would be useful).  I don't really see any documentation on "so you want to help develop for dfHack"...
Most people make a PR (once a script is ready for inclusion), although this thread and #dfhack on irc.freenode.net also work. In order to make a PR, you'd need to fork DFHack/dfhack (https://github.com/dfhack/dfhack) on Github, create a new branch from the "develop" branch, add your script to it and create a PR based on "DFHack:develop" (i.e. the develop branch of DFHack/dfhack).

PR == Pull Request

Just in case you didn't know.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on September 30, 2014, 03:28:37 pm
make sure to update NEWS
Title: Re: DFHack 0.40.13-r1
Post by: breadman on September 30, 2014, 04:49:36 pm
Mostly the ability to automagically dump everything from my indoors refuse pile down the garbage chute (80z's down straight into the magma bath with all of those useless goblin clothes!) ... without having to learn how to use mine carts.  :D

I suppose this would probably be a good time for me to learn how to use minecarts, eh? :P

This seems like a perfect application for them, yes.  They're really not that bad, though setting up tracks can be a bit finicky.

Also: was it you that recompiled and updated the other plugins like automelt for the new version? If so, or if you've done any other work on dfhack at all -- thank you so much! dfhack makes my entire Dwarf Fortress experience much more enjoyable, and I really appreciate it.

Just those three, along with a few other small fixes.  The real credit goes to those who wrote and maintain the core system; I'm nowhere near the top of the list of contributors (https://github.com/DFHack/dfhack/graphs/contributors).
Title: Re: DFHack 0.40.13-r1
Post by: 0x517A5D on September 30, 2014, 06:50:13 pm
Mostly the ability to automagically dump everything from my indoors refuse pile down the garbage chute (80z's down straight into the magma bath with all of those useless goblin clothes!) ... without having to learn how to use mine carts.  :D

I suppose this would probably be a good time for me to learn how to use minecarts, eh? :P

This seems like a perfect application for them, yes.  They're really not that bad, though setting up tracks can be a bit finicky.

Note that minecarts can do what he wants without a single bit of track. 

Minecart Quantum Stockpiles (http://dwarffortresswiki.org/index.php/DF2014:Exploit#The_Minecart_Stop).  You just need a track stop set to dump toward the chute, and a single minecart with one stop and no depart rules.

It's fairly easy, and it's a good way to start learning minecart mechanics.
Title: Re: DFHack 0.40.10-r1
Post by: LeoCean on October 01, 2014, 06:35:43 pm
Can you use DFHack to add a syndrome to the selected dwarf?
i.e. to turn a dwarf into a vampire

Yes, but the syndrome has to have a name. See the modtools/add-syndrome script for details.

 Thanks, I'm assuming the name given in the LegendsViewer would work.
 Also, it was called add-syndrome?!
 I ctrl-f'd all over the place, well sorry for having missed it with so obvious a name.

I tried a bunch of things with this and could not figure out how to make it work. Can anyone tell me the command you'd use to make a vampire.

-snip

I got the whole modtools/add-syndrome -syndrome "gila monster bite" -target 16157 to work (found the target id with teleport ShowUnitID) and I guess that worked cause I go no error from it. But I want to make a vampire with it.... Nothing I try replacing "gila monster bite" seems to work. Can anyone get that to work? Or there is this script that is suppose to work in 34.11 r3, if someone could port that to 40.13 that'd be really sweet.


The base for it was this (https://gist.github.com/warmist/4061959). That script actually pops up a list of syndromes in dfhack but there were none that said vampire.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 01, 2014, 06:39:51 pm
If none say vampire, then none are named vampire and your script as written won't work.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 01, 2014, 08:19:59 pm
That script is written here (http://www.bay12forums.com/smf/index.php?topic=91166.msg4533967#msg4533967). I don't know, the only other way I can really see making a vampire is through the autosyndrome pluggin that meph has in masterwork with a reaction at a workshop. Seems the easiest but that pluggin was changed to be 2 different lua files in 40.xx.

But that script if rewritten for 40.13 should work possibly, I say that but I don't know how to rewrite it. But it does work in the 34.11 version I just tested it on (34.11r1 or r3 (it was made for r3 though). The modtools section of dfhack wasn't there before 40.xx so idk if that stuff (syndromes) is the same. Or if vampire is not a syndrome anymore.

Hmm I checked on r63 of the lazy newbpack 34.11 but that doesn't work so it wasn't working on r5 of dfhack. I think the one I tested it on and it worked was DFHack 0.34.11r1, though it is for r3. Though cursecheck after I let the game run for a minute or so shows I do have a vampire and dwarf therapist confirmed it with the highlight in that version.

If none say vampire, then none are named vampire and your script as written won't work.

Well is there a way to check the name of a units syndrome?
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 01, 2014, 08:26:53 pm
All syndrome names are listed in that inject-syndrome script.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 01, 2014, 08:51:18 pm
This one? (https://gist.github.com/warmist/4061959), possibly but a good number of them are ? and beast sickness. It's really just a few that are readable. Plus it doesn't change the fact that the other script was built from it.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 01, 2014, 09:13:24 pm
Yes, that one. The vampire syndrome is more than likely one of the ? syndromes.
Title: Re: DFHack 0.40.13-r1
Post by: The Bard on October 01, 2014, 09:22:34 pm
The DFFD links seem to be dead, and the DFHACK/dfhack site only seems to have source doe downloads. Is there a mirror where I can get the Windows release?
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 01, 2014, 09:23:44 pm
The DFFD links seem to be dead, and the DFHACK/dfhack site only seems to have source doe downloads. Is there a mirror where I can get the Windows release?

DFFD isn't dead right now...
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 01, 2014, 09:27:03 pm
Both of the scripts give the same errors on 40.13 though. Ok you were right I tried 5-6 of those ? in 34.11r1 or r3 and they all became vampires.. To bad it still wouldn't work without being changed/updated because of the errors it has in 40.13 though.

The DFFD links seem to be dead, and the DFHACK/dfhack site only seems to have source doe downloads. Is there a mirror where I can get the Windows release?

DFFD isn't dead right now...

It could be for him, some people aren't able to get on there for some reason or another. You can try downloading the LNP  The dropbox link  (https://www.dropbox.com/sh/74agv72ccbnqffi/C2-f5KyTUd) it comes with dfhack installed in it.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 01, 2014, 09:37:58 pm
The INVENTORY_CHANGE event currently crashes the game whenever it runs regardless of listeners.
Title: Re: DFHack 0.40.13-r1
Post by: ptb_ptb on October 03, 2014, 10:19:43 am
I wonder if anyone would be interested in wrangling up something for dfhack that can do stuff with the ABOVE_GROUND and SUBTERRANEAN tags. E.g. if you cast obsidian over a river, the riverbed is still tagged above ground, despite being hidden under a ton of rock.
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on October 03, 2014, 11:44:45 am
Yeah, that one is tricky I imagine, given how it works now I don't know of any way to undo the above ground/light tag, despite breaking all sorts of other stuff messing with things like infinitesky and tiletypes and so forth.

I mean, at one point I got a layer of air that randomly turned an adamantine tower into sand and killed several dwarves before I figured out that the (un)biome it was considered had a temperature of 0 urists!

I tried to break that for a while but despite having tons of magma there, campfires, ashes, wildfires, burning material, anything... it remained 0 out of 10,000+ urists consistently.

I can't imagine what sort of fun you'd get from being able to toggle above/below ground/dark/light status freely.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 03, 2014, 12:13:27 pm
The INVENTORY_CHANGE event currently crashes the game whenever it runs regardless of listeners.

That's bad. I'll take a look. Out of curiosity what mode did you test it in?
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 03, 2014, 01:24:59 pm
The INVENTORY_CHANGE event currently crashes the game whenever it runs regardless of listeners.

That's bad. I'll take a look. Out of curiosity what mode did you test it in?

Dwarf.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 04, 2014, 01:08:41 am
Hi, is there a way for a script to know if a particular unit has a particular syndrome?  I know that Dwarf Therapist can list current syndromes, so the info must be in there somewhere.

When I tried to figure out the structure of an active syndrome, I came up with the following (edited to make the values line up):
Code: [Select]
[lua]# for k,v in pairs(miner_unit.syndromes.active[0]) do print(k,v) end
type                  1
year                  125
year_time             18832
ticks                 3
wounds                <vector<int32_t>: 0x35ff2840>
wound_id              -1
symptoms              <vector<unit_syndrome.T_symptoms*>: 0x35ff2854>
reinfection_count     1
flags                 <unit_syndrome.T_flags: 0x35ff2868>
unk4                  <vector<int32_t>: 0x35ff286c>

The 'type' was 1 for two different syndromes, so that's not an identifier.  Running the same loop on 'wounds' and 'unk4' yields nothing, and 'symptoms' doesn't give me anything useful.  My guess is that I'm doing this almost exactly wrong.

In the give-me-a-fish category, how do I find out if a specific syndrome is affecting a unit?
In the teach-me-to-fish category, is there a complete object model documented somewhere?

DFHack is awesome, it's just a tad overwhelming at times.

Edit: Had the 'type' be 1 on one syndrome and 20 on another, so that seems to be an identifier.  The question then becomes, where do I look up that identifier to get the name of the syndrome?  I can't depend on the numeric id's staying static since who knows what other mods might be loaded in the future.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 04, 2014, 02:14:57 am
df.syndrome.find(type)
Title: Re: DFHack 0.40.13-r1
Post by: dwarf_reform on October 04, 2014, 03:22:24 am
I thought it'd be handy if some of the functions were grouped under some user-friendly headers.. An example would be a "Interacting with liquids" section that'd list any and all dfhack functions that deal with liquid interactions or usage.. Some other sections/groups could be 'Workflow controls", "Patches and repairs", "Commands that can kill", "Cleaning and framerate", "Item manipulation", stuff like that..

Basically it'd provide shorter and more focused lists of dfhack features in help-file format and give new users a cleaner way to explore available functions without scanning the gigantic/daunting 'ls' list :>

Also, enabling the 'liquids' command to place blood and venom, or extracts/dusts/illnesses in liquid form, if possible, would be insane.. Purposefully dumping sadness on my dwarves for science..
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 04, 2014, 03:44:28 am
Magma and water are the only actual liquids in the game.
Title: Re: DFHack 0.40.13-r1
Post by: ptb_ptb on October 04, 2014, 06:50:44 am
Not sure if this is the right thread,
[EDIT] Whoops! It should have been here (http://www.bay12forums.com/smf/index.php?topic=121451.0) I guess. I did look, but I must have looked right through that. :(
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 04, 2014, 09:18:11 am
df.syndrome.find(type)
Thank you Putnam.  That .find method didn't show up when I iterated over the df.syndrome object (my guess is that no methods would).  Is there some way in lua to interrogate all of the attributes and methods of an object?  Or better yet, an object model somewhere?  I tried searching in symbols.xml, but that doesn't have everything.
Title: Re: DFHack 0.40.13-r1
Post by: arcane on October 04, 2014, 01:06:40 pm
digFlood doesn't like me.  Per the man page I added a command to my dfhack.init but every time I launch it fails.

digFlood BISMUTHINITE CASSERITE GALENA GARNIERITE HEMATITE LIMONITE MAGNETITE MALACHITE SPHALERITE TETRAHEDRITE LIGNITE

this kicks back: Could not find material "BISMUTHINITE"

I'm spelling it correctly per the wiki and the raws, so what am I doing wrong?
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 04, 2014, 01:45:53 pm
df.syndrome.find(type)
Thank you Putnam.  That .find method didn't show up when I iterated over the df.syndrome object (my guess is that no methods would).  Is there some way in lua to interrogate all of the attributes and methods of an object?  Or better yet, an object model somewhere?  I tried searching in symbols.xml, but that doesn't have everything.

https://github.com/DFHack/df-structures

find seems to be a bit of a special case, though; you'll just have to sorta guess it's there for most objects with IDs. It usually is, though.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 04, 2014, 03:11:05 pm
digFlood doesn't like me.  Per the man page I added a command to my dfhack.init but every time I launch it fails.

digFlood BISMUTHINITE CASSERITE GALENA GARNIERITE HEMATITE LIMONITE MAGNETITE MALACHITE SPHALERITE TETRAHEDRITE LIGNITE

this kicks back: Could not find material "BISMUTHINITE"

I'm spelling it correctly per the wiki and the raws, so what am I doing wrong?
Do you see an equivalent error with "Cassiterite" when deleting BISMUTHINITE? (It should be CASSITERITE, not CASSERITE, by the way.) If so, you'll probably need to run that command with a world loaded - you can do this automatically by adding it to the "onLoadWorld.init" file (creating it if necessary) in the same folder as dfhack.init.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 04, 2014, 03:30:51 pm
I found a small bug in modtools/add-syndrome.lua

On line 122, it should read

  local affectedCaste = syndrome.syn_affected_caste[caste].value

instead of

  local affectedCaste = syndrome.syn_affectedCaste[caste].value

Fixing that made it a couple orders of magnitude easier for me to troubleshoot my scripts.

Thanks for all the awesomeness that is DFHack!  Now I'm off to stumble my way through art assets...
Title: Re: DFHack 0.40.13-r1
Post by: JackDaniels21 on October 04, 2014, 05:55:30 pm
Is there any way to keep dfhack from resizing the gui? It makes the font too small and it forces truetype.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 04, 2014, 08:23:14 pm
Are you using TwbT? If so, you can disable it by deleting <DF>/hack/plugins/twbt.plug.(dll/dylib/so) or changing PRINT_MODE to 2D in init.txt.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 04, 2014, 08:57:12 pm
digFlood doesn't like me.  Per the man page I added a command to my dfhack.init but every time I launch it fails.

digFlood BISMUTHINITE CASSERITE GALENA GARNIERITE HEMATITE LIMONITE MAGNETITE MALACHITE SPHALERITE TETRAHEDRITE LIGNITE

this kicks back: Could not find material "BISMUTHINITE"

I'm spelling it correctly per the wiki and the raws, so what am I doing wrong?

I think you need to do

Code: [Select]
digFlood 1 [materials]
Otherwise it's looking for an already-registered material to unregister. It doesn't find it since it hasn't been registered yet.

I found a small bug in modtools/add-syndrome.lua

On line 122, it should read

  local affectedCaste = syndrome.syn_affected_caste[caste].value

instead of

  local affectedCaste = syndrome.syn_affectedCaste[caste].value

Fixing that made it a couple orders of magnitude easier for me to troubleshoot my scripts.

Thanks for all the awesomeness that is DFHack!  Now I'm off to stumble my way through art assets...

Excellent catch. Thank you very much.

I thought it'd be handy if some of the functions were grouped under some user-friendly headers.. An example would be a "Interacting with liquids" section that'd list any and all dfhack functions that deal with liquid interactions or usage.. Some other sections/groups could be 'Workflow controls", "Patches and repairs", "Commands that can kill", "Cleaning and framerate", "Item manipulation", stuff like that..

Basically it'd provide shorter and more focused lists of dfhack features in help-file format and give new users a cleaner way to explore available functions without scanning the gigantic/daunting 'ls' list :>

Also, enabling the 'liquids' command to place blood and venom, or extracts/dusts/illnesses in liquid form, if possible, would be insane.. Purposefully dumping sadness on my dwarves for science..

This would be good to do. For the scripts it's really no harder than moving scripts into different folders, but coming up with an intuitive way of organizing them is tricky.
Title: Re: DFHack 0.40.13-r1
Post by: Drokles on October 04, 2014, 10:59:32 pm
Thanks for maintaining this amazing mod! It makes the game so much easier.
It seems to be an old problem, but couldn't find any solution to it by searching. Does anyone know how to get stonesense to work on Linux?
I get
Quote
/home/drokles/DFML-1-11/df/df_linux_0_40_13/hack/plugins/stonesense.plug.so: undefined symbol: al_color_rgb_to_hsv
Can't load plugin /home/drokles/DFML-1-11/df/df_linux_0_40_13/hack/plugins/stonesense.plug.so
I have understood that some clever folks made stonesense work by building it in such a way that allegro is included properly in the build, but is it really necessary to build Stonesense from scratch in order to make it work?

Thanks!
Title: Re: DFHack 0.40.13-r1
Post by: Nopenope on October 05, 2014, 02:11:11 am
DFHack is not a mod.

Also check this
Well there does seem to be something as opposed to past versions, this is interesting:

Code: [Select]
stonesense.plug.so: undefined symbol: al_color_rgb_to_hsv
Can't load plugin stonesense.plug.so

https://github.com/DFHack/dfhack/issues/282
I'll try to rebuild my Linux build (GCC 4.5.4) with Eswald's change when I get a chance.

EDIT: Didn't quite read your post correctly, sorry. For the inconvenience I can upload a build of stonesense that works on my machine, if you're interested.
Title: Re: DFHack 0.40.13-r1
Post by: Edrin on October 05, 2014, 03:32:08 pm
After a very variable time, the dfhack hotkeys simply stop working, until I close the process and restart it. Everything else works just fine. I didn't find any report about this.
I’m using windows 7 and Dwarf Fortress 40_13 Starter Pack r3 with a non-english keyboard, but I’m probably not the only one, so… Any ideas ?
Title: Re: DFHack 0.40.13-r1
Post by: Illogical_Blox on October 05, 2014, 04:50:11 pm
Just out of curiousity, is it possible to replace all stone with adamantine ore? If so, how? I want to play a fort like this for fun.
Title: Re: DFHack 0.40.13-r1
Post by: jwhite.df on October 05, 2014, 04:59:55 pm
Just out of curiousity, is it possible to replace all stone with adamantine ore? If so, how? I want to play a fort like this for fun.
http://dwarffortresswiki.org/index.php/DF2014:Cheating#Skill_Practice_Workshops

Is your goal to have a lot of adamantine around? Just add in the production of adamantine to one of the above reactions. For example:

Code: [Select]
[REACTION:PRACTICE_ARMORSMITHING]
[NAME:practice armorsmithing]
[BUILDING:PRACTICE_WORKSHOP:NONE]
[REAGENT:B:1:BOULDER:NO_SUBTYPE:NONE:NONE][PRESERVE_REAGENT]
[PRODUCT:100:1:BAR:NO_SUBTYPE:METAL:ADAMANTINE][PRODUCT_DIMENSION:150]
[SKILL:FORGE_ARMOR]

Or any reaction, for that matter.
Title: Re: DFHack 0.40.13-r1
Post by: arcane on October 05, 2014, 05:07:55 pm
digFlood doesn't like me.  Per the man page I added a command to my dfhack.init but every time I launch it fails.

digFlood BISMUTHINITE CASSERITE GALENA GARNIERITE HEMATITE LIMONITE MAGNETITE MALACHITE SPHALERITE TETRAHEDRITE LIGNITE

this kicks back: Could not find material "BISMUTHINITE"

I'm spelling it correctly per the wiki and the raws, so what am I doing wrong?
Do you see an equivalent error with "Cassiterite" when deleting BISMUTHINITE? (It should be CASSITERITE, not CASSERITE, by the way.) If so, you'll probably need to run that command with a world loaded - you can do this automatically by adding it to the "onLoadWorld.init" file (creating it if necessary) in the same folder as dfhack.init.

I did it manually with a world loaded and it worked much better.  The man file should be updated to put the commands into onLoadWorld.init
Title: Re: DFHack 0.40.13-r1
Post by: Illogical_Blox on October 05, 2014, 06:19:59 pm
Just out of curiousity, is it possible to replace all stone with adamantine ore? If so, how? I want to play a fort like this for fun.
http://dwarffortresswiki.org/index.php/DF2014:Cheating#Skill_Practice_Workshops

Is your goal to have a lot of adamantine around? Just add in the production of adamantine to one of the above reactions. For example:

Code: [Select]
[REACTION:PRACTICE_ARMORSMITHING]
[NAME:practice armorsmithing]
[BUILDING:PRACTICE_WORKSHOP:NONE]
[REAGENT:B:1:BOULDER:NO_SUBTYPE:NONE:NONE][PRESERVE_REAGENT]
[PRODUCT:100:1:BAR:NO_SUBTYPE:METAL:ADAMANTINE][PRODUCT_DIMENSION:150]
[SKILL:FORGE_ARMOR]

Or any reaction, for that matter.
Yeah, but is there a way to replace stone with adamantium? I saw someone else do it, and thought it was interesting.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 05, 2014, 08:01:39 pm
digFlood doesn't like me.  Per the man page I added a command to my dfhack.init but every time I launch it fails.

digFlood BISMUTHINITE CASSERITE GALENA GARNIERITE HEMATITE LIMONITE MAGNETITE MALACHITE SPHALERITE TETRAHEDRITE LIGNITE

this kicks back: Could not find material "BISMUTHINITE"

I'm spelling it correctly per the wiki and the raws, so what am I doing wrong?
Do you see an equivalent error with "Cassiterite" when deleting BISMUTHINITE? (It should be CASSITERITE, not CASSERITE, by the way.) If so, you'll probably need to run that command with a world loaded - you can do this automatically by adding it to the "onLoadWorld.init" file (creating it if necessary) in the same folder as dfhack.init.

I did it manually with a world loaded and it worked much better.  The man file should be updated to put the commands into onLoadWorld.init
Which file are you referring to?
Title: Re: DFHack 0.40.13-r1
Post by: arcane on October 05, 2014, 09:50:40 pm

I did it manually with a world loaded and it worked much better.  The man file should be updated to put the commands into onLoadWorld.init
Which file are you referring to?

Sorry, was referring to the message that outputs on 'digFlood ?'
Title: Re: DFHack 0.40.13-r1
Post by: deepholedwarf on October 06, 2014, 06:41:09 am
DFHack is not a mod.

Also check this
Well there does seem to be something as opposed to past versions, this is interesting:

Code: [Select]
stonesense.plug.so: undefined symbol: al_color_rgb_to_hsv
Can't load plugin stonesense.plug.so

https://github.com/DFHack/dfhack/issues/282
I'll try to rebuild my Linux build (GCC 4.5.4) with Eswald's change when I get a chance.

EDIT: Didn't quite read your post correctly, sorry. For the inconvenience I can upload a build of stonesense that works on my machine, if you're interested.

I'm also having this problem. I substituted the stonesense liib that Nopenope provided (thanks) but something is still wrong. It looks like it is looking for version 3.4.20, but you are compiling it with 4.5.4. Also, I have replaced df_linux/libs/libsdtc++.so.6 with the gcc-snapshot version. Maybe I have a LD_LIBRARY_PATH problem? Everything else seems to load and run properly.

Code: [Select]
/usr/lib/i386-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/jbabcock/df_linux/hack/plugins/twbt.plug.so) Can't load plugin /home/jbabcock/df_linux/hack/plugins/twbt.plug.so world: 2432492 ui: 28440 b_stock: 1272 d_init: 372
/usr/lib/i386-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/jbabcock/df_linux/hack/plugins/stonesense.plug.so) Can't load plugin /home/jbabcock/df_linux/hack/plugins/stonesense.plug.so
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on October 06, 2014, 12:11:41 pm
Yeah, but is there a way to replace stone with adamantium? I saw someone else do it, and thought it was interesting.
Assuming you mean "adamantine", there is a "changelayer" command which does exactly that.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 06, 2014, 02:14:05 pm
DFHack is not a mod.

Also check this
Well there does seem to be something as opposed to past versions, this is interesting:

Code: [Select]
stonesense.plug.so: undefined symbol: al_color_rgb_to_hsv
Can't load plugin stonesense.plug.so

https://github.com/DFHack/dfhack/issues/282
I'll try to rebuild my Linux build (GCC 4.5.4) with Eswald's change when I get a chance.

EDIT: Didn't quite read your post correctly, sorry. For the inconvenience I can upload a build of stonesense that works on my machine, if you're interested.

I'm also having this problem. I substituted the stonesense liib that Nopenope provided (thanks) but something is still wrong. It looks like it is looking for version 3.4.20, but you are compiling it with 4.5.4. Also, I have replaced df_linux/libs/libsdtc++.so.6 with the gcc-snapshot version. Maybe I have a LD_LIBRARY_PATH problem? Everything else seems to load and run properly.

Code: [Select]
/usr/lib/i386-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/jbabcock/df_linux/hack/plugins/twbt.plug.so) Can't load plugin /home/jbabcock/df_linux/hack/plugins/twbt.plug.so world: 2432492 ui: 28440 b_stock: 1272 d_init: 372
/usr/lib/i386-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/jbabcock/df_linux/hack/plugins/stonesense.plug.so) Can't load plugin /home/jbabcock/df_linux/hack/plugins/stonesense.plug.so
"GLIBCXX_3.4.20" corresponds to GCC 4.9.0 (see this page (https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html) for a complete list). It appears that those two plugins were compiled with GCC 4.9, so they won't work unless you have GCC 4.9 libraries available.
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on October 09, 2014, 05:03:13 am
Yeah, but is there a way to replace stone with adamantium? I saw someone else do it, and thought it was interesting.
Assuming you mean "adamantine", there is a "changelayer" command which does exactly that.
It is also fun and a great way to break things, but just turning stone into adamantine isn't so bad, be careful doing it with soil layers though, that gets a bit weird.

A more controlled way if you want to dig a fort out of candy is to use reveal and find one of the big round inclusions and do changevein RAW_ADAMANTINE through a few z levels (and remember to move the cursor a bit, I think it does it in 32x32 chunks lined up with the map grid), which should give you a nice big area to hollow out and polish up into a shiny candyland funhouse.
Title: Re: DFHack 0.40.13-r1
Post by: Sutremaine on October 11, 2014, 05:16:16 pm
Quick question: does Dwarf Manipulator work in Adventure Mode? Dwarf Therapist doesn't.

Is is possible to write a script which works for examining creature stats and skills in Adventure Mode?
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 11, 2014, 05:34:24 pm
Manipulator and therapist both require citizens (I.E members of your fortress), which adventure mode has none of, so no.

Of course it is. It's pretty easy, in fact; hell, you can do it without a script just by typing "gui/gm-editor" while in the unit's status screen. Stats and skills are under "body" and "status->current_soul."
Title: Re: DFHack 0.40.13-r1
Post by: Sutremaine on October 11, 2014, 06:31:36 pm
Oh, that is pretty easy. Thanks.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 11, 2014, 06:32:12 pm
I'm fairly sure that gm-editor even shows you what the skills actually are instead of giving you a number, heh.
Title: Re: DFHack 0.40.13-r1
Post by: MichaelB on October 12, 2014, 06:09:26 am
Hi all,

I've been experiencing some strange behaviour with the digtype plugin. When I invoke the plugin, any constructed walls built in previously mined veins of that type are marked for removal. Is this intended behaviour? It seems strange if it is.

I'm using the Starter Pack 40_13 r4

If this is not the best place to report this please direct me to a more appropriate place.

Cheers
Title: Re: DFHack 0.40.13-r1
Post by: Trouserman on October 12, 2014, 07:14:48 am
I know DFHack has drainaquifer. Is the reverse possible? Could a layer be turned into an aquifer layer?
Title: Re: DFHack 0.40.13-r1
Post by: IamanElfCollaborator on October 12, 2014, 04:43:28 pm
A quick question. I've pored over the DFHack readme multiple times but I can't seem to for the life of me figure out how to get the mod manager GUI to work without throwing up an error and shoving me back to the normal DFHack prompt.

This normal behaviour or am I doing something wrong? I do have a mods folder in the hack folder, with mods installed.
Title: Re: DFHack 0.40.13-r1
Post by: breadman on October 12, 2014, 06:44:46 pm
I know DFHack has drainaquifer. Is the reverse possible? Could a layer be turned into an aquifer layer?

Yes.  On the map block level, there are three flags to set: flags.has_aquifer, flags.check_aquifer, and designation[x%16][y%16].water_table for each tile you want to turn into a water source.  In addition, df.global.world.raws.inorganics[???].flags.AQUIFER for that tile's rock/soil type needs to be true.  (Or perhaps the tile's layer type; I haven't experimented with veins and inclusions.)

Even after all four flags are set, it might take a few steps for the new aquifer to start leaking.

It also appears that the drainaquifer script might be slightly wrong; it can miss aquifers that happen to miss the two tiles it checks, and it ignores the two block-level flags.  Is that a problem in practice?
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 12, 2014, 07:57:31 pm
I know DFHack has drainaquifer. Is the reverse possible? Could a layer be turned into an aquifer layer?
It also appears that the drainaquifer script might be slightly wrong; it can miss aquifers that happen to miss the two tiles it checks, and it ignores the two block-level flags.  Is that a problem in practice?
Yes - I've had small sections of an aquifer remain after running drainaquifer.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 13, 2014, 01:59:29 am
A quick question. I've pored over the DFHack readme multiple times but I can't seem to for the life of me figure out how to get the mod manager GUI to work without throwing up an error

Which error is very important.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 13, 2014, 09:27:32 am
Hi all,

I've been experiencing some strange behaviour with the digtype plugin. When I invoke the plugin, any constructed walls built in previously mined veins of that type are marked for removal. Is this intended behaviour? It seems strange if it is.

I'm using the Starter Pack 40_13 r4

If this is not the best place to report this please direct me to a more appropriate place.

Cheers

Definitely a bug. I'll add it to the list.
Title: Re: DFHack 0.40.13-r1
Post by: breadman on October 13, 2014, 09:53:53 am
It also appears that the drainaquifer script might be slightly wrong; it can miss aquifers that happen to miss the two tiles it checks, and it ignores the two block-level flags.  Is that a problem in practice?
Yes - I've had small sections of an aquifer remain after running drainaquifer.

Okay.  Because I was already meddling in that area for other reasons, and found the Ruby harder to debug than to replace, I've created a new drain-aquifer script (https://github.com/DFHack/dfhack/pull/361) using Lua.

Meanwhile, I'm vaguely curious about block flag 9, undocumented but occasionally set.
Title: Re: DFHack 0.40.13-r1
Post by: IamanElfCollaborator on October 13, 2014, 10:26:08 am
A quick question. I've pored over the DFHack readme multiple times but I can't seem to for the life of me figure out how to get the mod manager GUI to work without throwing up an error
Which error is very important.
This is the error I usually get when inputting the command:
Code: [Select]

...\Dwarf Fortress 0.40.13\hack\scripts/gui/mod-manager.lua:247: attempt to index local 'choice' (a nil value)
stack traceback:
...\Dwarf Fortress 0.40.13\hack\scripts/gui/mod-manager.lua:247: in function <...\Dwarf Fortress 0.40.13\hack\scripts/gui/mod-manager.lua:246>
[C]: in function 'on_select'
... 0.40.13\Dwarf Fortress 0.40.13\hack\lua\gui\widgets.lua:491: in function 'moveCursor'
... 0.40.13\Dwarf Fortress 0.40.13\hack\lua\gui\widgets.lua:447: in function 'setSelected'
... 0.40.13\Dwarf Fortress 0.40.13\hack\lua\gui\widgets.lua:442: in function 'setChoices'
... 0.40.13\Dwarf Fortress 0.40.13\hack\lua\gui\widgets.lua:423: in function 'fun'
...rtress 0.40.13\Dwarf Fortress 0.40.13\hack\lua\class.lua:98: in function 'invoke_after_rec'
...rtress 0.40.13\Dwarf Fortress 0.40.13\hack\lua\class.lua:127: in function 'List'
...\Dwarf Fortress 0.40.13\hack\scripts/gui/mod-manager.lua:207: in function 'fun'
...rtress 0.40.13\Dwarf Fortress 0.40.13\hack\lua\class.lua:98: in function 'invoke_after_rec'
...rtress 0.40.13\Dwarf Fortress 0.40.13\hack\lua\class.lua:127: in function 'manager'
...\Dwarf Fortress 0.40.13\hack\scripts/gui/mod-manager.lua:347: in main chunk
(...tail calls...)
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 13, 2014, 02:42:02 pm
Does the mod have an init.lua?
Title: Re: DFHack 0.40.13-r1
Post by: Trouserman on October 13, 2014, 03:11:28 pm
I know DFHack has drainaquifer. Is the reverse possible? Could a layer be turned into an aquifer layer?

Yes.  On the map block level, there are three flags to set: flags.has_aquifer, flags.check_aquifer, and designation[x%16][y%16].water_table for each tile you want to turn into a water source.  In addition, df.global.world.raws.inorganics[???].flags.AQUIFER for that tile's rock/soil type needs to be true.  (Or perhaps the tile's layer type; I haven't experimented with veins and inclusions.)

Even after all four flags are set, it might take a few steps for the new aquifer to start leaking.

It also appears that the drainaquifer script might be slightly wrong; it can miss aquifers that happen to miss the two tiles it checks, and it ignores the two block-level flags.  Is that a problem in practice?

Thanks. I had to dig around for how to access some of the relevant data, but this was enough for me to put together a toggleaquifer script that suits my purposes. It seems that the rock/soil type does not in fact need to be tagged as aquifer for this to work, and in particular the veins and inclusions can be made into aquifer. So, it was necessary to test that the tiletype is not MineralWall. I also added checks for surrounding open blocks, so that exposed edges don't begin to leak. (Though it is amusing for a slope to just start leaking all over the landscape.)

Presumably, the drainaquifer script is checking the corner and center of the block as a quick test if there are any aquifer tiles in the block. It should probably be checking the block-level flags, instead. And then, as you note, turning them off. (I suspect the only harm leaving them set does is causing some small amount of lag from extra checks for exposed aquifer cells. I'm not sure what has_aquifer does; check_aquifer seems to be necessary and sufficient for aquifer tiles in the block to function.)

Edit: I spoke too soon; check_aquifer doesn't apply to the aquifer tiles within a block, but to the tiles in the block which are adjacent to aquifer tiles. That makes a rigorous script for altering the aquifer status of individual layers a bit more complicated. Just when I thought I was done.
Title: Re: DFHack 0.40.13-r1
Post by: IamanElfCollaborator on October 13, 2014, 03:26:56 pm
Does the mod have an init.lua?
They do.

EDIT: Never mind, fixed it. I just deleted and repasted the mods and it worked again. Weird.
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on October 14, 2014, 10:11:25 am
Is there a script to force a megabeast attack? I heard there's one to force sieges, but I really need a challenge- like ten Bronze Colossi. Is there a script for that?
Title: Re: DFHack 0.40.13-r1
Post by: Rose on October 14, 2014, 10:38:48 am
there is no longer a script to force sieges.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 14, 2014, 10:46:46 am
there is no longer a script to force sieges.
Just to expand that a bit... siege armies now actually move across the map to your fort.  They no longer appear out of thin air.

You can use spawn-unit to create 10 hostile bronze colossi, but that's not quite the same thing as a megabeast attack.
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on October 14, 2014, 10:54:40 am
Crépe... Ohwell. Can someone tell me how to spawn
A female dragon at the curser
A male roc at the curser
I can just replace whatever beast I want spawned in the command, I really hate having to wait for virtual Smaug to show up. In the new version, I've gotten two hydrae, one bronze colossi, and three dragon attacks. I used to make sport of putting dragon bone doors everywhere.
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on October 14, 2014, 11:45:02 am
there is no longer a script to force sieges.
However, it is still possible to force megabeasts to arrive. Just take the script "devel/migrants-now" and change "Migrants" to "Megabeast" and replace the entity line with "entity = nil".
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 14, 2014, 11:52:52 am
there is no longer a script to force sieges.
Just to expand that a bit... siege armies now actually move across the map to your fort.  They no longer appear out of thin air.

You can use spawn-unit to create 10 hostile bronze colossi, but that's not quite the same thing as a megabeast attack.

Can you use that to create a vampire? Which you could then use to create new vampires from the lovely blood that it excretes while suffering in the torture chamber? Well I think I may have looked into it a little bit before but that command seems pretty complicated..
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on October 14, 2014, 11:58:36 am
So "devel/Megabeast-now entity=nil"? I'm a practical noob at DFhack, all I can do is reveal, clean, and make item.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 14, 2014, 01:30:07 pm
there is no longer a script to force sieges.
However, it is still possible to force megabeasts to arrive. Just take the script "devel/migrants-now" and change "Migrants" to "Megabeast" and replace the entity line with "entity = nil".

You described that a bit oddly...

You need to replace every instance if "Migrants" to "Megabeast" in the file and replace the entity line in the file with entity = nil.
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on October 14, 2014, 01:36:07 pm
 :o Yeah, not messing with files.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 14, 2014, 03:45:19 pm
Dude it's located here Dwarf Fortress 40_13 Starter Pack r3\Dwarf Fortress 0.40.13\hack\scripts\devel, and the script is 9 lines.

Spawn them with devel/migrants-now. If it's it a folder you use the /, and all the scripts are run through typing their name.

Spoiler: Original (click to show/hide)


I've no idea if this works because nothing is coming when I put Megabeasts. Maybe I would need to have met the requirements for them to come?


I wonder could you create a vampire with that? You'd need the regular entity though wouldn't you?
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 14, 2014, 04:12:11 pm
If you look at modtools/force that should give you what you want.

General unit creation is still being researched, and there's currently no way to spawn sieges because they're more complicated now.
Title: Re: DFHack 0.40.13-r1
Post by: Trouserman on October 14, 2014, 04:15:54 pm
:o Yeah, not messing with files.

If you're concerned about modifying something that's there, you can make a copy of the file to work with. Messing with the files really isn't all that hard, or dangerous. Nevertheless, if you really don't want to mess with the files at all, you can type lua at the command prompt to start an interactive Lua session, and paste the command there. (It looks like that script is Lua.)

Though, LeoCean seems to be finding that it may not work that way for megabeasts. I'm just pointing out there are alternatives to messing with the files.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 14, 2014, 05:18:26 pm
If you look at modtools/force that should give you what you want.

General unit creation is still being researched, and there's currently no way to spawn sieges because they're more complicated now.

modtools/force -eventType NightCreature -civ player <--- Doesn't seem to do anything, maybe you need to be at a point they spawn or something?

modtools/force -eventType Migrants -civ player <--- Automatic when entered

Really I should just give up on trying to "spawn them" and should just mod a vampire race to be my slaves as it would be much easier or create a vampiric animal but I did want it to work with my current save.

I guess I could turn cats into blood thirsty vampires, they are already sneaky as is and I think you can can add tags to an existing entity or at least edit existing tags within a save game without breaking it???? Cats may be to small for my plans though.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 14, 2014, 08:12:30 pm
-civ player refers to the civ where the event comes from, not where it's going to. NightCreature doesn't work, no.
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on October 14, 2014, 08:31:54 pm
I've no idea if this works because nothing is coming when I put Megabeasts. Maybe I would need to have met the requirements for them to come?
It does indeed respect the megabeast population/wealth/export requirements.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 14, 2014, 08:40:58 pm
-civ player refers to the civ where the event comes from, not where it's going to. NightCreature doesn't work, no.

Yeah I did a lot more combinations with a few of the available codes included in that script and figured that out.
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on October 15, 2014, 08:55:45 am
Is there any way to execute a script when world gen starts?

Also, how would I go about freezing DF, doing some stuff, and then resuming the game? Does dfhack.with_suspend(f[,args...]) do anything like this? How would I go about using this? :)
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on October 15, 2014, 09:06:02 am
Pausing has that effect...
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on October 15, 2014, 09:08:42 am
Pausing has that effect...

I'd like to freeze the game as soon as world gen starts though, and "do stuff" with a script. :)
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 15, 2014, 09:16:56 am
Is there any way to execute a script when world gen starts?

Also, how would I go about freezing DF, doing some stuff, and then resuming the game? Does dfhack.with_suspend(f[,args...]) do anything like this? How would I go about using this? :)

Currently there is no way of doing that.

DF is already frozen during Lua script execution.
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on October 15, 2014, 09:26:49 am
Is there any way to execute a script when world gen starts?

Also, how would I go about freezing DF, doing some stuff, and then resuming the game? Does dfhack.with_suspend(f[,args...]) do anything like this? How would I go about using this? :)

Currently there is no way of doing that.

DF is already frozen during Lua script execution.

Alright, thank you. :)
Title: Re: DFHack 0.40.13-r1
Post by: thegamemaster1234 on October 15, 2014, 02:33:50 pm
thegamemaster1234 has entered a fey mood!
thegamemaster1234 claims a MacBook Pro!

thegamemaster1234 was unable to satisfy his requirements...

thegamemaster1234 has gone insane!

^^
me after trying to get masterwork to work on osx using dfhack 34.11r5, since r4 never got an osx version for some reason, while ALL VERSIONS BEFORE (AND AFTER) IT GOT ONE. im a little mad at that.
every time a world is loaded while dfhack is being used causes a segfault. only happens while using masterwork raws.
I don't know what dfhack would be trying to access, but I do have this bit from the end of stderr.log, if that helps:
Spoiler (click to show/hide)
I've been trying to get masterwork to, well, work on osx for quite a while now, originally it was a matter of "everything that uses eventful plugin doesn't work because too outdated," but now it's "crashes with unknown explanation every time worlds are loaded."
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 15, 2014, 02:39:21 pm
r4 wasn't exactly an official release, but here's (http://dffd.wimbli.com/file.php?id=8474) an OS X build.
Title: Re: DFHack 0.40.13-r1
Post by: thegamemaster1234 on October 15, 2014, 03:21:34 pm
r4 wasn't exactly an official release, but here's (http://dffd.wimbli.com/file.php?id=8474) an OS X build.
Thanks, that seems to have taken a step in the right direction as twbt is working correctly now, yet there's still strange segfaults whenever worldgen starts to create caves; from this I assume this means that somehow dfhack is going all weird when creating certain civs.

I really hope I can find a solution to this mess.

EDIT: After turning off all civs but dwarves... that doesn't change anything. There's also no error logs or anything, just a cryptic segfault 11.
Turning off caves doesn't do anything either, so I still don't have any idea what this means. All I know is that right after genning minerals it immediately crashes.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 15, 2014, 04:19:08 pm
You should probably post masterwork problems in the masterwork area of the forums, meph added things to dfhack that would cause df to crash at some point if you used the wrong version of dfhack.
Title: Re: DFHack 0.40.13-r1
Post by: thegamemaster1234 on October 15, 2014, 05:07:43 pm
You should probably post masterwork problems in the masterwork area of the forums, meph added things to dfhack that would cause df to crash at some point if you used the wrong version of dfhack.
Huh, I didn't know that. Do you know what things specifically, and if they're not in the source code/can be fixed manually? I only posted this here because dfhack is a big part of mdf and it seems odd that it would only crash upon using masterwork RAWS... which is strange, as the raws are not code but rather a large compilation of various tags. If I wanted to present this problem on the mdf forums, where should I put it? It's not race- or gui- specific, and the mac version thread is old, so I don't really know whether or not to create a new thread.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 15, 2014, 05:41:52 pm
If you're using the right version of DFHack, any MDF crashes are most likely MDF-related (not DFHack-related).
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 15, 2014, 06:03:16 pm
You should probably post masterwork problems in the masterwork area of the forums, meph added things to dfhack that would cause df to crash at some point if you used the wrong version of dfhack.
Huh, I didn't know that. Do you know what things specifically, and if they're not in the source code/can be fixed manually? I only posted this here because dfhack is a big part of mdf and it seems odd that it would only crash upon using masterwork RAWS... which is strange, as the raws are not code but rather a large compilation of various tags. If I wanted to present this problem on the mdf forums, where should I put it? It's not race- or gui- specific, and the mac version thread is old, so I don't really know whether or not to create a new thread.

It's not that strange they add in new materials/minerals and a whole much of things and some of those things could use dfhack files I'm really not sure what your issue is but find the mac post in that section or make a new post. If you post in the mac thread then anyone who has posted there will see it when they look at new replies to your posts and so it's more likely that they will see it. MDF has things in the raws which use dfhack so it's not weird that it might crash with a different version than it was "shipped" with. Like the vanilla dfhack which hasn't been modified to include the dfhack stuff, I understand that someone over there uploads mac versions of MDF but you'd get better information over there.
Title: Re: DFHack 0.40.13-r1
Post by: Pyro627 on October 16, 2014, 05:02:14 pm
I've found a not-so-small bug with the digv command.

When you designate a vein to be dug with digv, it'll designate the vein's tiles for digging without checking to see if the vein has been replaced by something else during map generation. Specifically, I've noticed this with the obsidian walls of volcanoes; using digv will tell your dwarves to dig right into to the side of an active volcano.
Title: Re: DFHack 0.40.13-r1
Post by: wickys on October 17, 2014, 10:34:34 am
Is there any way to paint grass on underground tiles?

the tiletypes command only gives me sand if I input soil.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 17, 2014, 10:49:09 am
The cavegrasses grow once you've broke through to a cave then you can seal it up and the grasses will still continue to grow.
Title: Re: DFHack 0.40.13-r1
Post by: wickys on October 17, 2014, 11:34:51 am
Hmm okay.

Also: the revflood command doesn't seem to work when I use it.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 17, 2014, 01:59:05 pm
revflood seems to work for me. What exactly is the problem?

The cavegrasses grow once you've broke through to a cave then you can seal it up and the grasses will still continue to grow.
You can also use "feature" to trigger a cavern discovery (allowing grass to grow) without actually breaching a cavern.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 17, 2014, 02:17:13 pm
But then you don't get the unexpected like a troll breaking a door from the caverns and your dwarves ignoring it and it ignoring your dwarves while you are thinking oh s$%& cause you have no military but he is just interested in peace. Then becomes dog chow.
Title: Re: DFHack 0.40.13-r1
Post by: wickys on October 17, 2014, 04:12:33 pm
revflood seems to work for me. What exactly is the problem?

The cavegrasses grow once you've broke through to a cave then you can seal it up and the grasses will still continue to grow.
You can also use "feature" to trigger a cavern discovery (allowing grass to grow) without actually breaching a cavern.

It just doesn't hide any tiles. I did a failproof test by building a wall behind a natural wall and nothing got hidden. Like this: http://i.imgur.com/L8mm2.jpg
Title: Re: DFHack 0.40.13-r1
Post by: scamtank on October 17, 2014, 04:17:39 pm
Gotta chime in with another WORKS4ME. I do the exact same thing and revflood does the job fine. Something's not right here.
Title: Re: DFHack 0.40.13-r1
Post by: smjjames on October 17, 2014, 04:22:35 pm
I have a bit of a request for the pros here, I'm running into a town related crash (http://www.bay12games.com/dwarves/mantisbt/view.php?id=8290) in adventure mode, though specifically I want to see if I can save this savegame (http://dffd.wimbli.com/file.php?id=9936), especially since that adventurer is underground and thus, kind of stuck.

Basically, I'm just wondering if you guys can somehow salvage that specific savegame, but providing some insight into what's causing the crash would be of help to Toady One.

I might be able to get out by saving every ten steps or something.

I'm using Peridexis's starter pack r1.

Edit: Okay, I got out by saving every ten steps. Seems that once the trouble spot got offloaded, it stopped crashing, I think.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 17, 2014, 04:29:39 pm
revflood seems to work for me. What exactly is the problem?

The cavegrasses grow once you've broke through to a cave then you can seal it up and the grasses will still continue to grow.
You can also use "feature" to trigger a cavern discovery (allowing grass to grow) without actually breaching a cavern.

It just doesn't hide any tiles. I did a failproof test by building a wall behind a natural wall and nothing got hidden. Like this: http://i.imgur.com/L8mm2.jpg
I'm pretty sure that's expected behavior, since there's no way to make an underground room with constructed walls without revealing the adjacent natural walls (assuming they exist).
Edit: revflood appears to be using something similar to the tile visibility algorithm used by DF, if I understand correctly: https://github.com/DFHack/dfhack/blob/develop/plugins/reveal.cpp#L393
Title: Re: DFHack 0.40.13-r1
Post by: wickys on October 17, 2014, 08:49:28 pm
http://i.imgur.com/tH4HQgG.png

The little area I walled off to the left doesn't get filled in by revflood.

I dont know whats wrong.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 17, 2014, 11:45:39 pm
How would one go about expanding the embark tools plugin? 

In my major mod, smelter reactions are all custom reactions with additional reagents to the ore itself.  For example, tetrahedrite smelting needs a flux in rough green glass which you can get in several ways, lead and tin ores need another coal bar to reduce the oxide, and ironworking is done entirely outside of the smelter.  This means, metal ores are no longer considered as such by the vanilla game, so that they no longer appear on the embark screen as "Shallow Metal" and "Deep Metal". 

I want to restore something like that to the embark screen, which I think would work in a similar way to the sand indicator.  As groundwork I've prefixed all the ore names with METAL_ORE_ (so, METAL_ORE_HEMATITE and so on).  How would such a script work, so that for example, the string to search would be "METAL_ORE_"? Ideally I would like for it to work like vanilla (with plurals and depth and all) though that is too much wizardry for me (I can't into DFHack programming  :()
I'm not sure if samanato ever got an answer, but I was hoping to make a variation of the sand indicator for my mod as well, to indicate the presence of "living stone" (a set of several minerals added by the mod).  Ideally, I'd like the player to be able to filter locations by its presence, but that's probably beyond my limited coding capabilities.
Title: Re: DFHack 0.40.13-r1
Post by: Wooster on October 18, 2014, 08:06:55 am
How do I get prospect to work before embarkation?

At both the embark selection and points allocation stages, if I Ctrl-Shift-p and type prospect (or prospect all, etc.), all I get is, "Map is not available!" in red text. Is there something I need to do beforehand to make the map open to dfhack?

I'm running dfhack 0.40.13 (though this has happened in previous 0.40 releases as well) in Ubuntu 14.04 / Linux Mint 17.
Title: Re: DFHack 0.40.13-r1
Post by: heydude6 on October 18, 2014, 08:34:34 am
I know this isn't the right version of dfhack, but the previous dwarfhack forums are locked so I have to post my question here.

I seem to be having a problem  using the plugin syndrome trigger
Spoiler: MY INTERACTION (click to show/hide)

It looks correct so I have no idea whats wrong (I did enable syndrometriger in the init file). I'm using the r4 version of 34.xx
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 18, 2014, 09:04:32 am
How do I get prospect to work before embarkation?

At both the embark selection and points allocation stages, if I Ctrl-Shift-p and type prospect (or prospect all, etc.), all I get is, "Map is not available!" in red text. Is there something I need to do beforehand to make the map open to dfhack?

I'm running dfhack 0.40.13 (though this has happened in previous 0.40 releases as well) in Ubuntu 14.04 / Linux Mint 17.

You need to run "prospect all" in the DFHack console (i.e. not the in-game command prompt). "prospect" expects the top viewscreen to be the embark selection screen, and the command-prompt plugin creates its own viewscreen above the current viewscreen.
Title: Re: DFHack 0.40.13-r1
Post by: Wooster on October 18, 2014, 09:23:01 am
You need to run "prospect all" in the DFHack console (i.e. not the in-game command prompt). "prospect" expects the top viewscreen to be the embark selection screen, and the command-prompt plugin creates its own viewscreen above the current viewscreen.

Ah! Thanks, that's brilliant.
Title: Re: DFHack 0.40.13-r1
Post by: heydude6 on October 18, 2014, 03:04:03 pm
I know this isn't the right version of dfhack, but the previous dwarfhack forums are locked so I have to post my question here.

I seem to be having a problem  using the plugin syndrome trigger
Spoiler: MY INTERACTION (click to show/hide)

It looks correct so I have no idea whats wrong (I did enable syndrometriger in the init file). I'm using the r4 version of 34.xx

Nevermind it just turned out that slayrace doesn't work with syndrometrigger and syndrome trigger doesn't work in the object testing arena. Once I inputted the commands I actually wanted to use and started a testfort everything worked
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 18, 2014, 06:39:22 pm
I cannot see why slayrace wouldn't work with syndrometrigger.
Title: Re: DFHack 0.40.13-r1
Post by: wickys on October 18, 2014, 06:50:16 pm
http://i.imgur.com/tH4HQgG.png

The little area I walled off to the left doesn't get filled in by revflood.

I dont know whats wrong.

Nobody knows what's wrong with the command?

My base looks ridiculous with having long swindling halls that were mineral veins. Can't obscure them :(
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 18, 2014, 06:55:44 pm
My best guess is that constructed walls aren't treated as terrain that blocks visibility.
Title: Re: DFHack 0.40.13-r1
Post by: wickys on October 18, 2014, 07:16:47 pm
My best guess is that constructed walls aren't treated as terrain that blocks visibility.

Oh my god you're right.
Title: Re: DFHack 0.40.13-r1
Post by: heydude6 on October 18, 2014, 07:35:56 pm
I cannot see why slayrace wouldn't work with syndrometrigger.

Might have to do with the fact that the slayrace targeted it's own species so the moment such a command was activated it would cause an instant game over. More specifically an instant game over the moment you unpause after embarking.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 18, 2014, 07:37:49 pm
That would be a problem with slayrace, not syndrome-trigger.
Title: Re: DFHack 0.40.13-r1
Post by: Baffler on October 18, 2014, 08:00:43 pm
there is no longer a script to horse sieges.
Just to expand that a bit... siege armies now actually move across the map to your fort.  They no longer appear out of thin air.

You can use spawn-unit to create 10 hostile bronze colossi, but that's not quite the same thing as a megabeast attack.

Wait, this is possible to do in-game?

I have work to do... (http://www.youtube.com/watch?v=QMchOpvbUbI)
Title: Re: DFHack 0.40.13-r1
Post by: heydude6 on October 18, 2014, 08:11:49 pm
there is no longer a script to force sieges.
Just to expand that a bit... siege armies now actually move across the map to your fort.  They no longer appear out of thin air.


I am no expert on this(not even a noobie) but I think the first step to reimplementing siege forcing is figuring out what makes an army decide to move across the map to your fort in the first place.

Or is dwarfhack not capable of accessing the code responsible for that in the first place.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 18, 2014, 09:51:37 pm
Couple questions that are probably more on the fringe of what anyone has done with DFHack;

1. Currently, setting a creatures CAGED flag to true has the desired effect of removing the creature from the map (i.e. like a banishment spell). Unfortunately, when resetting the flag to false, the game crashes. I have tried a couple different things to avoid this crash, but have not had any luck. Has anyone experimented at all with this? Or does anyone have a working banishment-like spell?

2. Has anyone experimented with adding full entities after the game has already begun? By adding entities, I mean, adding one to the df.global.world.entities.all table, and filling all the appropriate fields in. I understand that there wouldn't be any known units currently existing for this new entity, but you could then possible create new units for them, and generate a full new entity.

3. Is there a flag, or relationship vector, stored somewhere that specifies if an entity is at war with another entity? Can peace/war be toggled as an option?

4. I find it interesting that pretty much everything an entity has access to but buildings are stored in a configurable space, is this just because we haven't found the memory locations for where buildings are stored, or are they just always read directly from the raws whenever needed?

5. Is it possible to configure the accessibility of certain tiles? I experimented with temperature changes, and they did indeed prevent movement through the tiles for as long as the temperature change lasted, but since temperature changes can not be permanent, and are actually somewhat random, that doesn't really work.

6. Is there a list, or someway to figure out, exactly what type of tile is underneath a unit (or a particular location)? What I mean is that there is currently several different numbers associated with a tile (type, id, biome-id, etc...) and except for very few instances (basically normal underground dirt) I am unsure what all the different numbers affect.

7. I forget who, but someone recently talked about the trouble with dfhack.run_script commands and the fact that if you save a game before a script is run, and then reload it, the script will not run. Is it at all possible to make those commands persistent over saves without a lot of hassle?
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 18, 2014, 09:57:23 pm
1. You try just sorta moving it off-map?
2. I've added historical figures after worldgen successfully, and full entities can be made by the player in adventure mode; I'm not sure all of what that entails, but it may be possible.
Title: Re: DFHack 0.40.13-r1
Post by: smjjames on October 18, 2014, 11:52:08 pm
I have a bit of a request for the pros here, I'm running into a town related crash (http://www.bay12games.com/dwarves/mantisbt/view.php?id=8290) in adventure mode, though specifically I want to see if I can save this savegame (http://dffd.wimbli.com/file.php?id=9936), especially since that adventurer is underground and thus, kind of stuck.

Basically, I'm just wondering if you guys can somehow salvage that specific savegame, but providing some insight into what's causing the crash would be of help to Toady One.

I might be able to get out by saving every ten steps or something.

I'm using Peridexis's starter pack r1.

Edit: Okay, I got out by saving every ten steps. Seems that once the trouble spot got offloaded, it stopped crashing, I think.

You know, instead of ignoring my posts, you guys (including the pros) could just say 'no idea' if you have no idea how to look into it.

I am really disliking the fact that it looks like you people are ignoring my posts. :<
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on October 19, 2014, 01:05:53 am
How would I hack in dragon bones?

I put "createitem REMAINS CREATURE_MAT:DRAGON:BONE 10"
Title: Re: DFHack 0.40.13-r1
Post by: danaris on October 19, 2014, 08:35:01 am
You know, instead of ignoring my posts, you guys (including the pros) could just say 'no idea' if you have no idea how to look into it.

I am really disliking the fact that it looks like you people are ignoring my posts. :<

The problem with that is, if nobody really knew how to deal with it, then what you'd get would be about a dozen posts saying, "No idea." For every single post that they didn't know about—not to mention the half-dozen or so saying "No idea" for every post that some of them knew the answers to. Because there isn't some central repository of knowledge, and the "pros", as you call them, aren't this close-knit group of hotshot developers that consult behind the scenes about every single post on the thread; they're really just a bunch of guys, and it's pretty much expected that if anyone knows how to answer the question, they simply will.

So I'm afraid you're just going to have to deal with the fact that if you ask questions nobody knows the answer to, the response is going to be a resounding silence.
Title: Re: DFHack 0.40.13-r1
Post by: smjjames on October 19, 2014, 10:24:09 am
You know, instead of ignoring my posts, you guys (including the pros) could just say 'no idea' if you have no idea how to look into it.

I am really disliking the fact that it looks like you people are ignoring my posts. :<

The problem with that is, if nobody really knew how to deal with it, then what you'd get would be about a dozen posts saying, "No idea." For every single post that they didn't know about—not to mention the half-dozen or so saying "No idea" for every post that some of them knew the answers to. Because there isn't some central repository of knowledge, and the "pros", as you call them, aren't this close-knit group of hotshot developers that consult behind the scenes about every single post on the thread; they're really just a bunch of guys, and it's pretty much expected that if anyone knows how to answer the question, they simply will.

So I'm afraid you're just going to have to deal with the fact that if you ask questions nobody knows the answer to, the response is going to be a resounding silence.

Okay, good point then.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 19, 2014, 09:14:47 pm
1. You try just sorta moving it off-map?
2. I've added historical figures after worldgen successfully, and full entities can be made by the player in adventure mode; I'm not sure all of what that entails, but it may be possible.

1. No actually, I hadn't... Seems like a pretty simple answer. I figured the game would complain about movement paths, or something else. I will give it a try.
2. Hmm, that sounds promising. I will have to look into it.
Title: Re: DFHack 0.40.13-r1
Post by: Gerund on October 19, 2014, 10:01:59 pm
So, can I get access to a socket from a lua script? I can tell that I can use clsocket from a native plugin, but I want to write an IRC chatbot and I'd rather not have to build/manage binaries every time I want to make a dumb change.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 20, 2014, 10:13:26 am
You know, instead of ignoring my posts, you guys (including the pros) could just say 'no idea' if you have no idea how to look into it.

I am really disliking the fact that it looks like you people are ignoring my posts. :<

The problem with the alternative is you get 99 people saying "dunno" to every question (possibly followed by one person who does know) which doesn't really contribute to discussion and spams the thread. If someone knows the answer they'll say something within a day or two. If I don't know I just leave it.

Never mind, danaris beat me to it.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 20, 2014, 01:52:37 pm
So, can I get access to a socket from a lua script? I can tell that I can use clsocket from a native plugin, but I want to write an IRC chatbot and I'd rather not have to build/manage binaries every time I want to make a dumb change.
Warmist's work in this branch (https://github.com/warmist/dfhack/tree/luasocket) may be helpful, although I'm not sure how usable it is in its current state.
Title: Re: DFHack 0.40.13-r1
Post by: Gerund on October 20, 2014, 03:36:45 pm
Warmist's work in this branch (https://github.com/warmist/dfhack/tree/luasocket) may be helpful, although I'm not sure how usable it is in its current state.
Alright, I'll ping him to see what he remembers about it. On the off chance that I hack it into something halfway usable, you think upstream would be interested in a PR for it? Giving arbitrary scripts socket access might be a bit dicey.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 20, 2014, 03:58:22 pm
I cannot imagine what kind of horrible things could be done with that that couldn't be done with a C++ plugin or an independent lua script. Besides that, who're we worried about? I doubt pack makers like PeredexisErrant or Meph will be very willing to do weird stuff with that, and besides that it's far more risky to make it C++ based anyway due to the fact that the code may not be readily available. Besides that, worse comes to worse, Toady would probably get the whole "there's malware included in this mod" angle.

Even ignoring malware, the worst case is performance issues, AFAIK, though I may be missing something there.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 21, 2014, 02:04:36 pm
How would one go about expanding the embark tools plugin? 

In my major mod, smelter reactions are all custom reactions with additional reagents to the ore itself.  For example, tetrahedrite smelting needs a flux in rough green glass which you can get in several ways, lead and tin ores need another coal bar to reduce the oxide, and ironworking is done entirely outside of the smelter.  This means, metal ores are no longer considered as such by the vanilla game, so that they no longer appear on the embark screen as "Shallow Metal" and "Deep Metal". 

I want to restore something like that to the embark screen, which I think would work in a similar way to the sand indicator.  As groundwork I've prefixed all the ore names with METAL_ORE_ (so, METAL_ORE_HEMATITE and so on).  How would such a script work, so that for example, the string to search would be "METAL_ORE_"? Ideally I would like for it to work like vanilla (with plurals and depth and all) though that is too much wizardry for me (I can't into DFHack programming  :()
I'm not sure if samanato ever got an answer, but I was hoping to make a variation of the sand indicator for my mod as well, to indicate the presence of "living stone" (a set of several minerals added by the mod).  Ideally, I'd like the player to be able to filter locations by its presence, but that's probably beyond my limited coding capabilities.
Looking at the source code in embark-tools.cpp, it doesn't look too hard to hack the sand indicator to check for a specific pattern of mineral names.  Before I get started, I have a couple more generic questions about DFHack plugins.

1. The "compile document" in this thread's OP is a broken link.  A pointer to real compiling instructions would be invaluable.  My limited experience with compilers was several years ago, and my experience with Git is non-existent.
2. Could embark-tools and a separate plug-in interposing at the same point coexist peacefully?  Can I guarantee that embark-tools would run first?
3. Would the embedded space in Core::getInstance().runCommand(out, "prospect all"); cause any problems?
4. This thing is going to be a stripped-down version of embark-tools, and I would really like to give attribution to the original author(s).
5. Is there a way to read what DF wrote on the screen?  That would let me put my indicator at the bottom of the site attributes.  Otherwise I need to print on top, and commingle my tool with the sand indicator.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 21, 2014, 02:20:58 pm
1. It was mentioned how to compile dfhack multiple times in the last 2 months a quick search will let you find that information.

http://www.bay12forums.com/smf/index.php?topic=139553.msg5667803#msg5667803 May help you or do a search for compile dfhack.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 21, 2014, 02:28:01 pm
1. It was mentioned how to compile dfhack multiple times in the last 2 months a quick search will let you find that information.

http://www.bay12forums.com/smf/index.php?topic=139553.msg5667803#msg5667803 May help you or do a search for compile dfhack.
Thanks!  Visual Studio Express would work fine for me because I don't know enough about the different compilers to have a strong preference, so I can use those instructions directly.
Title: Re: DFHack 0.40.13-r1
Post by: salithus on October 21, 2014, 02:37:16 pm
1. It was mentioned how to compile dfhack multiple times in the last 2 months a quick search will let you find that information.

http://www.bay12forums.com/smf/index.php?topic=139553.msg5667803#msg5667803 May help you or do a search for compile dfhack.
Thanks!  Visual Studio Express would work fine for me because I don't know enough about the different compilers to have a strong preference, so I can use those instructions directly.
you specifically need 2010 - I haven't dared to find out why yet but everyone who is "in the know" says that horrible things happen to your friends and loved ones if you use any other version.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 21, 2014, 02:39:34 pm
IIRC DF is compiled in that and not compiling it in that will cause random-ass crashes or something along those lines.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 21, 2014, 02:48:54 pm
The INVENTORY_CHANGE event currently crashes the game whenever it runs regardless of listeners.

just repeating this since it's a gigantic showstopper that prevents the release of numerous mods for the current version of DF
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 21, 2014, 02:56:48 pm
1. It was mentioned how to compile dfhack multiple times in the last 2 months a quick search will let you find that information.

http://www.bay12forums.com/smf/index.php?topic=139553.msg5667803#msg5667803 May help you or do a search for compile dfhack.
Here (https://github.com/DFHack/dfhack/blob/master/Compile.rst#windows) is the documentation on Github.

How would one go about expanding the embark tools plugin? 

In my major mod, smelter reactions are all custom reactions with additional reagents to the ore itself.  For example, tetrahedrite smelting needs a flux in rough green glass which you can get in several ways, lead and tin ores need another coal bar to reduce the oxide, and ironworking is done entirely outside of the smelter.  This means, metal ores are no longer considered as such by the vanilla game, so that they no longer appear on the embark screen as "Shallow Metal" and "Deep Metal". 

I want to restore something like that to the embark screen, which I think would work in a similar way to the sand indicator.  As groundwork I've prefixed all the ore names with METAL_ORE_ (so, METAL_ORE_HEMATITE and so on).  How would such a script work, so that for example, the string to search would be "METAL_ORE_"? Ideally I would like for it to work like vanilla (with plurals and depth and all) though that is too much wizardry for me (I can't into DFHack programming  :()
I'm not sure if samanato ever got an answer, but I was hoping to make a variation of the sand indicator for my mod as well, to indicate the presence of "living stone" (a set of several minerals added by the mod).  Ideally, I'd like the player to be able to filter locations by its presence, but that's probably beyond my limited coding capabilities.
Looking at the source code in embark-tools.cpp, it doesn't look too hard to hack the sand indicator to check for a specific pattern of mineral names.  Before I get started, I have a couple more generic questions about DFHack plugins.

1. The "compile document" in this thread's OP is a broken link.  A pointer to real compiling instructions would be invaluable.  My limited experience with compilers was several years ago, and my experience with Git is non-existent.
2. Could embark-tools and a separate plug-in interposing at the same point coexist peacefully?  Can I guarantee that embark-tools would run first?
3. Would the embedded space in Core::getInstance().runCommand(out, "prospect all"); cause any problems?
4. This thing is going to be a stripped-down version of embark-tools, and I would really like to give attribution to the original author(s).
5. Is there a way to read what DF wrote on the screen?  That would let me put my indicator at the bottom of the site attributes.  Otherwise I need to print on top, and commingle my tool with the sand indicator.
1. Replace "COMPILE.rst" with "Compile.rst"
2. Yes. Priority for specific hooks can be set with IMPLEMENT_VMETHOD_INTERPOSE_PRIO instead of IMPLEMENT_VMETHOD_INTERPOSE.
3. That space is intentional - "prospect all" is the desired command, and "prospectall" is not.
4. File history (https://github.com/DFHack/dfhack/commits/develop/plugins/embark-tools.cpp). I've been meaning to implement a better way of checking for sand that doesn't involve searching prospect's output.
5. From the search plugin:
Code: [Select]
Screen::Pen pen = Screen::readTile(x,y);
if (pen.valid())
{
    // pen.ch, pen.fg, pen.bg, pen.bold, etc.
}
I'm not sure if this is the best solution, though - with the smallest window size (80x25), there are only a few extra rows available. If you're interested in all metals available, I'd recommend a script which duplicates some of prospect's functionality instead.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 21, 2014, 03:48:23 pm
Don't want this to turn into a wall-of-quotes, so I'll start fresh :)

Thank you, lethosor, Putnam and salithus.  I'll make sure I find a copy of VSE 2010.  Somehow.  The original embark-tools only used "prospect" (looking for sand on the surface) and I just wanted to make that I didn't need to escape the space or somesuch to search for subterranean minerals with "prospect all".

The point of the project is that I made a mod that adds several features to the game, but they are only relevant if some of the modded stone types are on your map (LIVING GRANITE, LIVING SHALE, etc.).  For my own use I type prospect all at the console, but some players might consider that cheating.

With the Screen::Pen information it should be possible to loop my way down and find a blank line to report the site's status with "", "Living Stone" or "Living Stones".  I'll be sure to test it with an 80x25 screen on a busy embark site.

I think to start I will try a lua script (a wrapper around prospect all? prospector.cpp looks complicated...) that just reveals a little info about living stone on the map.  That has the advantage of being cross-platform and something I can throw into the raw/scripts folder.
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on October 21, 2014, 08:38:42 pm
I'll make sure I find a copy of VSE 2010.  Somehow.
You don't have to look very hard - it's right here (http://www.visualstudio.com/downloads/download-visual-studio-vs#DownloadFamilies_4).
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 22, 2014, 10:27:13 am
I'll make sure I find a copy of VSE 2010.  Somehow.
You don't have to look very hard - it's right here (http://www.visualstudio.com/downloads/download-visual-studio-vs#DownloadFamilies_4).
Pleasantly surprised that prior versions are still available.  Was not my experience with Microsoft the last time I was looking for old stuff (though that was years ago).

I'll stop hogging the thread now  :-X
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 22, 2014, 01:57:01 pm
The how to compile link has been fixed in the first post. Thanks for letting me know.

The INVENTORY_CHANGE event currently crashes the game whenever it runs regardless of listeners.

just repeating this since it's a gigantic showstopper that prevents the release of numerous mods for the current version of DF

Still on it, thanks. Hopefully I'll have some time this weekend to do DF stuff.

My current list is

Code: [Select]
fix digType
fix interaction-trigger
do conversion script for old syndromeTrigger system
fix INVENTORY_CHANGE
merge stuff
do release

No guarantees it'll be finished this weekend of course but I'll try.
Title: Re: DFHack 0.40.13-r1
Post by: Kiloku on October 23, 2014, 10:28:36 am
I saw that DFHack generates a few files relating to ghosts:
Can these somehow be used to modify ghosts and their behavior? I was thinking of making a mod that added friendlier and productive ghosts, but I've read that ghosts are hard-coded and can't be found on the Raws. Is DFHack powerful enough for me to make a ghost mod?
Title: Re: DFHack 0.40.13-r1
Post by: PariahDog on October 23, 2014, 11:20:33 am
Hi, I've got a question about DFhack v34.11 (I've still got a Fort left in 0.34)

I've tried activating the gui/assign-rack script but it told me to activate the weaponrack-UNassign binpatch first, when I did it gave me this error.
Now I have to admit that computers, programming etc. are by no means my domain so I wager I'm doing something wrong. However I was unable to find any kind of solution on the internet.
Thanks in advance and apologies if I'm posting this in the wrong place, if this post doesn't belong here then just tell me where to post and I'll delete it.

(http://i15.photobucket.com/albums/a361/project404/Whatdoesthismean_zps9e0b0b12.png)
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on October 23, 2014, 01:05:31 pm
You're typing the command "binpatch check/apply <weaponrack-unassign>", which is totally invalid - you should be typing "binpatch apply weaponrack-unassign" to apply the patch (or "binpatch check weaponrack-unassign" to check if it's already applied).
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 23, 2014, 01:13:29 pm
For those interested, I have written a little function to get the ADV_NAME of each interaction that a unit can do (both via creature/caste interactions, and those granted through syndromes). It will be going in my new unitViewer script, but I seem to remember someone asking for something like this in the past

Code: [Select]
function getTargetInteractions(tar)
 ints = {}
 t_ints = {}
 for i,x in pairs(df.global.world.raws.creatures.all[tonumber(tar.race)].caste[tonumber(tar.caste)].body_info.interactions) do
  s = -1
  check = false
  name = false
  for j,y in pairs(df.global.world.raws.creatures.all[tonumber(tar.race)].raws) do
   if split(y.value,':')[1] == '[CAN_DO_INTERACTION' then
    s = s + 1
    if s == i then
     check = true
    elseif s > i then
     break
    end
   end
   if check then
    if split(y.value,':')[2] == 'ADV_NAME' then
     ints[i+1] = split(split(y.value,':')[3],']')[1]
     name = true
end
   end
  end
  if not name then
   ints[i+1] = 'Unknown'
  end
 end
 if #ints == 0 then
  ints[1] = {'NONE'}
 end
 for i,x in pairs(tar.syndromes.active) do
  for j,y in pairs(df.global.world.raws.syndromes.all[tonumber(x.type)].ce) do
   if y._type == df['creature_interaction_effect_can_do_interactionst'] then
    t_ints[i+1] == y.name
   end
  end
 end
 return ints, t_ints
end
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 23, 2014, 02:11:51 pm
Hi, I've got a question about DFhack v34.11 (I've still got a Fort left in 0.34)

I've tried activating the gui/assign-rack script but it told me to activate the weaponrack-UNassign binpatch first, when I did it gave me this error.
Now I have to admit that computers, programming etc. are by no means my domain so I wager I'm doing something wrong. However I was unable to find any kind of solution on the internet.
Thanks in advance and apologies if I'm posting this in the wrong place, if this post doesn't belong here then just tell me where to post and I'll delete it.

(http://i15.photobucket.com/albums/a361/project404/Whatdoesthismean_zps9e0b0b12.png)
You can copy text from the DFHack console on Windows by accessing the window's menu (either by clicking in the upper left or upper right corner of the window).

I saw that DFHack generates a few files relating to ghosts:
  • unit_ghost_info.h
  • ghost_goal.h
  • ghost_type.h
Can these somehow be used to modify ghosts and their behavior? I was thinking of making a mod that added friendlier and productive ghosts, but I've read that ghosts are hard-coded and can't be found on the Raws. Is DFHack powerful enough for me to make a ghost mod?
Certainly, although I don't know exactly how much you'd be able to accomplish. Take a look at the tweak plugin (the "clear-ghostly" tweak to be specific) for an example.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 23, 2014, 02:26:31 pm
For those interested, I have written a little function to get the ADV_NAME of each interaction that a unit can do (both via creature/caste interactions, and those granted through syndromes). It will be going in my new unitViewer script, but I seem to remember someone asking for something like this in the past

-snip-

Wow that's cool!

...

You really need to work on variable names, though, heh. I can't read that at all.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 23, 2014, 02:53:10 pm
For those interested, I have written a little function to get the ADV_NAME of each interaction that a unit can do (both via creature/caste interactions, and those granted through syndromes). It will be going in my new unitViewer script, but I seem to remember someone asking for something like this in the past

-snip-

Wow that's cool!

...

You really need to work on variable names, though, heh. I can't read that at all.

NEVAR!

But yes, on a serious note, I really do. I get yelled at about it all the time for work, don't know what my problem with proper variable naming is... This code is actually pretty good compared to some of my others (like the one you saw with ddtot and such). ints = interactions, t_ints = temporary_interactions
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 23, 2014, 02:59:26 pm
For those interested, I have written a little function to get the ADV_NAME of each interaction that a unit can do (both via creature/caste interactions, and those granted through syndromes). It will be going in my new unitViewer script, but I seem to remember someone asking for something like this in the past

-snip-

Wow that's cool!

...

You really need to work on variable names, though, heh. I can't read that at all.

NEVAR!

But yes, on a serious note, I really do. I get yelled at about it all the time for work, don't know what my problem with proper variable naming is... This code is actually pretty good compared to some of my others (like the one you saw with ddtot and such). ints = interactions, t_ints = temporary_interactions
There is a way to fix unclear variable names.  CTRL-H.
Title: Re: DFHack 0.40.13-r1
Post by: heydude6 on October 23, 2014, 07:09:44 pm
This is a dumb question but what does ctrl-H do?
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 23, 2014, 08:07:07 pm
This is a dumb question but what does ctrl-H do?

Likely in notepad++ or some other file reader, nothing to do with dwarf fortress per se.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 23, 2014, 08:32:51 pm
What does it do?

Is it an autocomplete hotkey or summat?
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 23, 2014, 09:02:21 pm
What does it do?

Is it an autocomplete hotkey or summat?
It's the standard shortcut key for search-and-replace.
Title: Re: DFHack 0.40.13-r1
Post by: WillowLuman on October 23, 2014, 10:22:12 pm
How does one mess with lua in this version? unit=dfhack.gui.getSelectedUnit() does not seem to work ingame anymore.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 23, 2014, 10:25:09 pm
? It should.
Title: Re: DFHack 0.40.13-r1
Post by: WillowLuman on October 23, 2014, 10:25:45 pm
Nevermind, I miscapitalized.
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on October 24, 2014, 03:13:37 am
How would I go about using hotkeys to launch custom scripts?

Also, how would I go about simulating pressing the "Esc" key, or any other key for that matter? Would this be possible in LUA, or would I have to develop a c++ plugin?
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 24, 2014, 03:18:04 am
Custom scripts are treated as DFHack commands exactly like normal scripts (mostly because there's no difference whatsoever between custom scripts and included ones), so do it the same way you see other keybindings done in the init.

I ain't posting the whole documentation on the topic here, so search "simulateInput" here (https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst)
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on October 24, 2014, 03:24:30 am
Custom scripts are treated as DFHack commands exactly like normal scripts, so do it the same way you see other keybindings done in the init.

I ain't posting the whole documentation on the topic here, so search "simulateInput" here (https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst)
Thank you so much! :D
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 24, 2014, 10:04:41 am
So I'm trying to work with the gui and have some questions.

I can create screens and frames and all that, and I can put text in them, with columns and rows and overall it looks nice, but my issue is that some of the lists I want to put in are variable in length, and the only examples I have seen of organization is either all in a single list (e.g. room-list) or set columns and rows (e.g. autobutcher). I've been trying to look over the API documentation about the gui, but am still very much a novice when it comes to anything gui related (my only work with guis has been in python) and am having a hard time understanding everything.

So, long story short, my question is, does anyone have any knowledge they can impart about creating a gui that would, ideally, look something like this
Spoiler (click to show/hide)
Where the VARIABLE LENGTH parts can be 0-whatever rows in length.
Title: Re: DFHack 0.40.13-r1
Post by: TheDorf on October 24, 2014, 10:23:15 am
So I'm trying to work with the gui and have some questions.

I can create screens and frames and all that, and I can put text in them, with columns and rows and overall it looks nice, but my issue is that some of the lists I want to put in are variable in length, and the only examples I have seen of organization is either all in a single list (e.g. room-list) or set columns and rows (e.g. autobutcher). I've been trying to look over the API documentation about the gui, but am still very much a novice when it comes to anything gui related (my only work with guis has been in python) and am having a hard time understanding everything.

So, long story short, my question is, does anyone have any knowledge they can impart about creating a gui that would, ideally, look something like this
Spoiler (click to show/hide)
Where the VARIABLE LENGTH parts can be 0-whatever rows in length.

I think you could use something like
Code: [Select]
classes = {
--code to obtain classes from unit
}
list:setChoices(classes)

I'm really new to this whole lua scripting thing though, so I'm not sure at all. Also, I might have completely misunderstood your question, and if this is the case, I'm sorry. :( It's just something that I stumbled upon checking out gui/gm-editor.lua in my attemps to learn how to create a custom UI screen.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 24, 2014, 10:31:44 am
So I'm trying to work with the gui and have some questions.

I can create screens and frames and all that, and I can put text in them, with columns and rows and overall it looks nice, but my issue is that some of the lists I want to put in are variable in length, and the only examples I have seen of organization is either all in a single list (e.g. room-list) or set columns and rows (e.g. autobutcher). I've been trying to look over the API documentation about the gui, but am still very much a novice when it comes to anything gui related (my only work with guis has been in python) and am having a hard time understanding everything.

So, long story short, my question is, does anyone have any knowledge they can impart about creating a gui that would, ideally, look something like this
Spoiler (click to show/hide)
Where the VARIABLE LENGTH parts can be 0-whatever rows in length.
I'm not sure exactly what you're asking.  TheDorf addressed getting the data; this is about the formatting.

If you want "column G" to scoot over to accommodate the variable-length stuff in the middle, you'd need a way to figure out the right-most extent of the middle and just put your "column G" a space or two after that.

Alternatively, you could lift a word-wrap algorithm from the Lua wiki String Recipes (http://lua-users.org/wiki/StringRecipes) repository and guarantee a maximum width for each column (although if this is to be C++, the newlines involve moving the pen around).

Edit: On the other hand, if you meant a variable number of ROWS rather than COLUMNS, the same logic applies.  Determine the lowest-most point and place the next item a row or two under that.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 24, 2014, 10:35:12 am
The variable length would be in the row direction, not the column (sorry, was unsure of how to represent that in the image). The columns are all fixed to what they will be, but the skills might appear up or down from there, depending on how many classes the unit has.
Title: Re: DFHack 0.40.13-r1
Post by: breadman on October 24, 2014, 11:46:29 am
Seems like the easiest way to handle a variable number of rows is to start at the top and write one row at a time.  When you run out of items, skip a line or three and start the next section.

Of course, then you need to figure out what to do if there isn't enough room on the screen.  DF mostly uses paging, but there are interfaces that scroll instead, with up and down arrows at the side to indicate that there's more to see.

It's the standard shortcut key for search-and-replace.

Very few shortcut keys are standardized, and even the standard ones are frequently changed.  (Even something as basic as Paste.  Depending on how I copied it and what I'm pasting into, it could be Ctrl-V, Shift-Ctrl-V, `], "+p, Ctrl-R +, Shift-Ins, or the middle mouse button.  I also get into trouble when trying to erase the previous word in programs that use Ctrl-W to close a window.)

To me, Ctrl-H usually means Backspace, and gc is my most common shortcut for search-and-replace.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 24, 2014, 11:50:07 am
Seems like the easiest way to handle a variable number of rows is to start at the top and write one row at a time.  When you run out of items, skip a line or three and start the next section.

Of course, then you need to figure out what to do if there isn't enough room on the screen.  DF mostly uses paging, but there are interfaces that scroll instead, with up and down arrows at the side to indicate that there's more to see.

Yes, the issue I was having with this was how to place it in a specific column on the screen, but I think I have it figured out with multiple subviews.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 24, 2014, 12:34:57 pm
As you learn the GUI system, we could use a tutorial on it. People who don't know it well enough can't write one, and people who know it too well don't remember what parts are confusing and what parts aren't. The dwarffortresswiki might be a good place for it to live if you have time to write it. If not, well, we can't blame you. We're busy too.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 24, 2014, 12:40:55 pm
Sure, I can keep notes of what I find difficult, interesting, and anything else

Here is the first pass mock-up
Spoiler (click to show/hide)
Now obviously I need to do some work in prettying it up. Change color of different texts, center things, justify other things, change skill rating number to actual description (e.g. Dabbling), and some other things. I'm also thinking of splitting up the skill list to work/social/military for easier reading.

But it's coming along nicely. Still to add are active syndromes and known interactions (already have the code to get the information, just need to put it on the gui). What is some other information people would like to see on the unit view? Maybe happiness level? Health problems? Orientation? Lot's of information that can be put there. Just need to keep in mind the size of the screen.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 24, 2014, 01:20:22 pm
Different colors for data and names of lists (Attributes / Skills vs AGILITY / PACIFY) would make them stand out more than just making them brighter.

The name of the dwarf should be capitalized. Maybe give the english form of the name too?

I like it so far.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 24, 2014, 02:17:44 pm
It took me far longer than I thought it would to make the colors like this
Spoiler (click to show/hide)
Now I have to take a break and go back to actual work.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 24, 2014, 02:30:30 pm
Out of curiosity, how did you do that? Did you just end up making separate lists and label widgets?
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 24, 2014, 08:48:17 pm
Yep, there are four different subviews there, 3 lists (classes, attributes, and skills) and one label (name information). Really they could all be lists, and probably will be when I am finished.

EDIT: You can do some pretty fun stuff with colors and such. Like I figured out how to make every other entry in the list have a different background color for easier reading
Title: Re: DFHack 0.40.13-r1
Post by: palu on October 25, 2014, 10:11:13 am
Any idea what the architect, builder1, and builder2 numbers in building.design represent? It doesn't seem to be unit ids.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 25, 2014, 06:29:03 pm
Is it possible to find the profession name and description attached to each skill token? (e.g. given DETAILSTONE I want to get Engraver and Engraving). I know I can get the profession name of a specific unit, but would like the profession name for each skill.
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on October 25, 2014, 06:39:58 pm
Wouldn't it be best to ask that in the dwarf therapist thread? They deal with those things but your thing is pretty neat in it's own way so you should continue it. There's also another pluggin within dfhack that deals with skills to, I just forget what it is.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 25, 2014, 06:43:40 pm
Manipulator?
I think it's fairly easy to get a list of skill names through DFHack (and I think Roses is asking for a way to do so without hardcoding each skill name, which DT wouldn't help with).
Edit:
Code: [Select]
for i in ipairs(df.job_skill) do print(i, df.job_skill[i], df.job_skill.attrs[i].caption, df.job_skill.attrs[i].caption_noun) end
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 25, 2014, 06:52:33 pm
Perfect! Exactly what I was looking for. Just wasted 20 minutes trying to figure it out myself. Completely passed over the .attrs oh well, always good to learn :)

EDIT: Had a little more time to work on this today, here is what it's looking like now
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on October 25, 2014, 08:04:20 pm
Well, out of curiousity I tried to whip up a slapdash combination of the new df with this dfhack and the most recent twbt, it loads up ok but it doesn't give back the terminal to use dfhack commands, and the keybinds are all weird (l for announcements, f3 for pause/resume, s for artifacts?) but it DID load up the overrides properly though twbt didn't work either.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 25, 2014, 08:16:56 pm
What platform? Did you update symbols.xml? Are you compiling DFHack from source or using a 0.40.13-r1 build?
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on October 25, 2014, 08:39:14 pm
Linux, I didn't remember to check the symbols, I'm just using the dfhack40.13.tar.bz I think.

For clarity, I dled the linux version from the bay12games site, grabbed a fresh dfhack40.13 from the front page here, and the twbt linked from the spacefox thread (5.27 I think) and put them together as usual, copied over the graphics, objects, art, and init/d_init, tried to use the old and new interface but both broke, though I did have to replace the libgraphics.so with the working one from my 40.13 game along with adding in libpng.so to fix the canberra-gtk-module thing.

Oh, weirdly enough it spams me with libpng warning: iCCP: known incorrect sRGB profile if I try to start with ./df instead of ./dfhack, but yeah, looks pretty close to being fixable since it does load up, probably just needs the dfhack compiled against the right version?
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 25, 2014, 08:50:06 pm
If you replaced libgraphics.so with a copy from 0.40.13, that certainly explains the broken keybindings - 0.40.14 added new keybindings, changing the IDs of all keybindings following them, so DF 0.40.14 will retrieve the wrong  information from an older libgraphics (and may even crash in some cases - try accessing the last item of the last page of the keybindings screen).

DFHack refuses to load past a certain point if it doesn't recognize the DF version - adding a new <symbol-table> entry with the correct md5 should work. (Changing the md5 of an existing entry will almost certainly crash, however, since none of the addresses will be correct.)
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on October 25, 2014, 09:02:06 pm
Ahhh, that explains the keybinds, good to know, I'll poke around with it in a bit, and try the mdf5 fix, thanks!

Hmmm, switching to the libgraphics.so that came with it breaks it, just spams me with the libstdc++.s0.6:version 'GLIBCXX_3.4.20' not found (required by ./hack/libdfhack.so) messages and then the canberra-gtk-module, but it did try to load the right bindings, though they weren't actually right in the save I loaded, but that's not unexpected given how sloppily I put everything together atm.

When I get back on I'll try it with a fresh df, fresh dfhack, and put the right md5 in there, and then update the keybinds by hand.

This too, which was new to me, looks like the fruit gathering stuff keybinds, but the openal thing I've never seen before.
Code: [Select]
Sound devices available:
OpenAL Soft
Picking OpenAL Soft. 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
Unknown binding: CIVZONE_GATHER
Unknown binding: CIVZONE_GATHER_OPTIONS
Unknown binding: CIVZONE_GATHER_OPTIONS_PICK_TREES
Unknown binding: CIVZONE_GATHER_OPTIONS_PICK_SHRUBS
Unknown binding: CIVZONE_GATHER_OPTIONS_GATHER_FALLEN
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on October 25, 2014, 09:33:20 pm
What would I have to put in to have all my dwarves teleporting around? I'm only using it so one dwarf who's making a mini planepacked can get done sooner rather than later.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 25, 2014, 09:55:11 pm
"fastdwarf 0 1"

Or "fastdwarf 1 1" to make dwarves work faster as well.
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on October 25, 2014, 09:56:15 pm
Thanks. What would I have to do to make it go back to normal?
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 25, 2014, 09:57:29 pm
Ahhh, that explains the keybinds, good to know, I'll poke around with it in a bit, and try the mdf5 fix, thanks!

Hmmm, switching to the libgraphics.so that came with it breaks it, just spams me with the libstdc++.s0.6:version 'GLIBCXX_3.4.20' not found (required by ./hack/libdfhack.so) messages and then the canberra-gtk-module, but it did try to load the right bindings, though they weren't actually right in the save I loaded, but that's not unexpected given how sloppily I put everything together atm.

When I get back on I'll try it with a fresh df, fresh dfhack, and put the right md5 in there, and then update the keybinds by hand.

This too, which was new to me, looks like the fruit gathering stuff keybinds, but the openal thing I've never seen before.
Code: [Select]
Sound devices available:
OpenAL Soft
Picking OpenAL Soft. 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
Unknown binding: CIVZONE_GATHER
Unknown binding: CIVZONE_GATHER_OPTIONS
Unknown binding: CIVZONE_GATHER_OPTIONS_PICK_TREES
Unknown binding: CIVZONE_GATHER_OPTIONS_PICK_SHRUBS
Unknown binding: CIVZONE_GATHER_OPTIONS_GATHER_FALLEN
It sounds like the problem is with the DFHack build you're using, not libgraphics. What GCC versions do you have available? If you don't have GCC 4.9, you should be using the GCC 4.5 build of DFHack (which uses the libraries that come with DF).


Thanks. What would I have to do to make it go back to normal?
"fastdwarf 0 0"
(You can also use "help fastdwarf" for more information)
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on October 25, 2014, 10:00:39 pm
Thanks a lot! That is fast...

New question: how do I make a creature appear? I remember someone said to me something along the lines of making a creature appear to replace being able to force megabeast attacks. Which script is that?
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on October 26, 2014, 12:15:06 am
[thefunk@archenstein df_linux]$ ./dfhack
Gtk-Message: Failed to load module "canberra-gtk-module"
Loading bindings from data/init/interface.txt
Resetting textures
TWBT: version 5.27
TWBT: no display patch

./dfhack: line 43: 22368 Segmentation fault      (core dumped) setarch i386 -R env LD_PRELOAD=$PRELOAD_LIB ./libs/Dwarf_Fortress "$@"

[thefunk@archenstein df_linux]$ ./dfhack
Gtk-Message: Failed to load module "canberra-gtk-module"
ARGH, SO CLOSE....

I gave symbols.xml the right md5 in a new symbols table and it got that far, I've got gcc 4.9.1 already, but I haven't had more luck than getting twbt to start trying to load like that and segfaulting out.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 26, 2014, 01:15:02 am
Creating units from scratch is still being researched. See modtools/force.lua for megabeasts.

Perfect! Exactly what I was looking for. Just wasted 20 minutes trying to figure it out myself. Completely passed over the .attrs oh well, always good to learn :)

EDIT: Had a little more time to work on this today, here is what it's looking like now
Spoiler (click to show/hide)

Looks great! It's up to you but I'd put the numerical skill level in addition to the word (master / dabbler / etc). Just in case people forget what the order is.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 26, 2014, 03:02:11 am
Perfect! Exactly what I was looking for. Just wasted 20 minutes trying to figure it out myself. Completely passed over the .attrs oh well, always good to learn :)

EDIT: Had a little more time to work on this today, here is what it's looking like now
Spoiler (click to show/hide)

Looks great! It's up to you but I'd put the numerical skill level in addition to the word (master / dabbler / etc). Just in case people forget what the order is.

Hmm, I think you are right. I was also unsure if I should use total experience or rank experience for the 3rd column.

For Syndromes, do you know of a way to get the time left on the syndrome? I looked briefly where I thought it might be, but didn't have a chance to check to much, would be nice to be able to display that. (In a perfect world I would be able to find how much time is left on a units interaction cooldown as well, but I won't hold my breath for that one).

Is there anything else people would like to see on there?
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 26, 2014, 04:18:50 am
If you look up the syndrome from the unitSyndrome then you can look at the maximum duration for each symptom and subtract the duration so far to find the amount of time left. See syndrome-util.lua.
Title: Re: DFHack 0.40.13-r1
Post by: fricy on October 26, 2014, 05:09:34 am
TWBT: version 5.27
TWBT: no display patch
ARGH, SO CLOSE....
I gave symbols.xml the right md5 in a new symbols table and it got that far, I've got gcc 4.9.1 already, but I haven't had more luck than getting twbt to start trying to load like that and segfaulting out.

Twbt doesn't load anything from symbols.xml, but uses hardcoded memory offsets (https://github.com/mifki/df-twbt/blob/master/patches.hpp). So in short: no matter how hard you try, you won't be using it with 40.14 without mifki's update and a recompile.
Title: Re: DFHack 0.40.13-r1
Post by: ptb_ptb on October 26, 2014, 06:37:56 am
Is there anything else people would like to see on there?

Skills that are rusty, or very rusty, in a different color?
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 26, 2014, 07:13:39 am
[thefunk@archenstein df_linux]$ ./dfhack
Gtk-Message: Failed to load module "canberra-gtk-module"
Loading bindings from data/init/interface.txt
Resetting textures
TWBT: version 5.27
TWBT: no display patch

./dfhack: line 43: 22368 Segmentation fault      (core dumped) setarch i386 -R env LD_PRELOAD=$PRELOAD_LIB ./libs/Dwarf_Fortress "$@"

[thefunk@archenstein df_linux]$ ./dfhack
Gtk-Message: Failed to load module "canberra-gtk-module"
ARGH, SO CLOSE....

I gave symbols.xml the right md5 in a new symbols table and it got that far, I've got gcc 4.9.1 already, but I haven't had more luck than getting twbt to start trying to load like that and segfaulting out.

TwbT hasn't been updated yet, so it won't work with 0.40.14. I'm not sure if that's the cause of the segfault, though. Is there anything in stderr.log?
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on October 26, 2014, 08:30:16 am
Crap, I removed that folder since it was such a mess, so I didn't grab the log.

Worth noting that while I haven't gotten it working with dfhack yet, I was able to get the new libgraphics.so working after doing the explort ld_preload /user/lib32/libz.so.1 workaround for regular ./df launches, which is why I tried to use the old graphics.so, and it did fix the keybinds problem. Litle sleepy so I'll try to put it together and get ./dfhack to work the same way if I can later, using the added md5 table and linking to the zlib, assuming it doesn't get updated before I get back on anyways.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 26, 2014, 11:31:06 pm
Thanks for your help with the syndrome thing expwnent, got that working right, and got the class system working correctly as well (before it was just a place holder label, not it is a proper list). I also added a flag so if you aren't using my class system, you can just turn the display off and get that extra space back (instead it would just say 'None' and give you a lot of zeroes).

Here is the updated look
Spoiler (click to show/hide)

I may exchange the word Permanent for just a P or something since it is adding extra space that doesn't really need to be there. As always if anyone has any thoughts I am open to suggestions. I think I want to put some basic health information in the upper right corner (age, happiness level, health condition, maybe put up the sleepiness/hungry timers).

Is there anything else people would like to see on there?

Skills that are rusty, or very rusty, in a different color?
That's a pretty good suggestion, do we know the amount of rust_counter that describes each level of rustiness?

Other than that I am pretty content with where it is and where it is going, so I will probably release it to the public soon. Keep up the good suggestions!
Title: Re: DFHack 0.40.13-r1
Post by: Vanst7 on October 27, 2014, 01:05:00 am
Thanks for your help with the syndrome thing expwnent, got that working right, and got the class system working correctly as well (before it was just a place holder label, not it is a proper list). I also added a flag so if you aren't using my class system, you can just turn the display off and get that extra space back (instead it would just say 'None' and give you a lot of zeroes).

Here is the updated look
Spoiler (click to show/hide)

I may exchange the word Permanent for just a P or something since it is adding extra space that doesn't really need to be there. As always if anyone has any thoughts I am open to suggestions. I think I want to put some basic health information in the upper right corner (age, happiness level, health condition, maybe put up the sleepiness/hungry timers).

Is there anything else people would like to see on there?

Skills that are rusty, or very rusty, in a different color?
That's a pretty good suggestion, do we know the amount of rust_counter that describes each level of rustiness?

Other than that I am pretty content with where it is and where it is going, so I will probably release it to the public soon. Keep up the good suggestions!

Loving this so far. That's the kind of plug-in i would definitely use. A suggestion, is it possible to sort the skills, so the highest level skills are at the top. And maybe seperate them by 3 category, one for the work related skills, one for the combats skill and the other one for skills like negociator, comedian etc..
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 27, 2014, 03:03:41 am
Loving this so far. That's the kind of plug-in i would definitely use. A suggestion, is it possible to sort the skills, so the highest level skills are at the top. And maybe seperate them by 3 category, one for the work related skills, one for the combats skill and the other one for skills like negociator, comedian etc..

Yes to both of those, the sorting skills by rank is easy enough to do, and something I should have done already. The categorizing them is something I had originally intended to do, but wasn't quite sure how best to do it. I have an idea now though and just need to implement it.
Title: Re: DFHack 0.40.13-r1
Post by: Badger Storm on October 27, 2014, 04:02:39 am
Is DFHack available for 40.14 yet?
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on October 27, 2014, 07:41:46 am
Is DFHack available for 40.14 yet?
No.
Title: Re: DFHack 0.40.13-r1
Post by: palu on October 27, 2014, 10:19:44 am
Thanks for your help with the syndrome thing expwnent, got that working right, and got the class system working correctly as well (before it was just a place holder label, not it is a proper list). I also added a flag so if you aren't using my class system, you can just turn the display off and get that extra space back (instead it would just say 'None' and give you a lot of zeroes).

Here is the updated look
Spoiler (click to show/hide)

I may exchange the word Permanent for just a P or something since it is adding extra space that doesn't really need to be there. As always if anyone has any thoughts I am open to suggestions. I think I want to put some basic health information in the upper right corner (age, happiness level, health condition, maybe put up the sleepiness/hungry timers).

Is there anything else people would like to see on there?

Skills that are rusty, or very rusty, in a different color?
That's a pretty good suggestion, do we know the amount of rust_counter that describes each level of rustiness?

Other than that I am pretty content with where it is and where it is going, so I will probably release it to the public soon. Keep up the good suggestions!

Loving this so far. That's the kind of plug-in i would definitely use. A suggestion, is it possible to sort the skills, so the highest level skills are at the top. And maybe seperate them by 3 category, one for the work related skills, one for the combats skill and the other one for skills like negociator, comedian etc..
Aren't they categorized already?
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 27, 2014, 02:51:09 pm
They aren't really categorized (as far as I know). There is a loose categorization on the wiki, but that's by no means rigid.

The question I have for categories is about the outiers, for example, where should Building Designer or Record Keeper go? Should there be a medical skills category? I was thinking the break down would be;

Labor (all the hard labor stuff)
Administrative (things like Record Keeper, Organizer, etc...)
Social (things like Negotiation)
Medical (all medical skills)
Military (all military skills)

But is that too many categories? And what about strange ones like Alchemy, Swimming, etc... Thoughts?
Title: Re: DFHack 0.40.13-r1
Post by: IronSI on October 27, 2014, 06:19:54 pm
It is already split into three with the combat/labor/misc split in game (v - g - {c, l, m}) breaking down the skills further might be good though.
Title: Re: DFHack 0.40.13-r1
Post by: Vanst7 on October 28, 2014, 02:41:45 am
They aren't really categorized (as far as I know). There is a loose categorization on the wiki, but that's by no means rigid.

The question I have for categories is about the outiers, for example, where should Building Designer or Record Keeper go? Should there be a medical skills category? I was thinking the break down would be;

Labor (all the hard labor stuff)
Administrative (things like Record Keeper, Organizer, etc...)
Social (things like Negotiation)
Medical (all medical skills)
Military (all military skills)

But is that too many categories? And what about strange ones like Alchemy, Swimming, etc... Thoughts?

These categories are great, for the others skills that dont fit in it maybe just add a misc category for them? In what order you gonna place them?
1 Labor, 2 millitary, 3 medical, 4 administrative and 5 socials?

Another suggestion, well maybe a lillte bit weird but i thought for the health status adding a kind of stick figure representing the dwarf, maybe like that:

  O
_/|\_
   |
  / \
 -   -
When all part is green it mean hes in good shape, and add color to body part when they are missing or bruised etc..

Edit: personally i would put record keeper in administrative, and building designer in a misc category, maybe. Well Palu was kind of right, they kinda already categorized on the game. But using these category from the game would be too much. In game there a category for the engineering skills, maybe add that?

Edit2: If a skill is not activated on a dwarf and have experience on it, is it gonna be shown on the list?
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 28, 2014, 09:41:05 am
Another suggestion, well maybe a lillte bit weird but i thought for the health status adding a kind of stick figure representing the dwarf, maybe like that:

  O
_/|\_
   |
  / \
 -   -
When all part is green it mean hes in good shape, and add color to body part when they are missing or bruised etc..
That's a good idea except for two things: First, you can't guarantee that the screen font's punctuation isn't all screwy and Second, I'm not sure if DF is very helpful about telling you that a bruised pancreas is inside the lowerbody in order to color-code nicely.

It's conceivable to draw line-art on the DF screen (Stonesense overlay and an experimental build of TWBT did it), but it seems to be a pretty hardcore undertaking.

Edit: Actually it isn't line art, both of them are blitting images to the DF screen.  But they are images that aren't confined to the character grid.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 28, 2014, 10:11:35 am
Yeah, I think I will steer away from something as complicated as that, seeing as how the health screen already does a good job. Not that I don't think it would be awesome to have included, but limited time means I would rather work on other things instead. Maybe after I release it, if someone is interested, they can try and put it in themselves.

I was just thinking that it might be nice to be able to select a syndrome or interaction and learn more about what it does. Say I select "Beast Sickness", it would tell me what affects it is having on the dwarf (e.g. Pain, severity X, time to peak Y, time to end Z, etc...). I already have all that information, I just didn't want to put it on the main screen because if you have 4 different syndromes on, each with 5 different effects, you quickly crowd out the screen. But putting them in their own screen is certainly do-able.

Also, with different colors related to the rusty/very rusty skills, I could make attributes appear in different colors depending on if they are above or below normal, depending on if there is a syndrome affecting them. That way, at a quick glance, you could see if a syndrome is lowering your Dwarf's stats, or if they are just an usually weak Dwarf.

Edit2: If a skill is not activated on a dwarf and have experience on it, is it gonna be shown on the list?
Currently it takes all of the skills of the Dwarf, active or not, as long as they have some experience in the skill.
Title: Re: DFHack 0.40.13-r1
Post by: CLA on October 28, 2014, 11:36:15 am
I though about something like that at some point a few years back and made some mockups.

It would certainly make recognizing health issues at a quick glance easier, but at the very least you would have to separate mannequins for blood vessels, nervous tissue, skeletal structure, and organs plus skin to keep it reasonably clear.
Blinking could be used to denote injuries.

Spoiler: old mockups (click to show/hide)

As it has been mentioned though, this would be quite the work to do. I'd reckon you'd need 4 (as per separation mentioned above) generic mannequins for vertebrates (skull, 4 extremities, tail), several for arthropods with various # of extremities and some more for mollusks and similarly diverse animals. That's 20-30 compound images that have to be created, every one with all possible wound "overlays".
Title: Re: DFHack 0.40.13-r1
Post by: Vanst7 on October 28, 2014, 12:56:47 pm
I though about something like that at some point a few years back and made some mockups.

It would certainly make recognizing health issues at a quick glance easier, but at the very least you would have to separate mannequins for blood vessels, nervous tissue, skeletal structure, and organs plus skin to keep it reasonably clear.
Blinking could be used to denote injuries.

Spoiler: old mockups (click to show/hide)

As it has been mentioned though, this would be quite the work to do. I'd reckon you'd need 4 (as per separation mentioned above) generic mannequins for vertebrates (skull, 4 extremities, tail), several for arthropods with various # of extremities and some more for mollusks and similarly diverse animals. That's 20-30 compound images that have to be created, every one with all possible wound "overlays".

WOW CLA, this is genious! You should suggest that to Toady for the Dwarf health screen. It's amazing.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 28, 2014, 09:40:24 pm
That would be cool but it would take a LOT of work and it would only be effective for humanoid races.
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on October 29, 2014, 12:30:04 am
Couldn't you get a similar effect by just rearranging where the existing part damage indicators show up?

Have them painted on an overlay like:
-------------------Headparts
-------------------Moarheadparts
-------------------Neck
---------------Upper Body
R. Upper Arm -Spine- L. Upper Arm
R. Lower Arm -Guts-- L. Lower Arm
R. Hand ----Lower Body---- L. Hand
-------R. Upper Leg L. Upper Leg
-------R. Lower Leg L. Lower Leg
---------R. Foot ----------L. Foot
Heck, use that as a framework to put the equipment screen onto as well, so you could toggle between equipment slots/outer tissues/inner tissues, with the option to click on a body part and expand the pieces/display damaged parts maybe?

Seems like it would be easier than implementing a full graphical system atm.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on October 29, 2014, 10:00:09 am
I think for now I am going to avoid any sort of graphical representation of the creature, and just work on displaying more information about syndromes and interactions, categorizing skills, and then a little polish before releasing it
Title: Re: DFHack 0.40.13-r1
Post by: smjjames on October 29, 2014, 01:23:46 pm
Would it be possible to view, in adventure mode, other entities thoughts and emotional state like you can for fort mode?

It would be a really useful tool, not just for bug analysis, but other things too.

Edit: Well, maybe not thoughts, but seeing the emotional state of an entity should be possible.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on October 29, 2014, 03:32:04 pm
Just ask them how they're feeling, for thoughts.
Title: Re: DFHack 0.40.13-r1
Post by: smjjames on October 29, 2014, 06:31:33 pm
True, though it doesn't always seem consistent, but theres always room for improvement.
Title: Re: DFHack 0.40.13-r1
Post by: Skin36 on October 30, 2014, 02:37:51 am
Hi, is it possible to make support for input\output  Utf8 text for DFHAK ?
Title: Re: DFHack 0.40.13-r1
Post by: Rose on October 30, 2014, 03:38:56 am
I think it already does that.
Title: Re: DFHack 0.40.13-r1
Post by: Skin36 on October 30, 2014, 04:55:28 am
No, its not work

(http://f6.s.qip.ru/oHGouaIS.jpg)
Title: Re: DFHack 0.40.13-r1
Post by: palu on October 30, 2014, 10:53:13 am
Would Text Will Be Text (http://www.bay12forums.com/smf/index.php?topic=138754.0) help with that?
Title: Re: DFHack 0.40.13-r1
Post by: Skin36 on October 30, 2014, 11:08:12 am
yes TWBT help, but I need ttf output
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on October 30, 2014, 05:29:10 pm
...
Similarly, the reason DFHack doesn't use TrueType is because it doesn't support it, and the reason we don't support it is because it's too damn buggy.
Title: Re: DFHack 0.40.13-r1
Post by: palu on October 30, 2014, 05:45:12 pm
yes TWBT help, but I need ttf output
Why do you need ttf?
Title: Re: DFHack 0.40.13-r1
Post by: Skin36 on October 31, 2014, 12:45:09 am
TTF is useful because we can intercept text passed to SDL_ttf.dll and change it as we need, in order to polish the translation.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 31, 2014, 10:57:11 am
TTF is useful because we can intercept text passed to SDL_ttf.dll and change it as we need, in order to polish the translation.
There's a separate thread (http://www.bay12forums.com/smf/index.php?topic=145179) going on in the General Discussion area about attaching a screen reader to Dwarf Fortress (or more likely, the DFHack console as an interface to Dwarf Fortress).  It seems like any solution to "intercepting text sent to the screen" would be equally applicable to both situations.

Not that anyone has come up with a viable solution in that other thread yet, but it doesn't make sense for people to be re-inventing the wheel.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on October 31, 2014, 10:59:13 am
You could certainly use DFHack for things like that if you manually keep track of what viewscreen is which and where they write things to the screen. It'd be a pain but you could do it. If you do it the naive way you'd end up with garbled text for elves and dogs and humans wandering around.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 31, 2014, 11:16:56 am
You could certainly use DFHack for things like that if you manually keep track of what viewscreen is which and where they write things to the screen. It'd be a pain but you could do it. If you do it the naive way you'd end up with garbled text for elves and dogs and humans wandering around.
The map is quite definitely the biggest issue, since "reading it aloud" it is not feasible.

Apparently the norm in sound games is to have objects-of-interest emit sounds, which the game renders in locations relative to the player/cursor in stereo-or-better sound systems.  The problem is that in DF pretty much every tile is an object-of-interest.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on October 31, 2014, 11:45:41 am
I was not able to install Visual Studio Express 2010 because my computer is a piece of crap (and is going to be replaced sooner rather than later), but I realized that using "prospect all" to hunt for minerals on the embark screen is just not going to have reasonable response times.

So, that project needs to wait for me to get a compiler up and running, excise the relevant bits of prospector.cpp, and figure out a good way to implement break-loop-when-found to speed things up.

In the meantime, I did add a prospect-lite script to my mod in case anyone might find this useful.

Spoiler: tesb-prospect.lua (click to show/hide)

And a more general one:

Spoiler: lookfor.lua (click to show/hide)

The mod-specific one takes no arguments, the general one takes a list of strings to use for matching and accepts a -terse flag to report nothing but the mineral name.

lookfor -terse coal diamond ruby
DIAMOND_FY
DIAMOND_LY


Wondering if maybe -terse should be the default?  The whole point of this script is for people who consider prospect all to be cheating, but are looking for something in particular.
Title: Re: DFHack 0.40.13-r1
Post by: Dragoon209 on November 01, 2014, 09:44:36 am
Hello,

I'm setting up a computer to host Webfort, and allow users to connect and play Dwarf Fortress collectively. Link: https://github.com/Ankoku/df-webfort

It occurred to me that it would be really helpful and cool if I could extract information out of Dwarf Fortress and post to the web portal to make it easier for new players to get a grasp of what is going on in the fort, and bring previous players up to speed with what has changed.


DF Hack has a lot of really cool scripts and plugins to address most of my ideas, but I was wondering if there was a way to handle them in a fashion that makes them easier to script.  Specifically, I would need to be able to run them with dfhack-run, and point them to a directory (or at least be able to specify filenames to be sure I am moving the proper file around).  Here are my ideas:

Webfort is currently best suited for 34.11, so please keep that in mind if you have any suggestions.  I'm a bit of a hack when it comes to coding, so its most likely going to be just hosting the images and text files, and automatically replacing them via script in the background to 'refresh' them.  If anybody has any suggestions on how to best host the images and text (or at least, better than my hacky attempts), let me know!

I'll update this post in the coming day or two with a link to the fort. Ankoku and AdventureHost have a few sessions running as well if you want to see how it works.  Here is the Reddit post with the related information: http://www.reddit.com/r/dwarffortress/comments/2kh6pf/web_fortress_revival_project_urgent_help_required/
Title: Re: DFHack 0.40.13-r1
Post by: Rose on November 01, 2014, 10:56:16 am
Depending on how hard you want to work, it is technically possible to export the entire fortress once every few seconds without too much slowdown
Title: Re: DFHack 0.40.13-r1
Post by: ptb_ptb on November 01, 2014, 12:19:27 pm
So, after some effort, I managed to successfully follow instructions and compile DFHack 0.40.13-r1 from source for Windows.

Is there any way to compile an unofficial version that will work with Dwarf Fortress 0.40.14?

I would dearly love to be able to use autodump - I don't need anything else really.
Title: Re: DFHack 0.40.13-r1
Post by: Dragoon209 on November 01, 2014, 12:22:56 pm
Depending on how hard you want to work, it is technically possible to export the entire fortress once every few seconds without too much slowdown

Do you mean data, or data and Fort images?

I'm willing to spend a few hours each day learning. Do you have a place you recommend I start?
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 01, 2014, 12:52:07 pm
So, after some effort, I managed to successfully follow instructions and compile DFHack 0.40.13-r1 from source for Windows.

Is there any way to compile an unofficial version that will work with Dwarf Fortress 0.40.14?

I would dearly love to be able to use autodump - I don't need anything else really.

Both of Quietust's forks (dfhack and df-structures) appear to be up-to-date for 0.40.14. This should work from the command line (in the dfhack folder):
Code: [Select]
git remote add quietust https://github.com/quietust/dfhack
git fetch quietust
git checkout quietust/develop
cd library/xml
git remote add quietust https://github.com/quietust/df-structures
git fetch quietust
git checkout quietust/master
cd ../..
git submodule update
Title: Re: DFHack 0.40.13-r1
Post by: ptb_ptb on November 01, 2014, 01:03:39 pm
Both of Quietust's forks (dfhack and df-structures) appear to be up-to-date for 0.40.14. This should work from the command line (in the dfhack folder):
Brilliant. It's compiling now (fingers crossed).

[EDIT] Hmm, close, but not quite.  "Not a known DF version." error message on startup. Shut itself down. I guess I will just have to be patient a bit longer.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 01, 2014, 02:12:51 pm
Did you remember to update the library/xml submodule? What does "git status" display?
Title: Re: DFHack 0.40.13-r1
Post by: ptb_ptb on November 01, 2014, 02:22:43 pm
Did you remember to update the library/xml submodule? What does "git status" display?

I think so ... I followed all the steps in your list anyway.

Git status says
"HEAD detached at quietust/develop
nothing to commit, working directory clean"

I wouldn't worry about walking me through it, though. I'll just wait with the rest of the peons (j/k).
Title: Re: DFHack 0.40.13-r1
Post by: Badger Storm on November 01, 2014, 02:47:57 pm
Have any 40.14-compatible versions turned up yet?  I miss prospect and autoclean dearly, and the puddles of pus from my carpenter aren't getting any less gross.
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on November 01, 2014, 05:39:38 pm
The symbols bit isn't too hard, as an example I added this to my symbols.xml a while back and it started to load up but crashed due to it still being too early:
Code: [Select]
    <symbol-table name='v0.40.14 linux' os-type='linux'>
        <md5-hash value='8ab84807a405a7fa697847e6b3ecb00f'/>
    </symbol-table>
Got my git discovery set wrong though, need to figure out what is going on there, I'm too used to relying on pacman I guess.
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on November 01, 2014, 07:07:28 pm
Question: with createitem, how would I toss in 500 bars of coke? I tried "createitem BAR INORGANIC:Coke/COAL/COAL_REFINED/REFUNED_COAL/FUEL" but nothing gives me any.
Title: Re: DFHack 0.40.13-r1
Post by: scamtank on November 01, 2014, 07:10:50 pm
Fuel is one of those old hard-coded materials. I can't remember the createitem syntax, but in a reaction a chunk of coke would be BAR:NONE:COAL:COKE.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 01, 2014, 07:11:22 pm
createitem BAR COAL:COKE
(INORGANIC is usually not necessary, and is incorrect in this case.)


The symbols bit isn't too hard, as an example I added this to my symbols.xml a while back and it started to load up but crashed due to it still being too early:
Code: [Select]
    <symbol-table name='v0.40.14 linux' os-type='linux'>
        <md5-hash value='8ab84807a405a7fa697847e6b3ecb00f'/>
    </symbol-table>
Got my git discovery set wrong though, need to figure out what is going on there, I'm too used to relying on pacman I guess.
It crashed because, while you had a <symbol-table> entry in symbols.xml, every offset was missing. Like I said earlier, you'd need to check out a branch of dfhack and df-structures that are up-to-date for 0.40.14 (which both of Quietust's forks are) and compile DFHack from source for it to work with 0.40.14. There were significant structure changes between 0.40.13 and 0.40.14, so using an old build of DFHack will almost certainly crash when it tries to access changed structures (although the crash in your case was probably due to the missing addresses in symbols.xml).
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on November 01, 2014, 07:14:10 pm
Thank you! I have a modded metal that requires 10 bars of fuel plus the regular one for a single bar of it, plus flux and dragon bones. Trying to make a full suit of it to go with the artifact long sword of it. Yeah... With the steel industry going as well, fuel is in short amounts.
Title: Re: DFHack 0.40.13-r1
Post by: Rose on November 01, 2014, 10:03:44 pm
Depending on how hard you want to work, it is technically possible to export the entire fortress once every few seconds without too much slowdown

Do you mean data, or data and Fort images?

I'm willing to spend a few hours each day learning. Do you have a place you recommend I start?
Just the data. You would need to have a plugin that reads the map data and sends it over the network, and a client app that renders it.
Currently, Isoworld and the isoworld remote plugin do this.
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on November 01, 2014, 10:16:00 pm
what's the dfhack script to add skills to a dwarf? I really need an appraiser.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on November 01, 2014, 10:52:11 pm
I think that's in the modtools section now, just use ls -a
Title: Re: DFHack 0.40.13-r1
Post by: Max™ on November 01, 2014, 10:57:30 pm
createitem BAR COAL:COKE
(INORGANIC is usually not necessary, and is incorrect in this case.)


The symbols bit isn't too hard, as an example I added this to my symbols.xml a while back and it started to load up but crashed due to it still being too early:
Code: [Select]
    <symbol-table name='v0.40.14 linux' os-type='linux'>
        <md5-hash value='8ab84807a405a7fa697847e6b3ecb00f'/>
    </symbol-table>
Got my git discovery set wrong though, need to figure out what is going on there, I'm too used to relying on pacman I guess.
It crashed because, while you had a <symbol-table> entry in symbols.xml, every offset was missing. Like I said earlier, you'd need to check out a branch of dfhack and df-structures that are up-to-date for 0.40.14 (which both of Quietust's forks are) and compile DFHack from source for it to work with 0.40.14. There were significant structure changes between 0.40.13 and 0.40.14, so using an old build of DFHack will almost certainly crash when it tries to access changed structures (although the crash in your case was probably due to the missing addresses in symbols.xml).
Ahhhh, well, that's probably why I'm grateful for you all having the more arcane aspects handled, I suspected that nothing at all would happen, so the way it started to do the red and yellow twbt loading was a surprise. I'll have to check the git repo and see if I can smush something working together, though I'm not in a big rush due to the "oh god I miss my cousin, I'M GONNA GO PUNCH A BABY" state currently, as I'm anticipating a .15 update might not be too far away.
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on November 01, 2014, 11:28:25 pm
Well, through that, I learned how to pull up the arena mode k menu. *Suppressed squealing* Now I can toss in iron clad minotaurs and competent armies of goblins to fight my dwarves! After each good performance, my fort will get a creature to tame.

Edit: OH SHIT, OH SHIT, OH SHIT!!! Everyone started killing each other! My 108 dwarves just started tearing into one another, now I've got 43, and an iron-clad cave dragon running about.
Title: Re: DFHack 0.40.13-r1
Post by: smjjames on November 02, 2014, 11:26:25 am
Anyways, for the showing specific units emotional state, it shouldn't be too hard, I mean you have the gaydar thing and theres various ways to show unit information.
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on November 02, 2014, 03:02:47 pm
How would I add embark points with dfhack? I need more than 10k
Title: Re: DFHack 0.40.13-r1
Post by: funkydwarf on November 02, 2014, 04:42:18 pm
Add embark points in the advanced worldgen options of vanilla DF.


I hope this is ok, I managed to get a .14 version compiled by removing the manipulator and strangemood plugins, and following Lethosor's instructions. I didnt even try to compile other stuff like stonesense or isoworld.

Its for windows, and I am running an i5 if that matters, I am so ignorant on the specifics of who this may work for, i figured i would better mention it.

If this upsets anyone, I will happily take down the link, just let me know!

But reveal (and cleanall) seems to work, and thats what i need to save my dying thirsty colony, so I thought i would share it.  Thanks to the DFHack team and Quietust branch, they did the hard work, I just(barely) managed to compile something that is probably buggy and will wipe you fort, so test with a backup first people......
http://www.mediafire.com/download/nj5bd7l24efges5/dfhack-0.40.14-r0-Windows.zip
Title: Re: DFHack 0.40.13-r1
Post by: LeoCean on November 02, 2014, 04:50:33 pm
dwarves.rb - type "dwarves #" at the embark selector/map before you embark. It will raise your starting dwarves to the number you entered.

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'))

points.lua - type "points #" at the embark selector/map before you embark. It will raise your embark points to that number.
Code: [Select]
df.global.world.worldgen.worldgen_parms.embark_points=tonumber(...)

The dwarf count one is outdated though, but I do know of a working one. For 40.13 anyways. Or you can use cheat engine to modify any of the points in that menu.
Title: Re: DFHack 0.40.13-r1
Post by: StagnantSoul on November 02, 2014, 05:06:09 pm
Thanks.,
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 02, 2014, 05:20:59 pm
Add embark points in the advanced worldgen options of vanilla DF.

I don't think that's what StagnantSoul is looking for:
How would I add embark points with dfhack? I need more than 10k


Quote

I hope this is ok, I managed to get a .14 version compiled by removing the manipulator and strangemood plugins, and following Lethosor's instructions. I didnt even try to compile other stuff like stonesense or isoworld.

Its for windows, and I am running an i5 if that matters, I am so ignorant on the specifics of who this may work for, i figured i would better mention it.

If this upsets anyone, I will happily take down the link, just let me know!

But reveal (and cleanall) seems to work, and thats what i need to save my dying thirsty colony, so I thought i would share it.  Thanks to the DFHack team and Quietust branch, they did the hard work, I just(barely) managed to compile something that is probably buggy and will wipe you fort, so test with a backup first people......
http://www.mediafire.com/download/nj5bd7l24efges5/dfhack-0.40.14-r0-Windows.zip
If you had to remove manipulator and strangemood, you're doing something wrong - those plugins should work if you use the develop branch of DFHack/dfhack (since all 0.40.14 development has now been merged into it). Quietust's develop branch appears to include the changes necessary for these plugins to compile as well (although DFHack:develop is more up-to-date).



dwarves.rb - type "dwarves #" at the embark selector/map before you embark. It will raise your starting dwarves to the number you entered.

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'))

points.lua - type "points #" at the embark selector/map before you embark. It will raise your embark points to that number.
Code: [Select]
df.global.world.worldgen.worldgen_parms.embark_points=tonumber(...)

The dwarf count one is outdated though, but I do know of a working one. For 40.13 anyways. Or you can use cheat engine to modify any of the points in that menu.
That "dwarves" script is exactly the same as the "startdwarf" script included with DFHack since at least 0.34.11-r3, which certainly works (assuming you have the start_dwarf_count offset in symbols.xml).
Edit: Of course, it's a ruby script, not a lua script.
Title: Re: DFHack 0.40.13-r1
Post by: sv-esk on November 03, 2014, 08:40:54 am
If you had to remove manipulator and strangemood, you're doing something wrong
It was  'stress_level'  errors. Yesterday I tried to compile and had these errors too:
..\..\..\plugins\strangemood.cpp(637): error C2039: 'stress_level' : is not a member of 'df::unit_personality'
__
Today I compiled it without errors(stonesense disabled). And many tools seems to work fine.
It might be very buggy. Use at your own risk for testing and fooling around with a fortress you don't care about much:
http://www.mediafire.com/download/c1mntxtnq06vzk1/dfhack-0.40.14-r0-Windows-3.11.zip (http://www.mediafire.com/download/c1mntxtnq06vzk1/dfhack-0.40.14-r0-Windows-3.11.zip)(edit: outdated)
Title: Re: DFHack 0.40.13-r1
Post by: Sappho on November 03, 2014, 09:41:40 am
Using 40.13 with the latest version of DFHack, I'm getting error messages with adventure mode commands. It won't let me bodyswap or use advtools. I get the message that it's not a recognized command. Are these commands broken? Is there anything I can do?
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on November 03, 2014, 10:53:21 am
Using 40.13 with the latest version of DFHack, I'm getting error messages with adventure mode commands. It won't let me bodyswap or use advtools. I get the message that it's not a recognized command. Are these commands broken? Is there anything I can do?
Those commands were disabled in version 0.40 because they use variables whose locations are no longer known, and we didn't have time to fix them.
Title: Re: DFHack 0.40.13-r1
Post by: Sappho on November 03, 2014, 01:20:32 pm
:C

So the Readme is really out of date... Thanks for answering, anyway. Is that likely to change?
Title: Re: DFHack 0.40.13-r1
Post by: necrotic on November 03, 2014, 02:48:02 pm
If you had to remove manipulator and strangemood, you're doing something wrong
It was  'stress_level'  errors. Yesterday I tried to compile and had these errors too:
..\..\..\plugins\strangemood.cpp(637): error C2039: 'stress_level' : is not a member of 'df::unit_personality'
__
Today I compiled it without errors(stonesense disabled). And many tools seems to work fine.
It might be very buggy. Use at your own risk for testing and fooling around with a fortress you don't care about much:
http://www.mediafire.com/download/c1mntxtnq06vzk1/dfhack-0.40.14-r0-Windows-3.11.zip (http://www.mediafire.com/download/c1mntxtnq06vzk1/dfhack-0.40.14-r0-Windows-3.11.zip)

Weird, I built it on OSX last night and had no issues with manipulator or strangemood when building. And manipulator worked great in-game.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 03, 2014, 02:59:43 pm
If you had to remove manipulator and strangemood, you're doing something wrong
It was  'stress_level'  errors. Yesterday I tried to compile and had these errors too:
..\..\..\plugins\strangemood.cpp(637): error C2039: 'stress_level' : is not a member of 'df::unit_personality'
__
Today I compiled it without errors(stonesense disabled). And many tools seems to work fine.
It might be very buggy. Use at your own risk for testing and fooling around with a fortress you don't care about much:
http://www.mediafire.com/download/c1mntxtnq06vzk1/dfhack-0.40.14-r0-Windows-3.11.zip (http://www.mediafire.com/download/c1mntxtnq06vzk1/dfhack-0.40.14-r0-Windows-3.11.zip)
Oh, you need to update the library/xml submodule with "git submodule update". Git doesn't automatically check out new versions of submodules, even when the parent repo (dfhack) points to them (although it will often fetch new submodule commits to make it easier to check them out later). This is useful for developers, since it allows us to work on df-structures and dfhack separately (without the risk of losing submodule content when the dfhack repo is updated), but it can be confusing if you're only trying to compile a branch that requires different submodule commits. You should always run "git status" after changing branches, then "git submodule update" if any submodules are listed.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on November 04, 2014, 10:57:43 am
Is there some simple way to detect if a tile has been touched by (or submerged in) magma?  I'm trying to hack in a property for an unmined mineral, but I'm sure a solution would be applicable in lots of other areas as well.

The complicated way would be to:

1. Locate all specks of the mineral when the map is loaded.  Somehow store that information so that it persists for the session.
2. Every N ticks, check each speck to make sure it's still unmined.  Remove mined ones from the list of specks.
3. Check the tiles surrounding each speck for magma.  Could be 6, 18 or 26 tiles depending on how diagonals are handled.
4. If magma is found in the right place, remove the tile, spawn a creature in its place, and make an appropriate announcement.
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on November 04, 2014, 11:25:58 am
There are some temperature update flags you could look at to avoid checking most map tile blocks. You could also keep track of dig job completions to find mined tiles.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on November 04, 2014, 12:03:10 pm
There are some temperature update flags you could look at to avoid checking most map tile blocks. You could also keep track of dig job completions to find mined tiles.
The temperature update might help, but since I don't want to run this every tick, maybe check the actual temperature instead?  "Warm stone" is 10075, so if the temperature is >= 10075 then that's pretty good evidence of magma.

Ideally, I could spawn a persistent structure for each mineral type (there are 24 distinct special minerals, but they won't all exist on the same map) that contains:


Though unlikely to happen in a real game, the structure should deconstruct itself gracefully if the last speck is removed from the list.

The initial scan that sets up the structures will be in charge of spacing out the checks over N ticks.  Not sure if last two digits of the time or last byte of the time (255 slices) would be more appropriate.  I think updating this once per load is reasonable.

I'm not aware of any way to keep a persistent list in a script, so actually building it would need to wait for my new machine to create a DFHack plug-in.
Title: Re: DFHack 0.40.13-r1
Post by: Badger Storm on November 04, 2014, 04:58:04 pm
Has anyone else tried the above compiled version on OSX yet?  I miss DFHack but I don't feel confident in testing it out for myself.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 04, 2014, 05:04:24 pm
The build sv-esk posted is Windows-only.
Title: Re: DFHack 0.40.13-r1
Post by: Kazimuth on November 04, 2014, 06:05:22 pm
I have a DFHack API question: what's the difference between Maps::getBlock and Maps::getTileBlock? The only change I can see is that getTileBlock right-shifts its x and y indices by 4...
Also, how long will the return values of these functions be valid? They're just pointers into df::world.map.map_blocks, right? Will that ever shift its entries around?
Title: Re: DFHack 0.40.13-r1
Post by: mifki on November 04, 2014, 06:39:30 pm
Quiver base value should be 20 instead of 10 in getItemBaseValue(), isn't it?
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 04, 2014, 07:00:37 pm
I have a DFHack API question: what's the difference between Maps::getBlock and Maps::getTileBlock? The only change I can see is that getTileBlock right-shifts its x and y indices by 4...
Going by that information, getTileBlock takes the coordinates of an individual tile, while getBlock takes the position of a (16x16 tile) map block.
Title: Re: DFHack 0.40.13-r1
Post by: Kazimuth on November 04, 2014, 07:42:36 pm
I have a DFHack API question: what's the difference between Maps::getBlock and Maps::getTileBlock? The only change I can see is that getTileBlock right-shifts its x and y indices by 4...
Going by that information, getTileBlock takes the coordinates of an individual tile, while getBlock takes the position of a (16x16 tile) map block.
I would guess something like that, except they both return a df::map_block*, and index into the same array. And each map_block seems to have a 16x16 array of tiles in it?
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 04, 2014, 07:45:17 pm
A map block consists of a 16x16(x1) array of tiles. getTileBlock() returns the map block that contains a specific tile, while getBlock() returns a specific block.

Edit:
Spoiler: Example (click to show/hide)
getTileBlock(1,1,0) returns the block containing the red tile, while getBlock(1,1,0) returns the blue block.

Edit (Sep 4 2016): Added z-levels, heh
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on November 04, 2014, 07:56:50 pm
Quiver base value should be 20 instead of 10 in getItemBaseValue(), isn't it?
No, because the base item value actually is 10...
Title: Re: DFHack 0.40.13-r1
Post by: Kazimuth on November 04, 2014, 08:06:31 pm
A map block consists of a 16x16(x1) array of tiles. getTileBlock() returns the map block that contains a specific tile, while getBlock() returns a specific block.

Edit:
Spoiler: Example (click to show/hide)
getTileBlock(1,1) returns the block containing the red tile, while getBlock(1,1) returns the blue block.
Ohhh, okay. Duh. Thank you!
Title: Re: DFHack 0.40.13-r1
Post by: mifki on November 04, 2014, 08:11:25 pm
Quiver base value should be 20 instead of 10 in getItemBaseValue(), isn't it?
No, because the base item value actually is 10...

Hmm.. I compare what Items::getValue() returns with what trade screen shows and *all* values are the same except for quivers.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 04, 2014, 08:23:57 pm
Is it possible that trade agreements are affecting the prices you see? Do you see the same values for items outside of the depot?
Title: Re: DFHack 0.40.13-r1
Post by: Quietust on November 04, 2014, 08:25:43 pm
Don't look at the value in the Trade screen, since it's adjusted by trade agreements - look at the value in the item description screen.
Title: Re: DFHack 0.40.13-r1
Post by: mifki on November 04, 2014, 08:46:00 pm
Oh maybe I forgot about an agreement with humans. I'll check once I get home, thanks.

EDIT: So when a caravan arrives and I meet to discuss trade agreement, on the [c]ivs screen I will see new agreement for the next year but prices for the caravan will be set according to the previous agreement, right?
Anyway, I don't have that specific save anymore, so let's assume it was an agreement indeed.
Title: Re: DFHack 0.40.13-r1
Post by: nekoexmachina on November 05, 2014, 03:13:24 am
-development branch, commit id 272aa5d, works on Linux as expected. No patching/turning features on & off (stonesense disabled by-default).
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on November 05, 2014, 10:24:29 am
I'm planning on a release very soon. It will be missing most of the things on my todo list. I'll do an r2 later for those.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on November 05, 2014, 11:34:53 am
@expwnent

Before I get to working on my spells I wanted to make sure that the system works the way I think it does, basically, if I have this
Code: [Select]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ add-syndrome -unit \\DEFENDER_ID -syndrome BURN ]
modtools/interaction-trigger -onAttachStr "casts burn" -command [ add-syndrome -unit \\ATTACKER_ID -syndrome SPELL_CAST ]
in onLoad.init, and a unit uses an interaction with the "casts burn" CDI:VERB, will both effects be triggered?
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on November 05, 2014, 12:39:10 pm
That is the intended usage, yes. It may or may not be broken. I forget if that was one of the broken things or not.
Title: Re: DFHack 0.40.13-r1
Post by: Roses on November 05, 2014, 12:59:19 pm
That is the intended usage, yes. It may or may not be broken. I forget if that was one of the broken things or not.

As long as that's the intended usage then I will base my work off of that. Thanks!
Title: Re: DFHack 0.40.13-r1
Post by: Sappho on November 05, 2014, 01:35:52 pm
Is there any command or script that will create a mob on the map? I need to create some zombies without having to actually travel across the map and bring some zombies there. It's for a story. I don't see any such command in the readme, but I know it's not 100% up to date, so I remain hopeful.

For the same reason, is there a way to make my character in adventure mode invincible, or at least increase the skills? I've seen scripts that seem to allow changing values of skills, but I have no idea how to use them. Please pardon my ignorance. I haven't played DF in ages and right now I'm just trying to get this story done.

(Failing that, is there any other mod or utility that will let me do this? I'm trying to get my next video out but it's not working at all as planned.)

Thank you!!
Title: Re: DFHack 0.40.13-r1
Post by: Rogue Yun on November 05, 2014, 02:27:01 pm
First off, I love dfhack and I don't know what I would do without it. It is a powerful and awesome tool. Thank you so much!

Second off, I have run into some bugs and I am hoping this is the right place to report them. If not, kindly point me in the right direction.

First Bug: I've noticed that the workflow plugin seems to have a limited number of entries that it can take before hanging? You can duplicate this error by running a bash script with multiple (~320) entries of "./dfhack-run workflow amount X 2 1" Where X # # is a new and different item to be produced. Exiting the game with the "die" command or the conventional way results with repetitions of the following error for each workflow command that didn't execute:
Code: [Select]
Could not connect to localhost: 5000
Here is an absolutely horrid script, but you can use/customize it to test it if you like.
Code: [Select]
#!/bin/bash
#workflow.sh
cd ~/PATH/TO/DF

#Reset stuff
./dfhack-run workflow enable
./dfhack-run workflow enable drybuckets
./dfhack-run workflow enable auto-melt
./dfhack-run workflow unlimit-all
./dfhack-run autobutcher stop
./dfhack-run autobutcher forget all

#Autobutcher 10 f kids, 10 m kids, 4 f adults, 2 m adults
./dfhack-run autobutcher target 6 3 3 1 all
./dfhack-run autobutcher autowatch
./dfhack-run autobutcher start

#OTHER COMMANDS
./dfhack-run autolabor 1
./dfhack-run seedwatch all 30
./dfhack-run getplants HEMP REED_ROPE
./dfhack-run getplants BERRY_SUN BERRIES_FISHER BERRIES_PRICKLE
./dfhack-run getplants BEET POTATO RADISH TURNIP KANIWA QUINOA FINGER_MILLET WILD_CARROT

#FOOD
./dfhack-run workflow amount DRINK 1000 500
./dfhack-run workflow amount FOOD 1000 500

############
## Farmer ##
############

./dfhack-run workflow amount THREAD 1000 500
./dfhack-run workflow amount LIQUID_MISC/MILK 1000 500
./dfhack-run workflow amount CHEESE 1000 500


###########
## Quern ##
###########

./dfhack-run workflow amount POWDER_MISC//MUSHROOM_CUP_DIMPLE:MILL 2 1
./dfhack-run workflow amount POWDER_MISC//GRASS_WHEAT_CAVE:MILL 2 1
./dfhack-run workflow amount GLOB 10 5

## Tools, Furniture, and Construction ##

./dfhack-run workflow amount BLOCKS/WOOD 2 1
./dfhack-run workflow amount BLOCKS/STONE,METAL 200 100

./dfhack-run workflow amount BOX/CLOTH,YARN,SILK,LEATHER 2 1
./dfhack-run workflow amount BOX/WOOD,STONE,METAL 2 1

./dfhack-run workflow amount ANIMALTRAP 2 1
./dfhack-run workflow amount BARREL 2 1
./dfhack-run workflow amount BIN 2 1
./dfhack-run workflow amount BUCKET 2 1

## Furniture and Construction ##
./dfhack-run workflow amount ANVIL 2 1
./dfhack-run workflow amount ARMORSTAND 2 1
./dfhack-run workflow amount BED 2 1
./dfhack-run workflow amount CABINET 2 1
./dfhack-run workflow amount CHAIN 2 1
./dfhack-run workflow amount CHAIR 2 1
./dfhack-run workflow amount COFFIN 2 1
./dfhack-run workflow amount DOOR 2 1
./dfhack-run workflow amount FLOODGATE 2 1
./dfhack-run workflow amount HATCH_COVER 2 1
./dfhack-run workflow amount GRATE 2 1
./dfhack-run workflow amount MILLSTONE 2 1
./dfhack-run workflow amount QUERN 2 1
./dfhack-run workflow amount SLAB 2 1
./dfhack-run workflow amount STATUE 2 1
./dfhack-run workflow amount TABLE 2 1
./dfhack-run workflow amount WEAPONRACK 2 1

./dfhack-run workflow amount TRAPPARTS 2 1
./dfhack-run workflow amount CAGE 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_ENORMOUSCORKSCREW 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_GIANTAXEBLADE 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_LARGESERRATEDDISC 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_MENACINGSPIKE 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_SPIKEDBALL 2 1

./dfhack-run workflow amount PIPE_SECTION 2 1

./dfhack-run workflow amount TOOL:ITEM_TOOL_MINECART 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_WHEELBARROW 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_NEST_BOX 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_JUG 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_LARGE_POT 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_HIVE 2 1

./dfhack-run workflow amount CRUTCH 2 1
./dfhack-run workflow amount SPLINT 2 1
./dfhack-run workflow amount TRACTION_BENCH 2 1

## Trade Goods ##

./dfhack-run workflow amount COIN 1000 500
./dfhack-run workflow amount CRAFTS 1000 500
./dfhack-run workflow amount GOBLET 1000 500
./dfhack-run workflow amount INSTRUMENT 1000 500
./dfhack-run workflow amount TOTEM 1000 500
./dfhack-run workflow amount TOY 1000 500

./dfhack-run workflow amount THREAD 1000 500
#./dfhack-run workflow amount THREAD//INORGANIC:ADAMANTINE 2 1
./dfhack-run workflow amount CLOTH/PLANT 2 1
./dfhack-run workflow amount CLOTH/SILK 2 1
./dfhack-run workflow amount CLOTH/YARN 2 1
./dfhack-run workflow amount CLOTH//INORGANIC 2 1

## Armor ##
./dfhack-run workflow amount SHIELD:ITEM_SHIELD_SHIELD 2 1
./dfhack-run workflow amount SHIELD:ITEM_SHIELD_BUCKLER 2 1

./dfhack-run workflow amount ARMOR:ITEM_ARMOR_DRESS 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_SHIRT 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_COAT 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_VEST 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_ROBE 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_CLOAK 2 1

./dfhack-run workflow amount ARMOR:ITEM_ARMOR_LEATHER 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_MAIL_SHIRT 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_BREASTPLATE 2 1

./dfhack-run workflow amount PANTS:ITEM_PANTS_PANTS 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_LEGGINGS 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_GREAVES 2 1

./dfhack-run workflow amount SHOES:ITEM_SHOES_BOOTS 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_BOOTS_LOW 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_SOCKS 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_SHOES 4 2

./dfhack-run workflow amount HELM:ITEM_HELM_CAP 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_HELM 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_HOOD 2 1

./dfhack-run workflow amount GLOVES:ITEM_GLOVES_GLOVES 4 2
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_MITTENS 4 2
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_GAUNTLETS 4 2

## Weapons ##
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_PICK 2 1

./dfhack-run workflow amount WEAPON:ITEM_WEAPON_SPEAR_TRAINING 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_SWORD_SHORT_TRAINING 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_AXE_TRAINING 2 1

./dfhack-run workflow amount WEAPON:ITEM_WEAPON_SWORD_SHORT/STONE 2 1

./dfhack-run workflow amount WEAPON:ITEM_WEAPON_MACE 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_SPEAR 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_SWORD_SHORT 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_HAMMER_WAR 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_AXE_BATTLE 2 1

./dfhack-run workflow amount WEAPON:ITEM_WEAPON_CROSSBOW 2 1
./dfhack-run workflow amount AMMO:ITEM_AMMO_BOLTS/WOOD,BONE 200 100
./dfhack-run workflow amount AMMO:ITEM_AMMO_BOLTS/METAL 200 100

## Military Misc ##
./dfhack-run workflow amount FLASK 2 1
./dfhack-run workflow amount BACKPACK 2 1
./dfhack-run workflow amount QUIVER 2 1

## Other ##
./dfhack-run workflow amount SMALLGEM 2 1

./dfhack-run workflow amount BALLISTAARROWHEAD 2 1

###########
## GLASS ##
###########

./dfhack-run workflow amount POWDER_MISC/SAND 100 50
./dfhack-run workflow amount BLOCKS/GLASS 200 100

##################
## Wood Furnace ##
##################

./dfhack-run workflow amount BAR//ASH 4 2
./dfhack-run workflow amount BAR//COAL 8 4


#############
## Smelter ##
#############

./dfhack-run workflow amount BAR//INORGANIC:COPPER 4 2
./dfhack-run workflow amount BAR//INORGANIC:SILVER 4 2

./dfhack-run workflow amount BAR//INORGANIC:BRONZE 4 2
./dfhack-run workflow amount BAR//INORGANIC:BISMUTH 4 2
./dfhack-run workflow amount BAR//INORGANIC:BISMUTH_BRONZE 4 2

./dfhack-run workflow amount BAR//INORGANIC:IRON 4 2
./dfhack-run workflow amount BAR//INORGANIC:PIG_IRON 4 2
./dfhack-run workflow amount BAR//INORGANIC:STEEL 4 2

./dfhack-run workflow amount BAR//INORGANIC:PLATINUM 4 2

./dfhack-run workflow amount BAR//INORGANIC:GOLD 4 2
./dfhack-run workflow amount BAR//INORGANIC:NICKEL 4 2
./dfhack-run workflow amount BAR//INORGANIC:ZINC 4 2
./dfhack-run workflow amount BAR//INORGANIC:BRASS 4 2
./dfhack-run workflow amount BAR//INORGANIC:ELECTRUM 4 2
./dfhack-run workflow amount BAR//INORGANIC:TIN 4 2
./dfhack-run workflow amount BAR//INORGANIC:PEWTER_FINE 4 2
./dfhack-run workflow amount BAR//INORGANIC:PEWTER_TRIFLE 4 2
./dfhack-run workflow amount BAR//INORGANIC:PEWTER_LAY 4 2
./dfhack-run workflow amount BAR//INORGANIC:ALUMINUM 4 2
./dfhack-run workflow amount BAR//INORGANIC:LEAD 4 2
./dfhack-run workflow amount BAR//INORGANIC:NICKEL_SILVER 4 2
./dfhack-run workflow amount BAR//INORGANIC:BILLON 4 2
./dfhack-run workflow amount BAR//INORGANIC:STERLING_SILVER 4 2
./dfhack-run workflow amount BAR//INORGANIC:BLACK_BRONZE 4 2
./dfhack-run workflow amount BAR//INORGANIC:ROSE_GOLD 4 2

#Containers
./dfhack-run workflow amount BARREL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_LARGE_POT 2 1
./dfhack-run workflow amount BIN 2 1
./dfhack-run workflow amount BOX/CLOTH 20 10
./dfhack-run workflow amount TOOL:ITEM_TOOL_JUG 2 1

#Furniture
./dfhack-run workflow amount BED///LOCAL,EXCEPTIONAL 2 1
./dfhack-run workflow amount DOOR///LOCAL,EXCEPTIONAL 2 1
./dfhack-run workflow amount TABLE///LOCAL,EXCEPTIONAL 2 1
./dfhack-run workflow amount CHAIR///LOCAL,EXCEPTIONAL 2 1
./dfhack-run workflow amount ARMORSTAND///LOCAL,EXCEPTIONAL 2 1
./dfhack-run workflow amount WEAPONRACK///LOCAL,EXCEPTIONAL 2 1
./dfhack-run workflow amount CABINET///LOCAL,EXCEPTIONAL 2 1
./dfhack-run workflow amount BOX/STONE//LOCAL,EXCEPTIONAL 2 1
./dfhack-run workflow amount COFFIN 2 1
./dfhack-run workflow amount SLAB 2 1
./dfhack-run workflow amount STATUE 2 1
./dfhack-run workflow amount WINDOW 2 1
./dfhack-run workflow amount GRATE 2 1
./dfhack-run workflow amount HATCH_COVER 2 1
./dfhack-run workflow amount FLOODGATE 2 1

./dfhack-run workflow amount CHAIN 2 1

#Workshop Carpenter
./dfhack-run workflow amount BED/WOOD 2 1
./dfhack-run workflow amount DOOR/WOOD 2 1
./dfhack-run workflow amount TABLE/WOOD 2 1
./dfhack-run workflow amount CHAIR/WOOD 2 1
./dfhack-run workflow amount ARMORSTAND/WOOD 2 1
./dfhack-run workflow amount WEAPONRACK/WOOD 2 1
./dfhack-run workflow amount CABINET/WOOD 2 1
./dfhack-run workflow amount BOX/WOOD 2 1
./dfhack-run workflow amount COFFIN/WOOD 2 1

#Tools
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_PICK 2 1
./dfhack-run workflow amount BUCKET 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_MINECART 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_WHEELBARROW 2 1

#Traps
./dfhack-run workflow amount CAGE 10 5
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_ENORMOUSCORKSCREW 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_SPIKEDBALL 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_MENACINGSPIKE 2 1

#Consumables
./dfhack-run workflow amount THREAD 1000 500
./dfhack-run workflow amount CLOTH/PLANT 1000 500

./dfhack-run workflow amount CORPSEPIECE/YARN 1000 500
./dfhack-run workflow amount CLOTH/YARN 1000 500

#Construction
./dfhack-run workflow amount BLOCKS 1000 500
./dfhack-run workflow amount TRAPPARTS 20 10
./dfhack-run workflow amount PIPE_SECTION 2 1
./dfhack-run workflow amount QUERN 2 1
./dfhack-run workflow amount MILLSTONE 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_NEST_BOX 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_HIVE 2 1

#Construction Wood
./dfhack-run workflow amount BLOCKS/WOOD 2 1

#Gear
./dfhack-run workflow amount FLASK 10 5
./dfhack-run workflow amount BACKPACK 10 5
./dfhack-run workflow amount QUIVER 10 5


#Weapons Copper
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_AXE_BATTLE//INORGANIC:COPPER 2 1

#Weapons Ranged
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_CROSSBOW 10 5
./dfhack-run workflow amount AMMO:ITEM_AMMO_BOLTS/METAL 1000 500
./dfhack-run workflow amount AMMO:ITEM_AMMO_BOLTS/WOOD,BONE 200 100

#Trade Goods
./dfhack-run workflow amount TOTEM 1000 500
./dfhack-run workflow amount TOY 1000 500
./dfhack-run workflow amount CRAFTS 1000 500
./dfhack-run workflow amount GOBLET 1000 500
./dfhack-run workflow amount INSTRUMENT 1000 500

#Jewels
./dfhack-run workflow amount ROUGH 1000 500

#Hospital
./dfhack-run workflow amount CRUTCH 4 2
./dfhack-run workflow amount SPLINT 4 2
./dfhack-run workflow amount TRACTION_BENCH 2 1

#Soap
./dfhack-run workflow amount BAR//ASH 10 5
./dfhack-run workflow amount LIQUID_MISC//LYE 10 5
./dfhack-run workflow amount BAR/SOAP 4 2

#Farming
./dfhack-run workflow amount BAR//POTASH 20 10

#Glass
./dfhack-run workflow amount POWDER_MISC/SAND 100 50
./dfhack-run workflow amount SMALLGEM 1000 500

#Clay Pottery
./dfhack-run workflow amount BOULDER/CLAY 20 10

#Dye
./dfhack-run workflow amount POWDER_MISC//MUSHROOM_CUP_DIMPLE:MILL 1000 500

#Fuel
./dfhack-run workflow amount BAR//COAL 40 20

#Smithing
./dfhack-run workflow amount BAR//INORGANIC:COPPER 4 2
./dfhack-run workflow amount BAR//INORGANIC:SILVER 4 2
./dfhack-run workflow amount BAR//INORGANIC:IRON 4 2
./dfhack-run workflow amount BAR//INORGANIC:STEEL 4 2
./dfhack-run workflow amount BAR//INORGANIC:BRONZE 4 2

#Forge

#Weapons Bronze
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_AXE_BATTLE//INORGANIC:BRONZE/LOCAL,MASTERFUL 2 1

#Weapons Steel
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_AXE_BATTLE//INORGANIC:STEEL/LOCAL,MASTERFUL 2 1

#Trap Parts Steel
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_MENACINGSPIKE//INORGANIC:STEEL/LOCAL,MASTERFUL 2 1


## Furniture Iron ##

./dfhack-run workflow amount CAGE//INORGANIC:IRON 2 1
./dfhack-run workflow amount CHAIN//INORGANIC:IRON 2 1
./dfhack-run workflow amount ANIMALTRAP//INORGANIC:IRON 2 1
./dfhack-run workflow amount BUCKET//INORGANIC:IRON 2 1
./dfhack-run workflow amount BARREL//INORGANIC:IRON 2 1
./dfhack-run workflow amount ARMORSTAND//INORGANIC:IRON 2 1
./dfhack-run workflow amount BLOCKS//INORGANIC:IRON 16 8
./dfhack-run workflow amount DOOR//INORGANIC:IRON 2 1
./dfhack-run workflow amount FLOODGATE//INORGANIC:IRON 2 1
./dfhack-run workflow amount HATCH_COVER//INORGANIC:IRON 2 1
./dfhack-run workflow amount GRATE//INORGANIC:IRON 2 1
./dfhack-run workflow amount STATUE//INORGANIC:IRON 2 1
./dfhack-run workflow amount CABINET//INORGANIC:IRON 2 1
./dfhack-run workflow amount BOX//INORGANIC:IRON 2 1
./dfhack-run workflow amount CHAIR//INORGANIC:IRON 2 1
./dfhack-run workflow amount COFFIN//INORGANIC:IRON 2 1
./dfhack-run workflow amount TABLE//INORGANIC:IRON 2 1
./dfhack-run workflow amount WEAPONRACK//INORGANIC:IRON 2 1
./dfhack-run workflow amount BIN//INORGANIC:IRON 2 1
./dfhack-run workflow amount PIPE_SECTION//INORGANIC:IRON 2 1
./dfhack-run workflow amount SPLINT//INORGANIC:IRON 2 1
./dfhack-run workflow amount CRUTCH//INORGANIC:IRON 2 1

## Furniture GOLD ##

./dfhack-run workflow amount CAGE//INORGANIC:GOLD 2 1
./dfhack-run workflow amount CHAIN//INORGANIC:GOLD 2 1
./dfhack-run workflow amount ANIMALTRAP//INORGANIC:GOLD 2 1
./dfhack-run workflow amount BUCKET//INORGANIC:GOLD 2 1
./dfhack-run workflow amount BARREL//INORGANIC:GOLD 2 1
./dfhack-run workflow amount ARMORSTAND//INORGANIC:GOLD 2 1
./dfhack-run workflow amount BLOCKS//INORGANIC:GOLD 16 8
./dfhack-run workflow amount DOOR//INORGANIC:GOLD 2 1
./dfhack-run workflow amount FLOODGATE//INORGANIC:GOLD 2 1
./dfhack-run workflow amount HATCH_COVER//INORGANIC:GOLD 2 1
./dfhack-run workflow amount GRATE//INORGANIC:GOLD 2 1
./dfhack-run workflow amount STATUE//INORGANIC:GOLD 2 1
./dfhack-run workflow amount CABINET//INORGANIC:GOLD 2 1
./dfhack-run workflow amount BOX//INORGANIC:GOLD 2 1
./dfhack-run workflow amount CHAIR//INORGANIC:GOLD 2 1
./dfhack-run workflow amount COFFIN//INORGANIC:GOLD 2 1
./dfhack-run workflow amount TABLE//INORGANIC:GOLD 2 1
./dfhack-run workflow amount WEAPONRACK//INORGANIC:GOLD 2 1
./dfhack-run workflow amount BIN//INORGANIC:GOLD 2 1
./dfhack-run workflow amount PIPE_SECTION//INORGANIC:GOLD 2 1
./dfhack-run workflow amount SPLINT//INORGANIC:GOLD 2 1
./dfhack-run workflow amount CRUTCH//INORGANIC:GOLD 2 1

## Furniture SILVER ##

./dfhack-run workflow amount CAGE//INORGANIC:SILVER 2 1
./dfhack-run workflow amount CHAIN//INORGANIC:SILVER 2 1
./dfhack-run workflow amount ANIMALTRAP//INORGANIC:SILVER 2 1
./dfhack-run workflow amount BUCKET//INORGANIC:SILVER 2 1
./dfhack-run workflow amount BARREL//INORGANIC:SILVER 2 1
./dfhack-run workflow amount ARMORSTAND//INORGANIC:SILVER 2 1
./dfhack-run workflow amount BLOCKS//INORGANIC:SILVER 16 8
./dfhack-run workflow amount DOOR//INORGANIC:SILVER 2 1
./dfhack-run workflow amount FLOODGATE//INORGANIC:SILVER 2 1
./dfhack-run workflow amount HATCH_COVER//INORGANIC:SILVER 2 1
./dfhack-run workflow amount GRATE//INORGANIC:SILVER 2 1
./dfhack-run workflow amount STATUE//INORGANIC:SILVER 2 1
./dfhack-run workflow amount CABINET//INORGANIC:SILVER 2 1
./dfhack-run workflow amount BOX//INORGANIC:SILVER 2 1
./dfhack-run workflow amount CHAIR//INORGANIC:SILVER 2 1
./dfhack-run workflow amount COFFIN//INORGANIC:SILVER 2 1
./dfhack-run workflow amount TABLE//INORGANIC:SILVER 2 1
./dfhack-run workflow amount WEAPONRACK//INORGANIC:SILVER 2 1
./dfhack-run workflow amount BIN//INORGANIC:SILVER 2 1
./dfhack-run workflow amount PIPE_SECTION//INORGANIC:SILVER 2 1
./dfhack-run workflow amount SPLINT//INORGANIC:SILVER 2 1
./dfhack-run workflow amount CRUTCH//INORGANIC:SILVER 2 1

## Furniture COPPER ##

./dfhack-run workflow amount CAGE//INORGANIC:COPPER 2 1
./dfhack-run workflow amount CHAIN//INORGANIC:COPPER 2 1
./dfhack-run workflow amount ANIMALTRAP//INORGANIC:COPPER 2 1
./dfhack-run workflow amount BUCKET//INORGANIC:COPPER 2 1
./dfhack-run workflow amount BARREL//INORGANIC:COPPER 2 1
./dfhack-run workflow amount ARMORSTAND//INORGANIC:COPPER 2 1
./dfhack-run workflow amount BLOCKS//INORGANIC:COPPER 16 8
./dfhack-run workflow amount DOOR//INORGANIC:COPPER 2 1
./dfhack-run workflow amount FLOODGATE//INORGANIC:COPPER 2 1
./dfhack-run workflow amount HATCH_COVER//INORGANIC:COPPER 2 1
./dfhack-run workflow amount GRATE//INORGANIC:COPPER 2 1
./dfhack-run workflow amount STATUE//INORGANIC:COPPER 2 1
./dfhack-run workflow amount CABINET//INORGANIC:COPPER 2 1
./dfhack-run workflow amount BOX//INORGANIC:COPPER 2 1
./dfhack-run workflow amount CHAIR//INORGANIC:COPPER 2 1
./dfhack-run workflow amount COFFIN//INORGANIC:COPPER 2 1
./dfhack-run workflow amount TABLE//INORGANIC:COPPER 2 1
./dfhack-run workflow amount WEAPONRACK//INORGANIC:COPPER 2 1
./dfhack-run workflow amount BIN//INORGANIC:COPPER 2 1
./dfhack-run workflow amount PIPE_SECTION//INORGANIC:COPPER 2 1
./dfhack-run workflow amount SPLINT//INORGANIC:COPPER 2 1
./dfhack-run workflow amount CRUTCH//INORGANIC:COPPER 2 1

## Furniture STEEL ##

./dfhack-run workflow amount CAGE//INORGANIC:STEEL 2 1
./dfhack-run workflow amount CHAIN//INORGANIC:STEEL 2 1
./dfhack-run workflow amount ANIMALTRAP//INORGANIC:STEEL 2 1
./dfhack-run workflow amount BUCKET//INORGANIC:STEEL 2 1
./dfhack-run workflow amount BARREL//INORGANIC:STEEL 2 1
./dfhack-run workflow amount ARMORSTAND//INORGANIC:STEEL 2 1
./dfhack-run workflow amount BLOCKS//INORGANIC:STEEL 16 8
./dfhack-run workflow amount DOOR//INORGANIC:STEEL 2 1
./dfhack-run workflow amount FLOODGATE//INORGANIC:STEEL 2 1
./dfhack-run workflow amount HATCH_COVER//INORGANIC:STEEL 2 1
./dfhack-run workflow amount GRATE//INORGANIC:STEEL 2 1
./dfhack-run workflow amount STATUE//INORGANIC:STEEL 2 1
./dfhack-run workflow amount CABINET//INORGANIC:STEEL 2 1
./dfhack-run workflow amount BOX//INORGANIC:STEEL 2 1
./dfhack-run workflow amount CHAIR//INORGANIC:STEEL 2 1
./dfhack-run workflow amount COFFIN//INORGANIC:STEEL 2 1
./dfhack-run workflow amount TABLE//INORGANIC:STEEL 2 1
./dfhack-run workflow amount WEAPONRACK//INORGANIC:STEEL 2 1
./dfhack-run workflow amount BIN//INORGANIC:STEEL 2 1
./dfhack-run workflow amount PIPE_SECTION//INORGANIC:STEEL 2 1
./dfhack-run workflow amount SPLINT//INORGANIC:STEEL 2 1
./dfhack-run workflow amount CRUTCH//INORGANIC:STEEL 2 1

#ETC
#Gold
#Silver
#Copper
#Nickel
#Zinc
#Bronze
#Brass
#Steel
#Platinum
#Electrum
#Tin
#Fine_Pewter
#Trifle_Pewter
#Lay_Pewter
#ALUMINUM
#Nickel SIlver
#Billon
#Sterling Silver
#Black Bronze
#Rose Gold
#Bismuth Bronze
#Adamantine

## Siege Equipment Metal ##

./dfhack-run workflow amount BALLISTAARROWHEAD/METAL 10 5

#IRON
#SILVER
#COPPER
#BRONZE
#STEEL
#BISMUTH BRONZE
#ADAMANTINE

## Trap Components Metal ##

./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_GIANTAXEBLADE//METAL 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_ENORMOUSCORKSCREW//METAL 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_SPIKEDBALL//METAL 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_LARGESERRATEDDISC//METAL 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_MENACINGSPIKE//METAL 2 1
./dfhack-run workflow amount TRAPPARTS//METAL 2 1

#IRON
#SILVER
#COPPER
#BRONZE
#STEEL
#BISMUTH BRONZE
#ADAMANTINE

## Other Objects Metal ##

./dfhack-run workflow amount ANVIL/METAL 2 1
./dfhack-run workflow amount CRAFTS/METAL 2 1
./dfhack-run workflow amount GOBLET/METAL 2 1
./dfhack-run workflow amount TOY/METAL 2 1
./dfhack-run workflow amount INSTRUMENT/METAL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_NEST_BOX/METAL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_JUG/METAL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_LARGE_POT/METAL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_HIVE/METAL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_MINECART/METAL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_WHEELBARROW/METAL 2 1
./dfhack-run workflow amount FLASK/METAL 2 1
./dfhack-run workflow amount COIN/METAL 2 1

## Other Objects STEEL ##

./dfhack-run workflow amount ANVIL//INORGANIC:STEEL 2 1
./dfhack-run workflow amount CRAFTS//INORGANIC:STEEL 2 1
./dfhack-run workflow amount GOBLET//INORGANIC:STEEL 2 1
./dfhack-run workflow amount TOY//INORGANIC:STEEL 2 1
./dfhack-run workflow amount INSTRUMENT//INORGANIC:STEEL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_NEST_BOX//INORGANIC:STEEL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_JUG//INORGANIC:STEEL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_LARGE_POT//INORGANIC:STEEL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_HIVE//INORGANIC:STEEL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_MINECART//INORGANIC:STEEL 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_WHEELBARROW//INORGANIC:STEEL 2 1
./dfhack-run workflow amount FLASK//INORGANIC:STEEL 2 1
./dfhack-run workflow amount COIN//INORGANIC:STEEL 2 1

#Reset stuff
./dfhack-run workflow enable
./dfhack-run workflow enable drybuckets
./dfhack-run workflow enable auto-melt
./dfhack-run workflow unlimit-all
./dfhack-run autobutcher stop
./dfhack-run autobutcher forget all

#Autobutcher 10 f kids, 10 m kids, 4 f adults, 2 m adults
./dfhack-run autobutcher target 4 4 2 1 all
./dfhack-run autobutcher autowatch
./dfhack-run autobutcher start

#OTHER COMMANDS
./dfhack-run autolabor 1
./dfhack-run seedwatch all 30
./dfhack-run getplants REED_ROPE BERRY_SUN BERRIES_FISHER BERRIES_PRICKLE HEMP
# Beet, Wild Carrot, Potato, Radish, Turnip, Kaniwa, Quinoa, Finger Millet, Hemp

#FOOD
./dfhack-run workflow amount DRINK 3000 1500
./dfhack-run workflow amount FOOD:ITEM_FOOD_ROAST 3000 1500


############
## Farmer ##
############

./dfhack-run workflow amount THREAD 1000 500
./dfhack-run workflow amount LIQUID_MISC/MILK 100 50
./dfhack-run workflow amount CHEESE 3000 1500


###########
## Quern ##
###########

./dfhack-run workflow amount POWDER_MISC//MUSHROOM_CUP_DIMPLE:MILL 2 1
./dfhack-run workflow amount POWDER_MISC//GRASS_WHEAT_CAVE:MILL 2 1
./dfhack-run workflow amount GLOB 10 5


###############
## Carpenter ##
###############

#Tasks=31
#Workshops=4

./dfhack-run workflow amount SHIELD:ITEM_SHIELD_SHIELD/WOOD 2 1
./dfhack-run workflow amount SHIELD:ITEM_SHIELD_BUCKLER/WOOD 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_SPEAR_TRAINING/WOOD 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_SWORD_SHORT_TRAINING/WOOD 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_AXE_TRAINING/WOOD 2 1
./dfhack-run workflow amount BARREL/WOOD 2 1
./dfhack-run workflow amount BLOCKS/WOOD 2 1
./dfhack-run workflow amount BUCKET/WOOD 2 1
./dfhack-run workflow amount ANIMALTRAP/WOOD 2 1
./dfhack-run workflow amount CAGE/WOOD 2 1
./dfhack-run workflow amount ARMORSTAND/WOOD 2 1
./dfhack-run workflow amount BED/WOOD 2 1
./dfhack-run workflow amount CHAIR/WOOD 2 1
./dfhack-run workflow amount COFFIN/WOOD 2 1
./dfhack-run workflow amount DOOR/WOOD 2 1
./dfhack-run workflow amount FLOODGATE/WOOD 2 1
./dfhack-run workflow amount HATCH_COVER/WOOD 2 1
./dfhack-run workflow amount GRATE/WOOD 2 1
./dfhack-run workflow amount CABINET/WOOD 2 1
./dfhack-run workflow amount BIN/WOOD 2 1
./dfhack-run workflow amount BOX/WOOD 2 1
./dfhack-run workflow amount WEAPONRACK/WOOD 2 1
./dfhack-run workflow amount TABLE/WOOD 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_ENORMOUSCORKSCREW/WOOD 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_SPIKEDBALL/WOOD 2 1
./dfhack-run workflow amount TRAPCOMP:ITEM_TRAPCOMP_MENACINGSPIKE/WOOD 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_MINECART/WOOD 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_WHEELBARROW/WOOD 2 1
./dfhack-run workflow amount PIPE_SECTION/WOOD 2 1
./dfhack-run workflow amount SPLINT/WOOD 2 1
./dfhack-run workflow amount CRUTCH/WOOD 2 1


###########
## Mason ##
###########

./dfhack-run workflow amount ARMORSTAND//INORGANIC 2 1
./dfhack-run workflow amount BLOCKS//INORGANIC 16 8
./dfhack-run workflow amount CHAIR//INORGANIC 2 1
./dfhack-run workflow amount COFFIN//INORGANIC 2 1
./dfhack-run workflow amount DOOR//INORGANIC 2 1
./dfhack-run workflow amount FLOODGATE//INORGANIC 2 1
./dfhack-run workflow amount HATCH_COVER//INORGANIC 2 1
./dfhack-run workflow amount GRATE//INORGANIC 2 1
./dfhack-run workflow amount CABINET//INORGANIC 2 1
./dfhack-run workflow amount BOX//INORGANIC 2 1
./dfhack-run workflow amount STATUE//INORGANIC 2 1
./dfhack-run workflow amount SLAB//INORGANIC 2 1
./dfhack-run workflow amount TABLE//INORGANIC 2 1
./dfhack-run workflow amount WEAPONRACK//INORGANIC 2 1
./dfhack-run workflow amount QUERN//INORGANIC 2 1
./dfhack-run workflow amount MILLSTONE//INORGANIC 2 1


#################
## Craftsdwarf ##
#################

## Rock ##

./dfhack-run workflow amount CRAFTS//INORGANIC 2 1
./dfhack-run workflow amount GOBLET//INORGANIC 2 1
./dfhack-run workflow amount INSTRUMENT//INORGANIC 2 1
./dfhack-run workflow amount WEAPON:ITEM_WEAPON_SWORD_SHORT//INORGANIC 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_NEST_BOX//INORGANIC 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_JUG//INORGANIC 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_LARGE_POT//INORGANIC 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_HIVE//INORGANIC 2 1
./dfhack-run workflow amount TOY//INORGANIC 2 1

## Wood ##

./dfhack-run workflow amount CRAFTS/WOOD 2 1
./dfhack-run workflow amount AMMO:ITEM_AMMO_BOLTS/WOOD 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_NEST_BOX/WOOD 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_JUG/WOOD 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_LARGE_POT/WOOD 2 1
./dfhack-run workflow amount TOOL:ITEM_TOOL_HIVE/WOOD 2 1

## Bone ##

./dfhack-run workflow amount AMMO:ITEM_AMMO_BOLTS/BONE 2 1
./dfhack-run workflow amount CRAFTS/BONE 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_LEGGINGS/BONE 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_GREAVES/BONE 2 1
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_GAUNTLETS/BONE 4 2
./dfhack-run workflow amount HELM:ITEM_HELM_HELM/BONE 2 1

## Shell ##

./dfhack-run workflow amount CRAFTS/SHELL 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_LEGGINGS/SHELL 2 1
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_GAUNTLETS/SHELL 4 2
./dfhack-run workflow amount HELM:ITEM_HELM_HELM/SHELL 2 1

## Misc ##

./dfhack-run workflow amount TOTEM 2 1
./dfhack-run workflow amount CRAFTS/CLOTH 2 1
./dfhack-run workflow amount CRAFTS/SILK 2 1
./dfhack-run workflow amount CRAFTS/YARN 2 1
./dfhack-run workflow amount CRAFTS/TOOTH 2 1
./dfhack-run workflow amount CRAFTS/HORN 2 1
./dfhack-run workflow amount CRAFTS/PEARL 2 1
./dfhack-run workflow amount CRAFTS/LEATHER 2 1
./dfhack-run workflow amount THREAD//INORGANIC:ADAMANTINE 2 1

##############
## Mechanic ##
##############

./dfhack-run workflow amount TRAPPARTS//INORGANIC 2 1
./dfhack-run workflow amount TRACTION_BENCH 2 1


##########
## Loom ##
##########

#Tasks=5
#Workshops=1

./dfhack-run workflow amount THREAD/SILK 1000 500
./dfhack-run workflow amount CLOTH/PLANT 2 1
./dfhack-run workflow amount CLOTH/SILK 2 1
./dfhack-run workflow amount CLOTH/YARN 2 1
./dfhack-run workflow amount CLOTH//INORGANIC 2 1


##############
## Clothier ##
##############

#Tasks=39
#Workshops=4

##CLOTH##
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_DRESS/CLOTH 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_SHIRT/CLOTH 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_COAT/CLOTH 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_VEST/CLOTH 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_ROBE/CLOTH 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_CLOAK/CLOTH 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_PANTS/CLOTH 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_CAP/CLOTH 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_HOOD/CLOTH 2 1
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_GLOVES/CLOTH 4 2
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_MITTENS/CLOTH 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_SOCKS/CLOTH 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_SHOES/CLOTH 4 2
./dfhack-run workflow amount BOX/CLOTH 2 1
./dfhack-run workflow amount CHAIN/CLOTH 2 1

##SILK##
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_DRESS/SILK 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_SHIRT/SILK 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_ROBE/SILK 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_CLOAK/SILK 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_PANTS/SILK 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_CAP/SILK 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_HOOD/SILK 2 1
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_GLOVES/SILK 4 2
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_MITTENS/SILK 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_SOCKS/SILK 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_SHOES/SILK 4 2
./dfhack-run workflow amount BOX/SILK 2 1
./dfhack-run workflow amount CHAIN/SILK 2 1

##YARN##
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_DRESS/YARN 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_SHIRT/YARN 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_ROBE/YARN 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_CLOAK/YARN 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_PANTS/YARN 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_CAP/YARN 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_HOOD/YARN 2 1
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_GLOVES/YARN 4 2
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_MITTENS/YARN 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_SOCKS/YARN 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_SHOES/YARN 4 2
./dfhack-run workflow amount BOX/YARN 2 1
./dfhack-run workflow amount CHAIN/YARN 2 1


#############
## Leather ##
#############

./dfhack-run workflow amount ARMOR:ITEM_ARMOR_LEATHER/LEATHER 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_DRESS/LEATHER 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_SHIRT/LEATHER 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_COAT/LEATHER 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_VEST/LEATHER 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_ROBE/LEATHER 2 1
./dfhack-run workflow amount ARMOR:ITEM_ARMOR_CLOAK/LEATHER 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_LEGGINGS/LEATHER 2 1
./dfhack-run workflow amount PANTS:ITEM_PANTS_PANTS/LEATHER 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_CAP/LEATHER 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_HELM/LEATHER 2 1
./dfhack-run workflow amount HELM:ITEM_HELM_HOOD/LEATHER 2 1
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_GLOVES/LEATHER 4 2
./dfhack-run workflow amount GLOVES:ITEM_GLOVES_MITTENS/LEATHER 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_BOOTS_LOW/LEATHER 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_BOOTS/LEATHER 4 2
./dfhack-run workflow amount SHOES:ITEM_SHOES_SHOES/LEATHER 4 2
./dfhack-run workflow amount SHIELD:ITEM_SHIELD_SHIELD/LEATHER 2 1
./dfhack-run workflow amount SHIELD:ITEM_SHIELD_BUCKLER/LEATHER 2 1
./dfhack-run workflow amount BOX/LEATHER 2 1
./dfhack-run workflow amount FLASK/LEATHER 2 1
./dfhack-run workflow amount BACKPACK/LEATHER 2 1
./dfhack-run workflow amount QUIVER/LEATHER 2 1

cd ~/bin


Second Bug: I also notice in the autolabor plugin that woodcutting is snubbed completely if dwarves have any experience in mining. If you embark with seven picks and assign all your dwarves the "Mining" labor having all your dwarves dig and become dabblers, if you then enable the autolabor plugin and then assign some trees to be cut down your dwarves will refuse. Forcing one to disable autolabor and assign the woodcutting profession manually.

I run dwarf fortress and dfhack on a min install of debian linux jessie. If you need any other information just ask and I'll try to get the information to you as clearly as possible.
Title: Re: DFHack 0.40.13-r1
Post by: Putnam on November 05, 2014, 02:29:56 pm
That is the intended usage, yes. It may or may not be broken. I forget if that was one of the broken things or not.

It's not.
Title: Re: DFHack 0.40.13-r1
Post by: Dirst on November 05, 2014, 02:44:22 pm
Second Bug: I also notice in the autolabor plugin that woodcutting is snubbed completely if dwarves have any experience in mining. If you embark with seven picks and assign all your dwarves the "Mining" labor having all your dwarves dig and become dabblers, if you then enable the autolabor plugin and then assign some trees to be cut down your dwarves will refuse. Forcing one to disable autolabor and assign the woodcutting profession manually.

I run dwarf fortress and dfhack on a min install of debian linux jessie. If you need any other information just ask and I'll try to get the information to you as clearly as possible.
Just a quick thought, both the miner and the woodcutter have an invisible "uniform" that goes along with their labors (edit: Hunting does too).  Turning on both in Dwarf Therapist or the vanilla interface would also lead to problems.  These invisible "uniforms" also conflict with real military uniforms.

So this may not be an autolabor bug, though detecting these conflicts might be a nice feature for autolabor to have.
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 05, 2014, 03:04:28 pm
First off, I love dfhack and I don't know what I would do without it. It is a powerful and awesome tool. Thank you so much!

Second off, I have run into some bugs and I am hoping this is the right place to report them. If not, kindly point me in the right direction.

First Bug: I've noticed that the workflow plugin seems to have a limited number of entries that it can take before hanging? You can duplicate this error by running a bash script with multiple (~320) entries of "./dfhack-run workflow amount X 2 1" Where X # # is a new and different item to be produced. Exiting the game with the "die" command or the conventional way results with repetitions of the following error for each workflow command that didn't execute:
Code: [Select]
Could not connect to localhost: 5000
It's possible that that's a problem with dfhack-run, not workflow. Does the problem still occur if you place the commands in a file (without "./dfhack-run") and run "script (filename)" in the DFHack console?
Title: Re: DFHack 0.40.13-r1
Post by: breadman on November 05, 2014, 03:15:29 pm
Second off, I have run into some bugs and I am hoping this is the right place to report them. If not, kindly point me in the right direction.

This is probably the best place to ensure your bug report will be seen, but the issues list on GitHub (https://github.com/DFHack/dfhack/issues) has a longer memory, and the IRC channel can be better for a deep discussion if you catch the right person at the right time.

Quote from: Rogue Yun
Second Bug: I also notice in the autolabor plugin that woodcutting is snubbed completely if dwarves have any experience in mining.

Yeah, autolabor tries to deal with the three uniformed professions (mining, woodcutting, and hunting), but isn't exactly optimal for them.  It helps to reduce their maximum numbers to less than the number of civilians in your fort.  For this case:

Code: [Select]
autolabor MINE 2 6
autolabor CUTWOOD 1 2
autolabor HUNT 0 1

That will probably give you six miners and one woodcutter, but might switch them to five and two.

I've considered improving the plugin for this case, but haven't done much yet.  It would also be interesting to incorporate some of the improved algorithms from Dwarf Therapist.
Title: Re: DFHack 0.40.13-r1
Post by: walberg on November 05, 2014, 03:16:04 pm
First off, I love dfhack and I don't know what I would do without it. It is a powerful and awesome tool. Thank you so much!

Second off, I have run into some bugs and I am hoping this is the right place to report them. If not, kindly point me in the right direction.

First Bug: I've noticed that the workflow plugin seems to have a limited number of entries that it can take before hanging? You can duplicate this error by running a bash script with multiple (~320) entries of "./dfhack-run workflow amount X 2 1" Where X # # is a new and different item to be produced. Exiting the game with the "die" command or the conventional way results with repetitions of the following error for each workflow command that didn't execute:
Code: [Select]
Could not connect to localhost: 5000
It's possible that that's a problem with dfhack-run, not workflow. Does the problem still occur if you place the commands in a file (without "./dfhack-run") and run "script (filename)" in the DFHack console?

Or better yet, put them in an appropriately placed onLoad.init file...
Title: Re: DFHack 0.40.13-r1
Post by: Roses on November 05, 2014, 03:17:28 pm
That is the intended usage, yes. It may or may not be broken. I forget if that was one of the broken things or not.

It's not.

Code: [Select]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome BURN ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_1 FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] ]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ unit/attribute-change -unit !TARGET -physical [ ENDURANCE TOUGHNESS ] -fixed [ !VALUE !VALUE ] -dur 1000 ] -value self:willpower:-10:100 -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_1 FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -aclass [ ICE_1 ICE_2 ICE_3 ICE_4 ] ]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome ICE_WARD -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_1 FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -asyndrome [ ICE_WARD ] ]
modtools/interaction-trigger -onAttackStr "casts burn" -command [ wrapper -unitSource \\ATTACKER_ID -unitTarget \\DEFENDER_ID -script [ modtools/add-syndrome -unit !TARGET -syndrome SOAKED -eraseAll ] -reflect [ REFELECT_ALL REFLECT_ELEMENTAL REFLECT_FIRE ] -silence [ SILENCE_ALL SILENCE_ELEMENTAL SILENCE_FIRE ] -iclass [ FIRE_1 FIRE_2 FIRE_3 FIRE_4 MAGIC_IMMUNE MAGIC_RESIST ] -isyndrome [ FIRE_WARD RESIST_MAGIC IMMUNE_MAGIC ] -asyndrome [ SOAKED ] ]

Well here is an example of what I am thinking, the break down is;
Burn is a level 1 Fire spell, all fire creatures are immune to it, if not a fire creature the syndrome is applied
If the target is an ice creature, it will loose some amount of endurance and toughness, based on the casters willpower (100 at 2000, 400 at 5000)
If the target has an Ice Ward on it will remove the Ice Ward
If the target is soaked from a Water spell, it will remove the soaking

So basically all spells will have multiple effects based on strengths and weaknesses of schools versus each other. And each sphere of magic is associated with a different mental attribute, so that your spells are more powerful with a given attribute (Willpower for Elemental, Focus for Arcane, Creativity for Mental, Intuition for Divine, and Patience for Nature).
Title: Re: DFHack 0.40.13-r1
Post by: lethosor on November 05, 2014, 03:24:04 pm
First off, I love dfhack and I don't know what I would do without it. It is a powerful and awesome tool. Thank you so much!

Second off, I have run into some bugs and I am hoping this is the right place to report them. If not, kindly point me in the right direction.

First Bug: I've noticed that the workflow plugin seems to have a limited number of entries that it can take before hanging? You can duplicate this error by running a bash script with multiple (~320) entries of "./dfhack-run workflow amount X 2 1" Where X # # is a new and different item to be produced. Exiting the game with the "die" command or the conventional way results with repetitions of the following error for each workflow command that didn't execute:
Code: [Select]
Could not connect to localhost: 5000
It's possible that that's a problem with dfhack-run, not workflow. Does the problem still occur if you place the commands in a file (without "./dfhack-run") and run "script (filename)" in the DFHack console?

Or better yet, put them in an appropriately placed onLoad.init file...
That's only useful if you want the commands to be run when a specific world loads (or any world, in the case of onLoadWorld.init). Some plugins save their state, so commands involving them only need to be run once per world.
Title: Re: DFHack 0.40.13-r1
Post by: mifki on November 05, 2014, 04:26:18 pm
I'm planning on a release very soon. It will be missing most of the things on my todo list. I'll do an r2 later for those.

Aaand.. 0.40.15 is here:)
Title: Re: DFHack 0.40.13-r1
Post by: expwnent on November 05, 2014, 07:44:23 pm
I'm planning on a release very soon. It will be missing most of the things on my todo list. I'll do an r2 later for those.

Aaand.. 0.40.15 is here:)

Haha yeah. Sorry guys. 0.40.14-r1 will be up soon. Hopefully 0.40.15-r1 will be up within a few days.
Title: Re: DFHack 0.40.13-r1
Post by: Spacebat on November 05, 2014, 08:54:44 pm
So, what needs updating to make this compatible with 0.40.15? I have the source, but every time I look too deeply I can feel it staring back.
Title: Re: DFHack 0.40.14-r1
Post by: expwnent on November 05, 2014, 09:46:40 pm
Release done.
Title: Re: DFHack 0.40.14-r1
Post by: lethosor on November 05, 2014, 10:04:24 pm
OS X build (http://dffd.wimbli.com/file.php?id=10033) (0.40.14-r1)
Edit:
Linux build (GCC 4.5.4) (http://dffd.wimbli.com/file.php?id=10034)
Title: Re: DFHack 0.40.14-r1
Post by: Max™ on November 06, 2014, 02:38:57 am
Argh, what was the fix for the graphics either not working or working with messed up keybinds? I've tried various ways from scratch, used the linux tar.bz2 from here, used the native arch one, but I still get the l announcements, f3 pause, etc weirdness if I use the native arch libgraphics.so, or nothing but png errors if I try to use the one that comes with the df_linux install.

Hmmm, not directly related to a fix, but anyone got an idea why the arch one would be 6.9 mb while the bay12games download gives a 1.4 mb libgraphics.so?
Title: Re: DFHack 0.40.14-r1
Post by: AshenGrey on November 06, 2014, 03:11:02 am
I hate to complain, but I just downloaded the new version and I found several issues. First off, it says that 'plugin dwarfmoniter not built for this version of DF hack', as well as the dfhack.int config file is missing. Care to fix/Find out what is with that, please?
Title: Re: DFHack 0.40.14-r1
Post by: Max™ on November 06, 2014, 03:39:18 am
The dfhack.init missing is normal, rename the one present from .init.example or substitute your own if you have one.

Still stumped on the keybinds thing, I checked the symbols.xml and it's fine, but that would be involved in dfhack not working (which it does, by the way) not the weird keybinds. I'm missing something here.
Title: Re: DFHack 0.40.14-r1
Post by: fricy on November 06, 2014, 03:42:52 am
I hate to complain, but I just downloaded the new version and I found several issues. First off, it says that 'plugin dwarfmoniter not built for this version of DF hack', as well as the dfhack.int config file is missing. Care to fix/Find out what is with that, please?
Dwarf monitor has not yet been updated to the new thought system in 40.14. Rename the dfhack.init-example config, this how dfhack is always built. Dfhack.init is configured by the pack authors/users.
Title: Re: DFHack 0.40.14-r1
Post by: Badger Storm on November 06, 2014, 05:27:28 am
It isn't working, as in all I get when I try to go into DFHack is a logout message from Terminal, or, if I do that from dfhack-run, something about "illegal instruction".  How do I get it to work properly on OSX?  In the past I have only ever been able to access DFHack via the start-upon-DF-launch option that comes with the lazy newb pack.  Trying to launch the thing itself has only ever given me logout messages.

EDIT: I pulled it into the DF folder and now there is something about a segmentation fault?  I honestly have no clue what I am doing.
Title: Re: DFHack 0.40.14-r1
Post by: lethosor on November 06, 2014, 06:24:09 am
What version of OS X are you using?
Title: Re: DFHack 0.40.14-r1
Post by: danaris on November 06, 2014, 07:20:05 am
And what, exactly, are you trying to do to launch DFHack?
Title: Re: DFHack 0.40.13-r1
Post by: Rogue Yun on November 06, 2014, 11:30:59 am
It's possible that that's a problem with dfhack-run, not workflow. Does the problem still occur if you place the commands in a file (without "./dfhack-run") and run "script (filename)" in the DFHack console?

Seems to work fine using "script filename". Thank you so much!

Quote from: Rogue Yun
Second Bug: I also notice in the autolabor plugin that woodcutting is snubbed completely if dwarves have any experience in mining.

Yeah, autolabor tries to deal with the three uniformed professions (mining, woodcutting, and hunting), but isn't exactly optimal for them.  It helps to reduce their maximum numbers to less than the number of civilians in your fort.  For this case:

Code: [Select]
autolabor MINE 2 6
autolabor CUTWOOD 1 2
autolabor HUNT 0 1

That will probably give you six miners and one woodcutter, but might switch them to five and two.

You can assign min and max to specific labors? That is AWESOME! Is there a more detailed documentation for this somewhere? I always hated it when my whole fort started engraving or felt they had the right to use wood to make cruddy beds because they were a skilled cheesemaker.
Title: Re: DFHack 0.40.14-r1
Post by: Roses on November 06, 2014, 03:56:12 pm
Does anyone know how the game handles fireball vs firebreath type flows? What I mean is that we have a script that will allow us to spawn a flow, but there is only a distinction between firebreath and dragonfire. How does the game know how to spawn a cone vs circle when used via interaction?
Title: Re: DFHack 0.40.14-r1
Post by: expwnent on November 06, 2014, 04:53:17 pm
Dragonfire can hurt things normally immune to fire, I believe. In fact it used to be true (and might still be) that it's possible to be immune to dragonfire and not regular fire. I don't know whether that's the only difference or not.
Title: Re: DFHack 0.40.14-r1
Post by: Putnam on November 06, 2014, 04:55:52 pm
[FIREIMMUNE] versus [FIREIMMUNE_SUPER]. The former is only immune to jets, balls and AFAIK environmental fire. The latter is also immune to dragonfire.
Title: Re: DFHack 0.40.14-r1
Post by: Badger Storm on November 06, 2014, 05:05:04 pm
I clicked on the downloaded link, which downloaded the folder and the DFHack stuff contained therein.  I looked at my old version and saw there was a "hack" folder, plus other hack stuff, contained in the following directory:

-->Applications-->Macnewbie (lazy newb pack)--> Dwarf Fortress-->"hack" folder, dfhack, dfhack-run, dfhack.init, dfhack.history

The dfhack folder seems to contain dfhack, dfhack-run, dfhack.init-example, and a "hack" folder of its own.  I've got a hunch the "hack" folder needs to be put directly into the df-osx (my main DF folder for the new version) file, plus dfhack and dfhack-launch, but I honestly have no clue.  Dwarf Fortress is my first time putting graphics packs or using inits with pretty much anything.
Title: Re: DFHack 0.40.14-r1
Post by: lethosor on November 06, 2014, 05:50:29 pm
You should replace the entire hack folder with the one you downloaded (you may want to simply rename the old one, in case something goes wrong). The "dfhack" file hasn't changed, but you should replace "dfhack-run" if you want to run DFHack commands externally (e.g. from another command line).
Title: Re: DFHack 0.40.14-r1
Post by: Badger Storm on November 06, 2014, 05:59:06 pm
Considering my 40.14 version of the game doesn't have DFHack installed at all, what ought I to do?  If my old 40.13 files are any indication, I should put the hack folder, along with dfhack, dfhack-run, and df-hack.init, into the main dwarf fortress folder.  Is this correct, or am I missing something?

EDIT: Yep, it seems to be working just fine now.  So glad to have nice clean maps again!
Title: Re: DFHack 0.40.14-r1
Post by: lethosor on November 06, 2014, 06:51:33 pm
It appears that rendermax wasn't included in any builds of 0.40.14-r1 (it compiles, but wasn't re-enabled in CMakeLists.txt). This will hopefully be fixed in 0.40.15-r1.
In addition, "startdwarf" will only work on OS X (also a 0.40.14-r1-specific problem), due to the start_dwarf_count offset not being located on other platforms.
Title: Re: DFHack 0.40.14-r1
Post by: Roses on November 06, 2014, 08:54:59 pm
Dragonfire can hurt things normally immune to fire, I believe. In fact it used to be true (and might still be) that it's possible to be immune to dragonfire and not regular fire. I don't know whether that's the only difference or not.

So is the structure of the spawned flow hardcoded? I can't make cones vs circles with the spawnflow script?
Title: Re: DFHack 0.40.14-r1
Post by: Putnam on November 06, 2014, 10:43:02 pm
I haven't seen anything suggesting that shape isn't as much an intrinsic part of the flow as temperature.
Title: Re: DFHack 0.40.14-r1
Post by: expwnent on November 06, 2014, 11:49:28 pm
It seems the item-trigger / INVENTORY_CHANGE event wasn't actually having problems. I fixed a different problem for the next release. If you're in arena mode and swap back and forth between controlling a unit and releasing control then event manager might have problems in the current release.
Title: Re: DFHack 0.40.14-r1
Post by: Max™ on November 07, 2014, 12:28:54 am
YAY! Got it fixed, I kept pulling in either the wrong graphics AND interface.txt or the right interface.txt with the wrong graphics, reset the interface from scratch with the arch 14.04-2 update and it works perfectly! Hurray! Which twbt is current again, 5.29?

Edit: yep, 5.29 is current and works on linux, awesome work folks.
Title: Re: DFHack 0.40.14-r1
Post by: PeridexisErrant on November 07, 2014, 12:43:24 am
Pretty serious bug report:  mousequery is broken.  Clicking anywhere brings up stockpile or military menus, depending (I think) on whether you click on a unit.  Edge scrolling doesn't work.  Box select mode in the designations menu does work, luckily.  This is particularly bad for new players with my pack :(
Title: Re: DFHack 0.40.14-r1
Post by: mifki on November 07, 2014, 01:39:04 am
Strangely, mousequery on OS X is all fine.
Title: Re: DFHack 0.40.14-r1
Post by: Rogue Yun on November 07, 2014, 02:35:59 pm
I want to make Ctrl-Z execute the "die" command in dfhack. I tried putting the following into the dfhack.init but nothing gives. Any help would be appreciated.

Code: [Select]
#Kill dfhack
keybinding add Ctrl-Z die

Thanks in advance!

Also it seems the following command still allows all the dwarves to go plant gathering merrily without restraint.
Code: [Select]
autolabor HERBALIST 1 2
Title: Re: DFHack 0.40.14-r1
Post by: lethosor on November 07, 2014, 02:55:11 pm
Pretty serious bug report:  mousequery is broken.  Clicking anywhere brings up stockpile or military menus, depending (I think) on whether you click on a unit.  Edge scrolling doesn't work.  Box select mode in the designations menu does work, luckily.  This is particularly bad for new players with my pack :(
Does this occur with the default mousequery plugin or only with the one that comes with TwbT? Mousequery appears to be working for me.
Edit: Since mousequery (in the DFHack repo) hasn't changed in around 3 months, I suspect this is a TwbT problem.
Title: Re: DFHack 0.40.14-r1
Post by: expwnent on November 07, 2014, 03:12:07 pm
Mousequery seems to work for me on Windows. Edge scrolling works if you click. Hovering and clicking on dwarves seems to work. Clicking on dwarves in the military screen seems to work. I don't use it myself regularly so I'm not sure what all of the features are but I found it intuitive and functional.
Title: Re: DFHack 0.40.14-r1
Post by: breadman on November 07, 2014, 03:42:04 pm
You can assign min and max to specific labors? That is AWESOME! Is there a more detailed documentation for this somewhere? I always hated it when my whole fort started engraving or felt they had the right to use wood to make cruddy beds because they were a skilled cheesemaker.

The best documentation for it, beyond the source itself (https://github.com/DFHack/dfhack/blob/master/plugins/autolabor.cpp), is autolabor help.

The cruddy bed problem might be alleviated by using workshop profiles, as long as you always have a carpenter of at least novice skill.

Also it seems the following command still allows all the dwarves to go plant gathering merrily without restraint.
Code: [Select]
autolabor HERBALIST 1 2

That's another flaw with autolabor.  It only enables the herbalist labor on two dwarves at a time, but ignores the dwarves already performing that labor when calculating the maximum.  Fishing is also highly susceptible to this behavior, which is probably why it's set to a maximum of 1 by default.
Title: Re: DFHack 0.40.14-r1
Post by: PeridexisErrant on November 07, 2014, 05:28:02 pm
Mousequery seems to work for me on Windows. Edge scrolling works if you click. Hovering and clicking on dwarves seems to work. Clicking on dwarves in the military screen seems to work. I don't use it myself regularly so I'm not sure what all of the features are but I found it intuitive and functional.

You can still move the screen with right-clicking near the edge, but it's lost the hover-near-edge to scroll function.  Clicking opens the stockpile or military menu instead of whichever k/v/q/t menu would be appropriate.
edit ... and I can't replicate this in a fresh install of DF+DFHack.  NVM.
Title: Re: DFHack 0.40.14-r1
Post by: mifki on November 07, 2014, 05:59:50 pm
edit ... and I can't replicate this in a fresh install of DF+DFHack.  NVM.

So.. is it a problem of my plugin version?
Title: Re: DFHack 0.40.14-r1
Post by: PeridexisErrant on November 07, 2014, 06:37:35 pm
I've now tested a couple of combinations.  The base is a fresh install of DF and DFHack, no configuration at all except changing [PRINT_MODE:TWBT] and adding /data/art/shadows.png

 - Base: everything works as expected. 
 - Add TwbT plugin only:  mousequery still fine
 - Add TwbT-mousequery:  mousequery now shows odd behaviour
- TwbT-mousequery in an otherwise vanilla install still shows the odd behaviour
 - Installing TwbT and associated plugins *except* the alternate mousequery doesn't show the bug


Looks like it might be something about you changes to the mousequery plugin
Title: Re: DFHack 0.40.14-r1
Post by: mifki on November 07, 2014, 07:17:14 pm
Weird, there are no changes that could cause this, maybe I compiled with wrong dfhack headers somehow. I'll check, thanks for testing.
Title: Re: DFHack 0.40.14-r1
Post by: stabbymcstabstab on November 07, 2014, 07:38:06 pm
Quick question is the the Embark-tools option working? I've been trying to use it to invade some human villages and I can't figure out how to turn it's options on at all.
Title: Re: DFHack 0.40.14-r1
Post by: lethosor on November 07, 2014, 08:08:25 pm
What do you mean by "turn on its options"? If you've enabled the plugin with "enable embark-tools", there should be an "s" option on the embark screen.
Title: Re: DFHack 0.40.14-r1
Post by: stabbymcstabstab on November 07, 2014, 09:20:02 pm
Thanks, I'm rather new to DFhack.
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 09, 2014, 01:55:08 am
New release!
Title: Re: DFHack 0.40.15-r1
Post by: fricy on November 09, 2014, 04:28:10 am
OSX | DFHack 0.40.15-r1 (https://www.dropbox.com/s/8hsej3rt2hhc6z6/dfhack_osx_0.40.15-r1.tar.bz2?dl=0) with Stonesense
Title: Re: DFHack 0.40.15-r1
Post by: CautionToTheWind on November 09, 2014, 04:46:01 am
No Linux for .15? ;(
Title: Re: DFHack 0.40.15-r1
Post by: Mystry on November 09, 2014, 05:08:15 am
I don't understand this. Where is the release archive I'm supposed to download and extract into the DF folder?

Its literally nowhere to be found. This is why I absolutely hate github.
Title: Re: DFHack 0.40.15-r1
Post by: Rose on November 09, 2014, 05:15:08 am
The first post has a download link, and it's not even pointing to github.
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 09, 2014, 05:23:34 am
If github let me upload the package it would be at https://github.com/DFHack/dfhack/releases/tag/0.40.15-r1 but it won't, whether I use Firefox or Chrome and whether I use my computer or a different one I also tried. Other people tell me it works but I can't get it to. The dffd link in the first post should work.
Title: Re: DFHack 0.40.15-r1
Post by: Max™ on November 09, 2014, 06:05:47 am
Tried to compile it for linux but I think I managed to point it to a dev build folder I didn't realize I had there, so that's just a big mess... lol

Oh hell, forgot the build folders have stuff I don't own so I gotta rm them manually, and apparently arch doesn't have 40.15 so I just tried to compile dfhack for 40.15 into a folder for a dev branch from just before 40.14 came out but I was trying to do it against 40.14-2 or whatever, which explains why it almost worked... friends don't let friends surf and compile without paying attention...
Title: Re: DFHack 0.40.15-r1
Post by: Greiger on November 09, 2014, 10:36:45 am
New release!
Github oddities aside, we plebeians who don't know our ass from a compiler thank you and the entire DFHack team.
Title: Re: DFHack 0.40.15-r1
Post by: tejón on November 09, 2014, 01:41:51 pm
we plebeians who don't know our ass from a compiler thank you and the entire DFHack team.
As do we lazy bastards who've never bothered to set up a proper development environment since last installing Windows. :D
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 09, 2014, 03:25:56 pm
Linux build of 0.40.15-r1 (GCC 4.5.4) (http://dffd.wimbli.com/file.php?id=10050)
Title: Re: DFHack 0.40.15-r1
Post by: Demki on November 09, 2014, 05:18:10 pm
Using the latest build, Manipulator's keybindings are not shown properly, although they work as usual.
Instead of showing in the unit list "l - Manage labors" it shows "? - Manage labors" while [l] still works. It's the same for the manipulator screen's keys.

Spoiler (click to show/hide)

Is this a known bug or is it something that can be fixed without a new build?

I started a new game without raw editing, didn't change key bindings, I did disable mouse query since I don't use the mouse. Said region has raining goblin blood.
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 09, 2014, 05:26:47 pm
It's a known bug in the Windows version (and it's not just manipulator). Find the "<symbol-table name='v0.40.15 SDL' os-type='windows'>" line in <DF>/hack/symbols.xml and add this line under it:
Code: [Select]
<global-address name='keydisplay' value='0x181C170'/>
Title: Re: DFHack 0.40.15-r1
Post by: StagnantSoul on November 10, 2014, 12:07:25 am
Okay... Slight problem. I had a dwarf show up with no teeth and both arms missing. I wanted to heal him and get him engraving, but full-heal isn't doing anything on anyone.
Title: Re: DFHack 0.40.15-r1
Post by: Max™ on November 10, 2014, 03:50:14 am
Well, could try dfusion -> 3 -> 5 (I think that's the heal option). It generally works if full-heal won't. Sometimes full-heal just doesn't want to do anything, hard to identify exactly why.
Title: Re: DFHack 0.40.15-r1
Post by: Putnam on November 10, 2014, 04:01:52 am
While updating full-heal to use the standard args system (since right now it's a horrible mix of the old and new), I found that the only person I'm going to be stepping on the toes of when breaking compatibility for that particular program is... me.

Heh. Oh well.
Title: Re: DFHack 0.40.15-r1
Post by: deepspaceprobe9 on November 10, 2014, 06:20:47 am
How do I add a keybinding for manage labor?
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 10, 2014, 06:47:42 am
It's a known bug in the Windows version (and it's not just manipulator). Find the "<symbol-table name='v0.40.15 SDL' os-type='windows'>" line in <DF>/hack/symbols.xml and add this line under it:
Code: [Select]
<global-address name='keydisplay' value='0x181C170'/>
Title: Re: DFHack 0.40.15-r1
Post by: katwithk on November 10, 2014, 01:13:32 pm
Can somebody hook me up with a link to the 40.14 OSX release? I can't seem to find it anymore, and DT hasn't caught up with 40.15 yet
Title: Re: DFHack 0.40.15-r1
Post by: fricy on November 10, 2014, 01:49:40 pm
Can somebody hook me up with a link to the 40.14 OSX release? I can't seem to find it anymore, and DT hasn't caught up with 40.15 yet
https://github.com/splintermind/Dwarf-Therapist/blob/DF2014/share/memory_layouts/osx/v0.40.15_osx.ini
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 10, 2014, 02:54:27 pm
Can somebody hook me up with a link to the 40.14 OSX release? I can't seem to find it anymore, and DT hasn't caught up with 40.15 yet
http://dffd.wimbli.com/file.php?id=10033
Title: Re: DFHack 0.40.15-r1
Post by: katwithk on November 10, 2014, 03:28:29 pm
I love how very responsive and helpful you guys are, super props! one last thing, I don't see .34.11-r5 in the dfhack archive either, which I need for webfortress
Title: Re: DFHack 0.40.15-r1
Post by: Roses on November 10, 2014, 03:43:47 pm
Has there been any research done concerning the dimension variable in dfhack.maps.spawnFlow(pos,type,mat_type,mat_index,dimension)? I know it is basically the size of the flow, but I seem to get inconsistent results with sometimes seeing a large spread on the screen and then next time a smaller one, with the same number used.
Title: Re: DFHack 0.40.15-r1
Post by: breadman on November 10, 2014, 04:44:35 pm
one last thing, I don't see .34.11-r5 in the dfhack archive either, which I need for webfortress

That's when hosting switched to DFFD.  Unfortunately, even knowing that, searching doesn't immediately find the proper packages.  Windows (http://dffd.wimbli.com/file.php?id=8682), Mac (http://dffd.wimbli.com/file.php?id=8683), Linux (http://dffd.wimbli.com/file.php?id=8681), Ubuntu (http://dffd.wimbli.com/file.php?id=8692).
Title: Re: DFHack 0.40.15-r1
Post by: katwithk on November 11, 2014, 10:52:43 am
I see a small breakdown of colored numbers headed by an H in my lower-right corner now. Never seen that before, that I can recall, what is it measuring?
Title: Re: DFHack 0.40.15-r1
Post by: Max™ on November 11, 2014, 11:47:53 am
Happiness.

I think it's dwarfmonitor enable/disable to toggle it, might be dwarf-monitor enable/disable, I don't use it myself so I'm not sure off the top of my head.
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 11, 2014, 03:58:12 pm
Happiness.

I think it's dwarfmonitor enable/disable to toggle it, might be dwarf-monitor enable/disable, I don't use it myself so I'm not sure off the top of my head.
enable/disable dwarfmonitor, actually. ("enable" and "disable" are built-in commands that control most UI plugins, except for tweak and a couple others.)
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 11, 2014, 05:06:44 pm
It's supposed to do anything except maybe for tweaks so let us know if it's broken on one.
Title: Re: DFHack 0.40.15-r1
Post by: rmblr on November 12, 2014, 04:09:22 am
When I use tiletypes to paint out some floor onto previously solid stone, the surrounding tiles aren't revealed like they would be if a dwarf dug them out.

(https://i.imgur.com/85zNkSX.png)

Title: Re: DFHack 0.40.15-r1
Post by: Putnam on November 12, 2014, 04:11:46 am
1. revflood or send a dwarf over there
Title: Re: DFHack 0.40.15-r1
Post by: rmblr on November 12, 2014, 04:37:03 am
revflood worked great, thanks.

Now what about building constructed walls with tiletypes...

When using the CONSTRUCTION material and the WALL shape, when I place walls they stay in their O pillar shape, instead of connecting up like normally constructed walls. Is it possible to connect them?
Title: Re: DFHack 0.40.15-r1
Post by: Rose on November 12, 2014, 04:40:12 am
Every direction of wall is a different tile type.

Also, cunstructions need extra info defined for them, to tell the material.
Title: Re: DFHack 0.40.15-r1
Post by: Voxus on November 12, 2014, 09:29:25 am
It's a known bug in the Windows version (and it's not just manipulator). Find the "<symbol-table name='v0.40.15 SDL' os-type='windows'>" line in <DF>/hack/symbols.xml and add this line under it:
Code: [Select]
<global-address name='keydisplay' value='0x181C170'/>

So, I had this problem and tried this and it worked for the most part, except now I can't see the values in ranges in workflow's GUI, (go to a workshop, open the workflow gui, add a constraint, try to edit the range)

Additionally I'm getting this error spammed into stderr.log:
Spoiler (click to show/hide)

Lastly I'm getting crashes frequently, I'm using the starter pack and the version of DFHack packed with it, I can play at most for half an hour before something crashes, each time the action I last took before the crash was different, last time opening the building menu and trying to select building a carpenters workshop crashed the game, is there some way I can figure out what is causing the crashes? Are there any options I should avoid because they could be causing them? I'm not using any utilities but I have Workflow, Autolabor, and Mouse tweaks enabled as well as the bugfixes and performance tweaks options enabled. Graphics are all default options on pure install of the starter pack except I changed the pallet and installed spacefox, so I am using TwbT. The world and map were all generated in this version of DF and I imported no settings. The map is 4x4 and I have the calculation FPS cap at 300, I'm noticing no lag. Let me know if I should provide any other details.
Title: Re: DFHack 0.40.15-r1
Post by: milo christiansen on November 12, 2014, 10:51:31 am
A small suggestion (or two):
The manipulator plugin only allows you to toggle labors that are enabled in the entity, can this be changed? (I would like to use the alchemy labor without needing to mod the entity)
The manipulator plugin needs a "clear all labors, this dwarf" key. This would allow making custom professions via a macro (just like Therapist's custom professions).
Title: Re: DFHack 0.40.15-r1
Post by: Max™ on November 12, 2014, 12:00:14 pm
When I use tiletypes to paint out some floor onto previously solid stone, the surrounding tiles aren't revealed like they would be if a dwarf dug them out.

(https://i.imgur.com/85zNkSX.png)

  • How can I reveal those areas?
  • Is there a better way to dig out sections (without using dwarves)?
There is a better way than revflood.

I learned about these recently.

In tiletypes use paint h 1/0 for hidden/visible, l 1/0 for light/dark, st 1/0 for subterranean/above ground, and sv 1/0 for outside/inside.

I mostly use it to clean up ugly bits of revealed stone from where I had to dig an access shaft or something, oh, and when I clear out a mine I like to lock it up and rehide the veins.
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 12, 2014, 03:01:44 pm
It's a known bug in the Windows version (and it's not just manipulator). Find the "<symbol-table name='v0.40.15 SDL' os-type='windows'>" line in <DF>/hack/symbols.xml and add this line under it:
Code: [Select]
<global-address name='keydisplay' value='0x181C170'/>

So, I had this problem and tried this and it worked for the most part, except now I can't see the values in ranges in workflow's GUI, (go to a workshop, open the workflow gui, add a constraint, try to edit the range)

Additionally I'm getting this error spammed into stderr.log:
Spoiler (click to show/hide)

Lastly I'm getting crashes frequently, I'm using the starter pack and the version of DFHack packed with it, I can play at most for half an hour before something crashes, each time the action I last took before the crash was different, last time opening the building menu and trying to select building a carpenters workshop crashed the game, is there some way I can figure out what is causing the crashes? Are there any options I should avoid because they could be causing them? I'm not using any utilities but I have Workflow, Autolabor, and Mouse tweaks enabled as well as the bugfixes and performance tweaks options enabled. Graphics are all default options on pure install of the starter pack except I changed the pallet and installed spacefox, so I am using TwbT. The world and map were all generated in this version of DF and I imported no settings. The map is 4x4 and I have the calculation FPS cap at 300, I'm noticing no lag. Let me know if I should provide any other details.
Did the workflow problems occur before you added the line to symbols.xml? I don't think a symbols change would cause those types of errors.
Regarding the random crashes, I'd try disabling TwbT first.

A small suggestion (or two):
The manipulator plugin only allows you to toggle labors that are enabled in the entity, can this be changed? (I would like to use the alchemy labor without needing to mod the entity)
This is intentional - in fact, DF used to disable access to unavailable labors in 40d (bug report (http://www.bay12games.com/dwarves/mantisbt/view.php?id=6511)).
The manipulator plugin needs a "clear all labors, this dwarf" key. This would allow making custom professions via a macro (just like Therapist's custom professions).
What key would you suggest? (Custom professions should be possible as well, although coming up with a working configuration format could take some work.)
Title: Re: DFHack 0.40.15-r1
Post by: Max™ on November 12, 2014, 09:58:43 pm
My first instinct would be ctrl+alt+l, I can't think of anywhere it is used currently, and there's a ready mnemonic c(lear)trl al(l)t l(abors) too!
Title: Re: DFHack 0.40.15-r1
Post by: Voxus on November 13, 2014, 02:19:45 am
Did the workflow problems occur before you added the line to symbols.xml? I don't think a symbols change would cause those types of errors.
Regarding the random crashes, I'd try disabling TwbT first.

The problems do seem to be related to TwbT, they do not occur in TwbT legacy (so far), the text rendering was as such:

Default install of starter pack using TwbT with no fix to symbols.xml: Hotkeys all read as ?, ranges properly display.
Using TwbT with fix to symbols.xml: Hotkeys all read correctly, ranges are invisible in the range changing dialogue (fine in the workflow list, and the text can still be edited, just not seen).
Using TwbT Legacy with fix to symbols.xml: As of yet no noticeable issues, text rendering correctly.

TwbT standard does seem to use a mix of truetype and ascii, so this seems to imply that TwbT has some issues with workflow.

I'll post again after some extended duration of play to update on crashes.

Update: TwbT legacy is confusingly broken for me, every time I specifically change to (q) manage buildings it pretends I am on the level I think I am but shows information for a lower level, then when I try to move the cursor with arrow keys it puts me on a different level, it always returns to the same level, for me this was to my farms at 1 z level below the wagon. As such I'm testing in 2D drawing mode from now.
Title: Re: DFHack 0.40.15-r1
Post by: mifki on November 13, 2014, 03:39:59 am
I've never used the workflow plugin, so maybe I'm looking in wrong place, but I can edit ranges without problems:

(http://i.imgur.com/4AGDVFil.png) (http://imgur.com/4AGDVFi)

However your main issue is crashes, right? Here are the instructions how to enable crash dumps that would help me to fix it.
http://www.bay12forums.com/smf/index.php?topic=138754.msg5624349#msg5624349
Title: Re: DFHack 0.40.15-r1
Post by: rmblr on November 13, 2014, 05:29:16 am
Is there a script or plugin for exporting and importing stockpile settings?

I've tediously created stockpiles for High, Medium, and Low value gems that I don't want to lose :|

If there is no such plugin or script, does anyone know if the LUA API would allow for such a script? If so, I'll make it myself.

Edit: to clarify, I'm not talking about copystock. Rather I want a tool to migrate stockpile settings between saves.
Title: Re: DFHack 0.40.15-r1
Post by: Abadrausar on November 13, 2014, 07:57:20 am
Is there a script or plugin for exporting and importing stockpile settings?
There are a Falconne plugin that enables you to copy the settings of a stockpile, no import/export however, and I am not sure if it has been migrated to 40.xx.

Maybe your best option at the moment for exporting and importing your stockpile settings is to define some aliases for quickfort by joelpt in Dwarf Fortress macro format, and then use quickfort query phase to place your stockpiles.

Some examples of defined stockpile aliases taken from my modified aliases.txt file in the config directory of the quickfort utility
Code: [Select]
##################################
# food stockpile adjustments
##################################
seeds: s{Down}deb{Right}{Down 9}p^
noseeds: s{Down}dea{Right}{Down 9}f^
booze: s{Down}deb{Right}{Down 5}p{Down}p^
food: s{Down}dea{Right}{Down 5}f{Down}f{Down 3}f^
plants: s{Down}deb{Right}{Down 4}p^
PreparedFoods: s{down}debu^
plantsandseeds: s{Down}deb{Right}{Down 4}p{Down 5}p^
cookableSolids: s{Down}debu{Right}p{Down}p{Down 2}p{Down 5}p{Down}p{Down}p{Down}f{Right}&{Down}&{Down 2}&{Down 5}&{left}{Down 4}p{Right}{up}&{left}{Down 2}{Right}sroy&&{Down}&^

Some examples using the defined stockpile aliases in a quickfort designation:

Code: [Select]
#place Place a food stockpile
` ` ` ` #
` ` ` ` #
` f(2x1)#
` ` ` ` #
# # # # #
This illustration may be a little hard to understand. The f(2x1) is in column 2, row 3. All the other cells are empty. QF considers both ` and ~ characters within cells to be empty cells; this can help with multilayer or fortresswide blueprint layouts as 'chalk lines'.

With f(2x1), we've asked QF to place a Food stockpile 2 units wide by 1 high unit, or f(2x1). QF sends the necessary keys to resize the placement region. This also works properly in all modes, including build mode (floors Cf(10x10), bridges ga(4x4), etc. that are sized with UMKH keys).

Note that the f(2x1) syntax isn't actually necessary here; we could have just used:
Code: [Select]
#place Place a food stockpile
` ` ` ` #
` ` ` ` #
` f f ` #
` ` ` ` #
# # # # #

QF2 is smart enough to recognize this as a 2x1 food stockpile, and creates it as such rather than as two 1x1 food stockpiles. This applies to most cases where f(WxH) could also be used. The f(WxH) style can still be useful in cases where the layout would be ambiguous; consider an L-shaped food stockpile(s).

Lastly, let's turn the bed into a bedroom, and set the food stockpile to hold only booze.

Code: [Select]
#query
` ` ` ` #
` r+` ` #
` booze #
` ` ` ` #
# # # # #

In column 2, row 2 we have "r+". This sends r+ keys to DF when the cursor is over the bed, causing us to 'make room' and then increase its size to ensure the 'room' fills the entire area.

In column 2, row 3 we have "booze". booze is an alias keyword defined in the included config/aliases.txt file. This particular alias sets a food stockpile to carry booze only, by sending the commands needed to navigate DF's stockpile settings menu.

The included Blueprints/Examples/bedroom-*.csv files provide a good simple example of a 4-layer QF blueprint. Check out aliases.txt for some helpful starting aliases. Blueprints/TheQuickFortress/ provides a good detailed set of examples covering some more complex designs.

Spoiler (click to show/hide)

Title: Re: DFHack 0.40.15-r1
Post by: Voxus on November 13, 2014, 08:19:01 am
I've never used the workflow plugin, so maybe I'm looking in wrong place, but I can edit ranges without problems:

(http://i.imgur.com/4AGDVFil.png) (http://imgur.com/4AGDVFi)

However your main issue is crashes, right? Here are the instructions how to enable crash dumps that would help me to fix it.
http://www.bay12forums.com/smf/index.php?topic=138754.msg5624349#msg5624349

Yea, that's the correct location!
Workflow seems to be on and off for me, sometimes what you showed there is what I get now with TwbT, sometimes arbitrary text in specifically workflow so far stops working.
I've applied the registry files and I'll get back to you on anything I get out of that. I'll also try and get any screenshots I can.
Title: Re: DFHack 0.40.15-r1
Post by: UnicodingUnicorn on November 13, 2014, 09:54:52 am
Not too sure if this is the correct place to mention this, but when I use item-trigger in DFHack 0.40.13-r1 like this:
modtools/item-trigger -itemType ITEM_SHOES_PIPBUCK -onEquip -command [ modtools/add-syndrome -syndrome "PipBuck" -target \\UNIT_ID ]
DFHack will crash upon unpausing in Fortress Mode. Is this is a known thing? If you want, here is the crash dump (http://dffd.wimbli.com/file.php?id=10063)
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 13, 2014, 10:23:16 am
Not too sure if this is the correct place to mention this, but when I use item-trigger in DFHack 0.40.13-r1 like this:
modtools/item-trigger -itemType ITEM_SHOES_PIPBUCK -onEquip -command [ modtools/add-syndrome -syndrome "PipBuck" -target \\UNIT_ID ]
DFHack will crash upon unpausing in Fortress Mode. Is this is a known thing? If you want, here is the crash dump (http://dffd.wimbli.com/file.php?id=10063)

I'll take a look when I get a chance.
Title: Re: DFHack 0.40.15-r1
Post by: Mister Always on November 13, 2014, 11:06:04 am
Does DFHack work with the newest version of DF or what?
Title: Re: DFHack 0.40.15-r1
Post by: Rahk on November 13, 2014, 11:36:34 am
Does DFHack work with the newest version of DF or what?

It has the version that is supported in the original post.  But right now it supports up to 0.40.15 with DFHack version 0.40.15-r1.  DF 0.40.16 just came out so it is not yet supported by DFHack.
Title: Re: DFHack 0.40.15-r1
Post by: Dirst on November 13, 2014, 11:38:38 am
Does DFHack work with the newest version of DF or what?
I was going to ask that a few minutes after the update posted, just because I like the sound of Quietust saying "No."

But I don't want to distract the memory mapping guys.

It sounds like there were few if any changes to data structures, so I'd imaging this round of mapping would be relatively quick.  The automated detection might already be done with a bunch of testing now to make sure that DFHack 0.40.16-r1 doesn't set your computer on fire.
Title: Re: DFHack 0.40.15-r1
Post by: Mister Always on November 13, 2014, 11:43:09 am
Does DFHack work with the newest version of DF or what?
I was going to ask that a few minutes after the update posted, just because I like the sound of Quietust saying "No."

But I don't want to distract the memory mapping guys.

It sounds like there were few if any changes to data structures, so I'd imaging this round of mapping would be relatively quick.  The automated detection might already be done with a bunch of testing now to make sure that DFHack 0.40.16-r1 doesn't set your computer on fire.

Well I don't know WHAT the hell most of that means but I'll just wait a while.
Title: Re: DFHack 0.40.15-r1
Post by: Dirst on November 13, 2014, 12:01:19 pm
Well I don't know WHAT the hell most of that means but I'll just wait a while.
DFHack is a hack: it inserts itself into the DF game by replacing one of the DLL files.  If this DLL was compiled by Toady alongside the rest of DF, it would Just Work.  The reality is that the DFHack team has to poke around inside each new version of DF and find out where everything is stored, a task made a bit more difficult by the security features of Windows, OSX and Linux.  When you hear references to the SYMBOLS table, that is the list of memory locations for game data (the in-game date, the raws, the name of a creature, etc., etc., etc.).

I know that Dwarf Therapist also uses the SYMBOLS table, and a lot of 3rd-party tools (TWBT, Stonesense, Embark Tools, etc.) are DFHack plugins that can't operate without DFHack.
Title: Re: DFHack 0.40.15-r1
Post by: The Bard on November 13, 2014, 02:02:16 pm
Had a bit of a reveal mishap. I revealed, let my miners start digging, but now when I unreveal, my dug out squares are invisible, even if the miners dig them out afterward.
Title: Re: DFHack 0.40.15-r1
Post by: Max™ on November 13, 2014, 03:39:09 pm
^ try tiletypes paint h 0 it will unhide them, if you still can't see them you could try to use paint l 1 and make sure the squares are visible due to being lit.

Also, yeah, the memory mapper folks are wonderful, and should be entombed in molten steel for everyone to admire them eternally appreciated for their hard work getting new versions cracked open for the rest of us.
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 13, 2014, 04:48:40 pm
Well I don't know WHAT the hell most of that means but I'll just wait a while.
DFHack is a hack: it inserts itself into the DF game by replacing one of the DLL files.  If this DLL was compiled by Toady alongside the rest of DF, it would Just Work.
This is only true on Windows, where DFHack is implemented by replacing SDL.dll. Toady doesn't compile this, but it can safely be replaced (assuming the replacement is built correctly), since it's linked to DF dynamically (i.e. DF doesn't rely on a specific copy of SDL.dll).
On OS X and Linux, DFHack is built as a separate library and a modified launcher script is used to load this library before starting DF.

Quote
The reality is that the DFHack team has to poke around inside each new version of DF and find out where everything is stored, a task made a bit more difficult by the security features of Windows, OSX and Linux.  When you hear references to the SYMBOLS table, that is the list of memory locations for game data (the in-game date, the raws, the name of a creature, etc., etc., etc.).
There aren't really security problems, since DFHack and DF run in the same address space (and can access the same memory).
Of the things you listed, the date is the only one actually in symbols.xml (cur_year, cur_year_tick, etc.). If I understand correctly, most other things are located with respect to an offset in symbols.xml and the size of certain structures (for example, "world" contains a list of units, each of which have a name which can be located based on the known layout of a unit).
A lot of addresses in symbols.xml can be located automatically with scripts (i.e. by scanning the executable). Some need to be located when DF is running, which can be done semi-automatically with a DFHack script. A few (debug flags and save_on_exit) need to be located manually. The bulk of the manual work is determining if there are any changes to structures. For example, 0.40.15 added four new types of announcements, which increased the size of the announcement_flags array. It's difficult to say what would have happened if DFHack hadn't been updated to take this into account, but less trivial changes can easily cause crashes.
Quote
I know that Dwarf Therapist also uses the SYMBOLS table, and a lot of 3rd-party tools (TWBT, Stonesense, Embark Tools, etc.) are DFHack plugins that can't operate without DFHack.
Dwarf Therapist actually uses a separate configuration format (not symbols.xml) which contains some different data, so there isn't really a single "symbols table". However, a lot of this data comes from the df-structures (https://github.com/DFHack/df-structures) repo, which is what DFHack uses as well. (It's also possible to generate a DT ini file using DFHack, which I did for 0.40.15.)
Title: Re: DFHack 0.40.15-r1
Post by: Dirst on November 13, 2014, 05:24:52 pm
Spoiler: Detailed explanation (click to show/hide)
Thanks for the clarification.  The security feature I meant was the address space randomization, which affects how the memory mapping needs to be set up initially but probably doesn't affect version-to-version updates.  And sorry about the brain-fart conflating df-structures, symbols.xml, and Dwarf Therapist's .ini files.

In any case, great work on the whole enterprise!
Title: Re: DFHack 0.40.15-r1
Post by: Putnam on November 14, 2014, 01:40:13 am
Huh, you can edit stress directly and it'll stick now.

Code: [Select]
local utils = require 'utils'

validArgs = validArgs or utils.invert({
 'unit',
 'amount',
 'adjust'
})

local args = utils.processArgs({...}, validArgs)

local unit = args.unit and df.unit.find(args.unit) or dfhack.gui.getSelectedUnit(true)

if not unit then qerror('No unit was selected or specified.') end

if args.amount then
    if args.adjust then
        unit.status.current_soul.personality.stress_level=unit.status.current_soul.personality.stress_level+args.amount
    else
        unit.status.current_soul.personality.stress_level=args.amount
    end
else
    print(unit.status.current_soul.personality.stress_level)
end
Title: Re: DFHack 0.40.15-r1
Post by: Rose on November 14, 2014, 05:03:22 am
Cheat everyone to have -500000 stress?
Title: Re: DFHack 0.40.15-r1
Post by: Putnam on November 14, 2014, 05:12:09 am
I tested it by doing the opposite, heheh.

But yeah, that's 100% possible now.
Title: Re: DFHack 0.40.15-r1
Post by: rmblr on November 14, 2014, 05:22:21 am
Is there some reason dfhack gui plugins and keybindings wouldn't play well with vanilla macros?
Title: Re: DFHack 0.40.15-r1
Post by: Roses on November 14, 2014, 03:18:20 pm
So I am trying to find out more information about the interactions a creature can do. I have written something that will tell me the name of the interactions, but I was hoping to get some more information from the game itself and have some questions that may or may not be answerable.

From what I have gathered in unit.curse there is interaction_id, interaction_time, interaction_delay, own_interaction, and own_interaction_delay. Now I have figured out that the interaction_ fields are for interactions from syndromes and the own_interaction_ fields are for interactions from the creature/caste itself. From what I can gather interaction_time is just the amount of time the unit has been able to do the interaction (the number of ticks since the syndrome was applied), and the _delay is the number of ticks since the unit last used the interaction. The issue comes when trying to identify the individual interactions. The interaction_id doesn't seem to correspond to any identification that I can find, and the own_interaction is reference to the data in creature.caste.body_info.interactions which is listed as userdata.

1. Does anyone know what the interaction_id corresponds to?
2. Is there anyway to access a userdata table?

EDIT: Looks like I found what interaction_id points to, and how to get the information concerning the interactions acquired through syndromes. I am still unable to find any extra information regarding innate interactions.
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 14, 2014, 06:21:08 pm
Roses: All I know is that I tried very hard to figure that out and I failed. I believe there is a type that hasn't yet been mapped out for innate interactions a caste can do.
Title: Re: DFHack 0.40.15-r1
Post by: RadonPlasma on November 15, 2014, 01:23:05 am
Is there some reason dfhack gui plugins and keybindings wouldn't play well with vanilla macros?
Just curious, but is this in response to something you've experienced?
Title: Re: DFHack 0.40.15-r1
Post by: rmblr on November 15, 2014, 08:37:14 am
Is there some reason dfhack gui plugins and keybindings wouldn't play well with vanilla macros?
Just curious, but is this in response to something you've experienced?

Yea, whenever I record a basic macro (digging designations, placing furniture, hauling route assignment) then play it, crazy things happen. In particular I noticed a small dfhack prompt appearing in the upper left (where the FPS counter goes) and keys being entered there which is quite strange.

Title: Re: DFHack 0.40.15-r1
Post by: Dragoon209 on November 15, 2014, 08:49:31 am
While talking with other Web Fortress (http://www.bay12forums.com/smf/index.php?topic=144956.0) hosts, we came up with an idea for a Notes browser plugin that would help make community forts much more productive.

When summoned via hotkey, a menu would appear in the Dwarf Fortress game window with a list of all the notes in the fortress, sorted by name.  The player should be able to search the list.  When the player selects a note and hits enter, it should jump to that section of the fort, and open the note in the DF interface so the player can read any additional note text.

Additionally, it would be nice if the list of notes could be exported to a file to allow easy transfer to a community Fort Diary, allowing players who are just observing to get an idea of what is in the fortress. I think a format like this would be helpful:
   
Note Name: Note Coords
    Note Text
Note Name: Note Coords
    Note Text

Super Bonus Time Options:
    When a lever is built, a note is Automatically created at its location with a Name like "Lever-Coords"?

The Plugin would need to be compatible with DF Hack 34.11-R5 (The current supported version of Web Fortress.)

None of us are experienced enough with DF Hack or C++ to write it.  Would someone be interested in writing it?

Additionally, There is some need for a Story Telling Plugin as well that adds events to the log.  For example, when a Forgotten Beast arrives, the contents of the popup in-game should be written to the log for later capture.  The same could be done for arriving migrants, the creation of artifacts, etc.  Please let me know if there is any interest!  You can also find us in #webfortress in webchat.quakenet.org!
Title: Re: DFHack 0.40.15-r1
Post by: Dragoon209 on November 15, 2014, 08:58:23 am
Is there some reason dfhack gui plugins and keybindings wouldn't play well with vanilla macros?
Just curious, but is this in response to something you've experienced?

Yea, whenever I record a basic macro (digging designations, placing furniture, hauling route assignment) then play it, crazy things happen. In particular I noticed a small dfhack prompt appearing in the upper left (where the FPS counter goes) and keys being entered there which is quite strange.

You might want to increase the key delay in your init.txt.  It sounds like the macro is firing off too fast, and it is missing some keypresses, thus derailing the entire macro.

By default, it is set to 15ms, but I think the LNP sets it to 0ms to help with using quickfort.
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 15, 2014, 09:18:45 am
Is there some reason dfhack gui plugins and keybindings wouldn't play well with vanilla macros?
Just curious, but is this in response to something you've experienced?

Yea, whenever I record a basic macro (digging designations, placing furniture, hauling route assignment) then play it, crazy things happen. In particular I noticed a small dfhack prompt appearing in the upper left (where the FPS counter goes) and keys being entered there which is quite strange.
Can you verify that you're using Ctrl-P and not Ctrl-Shift-P?
Title: Re: DFHack 0.40.15-r1
Post by: ptb_ptb on November 15, 2014, 10:45:19 am
Huh, you can edit stress directly and it'll stick now.

I could really do with that ... but I'm in 0.40.16 so I'd have to wait anyway.
Title: Re: DFHack 0.40.15-r1
Post by: Badger Storm on November 15, 2014, 07:42:49 pm
When can we expect DFHack for 40.16?  The dwarf pus is gone, but somehow I got my aquifer full of otter blood!  Yuck.
Title: Re: DFHack 0.40.15-r1
Post by: jwhite.df on November 15, 2014, 08:43:27 pm
When can we expect DFHack for 40.16?  The dwarf pus is gone, but somehow I got my aquifer full of otter blood!  Yuck.

I want a pony. ;-)
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 15, 2014, 08:45:38 pm
When can we expect DFHack for 40.16?  The dwarf pus is gone, but somehow I got my aquifer full of otter blood!  Yuck.

I haven't heard anything.
Title: Re: DFHack 0.40.15-r1
Post by: Albany on November 16, 2014, 12:51:39 am
Is there a command within tiletypes to turn a particular tile into a sand tile? I've monkeyed around with it a bit and peered through help files but haven't found anything definitive, neither in my experimentation nor in the documentation.

Thanks!
Title: Re: DFHack 0.40.15-r1
Post by: myk on November 16, 2014, 12:53:18 am
I believe that if the layer+biome is sandy, m SOIL will result in a sand tile
Title: Re: DFHack 0.40.15-r1
Post by: Albany on November 16, 2014, 12:57:53 am
I believe that if the layer+biome is sandy, m SOIL will result in a sand tile

Hmm. I may be doing something wrong, or my biome isn't sandy. (Incidentally, if it isn't, is there any way to force a sandy tile? As you all know, I only need one. :P )

(http://i.gyazo.com/4ba7a80b7c101e7bc54820186a4f6991.png)

Here's what I'm trying. Activating it outside and inside my fortress didn't change anything.
Title: Re: DFHack 0.40.15-r1
Post by: arbarbonif on November 16, 2014, 03:15:44 am
I believe that if the layer+biome is sandy, m SOIL will result in a sand tile

Hmm. I may be doing something wrong, or my biome isn't sandy. (Incidentally, if it isn't, is there any way to force a sandy tile? As you all know, I only need one. :P )

(http://i.gyazo.com/4ba7a80b7c101e7bc54820186a4f6991.png)

Here's what I'm trying. Activating it outside and inside my fortress didn't change anything.

Try TAN_SAND (or SAND_TAN).  I usually just do changelayer.
Title: Re: DFHack 0.40.15-r1
Post by: Max™ on November 16, 2014, 03:46:33 am
Try to change some stone, you might find a layer that turns into sand, I had some granite I think which I accidentally turned into white sand while trying to paint in some soil channels for a waterfall.
Title: Re: DFHack 0.40.15-r1
Post by: UnicodingUnicorn on November 16, 2014, 09:52:48 am
Not wanting to sound impatient, but is there any progress on the crash related to item-trigger I posted previously?
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 16, 2014, 10:53:38 am
Not wanting to sound impatient, but is there any progress on the crash related to item-trigger I posted previously?

I fixed a lot of related things lately. What specifically was the problem?
Title: Re: DFHack 0.40.15-r1
Post by: StagnantSoul on November 16, 2014, 12:39:25 pm
Is there any way to get dwarves to like certain things? I want to get a dwarf to like cloaks, and another to like morningstars.
Title: Re: DFHack 0.40.15-r1
Post by: Just Some Guy on November 16, 2014, 01:09:18 pm
Am I the only one having issues with siren? It apparently can't read field unit.T_status.recent_events.
Title: Re: DFHack 0.40.15-r1
Post by: StagnantSoul on November 16, 2014, 01:22:26 pm
Siren appears to have a 50/50 chance of working. Same with full-heal and make-monarch.
Title: Re: DFHack 0.40.15-r1
Post by: fricy on November 16, 2014, 02:41:14 pm
Am I the only one having issues with siren? It apparently can't read field unit.T_status.recent_events.
Might be something to do with the emotion/thought rewrite, it seems df.unit_thought_type.Tired doesn't exist any more. No idea about recent_events, possibly that changed too.
Title: Re: DFHack 0.40.15-r1
Post by: UnicodingUnicorn on November 16, 2014, 09:07:46 pm
Not wanting to sound impatient, but is there any progress on the crash related to item-trigger I posted previously?

I fixed a lot of related things lately. What specifically was the problem?

Not too sure if this is the correct place to mention this, but when I use item-trigger in DFHack 0.40.13-r1 like this:
modtools/item-trigger -itemType ITEM_SHOES_PIPBUCK -onEquip -command [ modtools/add-syndrome -syndrome "PipBuck" -target \\UNIT_ID ]
DFHack will crash upon unpausing in Fortress Mode. Is this is a known thing? If you want, here is the crash dump (http://dffd.wimbli.com/file.php?id=10063)
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 16, 2014, 09:47:58 pm
There have been a lot of changes since 0.40.13-r1. I just tested it and item-trigger works just fine now, including onEquip and onUnequip events. add-syndrome has also had a few fixes.
Title: Re: DFHack 0.40.15-r1
Post by: UnicodingUnicorn on November 16, 2014, 10:56:44 pm
Thank you.
Title: Re: DFHack 0.40.15-r1
Post by: Max™ on November 17, 2014, 03:43:12 am
Is there any way to get dwarves to like certain things? I want to get a dwarf to like cloaks, and another to like morningstars.
Only way I know of for sure is kinda fiddly, but you can go into gm-editor > status > current soul > preferences, usually the fourth or fifth entry will be a pre-existing likes item preference, which I've found are a bit safer to edit than trying to manually add one or edit a totally different preference.

For cloaks you'd change the type to uh, 25, for armor I think, and then cloaks are item subtype 5 or 6 I think?

Morningstar... uh, would be type 24 for weapon but I'm not sure which subtype a morning star is, probably higher than 10 though, as I think the first few are like, battle axe, war hammer, short sword, pick, spear, crossbow, mace I think?
Title: Re: DFHack 0.40.15-r1
Post by: Putnam on November 17, 2014, 03:45:25 am
Subtypes are entirely based on your raws, so you'll basically have to search for what you want there. If you're using Lua, it's far better to just use df.item_type.ARMOR instead of using the magic number 25 in your code, especially since it'll cross versions if that ever changes (unlikely, but better safe than sorry and, again, it's better-looking anyway)
Title: Re: DFHack 0.40.15-r1
Post by: McFeel on November 18, 2014, 05:57:53 am
Hello,

  AdvFort is working correctly in DFHack 0.40.15-r1? You can cut the new trees?

  Thanks in advance.
Title: Re: DFHack 0.40.15-r1
Post by: Badger Storm on November 18, 2014, 06:46:03 am
Will the current version more-or-less work with 40.16?
Title: Re: DFHack 0.40.15-r1
Post by: Nopenope on November 18, 2014, 07:00:51 am
Having built dfhack using df-structures from quietust's repo I confirm that it does work.
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 18, 2014, 10:49:25 am
Just because it compiles doesn't mean it works yet.
Title: Re: DFHack 0.40.15-r1
Post by: Roses on November 18, 2014, 11:51:13 am
Roses: All I know is that I tried very hard to figure that out and I failed. I believe there is a type that hasn't yet been mapped out for innate interactions a caste can do.

Alright, that's pretty much what I thought.
Title: Re: DFHack 0.40.15-r1
Post by: Nopenope on November 18, 2014, 12:02:39 pm
Just because it compiles doesn't mean it works yet.
I didn't explicitly say it in the previous post but I obviously ran it, otherwise I wouldn't have posted at all. Even rendermax works.
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 18, 2014, 12:14:27 pm
Roses: All I know is that I tried very hard to figure that out and I failed. I believe there is a type that hasn't yet been mapped out for innate interactions a caste can do.

Alright, that's pretty much what I thought.

Actually Quietust just found that struct yesterday so it might be doable soon.
Title: Re: DFHack 0.40.15-r1
Post by: Roses on November 18, 2014, 12:29:17 pm
Roses: All I know is that I tried very hard to figure that out and I failed. I believe there is a type that hasn't yet been mapped out for innate interactions a caste can do.

Alright, that's pretty much what I thought.

Actually Quietust just found that struct yesterday so it might be doable soon.

Wow, that would be awesome!
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 18, 2014, 03:52:38 pm
Will the current version more-or-less work with 40.16?
To clarify, the current version (0.40.15-r1) will only work with 0.40.15 (possibly 0.40.14 as well), but it's fairly easy to compile from source for 0.40.16.
Title: Re: DFHack 0.40.15-r1
Post by: smeeprocket on November 18, 2014, 04:00:28 pm
aaand is that possible for everyone to do? I'm desperate and I'm being killed fps wise on my current fort.8
Title: Re: DFHack 0.40.15-r1
Post by: Harpya on November 18, 2014, 04:18:37 pm
Will the current version more-or-less work with 40.16?
To clarify, the current version (0.40.15-r1) will only work with 0.40.15 (possibly 0.40.14 as well), but it's fairly easy to compile from source for 0.40.16.

Not to be greedy, but would it be possible for one of you who easily compiled a version for 0.40.16 to please post it here for noobs like me? That would be great! Thanks a lot!
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 18, 2014, 04:27:18 pm
We should be able to have an actual release up soon.
Title: Re: DFHack 0.40.15-r1
Post by: Cptn Kaladin Anrizlokum on November 18, 2014, 06:34:39 pm
Okay, I need this just for clean owned... Half my rooms are full of owned food.
Title: Re: DFHack 0.40.15-r1
Post by: Zanzetkuken The Great on November 18, 2014, 08:01:44 pm
We should be able to have an actual release up soon.

How soon, by the way?  I have a succession fort I'm trying to start, but one of the mods requires this, and considering the mods I'm using, I need the fixes of the most recent version so all the civs don't die quickly.
Title: Re: DFHack 0.40.15-r1
Post by: expwnent on November 18, 2014, 11:25:56 pm
There are a few remaining globals left to be found. Give it a day or two.
Title: Re: DFHack 0.40.15-r1
Post by: funkydwarf on November 18, 2014, 11:30:13 pm
I give up! I have tried for an hour. Its driving me nuts. I just cant figure out how to clone the development branch instead of the main dfhack branch.

Im in windows 7 cmd, and I have successfully compiled the main branch before, so my environment is all set up and working.

instead of

git clone git://github.com/DFHack/dfhack.git

to start the list from the Compile.html

is there something like

git clone git://github.com/DFHack/develop/dfhack.git   or something to just clone the development branch?

or maybe its a fetch thing like  lethosor's instructions (on how to compile quiestust's early .14 build I followed, thanks!)

Spoiler (click to show/hide)

but way simpler cause i just need to fetch the develop branch of the main repo not a fork!!

I know there is a way, I know I am almost there, and have learned a little more by failing, but I am ready to move on, and know many people here have the git skills to help out. Please oh please help me. its driving me nuts

Thanks alot Dfhack team for so furiously coding away in these fast moving dwarfy times!   
Title: Re: DFHack 0.40.15-r1
Post by: mifki on November 18, 2014, 11:32:40 pm
git clone -b develop git://github.com/DFHack/dfhack.git
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 18, 2014, 11:43:07 pm
Or git checkout develop && git pull (which should automatically track origin/develop in a fresh clone).
Title: Re: DFHack 0.40.15-r1
Post by: funkydwarf on November 18, 2014, 11:47:03 pm
Thank YOU!!   When I run the git command line program with no switches and it shows the usage info, -b is not on there, I would have never got that!





lethosor:
Already compiling, but check that option out as well. Seems I should know about both ways, how they differ and why and when to use either.


These are both good launching points for me, thanks again guys! I find the trick to learning new things is having a few different vectors, or seeds, to search out from.

 
Title: Re: DFHack 0.40.15-r1
Post by: mkaito on November 19, 2014, 09:53:42 am
git clone -b develop git://github.com/DFHack/dfhack.git

Git veteran here, I never knew about the -b switch to clone. You never go to bed without having learned at least one new thing, eh?
Title: Re: DFHack 0.40.15-r1
Post by: Badger Storm on November 19, 2014, 02:45:22 pm
Since 40.16 isn't here yet, is there a way to use 40.15 df hack with 40.16?
Title: Re: DFHack 0.40.15-r1
Post by: lethosor on November 19, 2014, 02:52:40 pm
git clone -b develop git://github.com/DFHack/dfhack.git

Git veteran here, I never knew about the -b switch to clone. You never go to bed without having learned at least one new thing, eh?
Keep in mind that this will create a fresh clone of the repo - it's faster to simply use "git checkout develop" if you've already cloned DFHack.

Since 40.16 isn't here yet, is there a way to use 40.15 df hack with 40.16?
No. It won't recognize DF versions other than 0.40.14 or 0.40.15, and it could crash if you try to update symbols.xml with 0.40.16 symbols. (It's unlikely in this case, since the only changes I can see are naming changes, but it's generally not safe to use DFHack with an unsupported DF version.)
There are a few remaining globals left to be found. Give it a day or two.
Title: Re: DFHack 0.40.15-r1
Post by: mifki on November 19, 2014, 05:14:28 pm
Oh good I didn't update twbt for 40.16 :) Or will you still release it for some reason?
Title: Re: DFHack 0.40.15-r1
Post by: PeridexisErrant on November 19, 2014, 06:33:51 pm
Oh good I didn't update twbt for 40.16 :) Or will you still release it for some reason?

I don't really care whether it's 40.16 or 40.17 at this point, I just hope it's soon  :D
Title: Re: DFHack 0.40.15-r1
Post by: Dirst on November 19, 2014, 11:59:12 pm
Oh good I didn't update twbt for 40.16 :) Or will you still release it for some reason?

I don't really care whether it's 40.16 or 40.17 at this point, I just hope it's soon  :D
It sounded like .16 was just about finished, so I hope all that work doesn't go to waste.

Hopefully the automated scanning can happen in .17 while the human expertise polishes .16.
Title: Re: DFHack 0.40.16-r1
Post by: expwnent on November 20, 2014, 12:23:57 am
New release. 0.40.17-r1 will probably be faster than 0.40.16-r1. Download links are now on github.
Title: Re: DFHack 0.40.16-r1
Post by: PeridexisErrant on November 20, 2014, 12:43:22 am
Woohoo!
Title: Re: DFHack 0.40.16-r1
Post by: fricy on November 20, 2014, 03:05:10 am
OSX | DFHack 0.40.16-r1 (https://www.dropbox.com/s/1ynh6y2nw0dryce/dfhack_osx_0.40.16-r1.bz2?dl=0) with Stonesense
Title: Re: DFHack 0.40.16-r1
Post by: UnicodingUnicorn on November 20, 2014, 04:54:07 am
I'm sorry, but DFHack still seems to crash when item-trigger is used like this: modtools/item-trigger -itemType ITEM_SHOES_PIPBUCK -onEquip -command [ modtools/add-syndrome -syndrome "PipBuck" -target \\UNIT_ID ]

If you wish, here (http://dffd.wimbli.com/file.php?id=10063) is a crash dump.
Title: Re: DFHack 0.40.16-r1
Post by: smeeprocket on November 20, 2014, 05:32:06 am
is removebadthoughts all the wrong command for what I need or is it just not working,b ecause my dwarves are still unreasonably sad.
Title: Re: DFHack 0.40.16-r1
Post by: Putnam on November 20, 2014, 05:34:49 am
Removebadthoughts will need a complete rewrite to work. Not entirely sure why it's still included.
Title: Re: DFHack 0.40.16-r1
Post by: Rose on November 20, 2014, 05:40:22 am
make it just set the stress to -1000000
Title: Re: DFHack 0.40.16-r1
Post by: Putnam on November 20, 2014, 05:48:39 am
Heh.

Code: [Select]
if ... then
    for k,v in ipairs(df.global.world.units.active) do
        v.status.current_soul.personality.stress_level=-1000000
    end
else
    dfhack.gui.getSelectedUnit().status.current_soul.personality.stress_level=-1000000
end

There you go. Just type whatever you name that script (put it into a .lua file in hack/scripts, the name of the script is the name of the file) and it'll set the stress of the highlighted unit to -1000000; type any argument ("<name> all", for example) and it'll do it with all units on the map.

EDIT: Wow I just realized that removing bad thoughts won't actually decrease stress levels as of 0.40.14, so this is actually the best alternative. Ain't that a thing.
Title: Re: DFHack 0.40.16-r1
Post by: PeridexisErrant on November 20, 2014, 06:01:30 am
I'm calling this "remove-stress" and adding it to my pack.

Code: (remove-stress.lua) [Select]
-- remove stress from a unit
-- With unit selected, affects that unit.  Use "remove-stress all" to affect all units.

--By Putnam; http://www.bay12forums.com/smf/index.php?topic=139553.msg5820486#msg5820486

if ... then
    for k,v in ipairs(df.global.world.units.active) do
        v.status.current_soul.personality.stress_level=-1000000
    end
else
    dfhack.gui.getSelectedUnit().status.current_soul.personality.stress_level=-1000000
end
Title: Re: DFHack 0.40.16-r1
Post by: Putnam on November 20, 2014, 06:03:56 am
k
Title: Re: DFHack 0.40.16-r1
Post by: mifki on November 20, 2014, 06:37:10 am
Shouldn't it affect citizens only?
Title: Re: DFHack 0.40.16-r1
Post by: Sergarr on November 20, 2014, 06:37:41 am
I'm sorry, but DFHack still seems to crash when item-trigger is used like this: modtools/item-trigger -itemType ITEM_SHOES_PIPBUCK -onEquip -command [ modtools/add-syndrome -syndrome "PipBuck" -target \\UNIT_ID ]

If you wish, here (http://dffd.wimbli.com/file.php?id=10063) is a crash dump.
what if you use one slash instead of two

I heard this helps
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 20, 2014, 06:41:27 am
OSX | DFHack 0.40.16-r1 (https://www.dropbox.com/s/1ynh6y2nw0dryce/dfhack_osx_0.40.16-r1.bz2?dl=0) with Stonesense
How did you compile Stonesense? I haven't been able to compile it on any platform since the emotion changes in 0.40.14.
Title: Re: DFHack 0.40.16-r1
Post by: fricy on November 20, 2014, 07:21:03 am
OSX | DFHack 0.40.16-r1 (https://www.dropbox.com/s/1ynh6y2nw0dryce/dfhack_osx_0.40.16-r1.bz2?dl=0) with Stonesense
How did you compile Stonesense? I haven't been able to compile it on any platform since the emotion changes in 0.40.14.
Naive happiness patch. (https://github.com/DFHack/stonesense/pull/25) It runs, and feels as stable as usual on osx, but that's not too much. :)
Title: Re: DFHack 0.40.16-r1
Post by: ptb_ptb on November 20, 2014, 08:11:18 am
Eh, this is probably impossible - but I'm going to ask anyway. :P

Say you have retired fortress which falls while you are in adventure mode. If you reclaim you find it is full of all the dwarves that were in there before it 'fell' and they are all listed in 'other' as 'hostile'.

Is there any way to fix it so that they are considered part of the fortress' population - either before or after it is reclaimed?
Title: Re: DFHack 0.40.16-r1
Post by: expwnent on November 20, 2014, 09:15:12 am
I'm sorry, but DFHack still seems to crash when item-trigger is used like this: modtools/item-trigger -itemType ITEM_SHOES_PIPBUCK -onEquip -command [ modtools/add-syndrome -syndrome "PipBuck" -target \\UNIT_ID ]

If you wish, here (http://dffd.wimbli.com/file.php?id=10063) is a crash dump.

When does it crash? Immediately after calling it or when they equip it or unequip it? Arena or fort mode?
Title: Re: DFHack 0.40.16-r1
Post by: UnicodingUnicorn on November 20, 2014, 09:41:38 am
When does it crash? Immediately after calling it or when they equip it or unequip it? Arena or fort mode?
Immediately  after unpausing in Fortress Mode.
Title: Re: DFHack 0.40.16-r1
Post by: smeeprocket on November 20, 2014, 10:03:40 am
wow that worked like a charm. Thanks. I wouldn't cheat that much but the stress system currently just makes dwarves useless after a couple years.
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 20, 2014, 02:53:06 pm
OSX | DFHack 0.40.16-r1 (https://www.dropbox.com/s/1ynh6y2nw0dryce/dfhack_osx_0.40.16-r1.bz2?dl=0) with Stonesense
How did you compile Stonesense? I haven't been able to compile it on any platform since the emotion changes in 0.40.14.
Naive happiness patch. (https://github.com/DFHack/stonesense/pull/25) It runs, and feels as stable as usual on osx, but that's not too much. :)
Apparently I wasn't watching that repo, so I never noticed that PR. Thanks!

Edit: Also, how did you create that package? It appears from the filename that you used something other than "make package".
Title: Re: DFHack 0.40.16-r1
Post by: Badger Storm on November 20, 2014, 03:28:45 pm
So, to install DFHack, I'm putting in the contents of the downloaded folder into the "main" DF folder.  It's prompting me to replace some of the files ("libs" for one).  Should I go ahead and replace all of them?
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 20, 2014, 03:30:12 pm
What platform are you using, and what files are in the archive? It sounds like you're using OS X, but OS X DFHack builds shouldn't ship the "libs" folder at all.
Title: Re: DFHack 0.40.16-r1
Post by: Badger Storm on November 20, 2014, 03:34:38 pm
OSX, yes.  Files are libs, stonesense, hack, dfhack, dfhack-run, and dfhack.init-example.  Should I ditch the libs file that got downloaded?
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 20, 2014, 03:35:48 pm
Oh, Stonesense might require libs/libfreetype.dylib. I don't think anything else needs to be overwritten.
Title: Re: DFHack 0.40.16-r1
Post by: Beautato on November 20, 2014, 03:48:26 pm
I noticed there wasn't a pre-compiled version for linux this time around. I compiled one with gcc4.9.1, tested on ubuntu 14.04.

http://dffd.wimbli.com/file.php?id=10101

will be using it for the LNP later tonight.
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 20, 2014, 03:52:24 pm
I put up a build of 0.40.16-r1 at https://github.com/lethosor/dfhack/releases, which uses GCC 4.5. GCC 4.9 builds don't work on systems that don't have GCC 4.9 available (which includes a number of Ubuntu distros).
Title: Re: DFHack 0.40.16-r1
Post by: Beautato on November 20, 2014, 04:00:49 pm
I put up a build of 0.40.16-r1 at https://github.com/lethosor/dfhack/releases, which uses GCC 4.5. GCC 4.9 builds don't work on systems that don't have GCC 4.9 available (which includes a number of Ubuntu distros).


excellent, I will be using your builds instead of making my own 4.5.4 ones, Thanks! :D
Title: Re: DFHack 0.40.16-r1
Post by: int_ua on November 20, 2014, 09:34:31 pm
stonesense compiles and works fine on linux
https://github.com/DFHack/stonesense/pull/22
https://github.com/DFHack/stonesense/pull/25

isoworld too but it needs some tinkering still:
http://www.bay12forums.com/smf/index.php?topic=70700.msg5820756#msg5820756
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 20, 2014, 09:38:29 pm
It's left out of the Windows build as well, since #25 hasn't been merged yet.
Title: Re: DFHack 0.40.16-r1
Post by: fricy on November 21, 2014, 01:28:08 am
OSX | DFHack 0.40.16-r1 (https://www.dropbox.com/s/1ynh6y2nw0dryce/dfhack_osx_0.40.16-r1.bz2?dl=0) with Stonesense
How did you compile Stonesense? I haven't been able to compile it on any platform since the emotion changes in 0.40.14.
Naive happiness patch. (https://github.com/DFHack/stonesense/pull/25) It runs, and feels as stable as usual on osx, but that's not too much. :)
Apparently I wasn't watching that repo, so I never noticed that PR. Thanks!

Edit: Also, how did you create that package? It appears from the filename that you used something other than "make package".
I made it "by hand", (tar -jcvf), didn't know there's a make command for that. live and learn.
Title: Re: DFHack 0.40.16-r1
Post by: Dirst on November 22, 2014, 12:07:59 am
I had a question about poking reactions with DFHack.  Is it possible to intercept the reaction (either through reaction-trigger or some other hook) and look at or manipulate the reagents?

The idea is that certain rough gems might contain a "seed," and the process of extracting the seed would ruin the gem.  I'd like the player to get the gem back if the dice decide there is no seed in there, but not get the gem back if he/she gets a seed.

Since rough gems don't have names or quality levels or anything, it'd be fine to consume the original in the reaction and pop either a replacement rough gem or a seed in its place.  Ideally, I'd like the produced rough gem to be invisibly different from a mined rough gem (maybe setting it as "rotten" or something) so that the player can't repeatedly inspect the same gem.  "Rotten" or "undisturbed" would be nice because those can be excluded by reagent modifiers... it requires a [REAGENT:rough gem:1:ROUGH:NONE:INORGANIC:MY_MATERIAL][UNROTTEN].

Also, there is a typo in line 57 of modtools/reaction-trigger.lua: the "restul" should be "result".  I think it went under the radar because no one actually uses \\TARGET_ID.
Title: Re: DFHack 0.40.16-r1
Post by: Putnam on November 22, 2014, 01:14:15 am
https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#eventful
Title: Re: DFHack 0.40.16-r1
Post by: expwnent on November 22, 2014, 09:05:13 am
Yeah, it's almost possible with reaction trigger but currently there's no way to tell if a thing in the building was just created or if it has been there a while.
Title: Re: DFHack 0.40.16-r1
Post by: Dirst on November 22, 2014, 11:35:09 am
https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#eventful
Thanks!  This will take a bit of research, but it sounds like exactly what I needed.  Hopefully I can figure out how to make an inorganic "rotten" or "disturbed" without breaking the in-game text too much.

For future reference, is there any prospect of getting a \\REAGENT_LIST or \\PRODUCT_LIST for reaction-trigger?
Title: Re: DFHack 0.40.16-r1
Post by: expwnent on November 22, 2014, 11:41:44 am
At some point there will be.
Title: Re: DFHack 0.40.16-r1
Post by: Mokkun on November 22, 2014, 12:05:02 pm
First thanks for all the good work.

Second, I have probably scewed something up, so ill ask here for help.
changeitem no mather what command and whit a item chosen by K and placing cursor over it (a log lying on a stockpile) or T over a building results in "No item selected in the UI" "No Item selected"

Running Dwarf fortress 0.40.16 whit DF-Hack 0.40.16-r1 and Phobeus graphics, OS Win7 Pro (Norwegian). Fort is from the release whit stepladders.

Second, is there a way in df-hack to make a dwarf no longer like harps, or change its like of harps to robes? that royal is getting rather pissed and I rather get mandates for usefull stuff.. ;) (heard of something called gui\gm-editor but it just gives a errormessage about no valid target when using K button over dwarf.

Any info i can give that can help whit for the changeitem problem?
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 22, 2014, 12:41:42 pm
Are you using the DFHack console or the command-prompt plugin (Ctrl-Shift-P)?
Title: Re: DFHack 0.40.16-r1
Post by: fricy on November 22, 2014, 12:59:47 pm
item chosen by K and placing cursor over it (a log lying on a stockpile) or T over a building results in "No item selected in the UI" "No Item selected"
Could this be the cause? (https://github.com/quietust/df-structures/commit/74e9d4ca5f327ba6b58dff80b22ebdd1fd4a992e)
Title: Re: DFHack 0.40.16-r1
Post by: Mokkun on November 22, 2014, 01:05:07 pm
Are you using the DFHack console or the command-prompt plugin (Ctrl-Shift-P)?
not the promt in Df, the console. (its the window that looks like good old MS-Dos..
Title: Re: DFHack 0.40.16-r1
Post by: Mokkun on November 22, 2014, 05:04:45 pm
item chosen by K and placing cursor over it (a log lying on a stockpile) or T over a building results in "No item selected in the UI" "No Item selected"
Could this be the cause? (https://github.com/quietust/df-structures/commit/74e9d4ca5f327ba6b58dff80b22ebdd1fd4a992e)
It seems to be that for the changeitem, I on a gamble, replaced my symbols.xml whit that one (after spending 10 min to figure out where it was).. and now changeitem info worked.. (not tried rest yet).
Title: Re: DFHack 0.40.16-r1
Post by: UnicodingUnicorn on November 23, 2014, 08:54:44 am
I'm sorry, but DFHack still seems to crash when item-trigger is used like this: modtools/item-trigger -itemType ITEM_SHOES_PIPBUCK -onEquip -command [ modtools/add-syndrome -syndrome "PipBuck" -target \\UNIT_ID ]

If you wish, here (http://dffd.wimbli.com/file.php?id=10063) is a crash dump.
When does it crash? Immediately after calling it or when they equip it or unequip it? Arena or fort mode?
Immediately  after unpausing in Fortress Mode.
Not wanting to sound impatient, but is there any progress on this bug?
Title: Re: DFHack 0.40.16-r1
Post by: Billy Jack on November 23, 2014, 12:18:21 pm
First thanks for all the good work.

Second, I have probably scewed something up, so ill ask here for help.
changeitem no mather what command and whit a item chosen by K and placing cursor over it (a log lying on a stockpile) or T over a building results in "No item selected in the UI" "No Item selected"

Running Dwarf fortress 0.40.16 whit DF-Hack 0.40.16-r1 and Phobeus graphics, OS Win7 Pro (Norwegian). Fort is from the release whit stepladders.

Second, is there a way in df-hack to make a dwarf no longer like harps, or change its like of harps to robes? that royal is getting rather pissed and I rather get mandates for usefull stuff.. ;) (heard of something called gui\gm-editor but it just gives a errormessage about no valid target when using K button over dwarf.

Any info i can give that can help whit for the changeitem problem?

If changeitem isn't working, I don't know what you can do to a current game.

What I do when a new release comes out, is to add reactions so that I can make each of the "random" items (instruments and crafts) at the crafting workshop, allowing me to meet the nobles' needs without wasting a lot of materials for random outputs.

Urist McLovesBoats, "I said I wanted a toy boat, not a toy hammer. Idiots! I rule over idiots!"

Add this to the end of reaction_other.txt RAW
Spoiler (click to show/hide)

Then in the entity_default.txt file, I add the following after [PERMITTED_REACTION:ADAMANTINE_WAFERS]:
Spoiler (click to show/hide)

P.S.  You could add other reactions to cover the other materials that crafts, instruments, and toys can be made from, but rock is good enough for me. :D
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 23, 2014, 12:35:01 pm
The problem mentioned is that changeitem can't locate items, not that it can't modify them.
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 23, 2014, 01:21:15 pm
"devel/pop-screen" should dismiss a screen like that.
Title: Re: DFHack 0.40.16-r1
Post by: Billy Jack on November 23, 2014, 01:36:09 pm
The problem mentioned is that changeitem can't locate items, not that it can't modify them.
The root of the problem is that you can't specify what craft / instrument / toy to create. A hack should not be needed to do so.
Title: Re: DFHack 0.40.16-r1
Post by: smeeprocket on November 23, 2014, 03:27:49 pm
The problem mentioned is that changeitem can't locate items, not that it can't modify them.
The root of the problem is that you can't specify what craft / instrument / toy to create. A hack should not be needed to do so.

Oh that would be wonderful, I had this obnoxious baroness that kept requesting piccolos and bracelets.
Title: Re: DFHack 0.40.16-r1
Post by: Rumrusher on November 23, 2014, 06:04:34 pm
May I suggest some sort of escape key from the enhanced view of the stocks screen, or a way to keep it from automatically putting input into the search space? It, by default, locks key commands into the search bar, ignoring shift/ctrl keystrokes, etc. I'm assuming you escape the menu by pushing the leavescreen button, but since I've bound mine to space instead of esc (a habit formed of 40d), I was unable to leave the page and lost a season's worth of game progress, being forced to kill DF with no way to save.

I know it's an improbable way to run into problems with DFhack, but I might not be the only person to have re-bound the leavescreen key.
being the same type to do that, I just bound both Space and Esc to the same leave screen/leave all screens function, wonder if quicksave still functions in different screens and save you a season worth of game progress?
Title: Re: DFHack 0.40.16-r1
Post by: rmblr on November 24, 2014, 09:33:46 am
I'd love to delve into disassembling DF and do some memory mapping.  Helping with dfhack and TWBT memory address fixing on updates is one reason, but also I'd like to see more about what is going on under the hood exactly.

I'm a coder and I've written plenty of asm before, but never dabbled with disassembly.  I can't seem to find a README or BUILDING or any sort of docs on decompiling DF into a readable state.

Using df-structures and df_misc, I've been able to get metasm running (see screenshot below), but I'm not sure what to do next.

Spoiler: metasm screenshot (click to show/hide)

There is undoubtedly a whole bunch of knowledge about DF's internals floating around here in the form of _Q, angavrilov, jjyg, mifki, et. al., and I'd like to extract some of that.

Anyone care to write a simple primer on the subject? I don't need my hand held the whole way through, just a good shove in the right direction.

---
An example of two tasks I wanted to learn how to accomplish.

1. Find the p_display memory address (https://github.com/mifki/df-twbt/blob/master/patches.hpp) for TWBT

Quote
// Original code will check screentexpos et al. for changes but we don't want that
// because map is not rendered this way now. But we can't completely disable graphics
// because it's used on status screen to show professions at least.
// To find this address, look for a function with two SDL_GetTicks calls inside,
// there will be two calls with the same argument right before an increment between

How do I get libs/Dwarf_Fortress decompiled to work start grepping through the asm for that case?

2. Stockpile Settings UI lists - example: Furniture -> Metal and Stone material sub-lists

I want to be able to see which flags (IS_METAL, etc) DF is using to filter inorganics to generate these lists. So the question becomes:

How do I get libs/Dwarf_Fortress decompiled? (same as previous). How do I use the associated df_misc, and df-structure utils to help narrow down the section of code where the stockpile setting ui is?

edit: I'm looking for Linux specific advice here, not Windows.
Title: Re: DFHack 0.40.16-r1
Post by: expwnent on November 24, 2014, 07:08:34 pm
I don't really know but you might try the irc channel.

I'm sorry, but DFHack still seems to crash when item-trigger is used like this: modtools/item-trigger -itemType ITEM_SHOES_PIPBUCK -onEquip -command [ modtools/add-syndrome -syndrome "PipBuck" -target \\UNIT_ID ]

If you wish, here (http://dffd.wimbli.com/file.php?id=10063) is a crash dump.
When does it crash? Immediately after calling it or when they equip it or unequip it? Arena or fort mode?
Immediately  after unpausing in Fortress Mode.
Not wanting to sound impatient, but is there any progress on this bug?

It's more or less at the top of my list for when I get to DFHack stuff.
Title: Re: DFHack 0.40.16-r1
Post by: Tasurinchi on November 27, 2014, 12:22:15 pm
Is siege-engine meant to be working properly? The aiming screen appears to me horribly bugged, and upon withdrawal, it bugs out causing all sort of graphic oddities. Stockpile function works, thought you have to find blindly were the stock is.
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 27, 2014, 12:46:18 pm
Are you using TwbT? If so, try disabling it.
Title: Re: DFHack 0.40.16-r1
Post by: Tasurinchi on November 27, 2014, 07:03:15 pm
Are you using TwbT? If so, try disabling it.
Indeed! Thank you. I didn't knew the plugin allowed for "mortar" like shots with the catapults, nice. Edit: no, it doesn't, lol.
Title: Re: DFHack 0.40.16-r1
Post by: than402 on November 28, 2014, 12:22:15 pm
hey, is spawn-unit up to date?
Title: Re: DFHack 0.40.16-r1
Post by: expwnent on November 28, 2014, 01:01:41 pm
Almost. It will be updated soon.
Title: Re: DFHack 0.40.16-r1
Post by: Rumrusher on November 28, 2014, 05:26:22 pm
hey, is spawn-unit up to date?
spawn.lua works though... (https://gist.github.com/Rumrusher/f4d0ba18ba6868d38221) so that could be used as a substitute until spawn-unit gets patch up correctly.
Title: Re: DFHack 0.40.16-r1
Post by: than402 on November 28, 2014, 05:29:57 pm
so, can i use it in an inorganic? to spawn a unit through a reaction?
Title: Re: DFHack 0.40.16-r1
Post by: Putnam on November 28, 2014, 05:34:28 pm
You want modtools/reaction-trigger for that.
Title: Re: DFHack 0.40.16-r1
Post by: than402 on November 28, 2014, 05:38:04 pm
You want modtools/reaction-trigger for that.

i don't know much about the inner works of dfhack. i mostly copy and adjust frequently used reactions. what do you mean?
Title: Re: DFHack 0.40.16-r1
Post by: Putnam on November 28, 2014, 05:41:15 pm
type "modtools/reaction-trigger -help" into the DFHack console. This is how you make reactions activate DFHack stuff.
Title: Re: DFHack 0.40.16-r1
Post by: than402 on November 28, 2014, 05:42:57 pm
oh, and i can make it auto triggered through the INIT file, right? thanks.
Title: Re: DFHack 0.40.16-r1
Post by: samanato on November 28, 2014, 06:03:03 pm
You can use onLoad.init in the raws folder too.
Title: Re: DFHack 0.40.16-r1
Post by: than402 on November 28, 2014, 06:07:41 pm
got it. thanks a lot.
Title: Re: DFHack 0.40.16-r1
Post by: smeeprocket on November 28, 2014, 06:15:17 pm
I know DF has been getting updated a huge amount lately, but is there any chance on a dfhack for the new version soon? Gleding was a must have, as well as not having perpetually depressed dwarves.

There are puddles of elf blood from the rain all over the place on my embark.
Title: Re: DFHack 0.40.16-r1
Post by: expwnent on November 28, 2014, 11:27:53 pm
I'm sorry, but DFHack still seems to crash when item-trigger is used like this: modtools/item-trigger -itemType ITEM_SHOES_PIPBUCK -onEquip -command [ modtools/add-syndrome -syndrome "PipBuck" -target \\UNIT_ID ]

If you wish, here (http://dffd.wimbli.com/file.php?id=10063) is a crash dump.
When does it crash? Immediately after calling it or when they equip it or unequip it? Arena or fort mode?
Immediately  after unpausing in Fortress Mode.

I can't reproduce the crash but I fixed a different bug. Try this version. (https://github.com/DFHack/dfhack/blob/develop/scripts/modtools/item-trigger.lua) Send me a save on dffd if the crash keeps happening.
Title: Re: DFHack 0.40.16-r1
Post by: UnicodingUnicorn on November 28, 2014, 11:49:52 pm
I presume that the version is for .40.16?
Title: Re: DFHack 0.40.16-r1
Post by: expwnent on November 28, 2014, 11:58:37 pm
Yes.
Title: Re: DFHack 0.40.16-r1
Post by: Sergarr on November 29, 2014, 04:46:30 am
Is there a command to show all parameters of the selected creature?
Title: Re: DFHack 0.40.16-r1
Post by: Putnam on November 29, 2014, 05:14:24 am
Parameters?
Title: Re: DFHack 0.40.16-r1
Post by: Sergarr on November 29, 2014, 05:23:09 am
Parameters?
a) 100% bruised/burned/frostbite/melt/necrosis/blister/boil/freeze/condense (i.e. 10000+ in layer_effect_fraction)
b) 250% dented (i.e. 25000+ in layer_dent_fraction)
c) 100% cut (i.e. 10000+ in layer_cut_fraction) (cut in this case is synonymous with fracture)
The bolded ones, specifically.
Title: Re: DFHack 0.40.16-r1
Post by: Mister Always on November 29, 2014, 08:02:21 am
So uh... Downloaded the .rar for .16, unpacked it, and copied the folder that it spawned into my DF folder. But DFHack is not activating when I play. What am I doin' wrong, here?
Title: Re: DFHack 0.40.16-r1
Post by: Rumrusher on November 29, 2014, 08:08:06 am
wait you didn't just copied the contents of the folder then move it into the DF folder? there was a SDL bit that you need to replace before dfhack would be active.
Title: Re: DFHack 0.40.16-r1
Post by: Mister Always on November 29, 2014, 08:35:51 am
I copied the whole folder with all its contents.
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 29, 2014, 09:00:21 am
You should copy the folder's contents, not the folder itself. What files are in your DF folder?
Title: Re: DFHack 0.40.16-r1
Post by: scamtank on November 29, 2014, 09:02:45 am
If you didn't overwrite a .dll file, you missed the mark.
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 29, 2014, 09:40:53 am
That's only true on Windows (which I think Mister Always is using, but I don't believe DFHack is distributed as a .rar on any platforms).
Title: Re: DFHack 0.40.16-r1
Post by: Mister Always on November 29, 2014, 02:01:39 pm
That's only true on Windows (which I think Mister Always is using, but I don't believe DFHack is distributed as a .rar on any platforms).

Nope, I've most certainly got a WinRar archive of DFhack downloaded from the front page.

Okay, so only copy the folder's contents, not the whole thing... Got ya. But before I do that, what's this thing I need to overwrite and how do I do that?
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on November 29, 2014, 03:30:28 pm
That's only true on Windows (which I think Mister Always is using, but I don't believe DFHack is distributed as a .rar on any platforms).

Nope, I've most certainly got a WinRar archive of DFhack downloaded from the front page.
If you're downloading it from here (https://github.com/DFHack/dfhack/releases/tag/0.40.16-r1), it's a .7z file.

Quote
Okay, so only copy the folder's contents, not the whole thing... Got ya. But before I do that, what's this thing I need to overwrite and how do I do that?
If you copy everything from the DFHack archive folder to the DF folder, you should receive some sort of prompt asking you if you want to overwrite "SDL.dll", which you should confirm. (If you don't overwrite SDL.dll, DFHack won't load at all.)
Title: Re: DFHack 0.40.16-r1
Post by: Mister Always on November 29, 2014, 05:04:31 pm
I think it works alright now, thanks.

Now I can FINALLY clean the outside of this map where it never rains.

Edit: errmehgerd that is such an immediate FPS boost. Lovin' it.
Title: Re: DFHack 0.40.15-r1
Post by: Roses on December 03, 2014, 07:50:43 pm
Roses: All I know is that I tried very hard to figure that out and I failed. I believe there is a type that hasn't yet been mapped out for innate interactions a caste can do.

Alright, that's pretty much what I thought.

Actually Quietust just found that struct yesterday so it might be doable soon.

Just inquiring about this old topic, any progress?
Title: Re: DFHack 0.40.16-r1
Post by: Deus_Vult on December 04, 2014, 05:03:19 am
Is there a version for 0.40.18?
Title: Re: DFHack 0.40.16-r1
Post by: rmblr on December 04, 2014, 06:58:50 am
Is there a version for 0.40.18?

Nope, and there probably won't be giving recent activity on IRC and the source code repo.
Title: Re: DFHack 0.40.16-r1
Post by: Nopenope on December 04, 2014, 07:38:08 am
Is there a version for 0.40.18?
Just so you know, you can compile DFHack for .40.19. If you're using Linux I can upload a build if you like.
Title: Re: DFHack 0.40.16-r1
Post by: expwnent on December 04, 2014, 12:02:11 pm
OSX is missing a few globals. Soon.
Title: Re: DFHack 0.40.16-r1
Post by: mnjiman on December 04, 2014, 01:47:28 pm
OSX is missing a few globals. Soon.
Yaaay!
Title: Re: DFHack 0.40.16-r1
Post by: lethosor on December 04, 2014, 09:17:36 pm
Actually, it was only start_dwarf_count that needed to be found (on all three platforms), and it's been located now. Most of the remaining work is merging the 10-something open pull requests.
In other news, Danaris's Stonesense changes have been merged, so Stonesense should work again on OS X (although it's still buggy in general):
(http://i.imgur.com/wZBhjMT.png)
Title: Re: DFHack 0.40.16-r1
Post by: PeridexisErrant on December 04, 2014, 10:05:09 pm
Actually, it was only start_dwarf_count that needed to be found (on all three platforms), and it's been located now. Most of the remaining work is merging the 10-something open pull requests.
In other news, Danaris's Stonesense changes have been merged, so Stonesense should work again on OS X (although it's still buggy in general):
(http://i.imgur.com/wZBhjMT.png)

Does this mean that 40.19-r1 will include Stonesense?
Title: Re: DFHack 0.40.16-r1
Post by: Dirst on December 04, 2014, 11:02:20 pm
Does this mean that 40.19-r1 will include Stonesense?
Does this mean that 40.19-r1 will include overlay?
Title: Re: DFHack 0.40.16-r1
Post by: PeridexisErrant on December 05, 2014, 12:14:31 am
Does this mean that 40.19-r1 will include Stonesense?
Does this mean that 40.19-r1 will include overlay?

If it has Stonesense at all, it'll have the overlay - it's a built-in feature now (if unpolished).
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 05, 2014, 12:26:50 am
New release!
Title: Re: DFHack 0.40.19-r1
Post by: Rogue Yun on December 05, 2014, 12:39:40 am
New release!
Thank you so much! I'm sure my voice is the voice of thousands when I say. "We sure appreciate all you do!"
Title: Re: DFHack 0.40.19-r1
Post by: mnjiman on December 05, 2014, 01:15:51 am
Yes! Yes~!!!! YEeessss!!!!
Title: Re: DFHack 0.40.19-r1
Post by: 4kn on December 05, 2014, 01:16:12 am
hurrraah!
now, lazy newb pack 40.19. who's first?
Title: Re: DFHack 0.40.19-r1
Post by: TheHossofMoss on December 05, 2014, 01:19:00 am
Sweet!!
Title: Re: DFHack 0.40.19-r1
Post by: TheCoolSideofthePIllow on December 05, 2014, 03:00:29 am
Sweet! Someone told me yesterday it was all ready and everything, but I didn't actually believe. I guess they weren't lying.
Title: Re: DFHack 0.40.16-r1
Post by: PeridexisErrant on December 05, 2014, 03:30:29 am
Does this mean that 40.19-r1 will include Stonesense?
Does this mean that 40.19-r1 will include overlay?

If it has Stonesense at all, it'll have the overlay - it's a built-in feature now (if unpolished).

It does. It's easy to cause a crash, but it works! And it's *very* pretty.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 05, 2014, 04:58:56 am
(http://media.giphy.com/media/vGbL469j4pBJK/giphy.gif)

While I do not approve of posts made up entirely of image links, I approve of posts made up entirely of broken image links even less.
Title: Re: DFHack 0.40.19-r1
Post by: Scorch on December 05, 2014, 05:54:49 am
New release!

Oh thank goodness! I just finished discovering that all my caverns are full of sterile mud and I desperately need water.
Title: Re: DFHack 0.40.19-r1
Post by: Shonai_Dweller on December 05, 2014, 07:14:35 am
New release!

OK I passed the test and managed to actually locate the new release.
But you might want to add a link somewhere for the seething horde of other newbies.
Title: Re: DFHack 0.40.19-r1
Post by: Bartok on December 05, 2014, 08:47:20 am
Until the front page is updated:

http://github.com/DFHack/dfhack/releases/tag/0.40.19-r1
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 05, 2014, 10:46:15 am
Just fixed the link on the front page. Whoops.
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 05, 2014, 12:33:06 pm
All hail the DFHack team!

I love coming into the forum and seeing a new title on this thread.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 05, 2014, 12:50:12 pm
Perfect timing, just about burned out on fantasy life for now... I know, I know, shush.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 05, 2014, 03:07:32 pm
I'm uploading an OS X build now and starting a build on Linux.
Title: Re: DFHack 0.40.19-r1
Post by: fricy on December 05, 2014, 03:09:35 pm
I'm uploading an OS X build now and starting a build on Linux.
Uhmm: https://www.dropbox.com/s/jl2wlb8832o13bg/dfhack-0.40.19-r1-Darwin.zip

Forgot to post it earlier.
Title: Re: DFHack 0.40.19-r1
Post by: Shonai_Dweller on December 05, 2014, 06:32:20 pm
Hi sorry for Newb question, but something in DFHack is replacing some of the standard menu keyboard commands, any advise on how to switch them off?

'm' for military brings up some kind of Dwarf preference menu, seems interesting but I want my military screen back.
'p'- 'p' brings up a message "no buildings nearby" instead of making a weapons pile (other piles seem to work OK).
'q' - 'r' on beds makes a bedroom like it's supposed to but there's an extra screen 'no owner assigned' which doesn't seem to do anything and I have to press escape to get rid of it. Really annoying for assigning a bunch of bedrooms (I suspect I'm just misunderstanding a clever DfHack system for reducing micromanagement here - would like to turn it off though as I'm used to the vanilla version).

None of the above are defined in DfHack.ini which is mostly Alt+commands. Have Dwarf manipulator, Search and TWBT enabled in case that makes a difference. Using 4.19. The above only started happening on installing DFHack yesterday.

DFHack is surely a fantastic utility which enhances all sorts of aspects of the game, but what with the trend of packaging it with starter noob packs nowadays, having the menu not do what it says it does seems a great way to discourage any new Dwarf Fortress players.


 
Title: Re: DFHack 0.40.19-r1
Post by: PeridexisErrant on December 05, 2014, 06:54:44 pm
Hi sorry for Newb question, but something in DFHack is replacing some of the standard menu keyboard commands, any advise on how to switch them off?

Because DF uses an old SDL version, the 'alt' key gets stuck occasionally.  Press and release the 'alt' key so it gets the keyup signal, and it should be fine.
Title: Re: DFHack 0.40.19-r1
Post by: Shonai_Dweller on December 05, 2014, 07:57:40 pm
Hi sorry for Newb question, but something in DFHack is replacing some of the standard menu keyboard commands, any advise on how to switch them off?

Because DF uses an old SDL version, the 'alt' key gets stuck occasionally.  Press and release the 'alt' key so it gets the keyup signal, and it should be fine.

Problem solved. Thank you very much!
Now off to play with my new shiny Dwarf manipulator... :)
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 05, 2014, 09:28:42 pm
Here (https://github.com/lethosor/dfhack/releases/tag/0.40.19-r1) is a Linux build (apologies for the delay there).

I'm uploading an OS X build now and starting a build on Linux.
Uhmm: https://www.dropbox.com/s/jl2wlb8832o13bg/dfhack-0.40.19-r1-Darwin.zip

Forgot to post it earlier.
Thanks! Expwnent has uploaded that to Github (https://github.com/dfhack/dfhack/releases/tag/0.40.19-r1).

Hi sorry for Newb question, but something in DFHack is replacing some of the standard menu keyboard commands, any advise on how to switch them off?

Because DF uses an old SDL version, the 'alt' key gets stuck occasionally.  Press and release the 'alt' key so it gets the keyup signal, and it should be fine.
I don't believe this has anything to do with the SDL version, although you could try upgrading to 1.2.15. It may be a conflict with other utilities, a problem with how DFHack handles keybindings, or a problem with DF itself. Speaking of this, could you (or anyone else on Windows) try to reproduce it without any utilities and post your findings in the report (http://www.bay12games.com/dwarves/mantisbt/view.php?id=6455)?
Title: Re: DFHack 0.40.19-r1
Post by: ancistrus on December 06, 2014, 05:30:45 am
I skimmed the readme, but I cant figure this out:
what is that line displayed in the bottom right corner that looks like 0:0:0:0:3:27:14 ?
Title: Re: DFHack 0.40.19-r1
Post by: scamtank on December 06, 2014, 05:35:50 am
Happiness, measured in the amount of dwarves in that state. That's one of Falconne's old UI plugins that got folded into the majority version.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 06, 2014, 10:36:56 am
Hmmm, works great, but I'm not having any luck figuring out what to do to enable stonesense (or twbt, though I think I know where to look to fix that) as in it doesn't even show up in the ls -a, help, or ? prompts though it has what should be all the right files in place. Is the linux version not working yet?
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 06, 2014, 11:44:38 am
If you're using the build from https://github.com/lethosor/dfhack/releases/tag/0.40.19-r1, Stonesense is definitely included. (I even managed to get the overlay to work for a frame.) Are there any Stonesense-related messages when DFHack starts, such as "can't load stonesense"? What distro are you using? 32- or 64-bit?
Also, TwbT is not included with DFHack. If you want to use it, you'll need to download it separately from the TwbT thread.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 06, 2014, 01:40:28 pm
Can't load plugin /fee/fi/.df19/hack/plugins/stonesense.plug.so

64 bit arch
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 06, 2014, 01:48:05 pm
Is there anything mentioning Stonesense in stderr.log?
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 06, 2014, 02:03:53 pm
Just that and the "stonesense is not a recognized command" stuff when I tried to invoke it directly through the command line.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 06, 2014, 02:16:25 pm
Had the wrong twbt in btw, so that does work, still getting the same stuff for stonesense though, can't load plugin /path/to/.df19/hack/plugins/stonesense.plug.so which is weird since all the rest work fine.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 06, 2014, 02:36:47 pm
Is there anything before the "Can't load plugin" line in stderr.log? What does running "grep -i stonesense stderr.log" return?
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 06, 2014, 02:49:44 pm
This, but I figured it wasn't related since the libpng errors usually prevent the game from loading at all, much less loading with all the bells and whistles:

libpng12.so.0: cannot open shared object file: No such file or directory
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 06, 2014, 03:18:48 pm
If that doesn't occur if you move stonesense.plug.so out of the plugins folder, it is related - Allegro (and Stonesense) has a number of dependencies that aren't required by DF or DFHack. Do you have a 32-bit libpng installed?
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 06, 2014, 03:22:24 pm
Yeah, I've got a variety of libpng's installed, it's necessary to have them for df on arch, and you're right, removing the stonesense plugin killed that part of the error message.

Hmmm, I've got libpng16.so and libpng.so under /usr/lib32, don't see libpng12.so.0 anywhere though.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 06, 2014, 03:34:28 pm
Hmmm, ok, compiled libpng12, added them into the libs folder under df just in case, still getting the error.

Wait wrong elf class, dammit all is this a 64 bit version of a 32 bit library? What the?
Title: Re: DFHack 0.40.19-r1
Post by: PeridexisErrant on December 06, 2014, 03:48:38 pm
Siren bug:  https://i.imgur.com/UY86rCg.jpg
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 06, 2014, 04:00:05 pm
You can copy text from the DFHack console on Windows by using the console menu (I'm unsure exactly how this works - either left-clicking the window icon or right-clicking the console title bar should work).
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 06, 2014, 04:07:27 pm
Right click title bar, click "mark", highlight text you want to copy, press "enter", it's copied.
Title: Re: DFHack 0.40.19-r1
Post by: than402 on December 06, 2014, 04:20:02 pm
i'm having some trouble with spawning units. if i want to spawn a unit through a reaction, which scripts must i enable in the INIT file and how should i write the syndrome stone? do you know any mod who has done so in the new edition?
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 06, 2014, 04:21:35 pm
You have to use reaction-trigger with a newer version of spawn unit, which I'm not sure exists.

You shouldn't write anything in the syndrome stone.
Title: Re: DFHack 0.40.19-r1
Post by: than402 on December 06, 2014, 04:24:24 pm
i mean this part

Spoiler (click to show/hide)

did anything change from the last edition?
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 06, 2014, 04:25:00 pm
Yes, that part was replaced entirely with reaction-trigger.
Title: Re: DFHack 0.40.19-r1
Post by: than402 on December 06, 2014, 04:28:00 pm
so how would i write an inorganic for the new edition?
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 06, 2014, 04:29:51 pm
I'm pretty sure you don't need to.
Title: Re: DFHack 0.40.19-r1
Post by: than402 on December 06, 2014, 04:31:03 pm
ok, thanks
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 06, 2014, 05:01:31 pm
You still want some kind of reaction product, otherwise the reaction takes no time and generates no experience. A boil-away stone would work.

For the script, I hacked Warmist's old spawning script entangled with some mod-specific logic and got it to run under 40.08-40.16 (not yet tested under 40.19), but an official spawning script would be incredibly helpful.  Chasing down all the changes was a useful exercise to learn about the memory structures, but an official spawning script would be incredibly helpful.

Edit: I wouldn't mind taking a crack at a first draft of such a thing, but it'd probably be faster for one of the scripting gods to build it from scratch.
Title: Re: DFHack 0.40.19-r1
Post by: than402 on December 06, 2014, 05:14:08 pm
well the spawn script seems to work in the arena in 40.19. and i found some sample reactions in the elder scrolls mod, but i still can't get them to work :(
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 06, 2014, 07:35:06 pm
Rats, took a nap and dreamed I fixed it.
Title: Re: DFHack 0.40.19-r1
Post by: MAurelius on December 06, 2014, 09:23:51 pm
I'm probably doing something wrong but when I type in "remove-stress all" I get the following error:
 
Oh, it won't let me copy and past. Damn. Well, here's my attempt at transcribing:

error parsing arg 1: all
stack traceback:
[C]: in function 'error'
(filepath) utils.lua:607: in function 'processArgs'
(filepath) remove-stress.lua:13: in main chunk
<...tail calls...>

When I try just remove-stress it tells me to click a dwarf. I would prefer to not do that 200 times. :)

Thanks!
Title: Re: DFHack 0.40.19-r1
Post by: StagnantSoul on December 06, 2014, 09:25:52 pm
Is elevate-physical gone in the new version?
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 06, 2014, 09:27:30 pm
Heh, probably should have posted this earlier.
Code: [Select]
-- Allows ectobiology.

-- where doing it man

-- where MAKING THIS HAPEN

local function getCitizenList(lovers_only)
    local citizenTable={}
    if lovers_only then
        for k,u in ipairs(df.global.world.units.active) do
            if dfhack.units.isCitizen(u) and (u.relations.spouse_id~=-1 or u.relations.lover_id~=-1) then
                table.insert(citizenTable,{dfhack.TranslateName(dfhack.units.getVisibleName(u)),nil,u})
            end
        end
    else
        for k,u in ipairs(df.global.world.units.active) do
            if dfhack.units.isCitizen(u) then
                table.insert(citizenTable,{dfhack.TranslateName(dfhack.units.getVisibleName(u)),nil,u})
            end
        end
    end
    return citizenTable
end

local function getSpouseOrLover(unit)
    local lover_unit=df.unit.find(unit.relations.lover_id) or df.unit.find(unit.relations.spouse_id)
    if lover_unit then
        return lover_unit.hist_figure_id
    else
        local hist_fig=df.historical_figure.find(unit.hist_figure_id)
        for k,v in ipairs(hist_fig.histfig_links) do
            if df.histfig_hf_link_spousest:is_instance(v) or df.histfig_hf_link_loverst:is_instance(v) then
                return v.target_hf
            end
        end
    end
end

local function getFemaleCasteWithSameMaxAge(unit)
    local curCaste=df.creature_raw.find(unit.race).caste[unit.caste]
    for k,caste in ipairs(df.creature_raw.find(unit.race).caste) do
        if caste.gender==0 and caste.misc.maxage_min==curCaste.misc.maxage_min and caste.misc.maxage_max==curCaste.misc.maxage_max then return k end
    end
end

local function ectobiologize(freeform)
    local script=require('gui.script')
    script.start(function()
    local citizens=getCitizenList(not freeform)
    if #citizens==0 then script.showMessage('Ectobiology',"Nobody is in a relationship! Best use freeform ectobiology.",COLOR_WHITE) return end
    if freeform then
        local ok1,name1,unit1_t=script.showListPrompt("Ectobiology","Choose first paradox ghost slime target.",COLOR_WHITE,citizens)
        local ok2,name2,unit2_t=script.showListPrompt("Ectobiology","Choose second paradox ghost slime target.",COLOR_WHITE,citizens)
        local unit1=unit1_t[3]
        local unit2=unit2_t[3]
        unit1.relations.pregnancy_timer=1
        unit1.relations.pregnancy_genes=unit1.appearance.genes:new()
        unit1.relations.pregnancy_spouse=unit2.hist_figure_id
        unit1.relations.pregnancy_caste=unit2.caste
        dfhack.run_script('modtools/add-syndrome','-syndrome','temp desterilize','-target',unit1.id)
        if unit1.sex==1 then
            local normal_caste=unit1.enemy.normal_caste
            unit1.enemy.normal_caste=getFemaleCasteWithSameMaxAge(unit1)
            script.sleep(1,'ticks')
            unit1.enemy.normal_caste=normal_caste
        end
    else
        local ok,name,unit_t=script.showListPrompt("Ectobiology","Choose first genetic material giver.",COLOR_WHITE,citizens)
        local unit=unit_t[3]
        local lover=getSpouseOrLover(unit)
        unit.relations.pregnancy_timer=1
        unit.relations.pregnancy_genes=unit.appearance.genes:new()
        unit.relations.pregnancy_spouse=lover
        unit.relations.pregnancy_caste=df.historical_figure.find(lover).caste
        dfhack.run_script('modtools/add-syndrome','-syndrome','temp desterilize','-target',unit.id)
        if unit.sex==1 then
            local normal_caste=unit.enemy.normal_caste
            unit.enemy.normal_caste=getFemaleCasteWithSameMaxAge(unit)
            script.sleep(1,'ticks')
            unit.enemy.normal_caste=normal_caste
        end
    end
    end)
end
local utils=require('utils')

validArgs = validArgs or utils.invert({
 'freeform'
})

local args = utils.processArgs({...}, validArgs)

ectobiologize(args.freeform)

Run the script and it'll show you a list of every unit with a lover/spouse, regardless of the unit's sex or the lover's. Select a unit and the unit will immediately have a baby with the lover as the "father", again regardless of the unit's sex or the lover's. The game really works well with it, too.

It's called "ectobiology.lua" because I made it for Fortbent, but it would probably do well otherwise named.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 06, 2014, 09:37:28 pm
Is elevate-physical gone in the new version?
That's never been included in the DFHack repo - it's one of Vjek's scripts (http://dwarffortresswiki.org/index.php/User:Vjek).
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 06, 2014, 09:39:35 pm
You still want some kind of reaction product, otherwise the reaction takes no time and generates no experience.

This is not a problem.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 06, 2014, 09:56:17 pm
Hmmm, is it necessary to use libpng12 when building this with stonesense, or could it be done with a more up to date library?

Code: [Select]
libpng12.so.0: wrong ELF class: ELFCLASS64
Can't load plugin /path/to/df19/hack/plugins/stonesense.plug.so

That's a heck of a thing.
Title: Re: DFHack 0.40.19-r1
Post by: SlicedAndDiced on December 07, 2014, 02:18:17 am
I am having trouble using the "changeitem" function in adventure mode.  I highlight the item using "l" and it even says "here we have a XXXXXX" but when i type  in the Command "changeitem q 5", it says the following "No item is selected"

Am i doing something wrong here?
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 07, 2014, 02:22:53 am
Press the button to actually go into the item's screen, it's only selected if you do that.
Title: Re: DFHack 0.40.19-r1
Post by: SlicedAndDiced on December 07, 2014, 02:31:26 am
Press the button to actually go into the item's screen, it's only selected if you do that.
so when i have it highlighted and go to the menu where you can see it's weight and etc. Already tried it not working

Ok this time i went to item screen it didn't work, when I put the command "changeitem q 5:" but if you put add "here" in it works.
So like "changeitem here q 5"

thankyou
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 07, 2014, 12:42:17 pm
I'm not sure if this is possible, but I've seen a LOT of people get confused by the stuck-Alt-key issue and complain in the Starter Pack thread.

When DFHack's hotkey infrastructure hears an Alt-up event, can it stuff an Alt-up event into DF's window?  Since Alt itself doesn't do anything, false-positives (Alt-Tabbing in from Dwarf Therapist or a web browser) shouldn't do any harm.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 07, 2014, 01:51:41 pm
Are you sure this is caused by DFHack? I know it's noticeable with DFHack keybindings, but could you see if it occurs with vanilla DF?
I don't believe this has anything to do with the SDL version, although you could try upgrading to 1.2.15. It may be a conflict with other utilities, a problem with how DFHack handles keybindings, or a problem with DF itself. Speaking of this, could you (or anyone else on Windows) try to reproduce it without any utilities and post your findings in the report (http://www.bay12games.com/dwarves/mantisbt/view.php?id=6455)?
Title: Re: DFHack 0.40.19-r1
Post by: Shonai_Dweller on December 07, 2014, 04:39:51 pm
Are you sure this is caused by DFHack? I know it's noticeable with DFHack keybindings, but could you see if it occurs with vanilla DF?

I've played for quite a bit in 4.19 without DFHack and built quite a few statues. It's not yet tried to build an Alt-s Slab by mistake yet.
Also using Alt-s to build slabs doesn't ever seem to make the Alt key 'stick'. I'm also Alt-tabbing a lot to Dwarf Therapist with no obvious problems. Installing DFHack causes problems (solved by tapping Alt once) almost immediately.

I guess that's not very helpful, apart from to say Alt seems to 'stick' at random without ever actually having to press it and hasn't yet occurred in several hours of 4.19 vanilla play. Does anyone have a definite way to make it happen yet?
Title: Re: DFHack 0.40.19-r1
Post by: vjek on December 07, 2014, 06:34:16 pm
Is elevate-physical gone in the new version?
I'm going to be testing all my scripts with the current (40.19) df/dfhack this week, and updating the wiki page to reflect any changes.  They might work perfectly at the moment, they might burn down your house, not sure yet. :)
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 07, 2014, 07:36:26 pm
Code: [Select]
-- lets babies be adopted by couples with no infants.

local function getSpouseOrLover(unit)
    local lover_unit=df.unit.find(unit.relations.lover_id) or df.unit.find(unit.relations.spouse_id)
    if lover_unit then
        return lover_unit.hist_figure_id
    else
        local hist_fig=df.historical_figure.find(unit.hist_figure_id)
        for k,v in ipairs(hist_fig.histfig_links) do
            if df.histfig_hf_link_spousest:is_instance(v) or df.histfig_hf_link_loverst:is_instance(v) then
                return v.target_hf
            end
        end
    end
    return false
end

local function getNumberOfChildren(unit)
    local children=0
    for k,v in ipairs(df.historical_figure.find(unit.hist_figure_id).histfig_links) do
        if df.histfig_hf_link_childst:is_instance(v) then children=children+1 end
    end
    return children
end

local function figureIsAlive(hist_figure)
    return hist_figure.died_year==-1
end

local function unitIsChild(unit)
    return df.global.cur_year-unit.relations.birth_year<12
end

local function unitIsOrphan(unit)
    if unitIsChild(unit) then
        local fatherIsAlive,motherIsAlive=false,false
        for k,v in ipairs(df.historical_figure.find(unit.hist_figure_id).histfig_links) do
            if df.histfig_hf_link_motherst:is_instance(v) then
                if figureIsAlive(df.historical_figure.find(v.hist_figure_id)) then motherIsAlive=true end
            elseif df.histfig_hf_link_fatherst:is_instance(v) then
                if figureIsAlive(df.historical_figure.find(v.hist_figure_id)) then fatherIsAlive=true end           
            end
        end
        return (fatherIsAlive or motherIsAlive)
    end
    return false
end

local function adopt(baby,couple)
    local mother,father=false,false
    if df.historical_figure.find(couple.unit).sex==0 then
        mother=couple.unit
        father=couple.lover --yeah, the "father" will be female if the unit's lover is female, but the game will correctly display both as "mother"
    else
        father=couple.unit
        mother=couple.lover --similar to the above, the "mother" will be male if the unit's lover is male, but they'll both be "father" pretty elegantly.
    end
    local mother_fig=df.historical_figure.find(mother)
    local father_fig=df.historical_figure.find(father)
    local baby_hist_fig=df.historical_figure.find(baby.hist_figure_id)
    for k,v in ipairs(baby_hist_fig.histfig_links) do
        if df.histfig_hf_link_motherst:is_instance(v) then
            v.target_hf=mother --yeah, adoption will remove any relation other than genetics between biological parents and children.
        elseif df.histfig_hf_link_fatherst:is_instance(v) then
            v.target_hf=father
        end
    end
    mother_fig.histfig_links:insert('#',{new=df.histfig_hf_link_childst,target_hf=baby.hist_figure_id,link_strength=100})
    father_fig.histfig_links:insert('#',{new=df.histfig_hf_link_childst,target_hf=baby.hist_figure_id,link_strength=100})
    baby.relations.mother_id=mother_fig.unit_id
    baby.relations.father_id=father_fig.unit_id
    local message = dfhack.TranslateName(mother_fig.name) .. ' and ' .. dfhack.TranslateName(father_fig.name) .. ' have adopted ' .. dfhack.TranslateName(dfhack.units.getVisibleName(baby)) .. '.'
    dfhack.gui.showAnnouncement(message)
    dfhack.gui.writeToGamelog(message) --too lazy to use makeAnnouncement right now
end

local function findBabiesWithNoParents()
    local couples_histfig={}
    local orphans={}
    for k,unit in ipairs(df.global.world.units.active) do
        if dfhack.units.isCitizen(unit) then
            local spouseOrLover=getSpouseOrLover(unit)
            if spouseOrLover then
                couples_histfig[unit.hist_figure_id]=couples_histfig[unit.hist_figure_id] or {children=getNumberOfChildren(unit),lover=spouseOrLover,unit=unit.hist_figure_id}
                couples_histfig[spouseOrLover]=true --this weird sequence of crap makes it so that 1. I can easily cull redundant units and 2. I can still sort the table
            elseif unitIsOrphan(unit) then
                table.insert(orphans,unit)
            end
        end
    end
    local couples={}
    for k in pairs(couples_histfig) do
        if couples[k]==true then couples[k]=nil end --not doing this will make an error show up when sorting the couples table due to true.children being nonsense
    end
    for k,v in pairs(couples_histfig) do
        table.insert(couples,v) --makes the keys of the couples table be 1,2,3 etc. instead of being all over the place as histfigs
    end
    table.sort(couples,function(a,b) return a.children<b.children end)
    if #orphans>1 then
        for k,orphan in ipairs(orphans) do
            adopt(orphan,math.ceil(couples[k]/2))
        end
    end
end

require('repeat-util').scheduleUnlessAlreadyScheduled('Orphan Adoption Service',1,'days',findBabiesWithNoParents)

Adoption! It takes childless parents and gives them parents from couples.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 08, 2014, 12:25:56 am
Now that is a hell of a thing, good job!

Still can't figure out why stonesense wants libpng12, or why I can only find 64 bit versions of it when stonesense apparently wants a 32 bit version...
Title: Re: DFHack 0.40.19-r1
Post by: Rose on December 08, 2014, 12:47:15 am
That would be due to whoever compiled it using that version.

You can probably symlink whatever version you have, as long as it's also 32bit
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 08, 2014, 12:55:52 am
Yeah, that part is probably my bad, as I'm sure I'm forgetting an obvious way to install the 32 bit version, but every time I grab the i686 version or whichever trying to get it to work I keep ending up with the 64 bit one.

Edit: Ah hah, I was using the wrong terms trying to find it, I THINK this will end up working once it finishes: https://aur.archlinux.org/packages/lib32-libpng12/

KHAN!

So close...
Code: [Select]
libjpeg.so.62: cannot open shared object file: No such file or directory
Now to track that down.

YES, YES, IT'S BEAUTIFUL!
Spoiler (click to show/hide)
BWAHAHAHAHAHA!
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 08, 2014, 02:08:10 am
To clear up the insanity there, I installed lib32-libpng12, libjpeg6, lib32-libjpeg6, and then placed a copy of the 32 bit versions right into the libs folder and it works like a charm.
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 08, 2014, 02:07:10 pm
Adoption! It takes childless parents and gives them parents from couples.
Putnam, this is extremely cool, but could you be a sweetheart and make a gist out of it or upload it on wimbli or do a pull request or do anything that will prevent this cool script from getting buried in the massive thread? We've already had these issues in the .34.11r5 thread. This way you'd have an easier time maintaining it, too.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 08, 2014, 03:37:51 pm
Oh, yeah, heh.

https://gist.github.com/Putnam3145/bf146ef7735aa9870fa0
Title: Re: DFHack 0.40.19-r1
Post by: breadman on December 08, 2014, 04:33:37 pm
I'm not sure if this is possible, but I've seen a LOT of people get confused by the stuck-Alt-key issue and complain in the Starter Pack thread.

Are you sure this is caused by DFHack? I know it's noticeable with DFHack keybindings, but could you see if it occurs with vanilla DF?

I'm reasonably certain this problem is specific to DFHack keybindings on Windows.  While the Alt key is stuck, DFHack (a) incorrectly runs hotkeys defined with Alt, and (b) incorrectly fails to run hotkeys defined without Alt.  But only DFHack keybindings are affected; not native DF keys, and not keys checked by DFHack plugins.

I have been able to modify Core::DFH_SDL_EVENT to notice SDL window focus events on Linux, which would be a convenient place to clear the bad state if we can do so.  Unfortunately, ke->ksym.mod is set by SDL internally, so we would need to either maintain our own flag for the Alt key, or perhaps use SDL_PushEvent to pretend that the Alt key has been pressed and released.  Note that DF itself uses the former solution; see update_modstate in g_src/enabler_input.cpp, and its associated comment.

Unfortunately, while I sometimes play on Windows, I can't currently compile for that platform, which makes it hard to test potential solutions.
Title: Re: DFHack 0.40.19-r1
Post by: m-logik on December 08, 2014, 09:01:54 pm
Is this the right place to report bugs with dfhack components?

I'm playing with 3dveins for the first time, and it seems to have worked properly. There are, however, several places where minerals "pierced" the ground under boulders, replacing them with a boulder of their material. This isn't much of a problem, except that there doesn't seem to be a tile defined for boulders of non-layer stones, resulting in a black square wherever this happens. I've got a save where all I've done is run 3dveins if it would be helpful.
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 09, 2014, 06:32:05 am
Speaking of which, has Toady made a decision on whether he intends to make a forum specific to DFHack stuff? I have a feeling that this thread is going to end up like the .34.11 one, with everything buried in it.
Title: Re: DFHack 0.40.19-r1
Post by: Rose on December 09, 2014, 09:00:43 am
You may notice that this is in the 'utilities and 3rd party applications' subforum
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 09, 2014, 09:23:16 am
Uh, yes. What I meant is that there should be a subforum specifically dedicated to DFHack so all questions related to it aren't contained within one giant thread. There was a poll about it some time ago, and most people were favourable to the idea.
Title: Re: DFHack 0.40.19-r1
Post by: Rumrusher on December 09, 2014, 02:02:01 pm
Uh, yes. What I meant is that there should be a subforum specifically dedicated to DFHack so all questions related to it aren't contained within one giant thread. There was a poll about it some time ago, and most people were favourable to the idea.
Japa means that UA3PA forum is kinda the DFhack(and other utilities) subforum after it got separated from DFmodding. I don't think another subforum would be needed for a Post in a thread, that's like making a new planet for one person in a country. you're better off just making a [Dfhack question] thread and hope someone could answer it(we usually don't so it's bound to be empty).  Though you're best bet for questions to not get swallowed up is to hit us on IRC.
Though I really don't want to redirect folks to a different thread since if we answer your question in with a script then you have 2 threads to search through for scripts than just 1(well there's separate threads with scripts now so more than 1). then again I wonder if looking at a posters history in the thread would ease up 'new script' woes.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 09, 2014, 04:19:26 pm
This thread is good for some questions, but not so good for discussions about individual scripts, features, ideas, etc.. At the moment, 20 of the first 60 threads in this subforum have "DFHack" in the title (as well as a handful of others that don't), which is considerably more than any other utility. If I remember correctly, this is the same reason MDF was moved to its own sub-board. A DFHack sub-board also been suggested several times in the past - for instance, the subforum organization thread (http://www.bay12forums.com/smf/index.php?topic=127183.msg5516129#msg5516129) and this thread (http://www.bay12forums.com/smf/index.php?topic=135335.0).
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 09, 2014, 04:32:31 pm
My two cents: there is enough DFHack content to merit its own forum but there isn't enough 3rd party stuff that isn't DFHack to merit its own forum so it may as well all get lumped together.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 09, 2014, 06:44:02 pm
Uh, yes. What I meant is that there should be a subforum specifically dedicated to DFHack so all questions related to it aren't contained within one giant thread. There was a poll about it some time ago, and most people were favourable to the idea.
I don't think another subforum would be needed for a Post in a thread, that's like making a new planet for one person in a country.

Thus the "Putnam's mods" forum no longer existing, heh.
Title: Re: DFHack 0.40.19-r1
Post by: m-logik on December 09, 2014, 10:02:15 pm
If I'm reading the thread correctly, the discussion on forum organization was prompted by my bug report about 3dveins? So, is there a more appropriate place to report it? I'm not really asking for help, as the "problem" is purely cosmetic, and easily solved by smoothing the offending boulders. I figured the bright minds making all the magic happen would like to know about things of this sort, but I don't want to clutter the thread or detract from more important discussions.

Fwiw, I really like how 3dveins makes minerals seem to flow across z levels; it improves the aesthetics and makes mining more interesting. So thanks to whoever wrote it. A plugin (script?) to do something similar for layer stones so that the transitions between them aren't so sudden and sharp would be an excellent compliment to 3dveins.
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 09, 2014, 11:00:59 pm
Quote
My two cents: there is enough DFHack content to merit its own forum but there isn't enough 3rd party stuff that isn't DFHack to merit its own forum so it may as well all get lumped together.
Actually there's plenty, it just tends to be buried by all the dfhack stuff since dfhack development is much more active and needs constant updating. I think a separation could benefit both sides. Other third party utilities would have greater visibility and user support for DFHack (since it's lacking somewhat in documentation) would be easier.
Title: Re: DFHack 0.40.19-r1
Post by: rmblr on December 10, 2014, 02:01:46 am
Quote
My two cents: there is enough DFHack content to merit its own forum but there isn't enough 3rd party stuff that isn't DFHack to merit its own forum so it may as well all get lumped together.
Actually there's plenty, it just tends to be buried by all the dfhack stuff since dfhack development is much more active and needs constant updating. I think a separation could benefit both sides. Other third party utilities would have greater visibility and user support for DFHack (since it's lacking somewhat in documentation) would be easier.

This is my opinion as well (except the documentation bit, I think DFHack is quite well documented from a users perspective). A separate forum would enhance DFHack support while unclogging this board for the other 3rd party utils. Though TBH, I think for user support forums are atrocious at it, a very mid-200s solution, when more efficient things exist like DF on Stackexchange Gaming (https://gaming.stackexchange.com/questions/tagged/dwarf-fortress). But that's another topic.. ignore me.

The "there's not enough discussion about non DFHack utils" argument doesn't hold water IMHO, just look at the Wiki board which is very quiet yet still merits its own place. Separate would ensure non-DFhack topic aren't lost in the "noise".
Title: Re: DFHack 0.40.19-r1
Post by: rmblr on December 10, 2014, 02:15:22 am
@expwnent - Could you please edit the first post to remove the line "This must be downloaded separately for technical reasons." from the stonesense line. Stonesense hasn't had its own release since 2010 (https://github.com/DFHack/stonesense/releases), and its been bundled with DFHack releases for awhile (except of course the recent non-availability due to bugs).

Elsewhere (Reddit and StackExchange) people are confused about how to get stonesense because of that line ([snide_comment]apparently some people read user docs![/snide_comment]).
Title: Re: DFHack 0.40.19-r1
Post by: Iced_Eagle on December 10, 2014, 03:04:21 am
Hey guys,

I'm trying to use the DFHack remote client in a C# application. My end goal is to be able to query DFHack and the remote client using protobuf in Unity. In the documentation it mentions there is a C# client which exists, but I haven't been able to find it (doc is wrong or I'm blind!).

Has anyone else done something like this? I didn't see anything mentioned in the thread.

The first issue comes in to play in that you supposedly can't use PInvoke on native classes and members for pulling in RemoteClient to the managed side. I would assume that it would work fine if you're importing into another native project though. If I'm mistaken about this, please let me know with the dwarfiest horn you can find! All signs I've read point to "you can't do this".

My initial approach was to create a separate managed C++ dll which would be a wrapper around RemoteClient. I seem to get memory corruption errors when calling connect() that I wasn't able to debug. I'm not familiar with managed C++ so I wasn't sure the best place to start looking. It very well could have been an issue with the way I was compiling my project or something like that.

Instead, I'm thinking of just writing a C-style wrapper around remote client and expose only functions which would first return a handle to the created object, and then all function would take in a handle, in addition to their regular parameters. I should then be able to use PInvoke on this wrapper, ideally without the memory corruption. :-) The pro to this method is that it's a bit simpler and I'm more familiar with the method. The con is of course things like type safety you get from having the wrapper be in managed code.

One thing which was easy of course was pulling in all of the protobuf work into C#, so once I get the client connection portion worked out, I'm imagining the deserialization of the messages is going to be a bit more straightforward (I hope).

Any thoughts are appreciated! Let me know if I also missed anything major or in my approach.
Title: Re: DFHack 0.40.19-r1
Post by: Rose on December 10, 2014, 03:34:08 am
https://github.com/JapaMala/armok-vision

This is a little something I threw together to read DF map data into Unity.

The way it works is that there's a DFHack plugin that accepts RPC calls over sockets, and returns data to the client. Right now it's just basic map reading, but it can be extended to anything. The important part is that the RPC language used is independent of DFHack version, so even if DFHack adds or removes features, the RPC protocol either is unchanged, or changes more intelligently, to maintain compatibility (This has already happened at least once so far)

Then the unity side does what it wants with everything.

My goal with this was to have a 3d visualizer that worked with multiple versions of DF at the same time. (In comparison to stonesense, which is locked to one DF version, so if you want to view older forts, you have to use an older stonesense, and all that implies)
Title: Re: DFHack 0.40.19-r1
Post by: rmblr on December 10, 2014, 08:51:28 am
Anyone know how to use the job plugin and/or workflow to produce a specific type of rock crafts, specifically amulets?
Title: Re: DFHack 0.40.19-r1
Post by: cdombroski on December 10, 2014, 09:38:38 am
I noticed that fix-armory and the related binpatches are missing. Are the underlying issues fixed in DF?
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 10, 2014, 10:21:00 am
@expwnent - Could you please edit the first post to remove the line "This must be downloaded separately for technical reasons." from the stonesense line. Stonesense hasn't had its own release since 2010 (https://github.com/DFHack/stonesense/releases), and its been bundled with DFHack releases for awhile (except of course the recent non-availability due to bugs).

Elsewhere (Reddit and StackExchange) people are confused about how to get stonesense because of that line ([snide_comment]apparently some people read user docs![/snide_comment]).

Whoops. Thanks.
Title: Re: DFHack 0.40.19-r1
Post by: Iced_Eagle on December 10, 2014, 01:55:31 pm
https://github.com/JapaMala/armok-vision

This is a little something I threw together to read DF map data into Unity.

The way it works is that there's a DFHack plugin that accepts RPC calls over sockets, and returns data to the client. Right now it's just basic map reading, but it can be extended to anything. The important part is that the RPC language used is independent of DFHack version, so even if DFHack adds or removes features, the RPC protocol either is unchanged, or changes more intelligently, to maintain compatibility (This has already happened at least once so far)

Then the unity side does what it wants with everything.

My goal with this was to have a 3d visualizer that worked with multiple versions of DF at the same time. (In comparison to stonesense, which is locked to one DF version, so if you want to view older forts, you have to use an older stonesense, and all that implies)

Cool, thank you! So it looks like you recreated the RPC protocol within C# instead of linking to the RemoteClient library. That definitely works and would remove the tight compatibility with the DFHack version. I'd assume that if you were to change the server output, you'd change the request/response or something like that in case formatting changes or something like that then.

Just curious, but have you tried having a truly real-time connection to DF? It looks like you're grabbing everything on start-up, creating meshes and then disconnecting. I'm not sure of the performance of the remote client, and how quickly it gets map data, so maybe it's not feasible, or I would just need to get creative on the best way to do that given that there's no eventing or things like that. I don't recall there being an API to return dwarf positional data, so that may be something else I investigate further so we could see our friends running around. :-)

I'm pretty sure I've seen you on the IRC channel, so I may have additional questions later on, especially if I make any changes to your code that would be good to check-in for others to use.
Title: Re: DFHack 0.40.19-r1
Post by: Rose on December 10, 2014, 10:06:08 pm
Only reason that wasn't realtime is because I was more working on making sure things were connecting right and rendering. There's no reason why it couldn't do updates more often. The communication is pretty quick, in any case.

Regarding events, something clever could be done with them, maybe, but I think it'd be simplest just to poll for changed values of stuff.

Things like dwarf positions would change far more often than terrain data, after all.
Title: Re: DFHack 0.40.19-r1
Post by: Iced_Eagle on December 10, 2014, 10:54:11 pm
Only reason that wasn't realtime is because I was more working on making sure things were connecting right and rendering. There's no reason why it couldn't do updates more often. The communication is pretty quick, in any case.

Regarding events, something clever could be done with them, maybe, but I think it'd be simplest just to poll for changed values of stuff.

Things like dwarf positions would change far more often than terrain data, after all.

Well I'm home from work now, so it's time to start experimenting! Great work with this Japa. Reduces a lot of the framework I was thinking I was needing to write to get the RPC connection working. :)
Title: Re: DFHack 0.40.19-r1
Post by: rmblr on December 11, 2014, 02:39:53 am
Only reason that wasn't realtime is because I was more working on making sure things were connecting right and rendering. There's no reason why it couldn't do updates more often. The communication is pretty quick, in any case.

Regarding events, something clever could be done with them, maybe, but I think it'd be simplest just to poll for changed values of stuff.

Things like dwarf positions would change far more often than terrain data, after all.

Well I'm home from work now, so it's time to start experimenting! Great work with this Japa. Reduces a lot of the framework I was thinking I was needing to write to get the RPC connection working. :)

A request from a fellow dev and non-windows user: whatever you're creating for DFHack, if you plan to mass release it, please keep it compatible with the Mono libraries so non-windows users can use it.
Title: Re: DFHack 0.40.19-r1
Post by: Severedicks on December 11, 2014, 02:51:04 am
Or better yet, stay away from C#.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 11, 2014, 03:27:54 am
Or better yet, stay away from C#.

why
Title: Re: DFHack 0.40.19-r1
Post by: Rose on December 11, 2014, 03:35:09 am
Only reason that wasn't realtime is because I was more working on making sure things were connecting right and rendering. There's no reason why it couldn't do updates more often. The communication is pretty quick, in any case.

Regarding events, something clever could be done with them, maybe, but I think it'd be simplest just to poll for changed values of stuff.

Things like dwarf positions would change far more often than terrain data, after all.

Well I'm home from work now, so it's time to start experimenting! Great work with this Japa. Reduces a lot of the framework I was thinking I was needing to write to get the RPC connection working. :)

A request from a fellow dev and non-windows user: whatever you're creating for DFHack, if you plan to mass release it, please keep it compatible with the Mono libraries so non-windows users can use it.

So far, we're doing it in Unity, which uses mono, and releases linux binaries, so not a problem.
Title: Re: DFHack 0.40.19-r1
Post by: Rose on December 11, 2014, 10:14:35 am
Okay, added very basic unit loading to Armok Vision, and RemoteFortressReader. All it does is get a list of the coordinates of all units in play over the network.
Title: Re: DFHack 0.40.19-r1
Post by: Severedicks on December 11, 2014, 11:35:03 am
why
C# is an unwieldy language for non-Windows OSes.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 11, 2014, 01:11:02 pm
why
C# is an unwieldy language for non-Windows OSes.

Give it a while (https://github.com/dotnet/corefx).
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 11, 2014, 02:47:18 pm
Unity is actually fairly cross-platform. I believe someone on IRC compiled that visualizer on OS X a while back, and, like Japan said, Linux should be simple as well. I do agree that C# in general tends to be difficult to compile for other platforms, though.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 11, 2014, 06:53:17 pm
Yeah, I haven't touched a windows machine except to strip out windows in years, but I've got some Unity compatibility stuff here on Arch as is, though I've never actually seen C# mentioned before, and my first reflex was to pronounce it "tchash" before the wiki page loaded and said it's "cee-sharp"... I think tchash is funnier so I'm keeping it.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 11, 2014, 11:29:04 pm
interaction-trigger -suppressDefend doesn't seem to work.
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 12, 2014, 12:41:22 am
interaction-trigger -suppressDefend doesn't seem to work.

I'm going to bed soon. Can you post an issue on the tracker if you haven't already?
Title: Re: DFHack 0.40.19-r1
Post by: madk on December 12, 2014, 06:48:06 am
Where's the OSX release for 0.40.19?
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 12, 2014, 07:11:56 am
https://github.com/dfhack/dfhack/releases
Click the 'Darwin' link.
Title: Re: DFHack 0.40.19-r1
Post by: madk on December 12, 2014, 08:29:02 am
Oh. I don't feel smart. Thanks much!
Title: Re: DFHack 0.40.19-r1
Post by: Henour on December 13, 2014, 10:48:36 am
In lua how do I get the type of a tile?

The Documentation seem a bit sparse, I found the dfhack.maps.getTileType(coords) function which returns a number, however it seems to return the same for eg openSpace and Lava?

My end goal is check if there is a Liquid and which one at a given position. Any hints/examples are appreciated.
Title: Re: DFHack 0.40.19-r1
Post by: StagnantSoul on December 13, 2014, 08:33:56 pm
How would I make someone hostile with DFHack?
Title: Re: DFHack 0.40.19-r1
Post by: breadman on December 13, 2014, 11:52:00 pm
In lua how do I get the type of a tile?

The Documentation seem a bit sparse, I found the dfhack.maps.getTileType(coords) function which returns a number, however it seems to return the same for eg openSpace and Lava?

My end goal is check if there is a Liquid and which one at a given position. Any hints/examples are appreciated.

Liquids are separate from the tile type, and are stored in the map block.  In this case, there are two fields of interest in the designation array:

Code: [Select]
block = dfhack.maps.getTileBlock(x, y, z)
flow_size = block.designation[x%16][y%16].flow_size
liquid_type = block.designation[x%16][y%16].liquid_type

When flow_size is greater than zero, there's liquid in the tile, and liquid_type will tell you which type: 0 for water, 1 for magma.

Meanwhile, for a bit more information on the tile type, you can check df.tiletype; for example, df.tiletype[32] returns the name OpenSpace.
Title: Re: DFHack 0.40.19-r1
Post by: Rumrusher on December 14, 2014, 01:28:05 am
How would I make someone hostile with DFHack?
depends on what range of hostilities
there's the No civ berserk with civil units, then there's the moods flags in the unit flags, and the invader flags.
how uhh hmm well you look at someone then use gui/gm-editor on a unit then once in a new menu, look for the invader flag it should be in the section label flags.
Title: Re: DFHack 0.40.19-r1
Post by: StagnantSoul on December 14, 2014, 01:47:22 am
My dfhack comes up with a ton of red text when I try that... Ohwell. I'll try again some other time. Thanks for telling me!
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 14, 2014, 01:51:56 am
My dfhack comes up with a ton of red text when I try that... Ohwell. I'll try again some other time. Thanks for telling me!

Try what?

Also, what's the red text?
Title: Re: DFHack 0.40.19-r1
Post by: Envite on December 14, 2014, 11:48:27 pm
DigFlood failure?

[DFHack]# digFlood CLEAR
Could not find material "CLEAR".
Usage:
Example:
  digFlood 0
    disable plugin
  digFlood 1
    enable plugin
  digFlood 0 MICROCLINE COAL_BITUMINOUS 1
    disable plugin and remove microcline and bituminous coal from being monitored, then re-enable plugin  digFlood 1 MICROCLINE 0 COAL_BITUMINOUS 1
    do monitor microcline, don't monitor COAL_BITUMINOUS, then enable plugin
  digFlood CLEAR
    remove all inorganics from monitoring
  digFlood digAll1
    enable digAll mode: dig any vein, regardless of the monitor list
  digFlood digAll0
    disable digAll mode
[DFHack]#
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 15, 2014, 12:07:45 am
Try lowercase? The documentation might be wrong.
Title: Re: DFHack 0.40.19-r1
Post by: PeridexisErrant on December 15, 2014, 03:25:40 am
I'm working on an updated form of position.py (it's old!), which shows detailed information about the time and place. 

I've got the time down, but I'm having trouble with location - aside from df.global.window_x /y/z - how would I get the embark-tile coords on the world map?  Window size?  Can I also find the total size of the world map?

Spoiler: part of position.py (click to show/hide)

It would also be nice to show "It is the Age of <whatever>", but that could be tricky...
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 15, 2014, 01:43:09 pm
DigFlood failure?

[DFHack]# digFlood CLEAR
Could not find material "CLEAR".
Usage:
Example:
  digFlood 0
    disable plugin
  digFlood 1
    enable plugin
  digFlood 0 MICROCLINE COAL_BITUMINOUS 1
    disable plugin and remove microcline and bituminous coal from being monitored, then re-enable plugin  digFlood 1 MICROCLINE 0 COAL_BITUMINOUS 1
    do monitor microcline, don't monitor COAL_BITUMINOUS, then enable plugin
  digFlood CLEAR
    remove all inorganics from monitoring
  digFlood digAll1
    enable digAll mode: dig any vein, regardless of the monitor list
  digFlood digAll0
    disable digAll mode
[DFHack]#


This will be fixed in the next release. Even in the current version, it should actually do the clearing, it just prints an error that it shouldn't.
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 15, 2014, 10:44:13 pm
I don't know if it's been posted already, but rendermax is really weird in this release. Typing "rendermax light" will simply leave the dfhack console hanging with no other way to stop it other than killing the game itself. Tried with STANDARD and VBO print mode on Debian.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 15, 2014, 10:55:12 pm
It's working normally for me, and I think it worked for me on Linux as well. Is there anything in stderr.log?
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 15, 2014, 11:24:56 pm
Pretty much nothing, except when I kill Dwarf Fortress (either manually or by means of Ctrl-Shift-P and "die"):
Spoiler (click to show/hide)

I should mention it also uses up a whole core on itself (DF running on another core) if I leave it hanging.
Title: Re: DFHack 0.40.19-r1
Post by: Warmist on December 16, 2014, 11:38:24 am
Pretty much nothing, except when I kill Dwarf Fortress (either manually or by means of Ctrl-Shift-P and "die"):
Spoiler (click to show/hide)

I should mention it also uses up a whole core on itself (DF running on another core) if I leave it hanging.
Does it matter if you invoke the command with "Ctrl-Shift-P" or in console?
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 16, 2014, 04:09:22 pm
No, pretty much the same thing happens. The prompt hangs and I even lose control of the game, so I have to kill it with the actual console.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on December 16, 2014, 05:56:02 pm
Worth noting that having something on linux grab a core when it freezes isn't that unusual, it's why I like to keep a terminal with top running and a couple of visible temperature/usage monitors, so I can catch and kill anything that does it if it happens, df or not.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 16, 2014, 06:07:37 pm
No, pretty much the same thing happens. The prompt hangs and I even lose control of the game, so I have to kill it with the actual console.
Does the console hang before or after displaying the DFHack prompt again?
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 16, 2014, 06:49:31 pm
Hmm I'm not sure what you mean so I simply took a screenshot of what happens
(http://s18.postimg.org/qqol1hgft/rendermax.png)
It then proceeds to use up one of my cores
Title: Re: DFHack 0.40.19-r1
Post by: kopout on December 17, 2014, 08:07:40 pm
When I try to use the Embark comand it just says;

Offset for embark patch not found!

I haven't changed any of the settings, its all default. Should I have? Do I need to redownload?
Title: Re: DFHack 0.40.19-r1
Post by: UnicodingUnicorn on December 17, 2014, 09:18:12 pm
When I try to use the Embark comand it just says;

Offset for embark patch not found!

I haven't changed any of the settings, its all default. Should I have? Do I need to redownload?
Try typing embark-tools enable.
Title: Re: DFHack 0.40.19-r1
Post by: kopout on December 17, 2014, 10:26:33 pm
That works, thanks.
Title: Re: DFHack 0.40.19-r1
Post by: Vndetta on December 18, 2014, 03:58:14 pm
I recently struck up a discussion (http://www.bay12forums.com/smf/index.php?topic=146638.0) on the Gameplay Questions forum about finding a way to pinpoint what has caused a unit to be "Horrified" at that particular moment in-game. Currently there are no announcements and the only way to figure it out is through process of elimination - I usually end up save-scumming and removing nearby corpses, stopping fights or stopping butchering when my scared merchants implode (http://www.bay12games.com/dwarves/mantisbt/view.php?id=7185). Can DFHack access this information? How difficult would it be to implement something like "deathcause" but for fear reactions? I'm more than willing to contribute effort, though I don't know much of anything about how it works.

Also, I recently saw a screenshot somewhere of a unit list that showed Pregnant status. It looked like the DFHack window but I can't seem to find it again. Did I imagine this? Is there any way to see if a unit (creature or dwarf) is pregnant?
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 18, 2014, 04:13:37 pm
1. Well, it tells you what causes them to be horrified pretty explicitly, say, "watching x die".
2. Easily, if unit.relations.pregnancy_timer>0 then unit is pregnant.

end
Title: Re: DFHack 0.40.19-r1
Post by: Vndetta on December 18, 2014, 04:40:02 pm
1. Well, it tells you what causes them to be horrified pretty explicitly, say, "watching x die".
2. Easily, if unit.relations.pregnancy_timer>0 then unit is pregnant.

end

1. True, although my dwarves all have dozens of these thoughts at all times, and it's not quite accurate since they get the same thought from seeing something die right then as they do from walking past its corpse in the refuse stockpile three years later. Plus, you can't see the thoughts of merchants or non-dwarves.
2. Neat! How would one go about using this in-game? I saw a "relations" line in the gm-editor plugin but had no idea how to interpret it. It said something like "0x16fa3468" on a random dwarf.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 18, 2014, 04:45:39 pm
1. Thus why they're overcome by horror. Getting a regular reminder of the horrors of the world by seeing festering corpses in the pile.
2. Yes, that's because it's a structure. Press enter on it.
Title: Re: DFHack 0.40.19-r1
Post by: Vndetta on December 18, 2014, 04:51:11 pm
2. Yes, that's because it's a structure. Press enter on it.
Woo! Dunno why I didn't think of that. That's got me wanting to figure out how to make a script for a Pregnancy GUI. It will be a nice and relevant project to learn, as I'm about to pop out an actual baby sometime this week ;) Thanks for the help!
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 18, 2014, 04:53:20 pm
I would make it right now (the data structures are hella simple), but then I realized that the relative simplicity of the data involved makes it a good learning experience, so I'll just let you do that.
Title: Re: DFHack 0.40.19-r1
Post by: Roses on December 19, 2014, 05:30:28 pm
So I'm not sure if I have asked this before. It crossed my mind awhile ago and just again now. I have been playing with the in game gui capabilities a bit and it made me realize that we could put better descriptions and information about creatures and items. Now I can do this already by having a separate button for checking this "enhanced" description, but I was wondering if it is possible to set it up so that instead of opening the standard description page when viewing a unit, it instead opens my custom page?

To be more clear, I am thinking about being able to display the descriptions properly formatted, where putting something like NEWLINE means that you will get a new line. And possibly even allowing descriptions on items through an external file.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 19, 2014, 06:42:55 pm
Could it be possible to force the game to display more colors than the 16 included?
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 19, 2014, 07:25:44 pm
So I'm not sure if I have asked this before. It crossed my mind awhile ago and just again now. I have been playing with the in game gui capabilities a bit and it made me realize that we could put better descriptions and information about creatures and items. Now I can do this already by having a separate button for checking this "enhanced" description, but I was wondering if it is possible to set it up so that instead of opening the standard description page when viewing a unit, it instead opens my custom page?

To be more clear, I am thinking about being able to display the descriptions properly formatted, where putting something like NEWLINE means that you will get a new line. And possibly even allowing descriptions on items through an external file.

Custom viewscreen are possible. manipulator replaces the V-P-L interface and it does it by overriding viewscreens. There might be an lua interface for GUIs but I forget how powerful it is.

Could it be possible to force the game to display more colors than the 16 included?

Based on what I know it would be far more difficult than it's worth.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 19, 2014, 08:11:54 pm
The GUI lua interface is pretty damn powerful.

Also, darn. Oh well, it was just a minor idea.
Title: Re: DFHack 0.40.19-r1
Post by: Roses on December 19, 2014, 08:25:07 pm
Hmmm, I might have to try and work on a better system for descriptions. It would be really nice to be able to have an in-depth description that is easy to read.
Title: Re: DFHack 0.40.19-r1
Post by: mifki on December 19, 2014, 08:39:01 pm
Could it be possible to force the game to display more colors than the 16 included?

It's one of the planned things that I still don't have time to do.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 19, 2014, 09:37:29 pm
Could it be possible to force the game to display more colors than the 16 included?
Do you mean something like rendermax? If you mean using arbitrary colors for interface elements (particularly DFHack-generated ones), that should be possible using a similar strategy (subclassing df::renderer). Unfortunately, there's currently no safe way to use multiple custom renderers, so it wouldn't be possible to combine this with rendermax. I'm thinking of implementing a more centralized way to add custom renderers, which could make this and additional colors easier to implement (possibly from Lua as well).
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 19, 2014, 11:53:15 pm
No, not interface elements, actual materials. Have spatters be the correct STATE_COLOR and what-not. That's what I want it for, at least. It just seems a shame that those tokens aren't really actually used.
Title: Re: DFHack 0.40.19-r1
Post by: Rose on December 20, 2014, 12:43:56 am
Stonesense uses those :P
Title: Re: DFHack 0.40.19-r1
Post by: Roses on December 20, 2014, 03:08:43 am
So just doing some preliminary testing (I know I have enough other stuff to do, but I get side tracked easily), it seems I can gather what information I want about a current screen using dfhack.gui.getCurFocus() and dfhack.gui.getCurViewscreen(). The descriptions for both units and items are listed as "textviewer", but if you check the parent viewscreen you will get either unit or item. Now my question is two-fold

1. Is it possible to just add text to the already existing screen? (i.e. Underneath "This is a pig tail fiber trousers. It is made of pig tail fiber." in the item description screen you could put your own text)
2. Is there an eventful command, or some other command, that runs every time the Viewscreen is changed? I want to be able to register that you are looking at the correct page.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 20, 2014, 03:40:51 am
1. I just tried, it's difficult at the very best. Imma keep trying.
2. There's the SC_VIEWSCREEN_CHANGED state change that can be used with dfhack.onStateChange.

EDIT: Oh, formatted_text.text seems to be a char[]. That makes it easier.

Inconvenient is that the junk values it's giving me when I put in high z for text[z] later suggest that I can get up to some serious trouble if I flub this. Oof.

But yeah, you can definitely edit the text in the text viewer.

(http://imgur.com/UNVTt4Z.png)

I can't figure that blank space in the word "is", though. I can't change it to anything, either.
Title: Re: DFHack 0.40.19-r1
Post by: Roses on December 20, 2014, 04:20:00 am
1. I just tried, it's difficult at the very best. Imma keep trying.
2. There's the SC_VIEWSCREEN_CHANGED state change that can be used with dfhack.onStateChange.

EDIT: Oh, formatted_text.text seems to be a char[]. That makes it easier.

Inconvenient is that the junk values it's giving me when I put in high z for text[z] later suggest that I can get up to some serious trouble if I flub this. Oof.

But yeah, you can definitely edit the text in the text viewer.

(http://imgur.com/UNVTt4Z.png)

I can't figure that blank space in the word "is", though. I can't change it to anything, either.

That's pretty funny.

But if it looks like it is going to be difficult, maybe the best thing would be to take the text from the default screen, duplicate it onto a custom screen, and then add whatever we want. Not sure I want to try and deal with formatting and stuff on the default screen, when it is so easy to make nice looking things with the custom screen.
Title: Re: DFHack 0.40.19-r1
Post by: myk on December 20, 2014, 06:07:42 am
Just a question (that I'm sure has been asked before .. I searched through the forum a bit, but I couldn't find a previous discussion): what is Toady's stance on exporting the symbols in the df binary that dfhack references?  Code-wise, it's a relatively small task (just add some macros and keywords, maybe tweak the build process).  The obvious benefit would be that dfhack (and other utils) wouldn't have to manage the offsets for each df version (symbols.xml).  dfhack would still need updates when symbols are added or deleted, but that is relatively rare compared to df releases.
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 20, 2014, 09:03:54 am
His basic reason is that he doesn't want to have to implement backwards compatibility for any modding API.
Title: Re: DFHack 0.40.19-r1
Post by: myk on December 20, 2014, 10:19:55 am
While I understand the desire not to be responsible for a stable modding API, he could easily export symbols without the guarantee of backwards compatibility.  dfhack would still need to be manually updated when symbols change, but when they don't change (which, in all likelihood, will be the common case) dfhack will 'just work' with the newer df release.
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 20, 2014, 07:46:49 pm
The GUI lua interface is pretty damn powerful.

Also, darn. Oh well, it was just a minor idea.
It depends on what you mean.  As for getting more than 16 colors on the screen, tileset graphics can already use arbitrary colors and TWBT/Rendermax both shade standard tiles.
As for coloring things by their named colors, that seems to be a lot more complicated.  Expanding the color palette in the raws (for example, specifying RGB values) might be impossible and is certainly infeasible.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 20, 2014, 08:02:43 pm
You can specify RGB values in the raws...

http://dwarffortresswiki.org/index.php/DF2014:Color#Color_tokens

You can make more of those arbitrarily.
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 20, 2014, 08:08:08 pm
You can specify RGB values in the raws...

http://dwarffortresswiki.org/index.php/DF2014:Color#Color_tokens

You can make more of those arbitrarily.
Yes, but the question seemed to be about getting beyond a 16-display-color palette.  It'd be nice if tiles were shaded by their named colors, but that's beyond the reach of raw modding and not yet a feature or TWBT or Rendermax.  It is part of Stonesense, but that's not quite a game interface.
Title: Re: DFHack 0.40.19-r1
Post by: mifki on December 20, 2014, 08:44:00 pm
As for coloring things by their named colors, that seems to be a lot more complicated.  Expanding the color palette in the raws (for example, specifying RGB values) might be impossible and is certainly infeasible.

It's very easy to support more values for colours specified in raws as fg:bg:br. As for colour tokens, I think I know how to do this, but I've asked several times for a gamesave with various objects (dyed items, spatter, right?) that should have colours specified with tokens but have approximated colours from 16-colour palette instead. I'm just not sure I know exactly what things are affected by this and not going to experiment without any help.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 20, 2014, 08:53:54 pm
You could always just download Fortbent, go into adventure mode and murder some trolls. They all have different blood colors.
Title: Re: DFHack 0.40.19-r1
Post by: ptb_ptb on December 21, 2014, 03:56:28 pm
[EDIT] Ignore me. Clarification in other thread being awaited.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 21, 2014, 04:06:02 pm
What's the exact path of the missing file? As far as I can tell, advfort requires "dfhack.buildings" and "gui.buildings", which correspond to <DF>/hack/lua/dfhack/buildings.lua and <DF>/hack/lua/gui/buildings.lua, both of which are included. As far as I can tell, there is no "building.lua" included with DFHack.
Title: Re: DFHack 0.40.19-r1
Post by: ptb_ptb on December 21, 2014, 04:12:34 pm
What's the exact path of the missing file? As far as I can tell, advfort requires "dfhack.buildings" and "gui.buildings", which correspond to <DF>/hack/lua/dfhack/buildings.lua and <DF>/hack/lua/gui/buildings.lua, both of which are included. As far as I can tell, there is no "building.lua" included with DFHack.

You're too fast for me. I deleted my post a short while back, but I guess you were already typing.
Title: Re: DFHack 0.40.19-r1
Post by: 0ink3r on December 22, 2014, 12:40:49 am
Can someone tell me where the custom profiles for the dfhack stockpiles command are stored ? (for purpose of backing up etc...)
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 22, 2014, 01:34:30 am
Should be <df folder>/stocksettings
Title: Re: DFHack 0.40.19-r1
Post by: ptb_ptb on December 22, 2014, 09:27:57 am
Putting aside the problems I've had with the version of advfort altered by Warmist (http://www.bay12forums.com/smf/index.php?topic=123944.0), how usuable is the default version included with dfhack?

I reinstalled dfhack and tried to make a workshop. This is what I got:

(http://imagr.eu/up/549824f0126d9_workshops.png) (http://imagr.eu/up/549824f0126d9_workshops.png)

However a whole list of buildings was output to the dfhack console.

(http://imagr.eu/up/5498254bdf117_console.png) (http://imagr.eu/up/5498254bdf117_console.png)

[EDIT] One thing that might be relevant is that my computer thinks I'm Japanese. That is the Windows Locale (http://args.building) is set to Japanese. Normally that would make little to no difference to the functioning of software, but it does mean that the default 8-bit plain text character encoding differs slightly.
Title: Re: DFHack 0.40.19-r1
Post by: 0ink3r on December 22, 2014, 04:09:09 pm
Should be <df folder>/stocksettings

Thanks heaps !
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 22, 2014, 06:59:43 pm
ptb: none of those buildings listed are workshops
Title: Re: DFHack 0.40.19-r1
Post by: ptb_ptb on December 22, 2014, 07:03:18 pm
ptb: none of those buildings listed are workshops
Er, yes, yes some of them are. Everything from Carpenters down are. In any case that doesn't really change the point of my questions. Namely, 'Advfort - does it work? And can I build workshops with it?'
Title: Re: DFHack 0.40.19-r1
Post by: Warmist on December 23, 2014, 04:06:02 am
Putting aside the problems I've had with the version of advfort altered by Warmist (http://www.bay12forums.com/smf/index.php?topic=123944.0), how usuable is the default version included with dfhack?
Not usable at all. Included in dfhack version has two major bugs: does not list any workshops (due to me commiting a version with experimenting on list filtration for deon) and not having new "action" mechanic that is used in new df (due to me not knowing enough about it to implement).

Er, yes, yes some of them are. Everything from Carpenters down are. In any case that doesn't really change the point of my questions. Namely, 'Advfort - does it work? And can I build workshops with it?'
Oh and yes old version prints out all possible buildings (again for filter development). It's really strange how it does not work for you. I'll have to look into it more closely. Maybe something todo with locale, but it's really unlikely...
Title: Re: DFHack 0.40.19-r1
Post by: ptb_ptb on December 23, 2014, 05:11:37 am
It's really strange how it does not work for you. I'll have to look into it more closely. Maybe something todo with locale, but it's really unlikely...

It would be great if you could look into it. If it helps I succeeded in building a tannery (http://www.bay12forums.com/smf/index.php?topic=146688.msg5894332#msg5894332).
Title: Re: DFHack 0.40.19-r1
Post by: milo christiansen on December 23, 2014, 07:07:39 am
Is it possible to get the exact material of a tile from a lua script?
Title: Re: DFHack 0.40.19-r1
Post by: DonPerotti on December 23, 2014, 09:12:10 pm
is it posible to install this version on 0.40.22? i mean that was posible with Dwarf therapist but i dont know if they work same way
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 23, 2014, 09:46:08 pm
No. Using symbols.xml from here (https://github.com/lethosor/df-structures/blob/0.40.22-osx-offsets/symbols.xml) might make DFHack recognize the DF version, but most useful offsets will be missing unless you're using OS X. (You could try copying the 0.40.20 offsets into the 0.40.22 section for your platform, although I have no idea if this is safe on other platforms.)
Title: Re: DFHack 0.40.19-r1
Post by: milo christiansen on December 24, 2014, 12:34:40 am
Is it possible to get the exact material of a tile from a lua script?

Anyone? I asked before elsewhere and was ignored there too (a long time ago), could I at least get a yes or no?
Title: Re: DFHack 0.40.19-r1
Post by: Roses on December 24, 2014, 01:35:11 am
Is it possible to get the exact material of a tile from a lua script?

Anyone? I asked before elsewhere and was ignored there too (a long time ago), could I at least get a yes or no?

I'm not sure if it is possible to get exact material (it should be, but I'm not aware how to do it). I do have a script that changes a tile to a specific inorganic (but it has some issues recognizing ramps and open grass and etc...)

The relevant code is
Code: [Select]
function findMineralEv(block,inorganic) -- Taken from Warmist's constructor.lua
 for k,v in pairs(block.block_events) do
  if df.block_square_event_mineralst:is_instance(v) and v.inorganic_mat==inorganic then
   return v
  end
 end
end
function set_vein(x,y,z,mat) -- Taken from Warmist's constructor.lua
    local b=dfhack.maps.ensureTileBlock(x,y,z)
    local ev=findMineralEv(b,mat.index)
    if ev==nil then
        ev=df.block_square_event_mineralst:new()
        ev.inorganic_mat=mat.index
        ev.flags.vein=true
        b.block_events:insert("#",ev)
    end
    dfhack.maps.setTileAssignment(ev.tile_bitmask,math.fmod(x,16),math.fmod(y,16),true)
end
function changeType(x,y,z,material,dur)
 local mat
 if material ~= 'clear' then
  mat = dfhack.matinfo.find(material)
  set_vein(x,y,z,mat)
 else
  clear_vein(x,y,z)
 end
end
You'll notice that the heart of it comes from Warmist, so he would probably be a better person to ask than me.
Title: Re: DFHack 0.40.19-r1
Post by: milo christiansen on December 24, 2014, 02:33:28 am
That most had stuff I knew about (the way veins are stored) but it was interesting to see how it works in practice, that may be helpful.
I have this feeling that the only way to get a tile material will be very complicated and hard to do (else there would be a function to do that already).
Title: Re: DFHack 0.40.19-r1
Post by: DonPerotti on December 24, 2014, 02:48:10 am
No. Using symbols.xml from here (https://github.com/lethosor/df-structures/blob/0.40.22-osx-offsets/symbols.xml) might make DFHack recognize the DF version, but most useful offsets will be missing unless you're using OS X. (You could try copying the 0.40.20 offsets into the 0.40.22 section for your platform, although I have no idea if this is safe on other platforms.)

Thanks anyway, i guess i will just wait until it is finally released for last version even though toady keeps updating the game like once a day (wich is kind of awesome since last time i played this for a long time i made like 20 fortresses in 0.34)
Title: Re: DFHack 0.40.19-r1
Post by: Henour on December 24, 2014, 08:42:23 am
Has the Brainwash script been removed from dfhack per default?

Got a immigrant thats basically the most miserable person in the world (Gets bad thoughts about everything, can't handle stress and so on) and wantes to give him therapy using this. I remember it still was there for on of the first new emotion releases.
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 24, 2014, 09:46:13 am
Use remove-stress.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 24, 2014, 10:03:11 am
Has the Brainwash script been removed from dfhack per default?
It's never been included in DFHack - it's one of Vjek's scripts (http://dwarffortresswiki.org/index.php/User:Vjek#brainwash).
Edit: As expwnent said, remove-stress should work for your purposes. I'm not sure exactly what brainwash did, but it probably won't work with 0.40.13+.
Title: Re: DFHack 0.40.19-r1
Post by: Billy Jack on December 24, 2014, 04:09:02 pm
As I recall, Brainwash would set the dwarf's preferences to be easily obtainable and remove those that were more exotic or hard to consistently produce; such as bracelets or other specific crafts.

Since it worked on preferences rather than happiness, I would guess that it would work with the new version, since the memory mapping for dwarfs should be up to date.
Title: Re: DFHack 0.40.19-r1
Post by: smjjames on December 24, 2014, 04:50:54 pm
ETA on DFhack catching up with 40.22? I know it'd obviously be after christmas though. Toady One might do an update shortly after christmas.
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 24, 2014, 06:45:24 pm
As far as I know it all relies on the update of df-structures (https://github.com/lethosor/df-structures/tree/0.40.22-osx-offsets) and the few people that usually do it are probably away, this being Christmas and all. However it seems lethosor did some preliminary work on OS X.
Title: Re: DFHack 0.40.19-r1
Post by: Baffler on December 24, 2014, 07:30:14 pm
Does anyone know if the spawnunit script still works/was fixed? I see it when I list the commands, but I don't want to destroy my save file in case it's just a holdover.
Title: Re: DFHack 0.40.19-r1
Post by: Valid_Dark on December 24, 2014, 11:21:44 pm
(http://i.imgur.com/lq1i4eC.png)
Title: Re: DFHack 0.40.19-r1
Post by: Roses on December 25, 2014, 02:50:59 am
I'm wondering if it is possible to get a siege-trigger and trade-trigger, basically a script that runs anytime a siege or traders arrive, possibly ambushers too? I saw the onInvasion in eventful, so I assume that is basically my siege-trigger. Is there a similar thing for traders and ambushers? (Would also be interesting if there was such a thing for megabeasts)

EDIT: @expwnent, has the onLoad.init been modified to accept multi-line commands?
Title: Re: DFHack 0.40.19-r1
Post by: Rumrusher on December 25, 2014, 02:54:21 am
Does anyone know if the spawnunit script still works/was fixed? I see it when I list the commands, but I don't want to destroy my save file in case it's just a holdover.
don't know if they updated it with my patched findings but here's a working spawn something script. (https://gist.github.com/Rumrusher/f4d0ba18ba6868d38221)
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 25, 2014, 10:23:51 pm
I'm wondering if it is possible to get a siege-trigger and trade-trigger, basically a script that runs anytime a siege or traders arrive, possibly ambushers too? I saw the onInvasion in eventful, so I assume that is basically my siege-trigger. Is there a similar thing for traders and ambushers? (Would also be interesting if there was such a thing for megabeasts)

EDIT: @expwnent, has the onLoad.init been modified to accept multi-line commands?

Those would be neat. There is currently no things for traders. On invasion should trigger for ambushes but not megabeasts (probably). onLoad.init does not yet support multiline commands, sadly.
Title: Re: DFHack 0.40.19-r1
Post by: Roses on December 26, 2014, 03:37:11 am
I'm wondering if it is possible to get a siege-trigger and trade-trigger, basically a script that runs anytime a siege or traders arrive, possibly ambushers too? I saw the onInvasion in eventful, so I assume that is basically my siege-trigger. Is there a similar thing for traders and ambushers? (Would also be interesting if there was such a thing for megabeasts)

EDIT: @expwnent, has the onLoad.init been modified to accept multi-line commands?

Those would be neat. There is currently no things for traders. On invasion should trigger for ambushes but not megabeasts (probably). onLoad.init does not yet support multiline commands, sadly.

Maybe I'll look into doing something for traders and megabeasts, but it'll go at the end of the list. Does on invasion distinguish between sieges and ambushers? Or is it just anytime someone comes on the map with an invasion id set?

No worries about the multi-line, my system works fine now, was just gonna start a big new thing soon and wanted to double check before I got going.
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on December 26, 2014, 08:18:35 am
Yeah it just goes based on invasion id. It doesn't distinguish between types of invaders.
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 26, 2014, 09:24:59 pm
Would there be a way to make an announce-trigger that fires whenever it matches the text of an announcement?  Not sure how useful it'd be without a host of ids/parameters to pass to its script, but at the least one could distinguish between types of invasions.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 26, 2014, 09:51:48 pm
I'm not sure what language (if any) that uses, but assuming you receive a report ID in Lua, a match can be determined with df.report.find(id).text:match('text to search for').
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 27, 2014, 01:01:35 pm
I'm not sure what language (if any) that uses, but assuming you receive a report ID in Lua, a match can be determined with df.report.find(id).text:match('text to search for').
Actually, from https://github.com/warmist/df-structures/blob/master/df.announcements.xml (https://github.com/warmist/df-structures/blob/master/df.announcements.xml) it looks like an announcement event has a lot of useful information embedded in it.  Just have no idea how to turn that into an actual announce-trigger.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 27, 2014, 01:25:43 pm
Exactly, df.report.find(id) returns an announcement object (or nil). What exactly is "announce-trigger"? I can't find anything in DFHack that refers to it.
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 27, 2014, 01:31:05 pm
Exactly, df.report.find(id) returns an announcement object (or nil). What exactly is "announce-trigger"? I can't find anything in DFHack that refers to it.
There isn't one, I was suggesting one if its feasible.  It would incorporate the features that Roses requested with a lot of additional flexibility for modders to react to announcements.  Might even pave the way for folding Soundsense into DFHack (if there would be any advantage to doing that).
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 27, 2014, 02:06:36 pm
You can use the onReport event - here (https://github.com/lethosor/dfhack-scripts/blob/master/annc-monitor.lua) is an example.
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 27, 2014, 02:35:57 pm
You can use the onReport event - here (https://github.com/lethosor/dfhack-scripts/blob/master/annc-monitor.lua) is an example.
Oh, that looks like exactly what Roses needed.  Just stick the event handling logic inside the annc_handler function.

The only use I'd have for this is to suppress an announcement, since I'd rather the player not know when he or she struck Living Stone.  That would require infrastructure similar to interaction-trigger.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 27, 2014, 02:45:23 pm
Announcement suppression doesn't seem to be working (at least in combat logs) as of now, so I'm not sure about that.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 27, 2014, 02:59:51 pm
You could set world.status.display_timer to 0 to hide the announcement from the bottom of the screen. Deleting it might be possible as well, although it could cause problems.
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 27, 2014, 03:10:13 pm
Thanks for the pointers.  I was imagining something like interaction-trigger where you could trigger a script in response to an announcement and optionally suppress that announcement from appearing (the same way you can suppress an interaction verb).  In my particular case, the handler would be a dummy script since all I want to do is prevent the player from being notified if specific minerals have been struck.  Living Granite is supposed to be indistinguishable from normal granite, and so on.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 27, 2014, 05:15:46 pm
(the same way you can suppress an interaction verb)

This doesn't seem to actually work as of the most recent version.
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on December 27, 2014, 05:25:25 pm
(the same way you can suppress an interaction verb)

This doesn't seem to actually work as of the most recent version.
That's unfortunate.  I hadn't noticed because I managed to build my mod out of syndrome-triggers and reaction-triggers instead of interaction-triggers.

Here's wishing the interaction-trigger a speedy recovery :)
Title: Re: DFHack 0.40.19-r1
Post by: emhs on December 27, 2014, 05:49:07 pm
The burrow plugin hates me. I consistently get "burrow not found" errors and auto-grow does nothing. Any ideas?
Title: Re: DFHack 0.40.19-r1
Post by: Devast on December 27, 2014, 08:09:23 pm
Is there a way to edit the value of how much power a windmill produces?
Title: Re: DFHack 0.40.19-r1
Post by: Rose on December 28, 2014, 12:24:02 am
Is it possible to directly control the behavior of created flows?
Title: Re: DFHack 0.40.19-r1
Post by: AoshimaMichio on December 28, 2014, 06:39:15 am
Does anyone know if there exists a GUI for "createitem" command? The command itself is not very easy or forgiving for people like me who have not dabbled with raws, so helpful filterable/searchable GUI would be very much appreciated.
Title: Re: DFHack 0.40.19-r1
Post by: fricy on December 28, 2014, 06:50:25 am
Does anyone know if there exists a GUI for "createitem" command? The command itself is not very easy or forgiving for people like me who have not dabbled with raws, so helpful filterable/searchable GUI would be very much appreciated.
gui/hack-wish
Title: Re: DFHack 0.40.19-r1
Post by: AoshimaMichio on December 28, 2014, 06:53:31 am
Does anyone know if there exists a GUI for "createitem" command? The command itself is not very easy or forgiving for people like me who have not dabbled with raws, so helpful filterable/searchable GUI would be very much appreciated.
gui/hack-wish
Thank you.
Title: Re: DFHack 0.40.19-r1
Post by: Naryar on December 29, 2014, 05:30:56 pm
How do you update dfhack to 40.23 on Windows ?
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 29, 2014, 06:29:36 pm
You can't, unless you compile it yourself. Not all offsets have been located for Windows yet, and you'd need a build of DFHack for at least 0.40.20 to be able to simply copy over symbols.xml.
Title: Re: DFHack 0.40.19-r1
Post by: Iced_Eagle on December 30, 2014, 12:13:39 am
Okay, added very basic unit loading to Armok Vision, and RemoteFortressReader. All it does is get a list of the coordinates of all units in play over the network.

Just saw this post and pulled down your changes. Cheers!

I finally got some time to start working on this during vacation. The first thing I noticed was that the MapInfo x/y coord's seem low. Maybe it's an issue with my understanding of how the DF map is structured though.

I did a default embark (4x4 I believe?), but the cord's came back with map size of 12 for both X and Y. The Z size is correct however (204). I placed a breakpoint on the DFHack side and that is what it's getting back from MapInfo object, so I'll dig deeper tomorrow. I would have expected to get something in the range of about 150-200 units.
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on December 30, 2014, 12:30:17 am
Probably map blocks instead of map tiles.
Title: Re: DFHack 0.40.19-r1
Post by: Rose on December 30, 2014, 01:53:51 am
Yeah, the map is divided into blocks of 16x16 tiles.
Title: Re: DFHack 0.40.19-r1
Post by: Badger Storm on December 30, 2014, 04:15:40 pm
Any news on when the next DFHack will be coming out?
Title: Re: DFHack 0.40.19-r1
Post by: Nopenope on December 30, 2014, 05:37:13 pm
You can already build it yourself with the latest df-structures. What OS are you using?
Title: Re: DFHack 0.40.19-r1
Post by: Iced_Eagle on December 30, 2014, 09:02:42 pm
Yeah, the map is divided into blocks of 16x16 tiles.

Got it! That makes sense. Numbers seem perfectly reasonable then.
Title: Re: DFHack 0.40.19-r1
Post by: Badger Storm on December 31, 2014, 12:21:35 pm
I'm using OS X.  Not really familiar with df-structures.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 31, 2014, 12:44:21 pm
In that case, all you need to do before building normally is update df-structures:
Code: [Select]
cd library/xml
git fetch origin
git checkout origin/master
Title: Re: DFHack 0.40.19-r1
Post by: Badger Storm on December 31, 2014, 05:28:00 pm
https://github.com/DFHack/df-structures/blob/master/osx/df.globals.xml

When I looked up DF-structures in finder, I found a link to this.  I'm guessing that "bumping" DFHack means making it compatible with the newest version?  If this is the case, is this a simple copy-paste job, or something a bit more involved?

Title: Re: DFHack 0.40.19-r1
Post by: lethosor on December 31, 2014, 06:06:39 pm
"Bumping" in that case means "running the automatic update scripts". If you look at the changes made to symbols.xml (https://github.com/DFHack/df-structures/commit/195ce87d9e43aaec1405ad05981a12e5a4ccb09b/symbols.xml) in that commit, you'll see that 2,732 lines were added (which Github refuses to display). About 20-30 globals need to be located semi-automatically from within DF/DFHack, and this has been done for Linux and OS X in 0.40.23.
To answer your question - if you're using OS X or Linux, you would still need a copy of DFHack from at least 0.40.20 (of which there are none) in order to make it work with 0.40.23 by copying over symbols.xml, due to structure changes made in 0.40.20.
Title: Re: DFHack 0.40.19-r1
Post by: Badger Storm on December 31, 2014, 07:01:07 pm
Yeah, I'm still using 40.19.  I'm actually okay with that, seeing as I've been doing mad modding recently and it would be a pain to copy everything over.  I'll just be on the lookout for the newest version of DFHack, I suppose! 

Title: Re: DFHack 0.40.19-r1
Post by: bobohead1988 on January 01, 2015, 06:41:32 am
hey guys, I'm having a problem with dfhack at the moment

my game keeps on crashing whenever DF with DFHack loads a save
It happens when I was saving but somehow the game crashed, now whenever i load, this issue happens

If I were to run it vanilla, theres no issue with DF, only happens when DFHack is loaded
I was using pyLNP bundle as well to start it up, no additional addons was added apart from therapist

I tried setting the print mode to various settings but no avail,

DF Error log shows this at the last few lines
*** Error(s) finalizing the translation DWARF
Unrecognized word token: YOR
*** Error(s) finalizing the translation ELF
Unrecognized word token: YOR
*** Error(s) finalizing the translation GOBLIN
Unrecognized word token: YOR
*** Error(s) finalizing the translation HUMAN
Unrecognized word token: YOR
*** Error(s) finalizing the entity MOUNTAIN

While DFHack Log shows
UNKNOWN CLASS 'dfhack_lua_viewscreen@DFHack': vtable = 0x50d7c884

If anyone's interested, the save file is below
http://dffd.wimbli.com/file.php?id=10363

EDIT : welp i renamed the plugin folder and dfhack loads the savegame without issue,

manipulator
search
automaterial
dwarf monitor
mousequery
automelt
autotrade
buildingplan
resume
trackstop
zone
stocks
autochop
stockflow

among those, which one would be the ones messing up the raws? since I can see the DF error came from some raws being edited into YOR
And what would be the command to disable it?


Title: Re: DFHack 0.40.19-r1
Post by: lethosor on January 01, 2015, 08:19:46 am
That shouldn't have anything to do with DFHack - that's most likely a problem with your graphics set. (YOR was changed to YORE in 0.40.05, I believe, and changing it in existing saves will break them). Try opening the language raw files in DF/data/save/(region folder)/raw/objects and changing YOR to YORE in each (or vice versa if they already contain YORE). No plugins whatsoever edit raws that I'm aware of, let alone save-specific raws (with the possible exception of non-official plugins, like TwbT).
Title: Re: DFHack 0.40.19-r1
Post by: notfood on January 01, 2015, 06:50:06 pm
Is there a script to auto-resume a suspended wall building job due to water ocuping it? I would like to have it less painful to dig and wall through aquifier.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on January 01, 2015, 07:31:26 pm
You could try "autounsuspend", although I'm not sure if it works in the current version or what exactly it does.
Title: Re: DFHack 0.40.19-r1
Post by: notfood on January 01, 2015, 08:16:54 pm
I just tested it, works perfectly for 40.23 Linux. It does exactly what I wanted.
Title: Re: DFHack 0.40.19-r1
Post by: Thundercraft on January 01, 2015, 10:36:42 pm
I just tested it, works perfectly for 40.23 Linux. It does exactly what I wanted.

Wait... You're saying we should be able to get  DFHack 0.40.19-r1 to work with 40.23?  :o

I thought DFHack relied on memory addresses and such that had to be updated to work with new releases. Or does DFHack do that automatically now?
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on January 02, 2015, 12:04:27 am
No.

If you're using OS X or Linux, you would still need a copy of DFHack from at least 0.40.20 (of which there are none) in order to make it work with 0.40.23 by copying over symbols.xml, due to structure changes made in 0.40.20.

In other words, you have to compile DFHack yourself for it to work with anything above 0.40.19.
Title: Re: DFHack 0.40.19-r1
Post by: notfood on January 02, 2015, 01:51:32 am
Yeah, compiled from Lethosor's 0.40.23-dev (https://github.com/lethosor/dfhack/tree/0.40.23-dev) branch. It's already quite stable, most things work. You need to use latest df-structures.
Title: Re: DFHack 0.40.19-r1
Post by: ptb_ptb on January 02, 2015, 04:46:56 am
Yeah, compiled from Lethosor's 0.40.23-dev (https://github.com/lethosor/dfhack/tree/0.40.23-dev) branch. It's already quite stable, most things work. You need to use latest df-structures.
I've tried that a few times before. Never quite managed it. If a kind person decided to upload an unofficial dev compiles for Window, Linux and/or OS X I'm sure many would be very grateful.
Title: Re: DFHack 0.40.19-r1
Post by: WillowLuman on January 02, 2015, 01:19:20 pm
Yeah, compiled from Lethosor's 0.40.23-dev (https://github.com/lethosor/dfhack/tree/0.40.23-dev) branch. It's already quite stable, most things work. You need to use latest df-structures.
I've tried that a few times before. Never quite managed it. If a kind person decided to upload an unofficial dev compiles for Window, Linux and/or OS X I'm sure many would be very grateful.
I as well.
Title: Re: DFHack 0.40.19-r1
Post by: Badger Storm on January 02, 2015, 03:23:58 pm
I third this sentiment.  I'm curious about the new job prioritization, but I need to be able to clean my map, darnit!
Title: Re: DFHack 0.40.19-r1
Post by: expwnent on January 02, 2015, 03:29:58 pm
I'm going to work on it this weekend. I've been busy with family stuff.
Title: Re: DFHack 0.40.19-r1
Post by: Naryar on January 02, 2015, 04:06:55 pm
It will be good to have a 40.23 version for Windows, yes.
Title: Re: DFHack 0.40.19-r1
Post by: notfood on January 02, 2015, 04:29:11 pm
There were some missing symbols for Windows, so that's why you aren't seeing any unofficial windows DFHack floating around. The only one in reddit is very buggy, it crashes on dig* commands, manager doesn't work, not even embark tools work. I think the only thing that works is reveal.
Title: Re: DFHack 0.40.19-r1
Post by: Mokkun on January 03, 2015, 01:43:54 pm
There were some missing symbols for Windows, so that's why you aren't seeing any unofficial windows DFHack floating around. The only one in reddit is very buggy, it crashes on dig* commands, manager doesn't work, not even embark tools work. I think the only thing that works is reveal.
Ohh. my favourite function for a new fort, and I just started one.. Makes planning a bit easier, and lets me avoid the mess I made in the last one.. hmm, where can I get that reddit version?
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on January 03, 2015, 09:32:13 pm
Hah, grabbed the new structures, thought I had it done right, it loads up, starts to look good, then the last line here I get red text:

Code: [Select]
Gtk-Message: Failed to load module "canberra-gtk-module"
Loading bindings from data/init/interface.txt
New window size: 1920x1080
Font size: 24x24
Resizing grid to 80x45
Resizing font to 24x24

Resetting textures
TWBT: version 5.36
TWBT: set PRINT_MODE to TWBT or TWBT_LEGACY in data/init/init.txt to activate the plugin

At that point it totally freezes and I have to kill it with the system monitor, as neither top nor closing the terminal tab were capable of getting rid of the frozen window.

Best part: it froze before generating an error log, meh, no rush.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on January 03, 2015, 09:38:28 pm
TwbT shouldn't be loaded unless you've compiled it for 0.40.23 or forgot to change the DFHack version. (For example, if DFHack is built as "0.40.19-r1", it'll load any plugins built with "0.40.19-r1", which can cause crashes if they're not actually compatible with the DF/DFHack version being used.) I'm not sure if TwbT is the problem in this case, but you could try removing it from the hack/plugins folder.
Title: Re: DFHack 0.40.19-r1
Post by: Electrode on January 03, 2015, 09:49:26 pm
Ohh. my favourite function for a new fort, and I just started one.. Makes planning a bit easier, and lets me avoid the mess I made in the last one.. hmm, where can I get that reddit version?

Here (https://www.reddit.com/r/dwarffortress/comments/2r0koe/df_hack_for_last_df_release/). A new build was just posted that fixes a lot of the problems the old one had.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on January 03, 2015, 09:58:06 pm
TwbT shouldn't be loaded unless you've compiled it for 0.40.23 or forgot to change the DFHack version. (For example, if DFHack is built as "0.40.19-r1", it'll load any plugins built with "0.40.19-r1", which can cause crashes if they're not actually compatible with the DF/DFHack version being used.) I'm not sure if TwbT is the problem in this case, but you could try removing it from the hack/plugins folder.
Yup, realized that I had forgot to swap over the new plugins folder which doesn't have it in there, checking to see if I've got it fixed.
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on January 03, 2015, 11:22:15 pm
Hmmm, fresh df, fresh dfhack, no twbt, loads up and freezes at title screen with nothing wrong in the error log, says it is running fine supposedly.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on January 04, 2015, 12:13:32 am
Strange. What happens if you rename the plugins folder?
Title: Re: DFHack 0.40.19-r1
Post by: Max™ on January 04, 2015, 12:49:00 am
Hmmm, with .plugins it just blinks and crashes instantly, put it back to normal and tried .scripts out of curiosity and it froze harder than ever, had to close the terminal tab and forcibly kill the process after trying to kill it normally and it just sitting there.
Title: Re: DFHack 0.40.19-r1
Post by: Mokkun on January 04, 2015, 06:33:21 am
Ohh. my favourite function for a new fort, and I just started one.. Makes planning a bit easier, and lets me avoid the mess I made in the last one.. hmm, where can I get that reddit version?

Here (https://www.reddit.com/r/dwarffortress/comments/2r0koe/df_hack_for_last_df_release/). A new build was just posted that fixes a lot of the problems the old one had.
Thank you wery much. :)
Title: Re: DFHack 0.40.19-r1
Post by: Naryar on January 04, 2015, 03:17:04 pm
going to test that reddit dfhack for 0.40.23 Windows and will tell what works, if it crashes, etc.
Title: Re: DFHack 0.40.19-r1
Post by: fitzitz on January 04, 2015, 05:23:51 pm
I'm using DFHack 40.19 on the 40.19 version of Dwarf Fortress to try and mess around with a fort, test some things out etc. Unfortunately, it seems the 'force' command doesn't work. Anyone know any reasons why this might be?
Title: Re: DFHack 0.40.19-r1
Post by: Putnam on January 04, 2015, 05:26:21 pm
Sieges were completely changed on 0.40.01 to basically something else entirely.
Title: Re: DFHack 0.40.19-r1
Post by: fitzitz on January 04, 2015, 07:11:53 pm
That explains the sieges, but it says "force" in itself isn't a command.
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on January 04, 2015, 09:00:07 pm
It's been moved to modtools/force (https://github.com/DFHack/dfhack/blob/master/scripts/modtools/force.lua), but it doesn't seem to have been updated for 0.40.xx at all (unless there are other versions of it floating around that I'm not aware of).
Title: Re: DFHack 0.40.19-r1
Post by: Moorindal on January 05, 2015, 04:37:16 am
So what about dfhack for 0.40.23? Will it be ready anytime soon?
Title: Re: DFHack 0.40.19-r1
Post by: mifki on January 05, 2015, 04:42:34 am
So what about dfhack for 0.40.23? Will it be ready anytime soon?

So many fixes recently, I have a feeling that .24 will be released soon.
Title: Re: DFHack 0.40.19-r1
Post by: Dirst on January 05, 2015, 02:20:10 pm
So what about dfhack for 0.40.23? Will it be ready anytime soon?

So many fixes recently, I have a feeling that .24 will be released soon.
Toady has an unnerving ability to time his releases to coincide with either the DFHack update or the Lazy New Pack update that follows quickly thereafter.

I told PE that he should commit to daily updates of the Pack and see how Toady responds :)
Title: Re: DFHack 0.40.19-r1
Post by: lethosor on January 05, 2015, 03:16:20 pm
Keep in mind that there are multiple packs, not just PeridexisErrant's.

So what about dfhack for 0.40.23? Will it be ready anytime soon?
Expwnent's been busy recently:
I'm going to work on it this weekend. I've been busy with family stuff.
I'm not sure exactly when we'll get around to a release, but DFHack is sufficiently updated for one. (There are a number of pull requests that fix problems with plugins that would need to be merged first, however.)

Edit: I've merged every open PR and updated a few things, so this branch should compile and work with 0.40.23 (at least, it does on OS X): https://github.com/lethosor/dfhack/tree/0.40.23-r1-rc

Title: Re: DFHack 0.40.19-r1
Post by: Roses on January 05, 2015, 05:35:15 pm
So here's a question. I know how to get the time of the current game world (in ticks), but I was wondering if there is a way to get the time in ticks, since a fort was established?

Also, I just happened across df.global.ui, which I had never looked in before, but seems to contain a lot of interesting information. Of particular interested are .caravans, .units_killed, .invasions, and .main.dead_citizens. Does anyone have any experience working with the information in df.global.ui? I can start to look at it all and experiment, but I figured I would ask to see if anyone has done anything with them.

For example,
1. What information is stored in .invasions? Does it list number of units? Kills? Deaths? Entities?
2. Similarly for .caravans. Is it just a list of numbers? Is it just a flag?
3. .units_killed seems weird, it appears to break down the kills by profession. Is it any unit killed on the map? Is it just enemies? What if they fall to their death?

EDIT: Where is information stored about your current fort? Like wealth, and import and export numbers and such?
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 05, 2015, 08:25:06 pm
New release. It took a long time because I was away for Christmas stuff. Sorry for the delay everyone!
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 05, 2015, 08:32:00 pm
OS X build (https://github.com/lethosor/dfhack/releases/tag/0.40.23-r1) (Linux build(s) to come.)
Title: Re: DFHack 0.40.23-r1
Post by: scamtank on January 05, 2015, 08:35:31 pm
New release. It took a long time because I was away for Christmas stuff. Sorry for the delay everyone!

Isn't that, like, the most understandably ironclad excuse there can be for not putting work into hobbies?

Thanks for being so prompt.
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 05, 2015, 08:44:49 pm
OSX build moved to main repo.

Special thanks to Lethosor for doing 99% of the stuff I normally do for releases this time.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 05, 2015, 09:07:27 pm
Uploaded a Linux build to the same location: https://github.com/lethosor/dfhack/releases/tag/0.40.23-r1
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 05, 2015, 09:35:18 pm
Included.
Title: Re: DFHack 0.40.23-r1
Post by: mifki on January 05, 2015, 10:25:04 pm
What's "v0.40.23-text osx"?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 05, 2015, 10:39:35 pm
It's an experimental build Toady put up with PRINT_MODE:TEXT support for OS X (which works for me on 10.9 but not for him on 10.6 - I'm not sure about anything in between). It looks like it's still available (http://bay12games.com/dwarves/text_test_osx.tar.bz2), if you want to take a look. I added offsets for it so I could test a few things in PRINT_MODE:TEXT without compiling on Linux - most of them are 0x5000 away from the standard 0.40.23 offsets, but there are a few exceptions.
Title: Re: DFHack 0.40.19-r1
Post by: Moorindal on January 06, 2015, 02:12:08 am
Edit: I've merged every open PR and updated a few things, so this branch should compile and work with 0.40.23 (at least, it does on OS X): https://github.com/lethosor/dfhack/tree/0.40.23-r1-rc
Umm... Thanks but... Am I supposed to compile it somehow? I don't even use *nix, you know. Where can I get compiled Windows version?
Title: Re: DFHack 0.40.19-r1
Post by: mifki on January 06, 2015, 02:22:22 am
Edit: I've merged every open PR and updated a few things, so this branch should compile and work with 0.40.23 (at least, it does on OS X): https://github.com/lethosor/dfhack/tree/0.40.23-r1-rc
Umm... Thanks but... Am I supposed to compile it somehow? I don't even use *nix, you know. Where can I get compiled Windows version?

(http://i.imgur.com/Q5vHAu9.png)
(http://i.imgur.com/WT5OI5i.png)

sorry
Title: Re: DFHack 0.40.23-r1
Post by: Rose on January 06, 2015, 04:22:15 am
You need to make either the entire picture, or the red circle, vibrate.
Title: Re: DFHack 0.40.23-r1
Post by: Orange Wizard on January 06, 2015, 04:52:21 am
People will still miss it.
Title: Re: DFHack 0.40.23-r1
Post by: Dirst on January 06, 2015, 12:29:19 pm
Thanks you guys for all of your tireless work on this invaluable part of the DF experience.  And I think the red oval should undulate, it'd be more likely to grab attention :)
Title: Re: DFHack 0.40.23-r1
Post by: Baffler on January 06, 2015, 03:04:08 pm
How do I add new scripts to DFHack? Do I just need to move the .lua file into the folder with all the others, or do I need to do something special to let it recognize it?
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 06, 2015, 03:05:13 pm
Just put the .lua file into the scripts folder, yeah.
Title: Re: DFHack 0.40.23-r1
Post by: Baffler on January 06, 2015, 03:06:13 pm
Awesome, thanks.
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 03:52:06 pm
Is the Darwin version the one for OSX?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 07, 2015, 03:54:03 pm
Yes.
Title: Re: DFHack 0.40.23-r1
Post by: PeridexisErrant on January 07, 2015, 03:56:43 pm
Does anyone have a way of getting properties of the hotkeys?  I'm working on a script to print the name and location of each, but without getting data all I can do is print placeholder info...

Code: (hotkey-notes.lua) [Select]
-- prints info on assigned hotkeys to the console

local hotkeys = {'F1 ', 'F2 ', 'F3 ', 'F4 ', 'F5 ', 'F6 ',
                 'F7 ', 'F8 ', 'F9 ', 'F10', 'F11', 'F12'}

for i=1, #hotkeys do
    local hk = hotkeys[i]
    hk = {id=hk}
    -- PLACEHOLDER PROPERTIES ONLY!
    hk.name = '_name'
    hk.x = df.global.window_x
    hk.y = df.global.window_y
    hk.z = df.global.window_z

    print(hk.id..'  '..hk.name..'    X= '..hk.x..',  Y= '..hk.y..',  Z= '..hk.z)
end
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 07, 2015, 03:59:20 pm
Take a look at df.global.ui.main.hotkeys
Also, there is no "F9" hotkey by default - the default keybindings use F1-F8 and Shift+F1-F8.
Edit: In case you didn't know, you can use string formatting instead of concatenating if you like:
Code: [Select]
print(('%i  %i  X=%i  Y=%i Z=%i'):format(hk.id, hk.name, hk.x, hk.y, hk.z))
(The parentheses around the string are only necessary for string literals.)
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 04:04:20 pm
I've forgotten how to install DFHack on OSX.  Can someone please give me a quick run-down?
Title: Re: DFHack 0.40.23-r1
Post by: PeridexisErrant on January 07, 2015, 04:05:10 pm
Take a look at df.global.ui.main.hotkeys
Also, there is no "F9" hotkey by default - the default keybindings use F1-F8 and Shift+F1-F8.

Thanks!
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 07, 2015, 04:07:42 pm
I've forgotten how to install DFHack on OSX.  Can someone please give me a quick run-down?
Same as other platforms - copy all files/folders from the archive into your DF folder.
On OS X (and Linux), you'll want to run the "dfhack" script instead of "df" (which launches DF without DFHack).
Title: Re: DFHack 0.40.23-r1
Post by: danaris on January 07, 2015, 04:08:16 pm
I've forgotten how to install DFHack on OSX.  Can someone please give me a quick run-down?

Just unzip the downloaded file and place everything that comes out of it (not the dfhack or dfhack-0 folder, but the contents of that folder) in your DF folder.
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 04:09:27 pm
That's what I did, but I got this:

Last login: Wed Jan  7 16:06:07 on ttys000
/Applications/Dwarf\ Fortress\ 40.23/dfhack ; exit;
computer:~ emans002$ /Applications/Dwarf\ Fortress\ 40.23/dfhack ; exit;
terminate called after throwing an instance of '__gnu_cxx::__concurrence_lock_error'
  what():  __gnu_cxx::__concurrence_lock_error
/Applications/Dwarf Fortress 40.23/dfhack: line 15: 14370 Abort trap              DYLD_INSERT_LIBRARIES=./hack/libdfhack.dylib ./dwarfort.exe "$@"

logout

[Process completed]


I tried re-copying and re-pasting, but to no avail.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 07, 2015, 04:11:15 pm
Are you using OS X 10.6?
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 04:12:26 pm
10.6.8, yeah.  Does that mean it won't work and I can't use DFHack anymore?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 07, 2015, 04:17:29 pm
Try deleting hack/libstdc++.6.dylib. That's there to fix a bunch of Lua-related crashes that occur with DF's libstdc++ (in libs/), but I doubt it works on 10.6. I could try adjusting some more GCC build flags, I suppose.
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 04:20:11 pm
Yeah, that fixed it.  Thank you UuU  Say, have there been any raw changes from 40.19 to 40.23?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 07, 2015, 04:22:37 pm
Not any important ones, as far as I can tell, although you'll want to update your keybindings.
Quote from: file changes.txt

******************************************************

Auxiliary file changes for 0.40.23:

   creature_small_riverlake and creature_standard
      breath -> breathe a few places (Gorobay)

******************************************************

Auxiliary file changes for 0.40.22:

   Just the usual.

******************************************************

Auxiliary file changes for 0.40.21:

   Just the usual.

******************************************************

Auxiliary file changes for 0.40.20:

   new keys
      DESIGNATE_STANDARD_MARKER:m
      DESIGNATE_MINE_MODE:a
      DESIGNATE_TOGGLE_MARKER:M
      BUILDJOB_NOW:n

   changed key
      DESIGNATE_FORTIFY a -> F
Title: Re: DFHack 0.40.23-r1
Post by: mifki on January 07, 2015, 04:23:38 pm
Try deleting hack/libstdc++.6.dylib. That's there to fix a bunch of Lua-related crashes that occur with DF's libstdc++ (in libs/), but I doubt it works on 10.6. I could try adjusting some more GCC build flags, I suppose.

What were the crashes, by the way? I'm doing a lot of Lua coding recently and never seen any crashes (well, except for the ones I believe caused by C++ part of my code).
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 04:27:25 pm
I posted one up earlier.

Also, 40.23 apparently has literally NO raws for domestic creatures.  I've looked and looked and I cannot find any creature_domestic.txt in it.  I haven't touched the raws in 40.23 yet, so I have no idea where this oversight came from.
Title: Re: DFHack 0.40.23-r1
Post by: fricy on January 07, 2015, 04:27:54 pm
Try deleting hack/libstdc++.6.dylib. That's there to fix a bunch of Lua-related crashes that occur with DF's libstdc++ (in libs/), but I doubt it works on 10.6. I could try adjusting some more GCC build flags, I suppose.

What were the crashes, by the way? I'm doing a lot of Lua coding recently and never seen any crashes (well, except for the ones I believe caused by C++ part of my code).
Lua error messages crash the game.

https://github.com/DFHack/dfhack/issues/437
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 04:30:07 pm
Will it be safe to just copy and paste my domestic creature raws from 40.19 into 40.23?  If not, I honestly don't know what I'm going to do. 
Title: Re: DFHack 0.40.23-r1
Post by: fricy on January 07, 2015, 04:33:49 pm
Will it be safe to just copy and paste my domestic creature raws from 40.19 into 40.23?  If not, I honestly don't know what I'm going to do.
Yeah, sure, .19 and .23 is almost identical.
Title: Re: DFHack 0.40.23-r1
Post by: mifki on January 07, 2015, 04:36:13 pm
Try deleting hack/libstdc++.6.dylib. That's there to fix a bunch of Lua-related crashes that occur with DF's libstdc++ (in libs/), but I doubt it works on 10.6. I could try adjusting some more GCC build flags, I suppose.

What were the crashes, by the way? I'm doing a lot of Lua coding recently and never seen any crashes (well, except for the ones I believe caused by C++ part of my code).
Lua error messages crash the game.

https://github.com/DFHack/dfhack/issues/437

Oh so it's not something you can do from Lua code. Thanks.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 07, 2015, 04:38:14 pm
Try deleting hack/libstdc++.6.dylib. That's there to fix a bunch of Lua-related crashes that occur with DF's libstdc++ (in libs/), but I doubt it works on 10.6. I could try adjusting some more GCC build flags, I suppose.

What were the crashes, by the way? I'm doing a lot of Lua coding recently and never seen any crashes (well, except for the ones I believe caused by C++ part of my code).
Lua error messages crash the game.

https://github.com/DFHack/dfhack/issues/437
More specifically, Lua errors triggered from C++ would crash (and only in some cases).

Oh so it's not something you can do from Lua code. Thanks.
That depends on what you mean - something as simple as "dfhack.gui.showAnnouncement()" crashed reliably.
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 04:41:27 pm
When I try to gen a new world, this white rectangle appears on screen and it covers over whatever else is on the screen in that area, and the game straight-up freezes. 

I think I might just give up and download the MacNewbie Pack.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 07, 2015, 04:46:15 pm
That sounds like a DF error message (the white box should be a dialog, but there seems to be a problem creating them occasionally). Is there anything in errorlog.txt?
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 04:48:48 pm
*** Error(s) found in the file "data/save/region4/raw/objects/creature_standard.txt"
AQUILOUP:Unrecognized Creature Caste Body Gloss Token: TALON
AQUILOUP:Attack SCRATCH seems to have correct format but could not find proper BPs in any caste, so not added
*** Error(s) found in the file "data/save/region4/raw/objects/creature_tropical_new.txt"
BONGO:Attack HGORE seems to have correct format but could not find proper BPs in any caste, so not added
BONGO:Unrecognized Creature Token: [SET_TL_GROUP
BONGO Color Mod Ending With (STRIPES_CHESTNUT_WHITE,1) Was Not Used


Both are modded creatures.  The aquiloup, at least, worked just fine in 40.19, so I don't know what changed.  I'll try deleting that world and see if it helps.

EDIT: It said region4, but getting rid of that world didn't help a whit.
Title: Re: DFHack 0.40.23-r1
Post by: fricy on January 07, 2015, 04:50:28 pm
When I try to gen a new world, this white rectangle appears on screen and it covers over whatever else is on the screen in that area, and the game straight-up freezes. 
That happens when you used modded raws with the saves and not everything is in the right place.

edit: yeah, modded save
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 07, 2015, 04:54:38 pm
I haven't touched the raws for 40.23 yet, though.  Why would it affect genning new worlds?

The raws for the creatures are as follows:

Code: [Select]
[CREATURE:AQUILOUP]
[DESCRIPTION:A wolf-like creature with an eagle's broad wings and razor-sharp talons instead of paws.  It can be seen flying high above the virtuous temperate lands.]
[NAME:aquiloup:aquiloups:aquiloup]
[CASTE_NAME:aquiloup:aquiloups:aquiloups]
[CHILD:2][GENERAL_CHILD_NAME:aquiloup pup:aquiloup pups]
[CREATURE_TILE:'A'][COLOR:6:0:0]
[LARGE_PREDATOR]
[LARGE_ROAMING][FREQUENCY:50]
[BIOME:TUNDRA]
[BIOME:FOREST_TAIGA]
[BIOME:ANY_TEMPERATE_FOREST]
[BIOME:SHRUBLAND_TEMPERATE]
[BIOME:MOUNTAIN]
[POPULATION_NUMBER:15:30]
[CLUSTER_NUMBER:3:7]
[GRASSTRAMPLE:0][NATURAL]
[PETVALUE:1000]
[PET_EXOTIC]
[TRAINABLE]
[GOOD]
[FLIER]
[GRASSTRAMPLE:0]
[MOUNT_EXOTIC]
[FANCIFUL]
[BONECARN]
[PREFSTRING:elaborate courtship flights]
[PREFSTRING:noble features]
[PREFSTRING:devoted parenting]
[BODY:QUADRUPED_NECK:2WINGS:TAIL:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:THROAT:NECK:SPINE:BRAIN:SKULL:4TOES_FQ_REG:4TOES_RQ_REG:MOUTH:TONGUE:GENERIC_TEETH_WITH_LARGE_EYE_TEETH:RIBCAGE]
[BODYGLOSS:TALON]
[BODY_DETAIL_PLAN:STANDARD_MATERIALS]
[BODY_DETAIL_PLAN:STANDARD_TISSUES]
[SELECT_TISSUE:HAIR]
[INSULATION:200]
[BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
[BODY_DETAIL_PLAN:BODY_HAIR_TISSUE_LAYERS:HAIR]
[USE_MATERIAL_TEMPLATE:FEATHER_FEATHER_TEMPLATE]
[USE_TISSUE_TEMPLATE:FEATHER:FEATHER_TEMPLATE]
[TISSUE_LAYER:BY_CATEGORY:WING]
[USE_MATERIAL_TEMPLATE:TALON:NAIL_TEMPLATE]
[USE_TISSUE_TEMPLATE:TALON:NAIL_TEMPLATE]
[TISSUE_LAYER:BY_CATEGORY:TOE:TALON:FRONT]
[SELECT_TISSUE_LAYER:HEART:BY_CATEGORY:HEART]
[PLUS_TISSUE_LAYER:SKIN:BY_CATEGORY:THROAT]
[TL_MAJOR_ARTERIES]
[BODY_DETAIL_PLAN:STANDARD_HEAD_POSITIONS]
[BODY_DETAIL_PLAN:HUMANOID_RIBCAGE_POSITIONS]
[USE_MATERIAL_TEMPLATE:SINEW:SINEW_TEMPLATE]
[TENDONS:LOCAL_CREATURE_MAT:SINEW:200]
[LIGAMENTS:LOCAL_CREATURE_MAT:SINEW:200]
[HAS_NERVES]
[USE_MATERIAL_TEMPLATE:BLOOD:BLOOD_TEMPLATE]
[BLOOD:LOCAL_CREATURE_MAT:BLOOD:LIQUID]
[CREATURE_CLASS:GENERAL_POISON]
[GETS_WOUND_INFECTIONS]
[GETS_INFECTIONS_FROM_ROT]
[USE_MATERIAL_TEMPLATE:PUS:PUS_TEMPLATE]
[PUS:LOCAL_CREATURE_MAT:PUS:LIQUID]
[BODY_SIZE:0:0:20000]
[BODY_SIZE:1:0:100000]
[BODY_SIZE:2:0:200000]
[BODY_APPEARANCE_MODIFIER:LENGTH:90:95:98:100:102:105:110]
[BODY_APPEARANCE_MODIFIER:HEIGHT:90:95:98:100:102:105:110]
[BODY_APPEARANCE_MODIFIER:BROADNESS:90:95:98:100:102:105:110]
[MAXAGE:20:40]
[ATTACK:BITE:CHILD_BODYPART_GROUP:BY_CATEGORY:HEAD:BY_CATEGORY:TOOTH]
[ATTACK_SKILL:BITE]
[ATTACK_VERB:bite:bites]
[ATTACK_CONTACT_PERC:100]
[ATTACK_PENETRATION_PERC:100]
[ATTACK_FLAG_EDGE]
[ATTACK_PREPARE_AND_RECOVER:3:3]
[ATTACK_PRIORITY:MAIN]
[ATTACK_FLAG_CANLATCH]
[ATTACK:SCRATCH:CHILD_TISSUE_LAYER_GROUP:BY_TYPE:STANCE:BY_CATEGORY:ALL:NAIL]
[ATTACK_SKILL:GRASP_STRIKE]
[ATTACK_VERB:claw:claws]
[ATTACK_CONTACT_PERC:100]
[ATTACK_PENETRATION_PERC:100]
[ATTACK_FLAG_EDGE]
[ATTACK_PREPARE_AND_RECOVER:3:3]
[ATTACK_PRIORITY:SECOND]
[DIURNAL]
[HOMEOTHERM:10070]
[APPLY_CREATURE_VARIATION:STANDARD_QUADRUPED_GAITS:900:447:298:149:1900:2900] 59 kph
[APPLY_CREATURE_VARIATION:STANDARD_SWIMMING_GAITS:6561:6115:5683:1755:7456:8567] 5 kph
[APPLY_CREATURE_VARIATION:STANDARD_CRAWLING_GAITS:6561:6115:5683:1755:7456:8567] 5 kph
[SWIMS_INNATE]
[MUNDANE]
[CASTE:FEMALE]
[FEMALE]
[CASTE:MALE]
[MALE]
[SET_BP_GROUP:BY_TYPE:LOWERBODY][BP_ADD_TYPE:GELDABLE]
[SELECT_CASTE:ALL]
[SET_TL_GROUP:BY_CATEGORY:ALL:HAIR]
[TL_COLOR_MODIFIER:WHITE:1:SILVER:1:PEARL:1]
[TLCM_NOUN:hair and feathers:PLURAL]
[SET_TL_GROUP:BY_CATEGORY:ALL:SKIN]
[TL_COLOR_MODIFIER:BROWN:1:BURNT_UMBER:1:CINNAMON:1:COPPER:1:DARK_BROWN:1:DARK_PEACH:1:DARK_TAN:1:ECRU:1:PALE_BROWN:1:PALE_CHESTNUT:1:PALE_PINK:1:PEACH:1:PINK:1:RAW_UMBER:1:SEPIA:1:TAN:1:TAUPE_PALE:1:TAUPE_SANDY:1]
[TLCM_NOUN:skin:SINGULAR]
[SET_TL_GROUP:BY_CATEGORY:EYE:EYE]
[TL_COLOR_MODIFIER:IRIS_EYE_AMBER:1:ORANGE:1:GOLD:1]
[TLCM_NOUN:eyes:PLURAL]
[SELECT_MATERIAL:ALL]
[MULTIPLY_VALUE:4]

and

Code: [Select]
[CREATURE:BONGO]
[DESCRIPTION: A large, heavy-bodied antelope with large, curving horns and striking white markings.]
[NAME:bongo:bongos:bongo]
[CASTE_NAME:bongo:bongos:bongo]
[CHILD:1][GENERAL_CHILD_NAME:bongo calf:bongo calves]
[CREATURE_TILE:'B'][COLOR:7:0:1]
[PETVALUE:50]
[PET_EXOTIC]
[MOUNT_EXOTIC]
[STANDARD_GRAZER]
[VISION_ARC:50:310]
[PREFSTRING:attractive markings]
[PREFSTRING:graceful horns]
[GRASSTRAMPLE:0]
[LARGE_ROAMING]
[POPULATION_NUMBER:15:30]
[CLUSTER_NUMBER:4:8]
[BIOME:SHRUBLAND_TROPICAL]
[BIOME:FOREST_TROPICAL_MOIST_BROADLEAF]
[BENIGN][MEANDERER][NATURAL]
[BODY:QUADRUPED_NECK_HOOF:TAIL:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:THROAT:NECK:SPINE:BRAIN:SKULL:MOUTH:GENERIC_TEETH:RIBCAGE]
[BODY_DETAIL_PLAN:STANDARD_MATERIALS]
[USE_MATERIAL_TEMPLATE:HOOF:HOOF_TEMPLATE]
[BODY_DETAIL_PLAN:STANDARD_TISSUES]
[USE_TISSUE_TEMPLATE:HOOF:HOOF_TEMPLATE]
[BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
[BODY_DETAIL_PLAN:BODY_HAIR_TISSUE_LAYERS:HAIR]
[SELECT_TISSUE_LAYER:HEART:BY_CATEGORY:HEART]
[PLUS_TISSUE_LAYER:SKIN:BY_CATEGORY:THROAT]
[TL_MAJOR_ARTERIES]
[BODY_DETAIL_PLAN:STANDARD_HEAD_POSITIONS]
[BODY_DETAIL_PLAN:HUMANOID_RIBCAGE_POSITIONS]
[USE_MATERIAL_TEMPLATE:SINEW:SINEW_TEMPLATE]
[TENDONS:LOCAL_CREATURE_MAT:SINEW:200]
[LIGAMENTS:LOCAL_CREATURE_MAT:SINEW:200]
[HAS_NERVES]
[USE_MATERIAL_TEMPLATE:BLOOD:BLOOD_TEMPLATE]
[BLOOD:LOCAL_CREATURE_MAT:BLOOD:LIQUID]
[CREATURE_CLASS:GENERAL_POISON]
[GETS_WOUND_INFECTIONS]
[GETS_INFECTIONS_FROM_ROT]
[USE_MATERIAL_TEMPLATE:PUS:PUS_TEMPLATE]
[PUS:LOCAL_CREATURE_MAT:PUS:LIQUID]
[BODY_APPEARANCE_MODIFIER:LENGTH:90:95:98:100:102:105:110]
[BODY_APPEARANCE_MODIFIER:HEIGHT:90:95:98:100:102:105:110]
[BODY_APPEARANCE_MODIFIER:BROADNESS:90:95:98:100:102:105:110]
[MAXAGE:10:20]
[ATTACK:KICK:BODYPART:BY_CATEGORY:HOOF_FRONT]
[ATTACK_SKILL:STANCE_STRIKE]
[ATTACK_VERB:kick:kicks]
[ATTACK_CONTACT_PERC:100]
[ATTACK_PREPARE_AND_RECOVER:4:4]
[ATTACK_PRIORITY:MAIN]
[ATTACK_FLAG_WITH]
[ATTACK_FLAG_BAD_MULTIATTACK]
[ATTACK:KICK:BODYPART:BY_CATEGORY:HOOF_REAR]
[ATTACK_SKILL:STANCE_STRIKE]
[ATTACK_VERB:kick:kicks]
[ATTACK_CONTACT_PERC:100]
[ATTACK_PREPARE_AND_RECOVER:4:4]
[ATTACK_PRIORITY:MAIN]
[ATTACK_FLAG_WITH]
[ATTACK_FLAG_BAD_MULTIATTACK]
[ATTACK:BITE:CHILD_BODYPART_GROUP:BY_CATEGORY:HEAD:BY_CATEGORY:TOOTH]
[ATTACK_SKILL:BITE]
[ATTACK_VERB:bite:bites]
[ATTACK_CONTACT_PERC:100]
[ATTACK_PENETRATION_PERC:100]
[ATTACK_FLAG_EDGE]
[ATTACK_PREPARE_AND_RECOVER:3:3]
[ATTACK_PRIORITY:SECOND]
[ATTACK_FLAG_CANLATCH][ATTACK:HGORE:BODYPART:BY_CATEGORY:HORN]
[ATTACK_SKILL:BITE]
[ATTACK_VERB:gore:gores]
[ATTACK_CONTACT_PERC:100]
[ATTACK_PREPARE_AND_RECOVER:3:3]
[ATTACK_FLAG_WITH]
[ATTACK_PRIORITY:MAIN]
[CREPUSCULAR]
[HOMEOTHERM:10067]
[APPLY_CREATURE_VARIATION:STANDARD_QUADRUPED_GAITS:900:438:292:146:1900:2900] 60 kph
[APPLY_CREATURE_VARIATION:STANDARD_SWIMMING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph, NO DATA
[APPLY_CREATURE_VARIATION:STANDARD_CRAWLING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph, NO DATA
[SWIMS_INNATE]
[MUNDANE]
[CASTE:FEMALE]
[FEMALE]
[MULTIPLE_LITTER_RARE]
[BODY_SIZE:0:0:19000]
[BODY_SIZE:1:0:75000]
[BODY_SIZE:2:0:220000]
[CASTE:MALE]
[MALE]
[BODY_SIZE:0:0:19000]
[BODY_SIZE:1:0:100000]
[BODY_SIZE:2:0:300000]
[SET_BP_GROUP:BY_TYPE:LOWERBODY][BP_ADD_TYPE:GELDABLE]
[SELECT_CASTE:ALL]
[[SET_TL_GROUP:BY_CATEGORY:ALL:HAIR]
[TL_COLOR_MODIFIER:CHESTNUT:1]
[TLCM_NOUN:hair:SINGULAR]
[SET_TL_GROUP:BY_CATEGORY:ALL:SKIN]
[TL_COLOR_MODIFIER:BROWN:1:BURNT_UMBER:1:CINNAMON:1:COPPER:1:DARK_BROWN:1:DARK_PEACH:1:DARK_TAN:1:ECRU:1:PALE_BROWN:1:PALE_CHESTNUT:1:PALE_PINK:1:PEACH:1:PINK:1:RAW_UMBER:1:SEPIA:1:TAN:1:TAUPE_PALE:1:TAUPE_SANDY:1]
[TLCM_NOUN:skin:SINGULAR]
[SET_TL_GROUP:BY_CATEGORY:EYE:EYE]
[TL_COLOR_MODIFIER:IRIS_EYE_BROWN:1]
[TLCM_NOUN:eyes:PLURAL]
[SELECT_MATERIAL:ALL]
[MULTIPLY_VALUE:3]

Do you have any idea what's wrong?

Title: Re: DFHack 0.40.23-r1
Post by: cdombroski on January 07, 2015, 09:44:44 pm
The line after [SELECT_CASTE:ALL] for the bongos has an extra '[' at the beginning. That's probably why the attack is failing to load as well because the format error is probably causing the definition for bongos to continue into the next creature.

The aquiloup is a bit trickier for me, apparently TALON is not a valid bodygloss (anymore?) but I don't know which ones are valid. The scratch attack is apparently referencing non-existent NAIL body parts at the end of feet.

No clue why you're getting errors during world gen if you haven't touched the default raws.
Title: Re: DFHack 0.40.23-r1
Post by: Raidau on January 07, 2015, 11:57:10 pm
Question for dfhack devs. In the new version df.global.ui_sidebar_menus.workshop_job table contains broken objects - fields of interface_button_building_new_jobst are filled with inappropriate numbers and often cause crashes when i try to browse it with gm-editor.

Is that dfhack of DF bug? Is there way to read the proper data? One of my scripts doesnt work anymore in 40.23 because of that.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 08, 2015, 11:01:51 am
It's most likely a result of some structure that changed in 0.40.20 (in other words, a DFHack/df-structures problem).
Title: Re: DFHack 0.40.23-r1
Post by: Raidau on January 08, 2015, 12:47:37 pm
It's most likely a result of some structure that changed in 0.40.20 (in other words, a DFHack/df-structures problem).

Looking forward for someone to fix this :)
Title: Re: DFHack 0.40.23-r1
Post by: Roses on January 08, 2015, 02:18:52 pm
So I am looking through all the different structures in dfhack, what should I do if I find something that isn't labeled and know what it is?

For example;
df.global.world.entities.all.site_links.anon_1 -> anon_1 = site_id
df.global.world.entities.all.site_links.anon_2 -> anon_2 = civ_id

Also, does anyone know where wealth information is stored? Looking for the import/export numbers for the current fortress.

EDIT: Nevermind, found it!
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 08, 2015, 03:32:34 pm
Change the lines in df-structures corresponding to them (here (https://github.com/DFHack/df-structures/blob/master/df.refs.xml#L518)) and submit a pull request. If you have a build environment set up, it would be easier to test, but it's not required.
* Edit the files in library/xml
* Rebuild DFHack (this should only involve rebuilding about 6 core files and any plugins that include "df/entity_site_link.h") and test your changes
* Commit and push to your df-structures fork (fork from DFHack/df-structures (https://github.com/DFHack/df-structures), not angavrilov/df-structures):
Code: [Select]
cd library/xml
git checkout -b <descriptive branch name>
git add df.refs.xml
git commit -m 'Identify entity_site_link.civ_id, etc.'
git remote add <username (or another descriptive remote name)> https://github.com/<username>/df-structures # if you haven't already
git push <username (or remote name)> <branch name>
* Make a pull request

Alternatively, you can do this through the Github web interface, but it's a good idea to actually test your changes. A common mistake is forgetting to self-close tags (i.e. use <int32_t name='foo'/>, not <int32_t name='foo'>).
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 08, 2015, 04:04:20 pm
(Ignore)
Title: Re: DFHack 0.40.23-r1
Post by: Meph on January 09, 2015, 09:36:01 am
Does this dfhack version include something that allows custom gloves to get a left/right assigned?

I still have an old script by Kurik Amudnil called AutoFixHandedness.rb in Masterwork, I'm not sure if I still need it.
Title: Re: DFHack 0.40.23-r1
Post by: milo christiansen on January 09, 2015, 01:13:44 pm
Yes, it is still needed.
(I have a Lua version in Rubble if you would rather have it in a language that can be used by humans)
Title: Re: DFHack 0.40.23-r1
Post by: Snergler on January 09, 2015, 02:20:28 pm
startdwarf is not working for me, anybody else having this? I have some basic objects.txt edits, but in dfhack0.40.19 it worked fine,
however there were times this happened before, and then fixed itself in the next release.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 09, 2015, 05:27:59 pm
startdwarf is not working for me, anybody else having this? I have some basic objects.txt edits, but in dfhack0.40.19 it worked fine,
however there were times this happened before, and then fixed itself in the next release.
Right. start_dwarf_count has to be located in symbols.xml, and nobody did that for this release. There were a couple releases in the past where this was also the case. I'll try to make sure it's located in the next version (which'll probably be 0.40.24).
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 09, 2015, 08:37:51 pm
Whenever I gen a world in advanced worldgen, the whole spiel about seedwatch shows up, as follows:

Code: [Select]
The plugin is disabled.
Autonestbox stopped.
Watches the numbers of seeds available and enables/disables seed and plant cooking.
Each plant type can be assigned a limit. If their number falls below,
the plants and seeds of that type will be excluded from cookery.
If the number rises above the limit + 20, then cooking will be allowed.
The plugin needs a fortress to be loaded and will deactivate automatically otherwise.
You have to reactivate with 'seedwatch start' after you load the game.
Options:
seedwatch all   - Adds all plants from the abbreviation list to the watch list.
seedwatch start - Start watching.
seedwatch stop  - Stop watching.
seedwatch info  - Display whether seedwatch is watching, and the watch list.
seedwatch clear - Clears the watch list.

You can use these abbreviations for the plant tokens:
bs -> SLIVER_BARB
bt -> TUBER_BLOATED
bw -> WEED_BLADE
cw -> GRASS_WHEAT_CAVE
dc -> MUSHROOM_CUP_DIMPLE
fb -> BERRIES_FISHER
hr -> ROOT_HIDE
kb -> BULB_KOBOLD
lg -> GRASS_LONGLAND
mr -> ROOT_MUCK
pb -> BERRIES_PRICKLE
ph -> MUSHROOM_HELMET_PLUMP
pt -> GRASS_TAIL_PIG
qb -> BUSH_QUARRY
rr -> REED_ROPE
rw -> WEED_RAT
sb -> BERRY_SUN
sp -> POD_SWEET
vh -> HERB_VALLEY
ws -> BERRIES_STRAW_WILD
wv -> VINE_WHIP
Examples:
seedwatch MUSHROOM_HELMET_PLUMP 30
  add MUSHROOM_HELMET_PLUMP to the watch list, limit = 30
seedwatch MUSHROOM_HELMET_PLUMP
  removes MUSHROOM_HELMET_PLUMP from the watch list.
seedwatch ph 30
  is the same as 'seedwatch MUSHROOM_HELMET_PLUMP 30'
seedwatch all 30
  adds all plants from the abbreviation list to the watch list, the limit being 30.
Loading script at PyLNP_dfhack_onLoad.init
Enabling the plugin.
The plugin is enabled.
Option drybuckets is enabled.
Option auto-melt is enabled.
Fixed feeding timers for 0 citizens.
unstuck 0 doors
[DFHack]#

Over and over and over again.  I have no idea when or how this started, and I regret ever going to 40.23.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 09, 2015, 10:37:59 pm
Seedwatch displays usage information like that if you invoke it in an invalid state (e.g. when a world is not loaded). Chances are a line in at least one of your .init files in your DF folder is causing this, so take a look at them and remove any "seedwatch ..." commands. Alternatively, you can move hack/plugins/seedwatch.plug.dylib out of the hack/plugins folder, but you'll just get "command not found" errors instead.
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 10, 2015, 03:24:52 pm
I got so frustrated with 40.23 and all its bugs that I deleted it and installed 40.24, hoping for a less frustrating esperience.

Well, the white rectangle of death came up again.

Except this time, it was on completely unmodded raws, with no DFHack.  The only thing different from just-downloaded was that I installed Phoebus graphics, just as before, using the OSX directions.  I have no clue at all what could be going on - I've got a bug report up on Mantis, because nothing on there was helpful.  The gamelog says literally nothing about it.

Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 10, 2015, 04:01:39 pm
Why are you reporting a crash here when you're not using DFHack? A white box (which should be a readable error message) is almost certainly a raw problem, if DF starts up normally, so that should be reported in the thread of the graphics pack you're using. Also, what bugs are you referring to? I haven't noticed an unusual number of new bugs in 0.40.23, unless you're referring to the DFHack libstdc++ problem.
Title: Re: DFHack 0.40.23-r1
Post by: ptb_ptb on January 10, 2015, 04:51:00 pm
I've been playing around with 'natural population growth' and the necessary relationship building. It's my understanding that dwarves have 'orientation' numbers that are checked to see if they can form heterosexual romantic attachments and if they can potentially commit to marriage.

Is there a script floating around that could check that for a selected dwarf?

Rose's GUI - Unit Viewer was the closest thing I could find, although it appears to be part of an overall mod and frankly I'm not up to tweaking it myself.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 10, 2015, 05:07:11 pm
Try "gaydar".
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 10, 2015, 05:25:09 pm
Why are you reporting a crash here when you're not using DFHack? A white box (which should be a readable error message) is almost certainly a raw problem, if DF starts up normally, so that should be reported in the thread of the graphics pack you're using. Also, what bugs are you referring to? I haven't noticed an unusual number of new bugs in 0.40.23, unless you're referring to the DFHack libstdc++ problem.
Phoebus doesn't do OSX releases (he doesn't have the OS, I presume) so he wasn't able to do anything about it when I did report to him.  I've noticed the complete absence of shellfish and vermin despite there being nothing wrong with their raws, crashing upon generating coin information, and this issue, and those are just the ones I can remember right now.

Tell me more about the libstdc++ problem.  I have that file in my DF libs, and when I open it I get:


Last login: Sat Jan 10 17:26:05 on ttys000
/Applications/df_osx/libs/libstdc++.6.dylib ; exit;
computer:~ emans002$ /Applications/df_osx/libs/libstdc++.6.dylib ; exit;
-bash: /Applications/df_osx/libs/libstdc++.6.dylib: cannot execute binary file
logout

[Process completed]

EDIT: Turns out it was my raws.  Now I just need to figure out why on God's green earth I get stuff from my modded raws floating around in decidedly unmodded downloading instances.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 10, 2015, 06:17:04 pm
Installing a graphics set does modify the raws, at least with Phoebus (assuming you install it correctly).

Tell me more about the libstdc++ problem.  I have that file in my DF libs, and when I open it I get:


Last login: Sat Jan 10 17:26:05 on ttys000
/Applications/df_osx/libs/libstdc++.6.dylib ; exit;
computer:~ emans002$ /Applications/df_osx/libs/libstdc++.6.dylib ; exit;
-bash: /Applications/df_osx/libs/libstdc++.6.dylib: cannot execute binary file
logout

[Process completed]
Er, libstdc++ is a library, meaning that it's used by other programs (DF in this case) but does effectively nothing on its own. In fact, it's not even a valid executable. The libstdc++ in the DF/hack folder takes priority, but apparently isn't compatible with 10.6, so deleting it causes DF to use the older one (with the same name) in DF/libs.
Title: Re: DFHack 0.40.23-r1
Post by: Pyrite on January 10, 2015, 08:18:38 pm
Any estimates of when dfhack will become available for 40.24?
Title: Re: DFHack 0.40.23-r1
Post by: ptb_ptb on January 11, 2015, 06:30:35 am
Try "gaydar".

Gaydar worked out wonderfully.  However I found an unexpected side effect of using the exile script (https://gist.github.com/IndigoFenix/8543616) by IndigoFenix. If you exile your expedition leader, the game won't appoint a new one. I think I killed the noble system entirely. :P 

I'll probably just continue 'as is' rather than start over.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 11, 2015, 06:39:59 am
You could always have just modified the orientation, you know.
Title: Re: DFHack 0.40.23-r1
Post by: ptb_ptb on January 11, 2015, 06:56:04 am
You could always have just modified the orientation, you know.

No gay 'cure' for me! :D
Title: Re: DFHack 0.40.23-r1
Post by: Oriolous on January 11, 2015, 06:00:39 pm
I need to convert some stairs into open space, but I can't TARGET the stairs. They're Up/Down stairs. How do I actually target them with tiletypes?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 11, 2015, 06:14:16 pm
Don't use a filter at all (and use a one-tile brush):
Code: [Select]
[DFHack]# tiletypes
tiletypes> paint sh EMPTY
tiletypes> paint mat AIR
tiletypes>
Alternatively, "filter sh STAIR_UPDOWN" should apply to select up/down stairs, allowing you to use a larger brush.
Title: Re: DFHack 0.40.23-r1
Post by: DoX on January 11, 2015, 07:13:52 pm
H'lo everyone. I just had some quick questions about the spawnunit hack, as I'm working in a region that, for some reason, can get caravans but not migrants.

1. Is it possible to give a unit spawned two names, like a normal civ member? I try to space them out, and get an error. Can someone give me an example of an input with two names?

2. What are the number values for certain castes? 0 seems to be no cast, peasant.

3. Can you spawn units with certain skills?
Title: Re: DFHack 0.40.23-r1
Post by: Meph on January 11, 2015, 07:21:50 pm
You are asking the wrong questions. First of all this is the new dfhack for 40x, but you are playing Masterwork on 34.11.

Secondly, the script that does the sieges, caravans and migrants is called Force Event, and is done by Putnam. Not spawnunit from Warmist.

You can give spawned units two names, I think it works with "". [SYN_CLASS:"name] [SYN_CLASS:secondname"], but I might be mistaken.

0 is the first caste in the raws. Peasant is a caste. You go through the creature_standard.txt (for dwarves) and count the amounts of CASTE: till you get the one you want. Masterwork has about 50 or so.

No. But you can add skills with other scripts, like make_legendary

Hope that helps.
Title: Re: DFHack 0.40.23-r1
Post by: DoX on January 11, 2015, 07:27:37 pm
Sheesh Meph, helping me all over the place XD Yes, that helps a lot. Thanks.

Edit: Quotes work! Two names are a go.
Title: Re: DFHack 0.40.23-r1
Post by: Meph on January 11, 2015, 07:37:18 pm
Sheesh Meph, helping me all over the place XD Yes, that helps a lot. Thanks.

Edit: Quotes work! Two names are a go.
There you go. :) All solved?
Title: Re: DFHack 0.40.23-r1
Post by: caekdaemon on January 11, 2015, 07:38:14 pm
So I've been trying to get two dwarves to marry via dfhack because they're taking too long, and I found a script to do so here (https://github.com/EldrickWT/My-Crazy-Dwarf-Fortress-Mods/blob/master/dfhack.40.06/scripts/marry.lua), which does exactly what I want to do. But there's a slight snag.

It keeps asking for a unit ID, and I have absolutely no idea what that is, and extensive googling has led me nowhere. I had a feeling it might have been the unit name (nada), the unit nickname (nope), the unit's memory address via dwarf therapist (again, nope), but nothing I've tried has worked.

Anyone know what a unit ID is? :p It's probably something extremely obvious that I'm missing out on, but I don't even know where to start on finding that thing.

EDIT : Tried using the names inside quotes, that didn't work either :(
Title: Re: DFHack 0.40.23-r1
Post by: DoX on January 11, 2015, 07:50:42 pm
Sheesh Meph, helping me all over the place XD Yes, that helps a lot. Thanks.

Edit: Quotes work! Two names are a go.
There you go. :) All solved?

All solved :D
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 11, 2015, 07:55:21 pm
So I've been trying to get two dwarves to marry via dfhack because they're taking too long, and I found a script to do so here (https://github.com/EldrickWT/My-Crazy-Dwarf-Fortress-Mods/blob/master/dfhack.40.06/scripts/marry.lua), which does exactly what I want to do. But there's a slight snag.

It keeps asking for a unit ID, and I have absolutely no idea what that is, and extensive googling has led me nowhere. I had a feeling it might have been the unit name (nada), the unit nickname (nope), the unit's memory address via dwarf therapist (again, nope), but nothing I've tried has worked.

Anyone know what a unit ID is? :p It's probably something extremely obvious that I'm missing out on, but I don't even know where to start on finding that thing.

EDIT : Tried using the names inside quotes, that didn't work either :(

Unit ID is not a name. It's unit.id in the structure. "teleport -showunitid" will show you the unit's Id.

Also, the way that scripts gets units from IDs is... awful. I mean, not as bad as my first tries, but still, awful. df.unit.find, come on :P
Title: Re: DFHack 0.40.23-r1
Post by: Max™ on January 11, 2015, 07:55:41 pm
Hmmm, you should be able to see it with gm-editor, just be wary of changing things in there.

Pardon the wonky 0's, twbt keeps giving me segfaults* but yeah, one of these for the unit in question should be what you're after:
(http://i.imgur.com/fqHElkn.png)

*Without twbt it works fine, when I turn it on (df 40.23, current dfhack, twbt 5.40, arch linux) I get this:
Code: [Select]
./dfhack: line 43:  9279 Segmentation fault      (core dumped) setarch i386 -R env LD_PRELOAD=$PRELOAD_LIB ./libs/Dwarf_Fortress "$@"
I knew what to do with that at one point, but things have been working smooth ever since so I'm tarding out on how to make it stop doing that.
Title: Re: DFHack 0.40.23-r1
Post by: caekdaemon on January 11, 2015, 08:07:02 pm
Unit ID is a name. It's unit.id in the structure. "teleport -showunitid" will show you the unit's Id.

Also, the way that scripts gets units from IDs is... awful. I mean, not as bad as my first tries, but still, awful. df.unit.find, come on :P
Tried that, but wierdly enough teleport gave me errors :o Dunno why, I was probably doing it wrong somehow, but...
Hmmm, you should be able to see it with gm-editor, just be wary of changing things in there.
This worked perfectly! :D

They're now a happy and loving couple!

EDIT : Hang on a second...I've got a bad feeling about this. It says on both of them that they are married to their spouse and shows that on the relationship screen, but they also say they are romantically involved with them.

Oh dear, I've probably just corrupted my save haven't I?

Double EDIT : Okay, just loaded and tested, game save still loads. Guess I have to chalk that one up as an oddity :p
Title: Re: DFHack 0.40.23-r1
Post by: Oriolous on January 11, 2015, 09:03:46 pm
I don't have the means to get metal bars for a mooded dwarf, so I have createitem set to put items on the floor via createitem floor. Then when I run the actual createitem to spawn in the bars, it refuses to work saying "No unit selected" what do I do?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 11, 2015, 09:05:48 pm
I don't have the means to get metal bars for a mooded dwarf, so I have createitem set to put items on the floor via createitem floor. Then when I run the actual createitem to spawn in the bars, it refuses to work saying "No unit selected" what do I do?
Select a unit (then run createitem).
Title: Re: DFHack 0.40.23-r1
Post by: Max™ on January 11, 2015, 09:45:06 pm
Doesn't it default to floor anyways?

I know createitem TYPE:ITEM_TYPE_SPECIFIC_NAME MATERIAL with a unit selected puts it at their feet.

Incidentally, while metals and stones are straightforward (createitem WEAPON:ITEM_WEAPON_SWORD_2H STEEL, createitem TABLE OBSIDIAN) other materials can be confusing as hell. I had some weird results trying to make spears for a shaft of enlightenment once before I figured it out (createitem WEAPON:ITEM_WEAPON_SPEAR_TRAINING PLANT:FEATHER:WOOD, not PLANT:FEATHER_WOOD, which gives you "feather wood plant training spear" apparently), oh and while trying to dress up an outsider adventurer to go chuck elves out of trees I worked out that createitem ARMOR:ITEM_ARMOR_ARMOR_LEATHER ELF:LEATHER does exactly what it says on the tin, which is neat.

Though a lot of that isn't necessary since hack-wish is working properly with the last several versions, which is nice in case you were wanting to say, finish an outfit of undulating cloth stuff you got in a quick raid on a vault, but weren't able to find a hood... because I have no clue how to make the various procedurally generated materials work right with createitem.
Title: Re: DFHack 0.40.23-r1
Post by: cdombroski on January 11, 2015, 11:23:53 pm
I don't have the means to get metal bars for a mooded dwarf, so I have createitem set to put items on the floor via createitem floor. Then when I run the actual createitem to spawn in the bars, it refuses to work saying "No unit selected" what do I do?
There's also a create-items command that handles bars (and a few other things). I find it easier to use for the items it works for.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 11, 2015, 11:38:55 pm
There's also gui/hack-wish which is a GUI that can be used to make any item.
Title: Re: DFHack 0.40.23-r1
Post by: Max™ on January 12, 2015, 04:42:52 am
Yup, and is way easier than memorizing createitem stuff, though once you get used to doing it that way it feels weird scrolling through the hack-wish gui.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 12, 2015, 04:43:17 am
Yup, and is way easier than memorizing createitem stuff, though once you get used to doing it that way it feels weird scrolling through the hack-wish gui.

You can search with hack-wish.
Title: Re: DFHack 0.40.23-r1
Post by: Max™ on January 12, 2015, 11:19:52 pm
True, but there are a lot of less-than-obvious options exposed through the gui, so unless I'm specifically looking for like, a flowing metal spear or something I don't mind paging through.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 12, 2015, 11:48:17 pm
Every item and every material are exposed, so that's kinda all-encompassing, heh.
Title: Re: DFHack 0.40.23-r1
Post by: disacorns on January 13, 2015, 11:27:18 am
a couple of things have been bothering me:

quicksave crashes my game. everything stops. i get large bar (nothing like the seasonal one). sometimes after a minute or so i can press enter or whatever and continue playing (not necessarily having saved). sometimes everything crashes.

therapist crashes df. ive gotten in the habit of saving after every read/update.

shouldnt clean clean ashes as well? (i had a major forest fire)

automelt/autodump tend to get "stuck". i notice after a while nothing happens. i try disabling and reenabling, setting it dump myself, remove the autodump from the stockpile, nothing until i close out the game and restart. (ditto everything with automelt, dont know about autotrade, i use it but its not as common) i think it happens when i save (normally) and continue game.

has anyone found a way for automaterial to remember the selected materials? its annoying to have to reset all the kinds wooden blocks each time i reopen the game.

is there a way to autochop specific types of trees? (a cool though i imagine difficult to implement feature request: autochop the biggest trees. )

---

i dont mean to sound whiny in all of this. dfhack is absolutely awesome. this is the first fort ive used it on. i didnt feel comfortable cheating, and so avoided it in the past, but now im working on an above ground fortress, and the blood, etc everywhere was driving me nuts, and there wasnt anything i could do about it. (just looking at the list in my bathtub made me queasy) so i got dfhack for its cleaning abilities. now i dont think i could play without it. personal favorites are: clean (of course), workflow, autobutcher, automaterial, automelt/dump/trade (basicly anything that helps automate). rename is surprisingly helpful (i just wish it worked on bridges). digv looks awesome, but above-ground fort, have yet to try it.

in short, thank you very very much!

(oh, p.s. people have been claiming cutting down the trees, especially cherry trees, helps with fps. after my major forest fire which burnt down most of my map, and any tree more than two stories, ive noticed absolutely no change in fps.)
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 13, 2015, 02:56:14 pm
Quicksave, at least, has been working for me. What DFHack version and platform are you using?
Title: Re: DFHack 0.40.23-r1
Post by: disacorns on January 14, 2015, 01:42:05 am
sorry should have mentioned that:
ubuntu 14.10
dfhack 0.40.19.r1

would updating help?
Title: Re: DFHack 0.40.23-r1
Post by: Arkangel on January 14, 2015, 07:17:33 am
Seedwatch appears to not be working for a lot of the new plants, specifically the ones without edible seeds, I believe. Has anyone else had this issue?
Title: Re: DFHack 0.40.23-r1
Post by: Naryar on January 14, 2015, 11:54:34 am
has there been an unofficial update for 0.40.24 windows ? there doesn't seem to be a lot of things changed, also i am looking forward to the bugfixing of military.
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 14, 2015, 01:11:11 pm
People are working on it.
Title: Re: DFHack 0.40.23-r1
Post by: Eldin00 on January 14, 2015, 04:26:09 pm
Seedwatch appears to not be working for a lot of the new plants, specifically the ones without edible seeds, I believe. Has anyone else had this issue?

Correct me if I'm wrong, but isn't the main function of seedwatch to toggle cooking of a seed type based on how many of that seed type you have? Doesn't seem like it could reasonably apply to plants which lack edible seeds.
Title: Re: DFHack 0.40.23-r1
Post by: cdombroski on January 14, 2015, 07:30:31 pm
Seedwatch appears to not be working for a lot of the new plants, specifically the ones without edible seeds, I believe. Has anyone else had this issue?

Correct me if I'm wrong, but isn't the main function of seedwatch to toggle cooking of a seed type based on how many of that seed type you have? Doesn't seem like it could reasonably apply to plants which lack edible seeds.

Pretty sure that edible and cookable are separate properties. No idea if there are any cookable, non-edible seeds but it should be possible to have them. Plump helmet seeds are in fact cookable but not edible raw.
Title: Re: DFHack 0.40.23-r1
Post by: Arkangel on January 15, 2015, 02:24:37 am
Seedwatch appears to not be working for a lot of the new plants, specifically the ones without edible seeds, I believe. Has anyone else had this issue?

Correct me if I'm wrong, but isn't the main function of seedwatch to toggle cooking of a seed type based on how many of that seed type you have? Doesn't seem like it could reasonably apply to plants which lack edible seeds.

Seedwatch toggles cooking of the plants AND the seeds, based on number of seeds available. I think that pre-DF2014 there simply weren't any non-cookable seeds in the game, so the issue never came up. But now that there are, the functionality would be very useful. You want to keep a certain amount of seeds (or plants, since they contain seeds) in reserve for planting, but want to cook the rest. This has been somewhat of a cornerstone for my last couple forts, since I'm fighting excessive food production with mass export of prepared meals.
Of course, this behaviour can theoretically result in situations where you have only a few seeds available, but huge amounts of the corresponding plant (I'm looking at you, alfalfa). This is mostly because several of the new plants can't be processed further, only eaten raw, which is enough to generate a few seeds for replanting, but not enough to counter over-production. So, if possible, I'd like to request an additional feature in seedwatch that allows plants to be enabled for cooking if they exceed a certain amount, regardless of seeds available.
Title: Re: DFHack 0.40.23-r1
Post by: Gorobay on January 15, 2015, 03:46:25 pm
I have been investigating the conversation system to try to figure out what the various unknown and anonymous fields mean.

unk_v40_1 of a report is an activity_entry ID, corresponding to df.global.world.activities.all[x].id, and unk_v40_3 is a speaker ID.

An activity_event_conversationst has some anonymous fields. anon_1 is a vector of conversation participants. Each entry contains two fields, anon_1 and anon_2, where anon_1 is a speaker ID and anon_2 is a quasi-speaker ID.

A speaker ID is constant for a given speaker; it does not vary across conversations. I don’t know what the actual number is an index into though. A quasi-speaker ID (for lack of a better name) is the same thing, but usually it is a different number than the speaker ID. They are only equal when the speaker is the player. The quasi-speaker ID is -1 until the player joins in the conversation.

anon_10 and anon_11 seem to be equal to anon_1[1].anon_1 and anon_1[1].anon_2 respectively.

anon_2 and anon_15 go together. They are both integers between -1 and 7, corresponding to different conversation states: -1 = before the conversation starts; 0 = responding to greeting; 1 = main menu; 2 to 4 = spreading rumors; 5 = asking for directions; 6 = responding to a rumor; 7 = goodbye. anon_1 controls the player and anon_15 the NPC.

anon_9 of an activity_event_conversationst is the most interesting. It is a vector of conversation turns. Each turn has 13 anonymous fields. anon_1 is a speaker ID and anon_2 is a quasi-speaker ID. anon_3 is the topic ID, where a topic is something you pick in the conversation menu. anon_4 is a vector of entity_events, which only have interesting information when the utterance is about a historical event or beast. anon_5 stays constant for a given speaker. anon_6, anon_7, and anon_8 are the color in the usual format: foreground, background, brightness. anon_9 seems to always be 5. anon_10 is the number of ticks since adventure mode started. anon_11 and anon_12 seem to encode the contents of the utterance: 4/20 is "It is terrifying", 2/20 is "It is inevitable", etc.

Does anyone have any more information about these fields? Specifically, what are speaker ID and quasi-speaker ID?
Title: Re: DFHack 0.40.23-r1
Post by: Oriolous on January 15, 2015, 03:49:10 pm
What is the code to spawn in cloth? Specifically Cave Spider silk cloth. I need it for a mooded dwarf -3-
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 15, 2015, 03:51:20 pm
What is the code to spawn in cloth? Specifically Cave Spider silk cloth. I need it for a mooded dwarf -3-
I'm not sure what you mean by "code" or "spawn in" - if you're referring to the createitem command, there's a page on the wiki (http://dwarffortresswiki.org/index.php/Utility:DFHack/createitem#Cloth.2Fleather) that gives some examples. (Note that all of them need to be preceded with "createitem ".)
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 15, 2015, 03:54:20 pm
gui/hack-wish would probably be easier.
Title: Re: DFHack 0.40.23-r1
Post by: PhoenixEggz on January 15, 2015, 06:42:26 pm
I'm having issues with this. I installed it to use gaydar so I could figure out why my dwarves arn't marrying, but now when I load DF It opens no command window alongside it. When I open up dfhack-run manually, the command window opens for a split second. I managed to somehow screencap it before it blinked away and it says Usage:dfhack-run <command> [args...] . That's it.

I'm using Windows.

I'm not sure what I did wrong or if there's something I'm missing here. What can I do to fix it so df hack works?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 15, 2015, 06:44:18 pm
Do SDL.dll and SDLreal.dll both exist in the DF folder (and are they different)? You need to copy over both of those files from the DFHack package on Windows in order for DFHack to work.
Title: Re: DFHack 0.40.23-r1
Post by: PhoenixEggz on January 15, 2015, 06:48:02 pm
Do SDL.dll and SDLreal.dll both exist in the DF folder (and are they different)? You need to copy over both of those files from the DFHack package on Windows in order for DFHack to work.

Wow that was fast

They do both exist, yes. I don't know how to tell if they are different or not.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 15, 2015, 06:51:34 pm
Size.
Title: Re: DFHack 0.40.23-r1
Post by: PhoenixEggz on January 15, 2015, 06:57:02 pm
Size.

They're both the same size, so I guess the sdl is the same as it was before. How can I fix this without reinstalling df hack?
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 15, 2015, 06:58:08 pm
You can't.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 15, 2015, 07:13:04 pm
Well, you have to replace DF's copy of SDL.dll with the one distributed by DFHack. If you've already downloaded DFHack, it should only be a matter of copying over the file.
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 15, 2015, 08:50:39 pm
What are you trying to avoid about reinstalling? Do you have custom scripts? It shouldn't overwrite them unless they have the same name as scripts in DFHack.
Title: Re: DFHack 0.40.23-r1
Post by: Rose on January 15, 2015, 09:17:31 pm
If a command window is opening with DF, it's installed right.
Dfhack-run us not what you need to use.
Title: Re: DFHack 0.40.23-r1
Post by: PhoenixEggz on January 15, 2015, 11:36:51 pm
What are you trying to avoid about reinstalling? Do you have custom scripts? It shouldn't overwrite them unless they have the same name as scripts in DFHack.

We have an insanely stupid, useless 37 GB hard-drive and the computer is over 10 years old. It just recently had it's space doubled so it's usable for basic things. To be brief, there's many house conflicts about it being dumb, and conserving hard-drive space when possible is a good thing. DF is all it has space and energy to run decently, without consuming the entire computer's resources.

Upon installing it I did overwrite the SDL file when asked, and it errored, so that's probably what caused the issue. If I were to just remove both instances of the SDL file and place them in a seperate folder and have nothing in the df folder, would it still install correctly, or would it not at all? I don't think I would be able to stop the error any other way.

If I have to I will reinstall it, i'm not that desperate, but it's an avoid-this-if-even-remotely-possible kind of scenario.

Well, you have to replace DF's copy of SDL.dll with the one distributed by DFHack. If you've already downloaded DFHack, it should only be a matter of copying over the file.

I can't replace just that because I can't open .7z files the same way I can open .zip files. It's not a folder or a pseudo-folder; the files are inaccessible. I have no choice but to extract it all at once, picking and choosing files is not an option.

Thanks for the help everyone.
Title: Re: DFHack 0.40.23-r1
Post by: Dirst on January 16, 2015, 12:17:56 pm
I can't replace just that because I can't open .7z files the same way I can open .zip files. It's not a folder or a pseudo-folder; the files are inaccessible. I have no choice but to extract it all at once, picking and choosing files is not an option.

Thanks for the help everyone.
If the DFHack window is opening at all, replacing the DLL won't fix it.  But maybe that was a console window from dfhack-run or something, so it's worth trying a re-install.

You should be able to extract everything on top of the current install, which won't use up any additional space (once the tempfiles clear).  You can rename the two SDL files to ensure that they're out of the way.  Once things are running properly, go ahead and delete the renamed files.
Title: Re: DFHack 0.40.23-r1
Post by: Max™ on January 16, 2015, 03:00:29 pm
OMG SO CLOSE, EXCITE TIME IS NEAR, it actually starts up and everything properly, still missing some globals though:
Spoiler (click to show/hide)

Still, the fact that it didn't just crash or load df without dfhack is good right?

Compiled and built the dev branch, arch linux, df 40.24, updated the symbols.xml with the one on newer commit, I think the globals was already the most up to date one but still damn close, awesome work!
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 16, 2015, 07:23:20 pm
Question about DFHack:

What does it mean when a creature will marry one sex but "likes" the other?  Does "like" refer to a lovers' relationship that never progresses?
Title: Re: DFHack 0.40.23-r1
Post by: PhoenixEggz on January 16, 2015, 08:03:36 pm
I can't replace just that because I can't open .7z files the same way I can open .zip files. It's not a folder or a pseudo-folder; the files are inaccessible. I have no choice but to extract it all at once, picking and choosing files is not an option.

Thanks for the help everyone.
If the DFHack window is opening at all, replacing the DLL won't fix it.  But maybe that was a console window from dfhack-run or something, so it's worth trying a re-install.

You should be able to extract everything on top of the current install, which won't use up any additional space (once the tempfiles clear).  You can rename the two SDL files to ensure that they're out of the way.  Once things are running properly, go ahead and delete the renamed files.

The problem is that it's not working at all. It's like I never installed DF-hack to begin with.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 16, 2015, 08:04:44 pm
Question about DFHack:

What does it mean when a creature will marry one sex but "likes" the other?  Does "like" refer to a lovers' relationship that never progresses?

Yes, as far as I know.
Title: Re: DFHack 0.40.23-r1
Post by: funkydwarf on January 16, 2015, 09:31:29 pm
-delete-

Good Luck
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 16, 2015, 09:42:40 pm
Well, you have to replace DF's copy of SDL.dll with the one distributed by DFHack. If you've already downloaded DFHack, it should only be a matter of copying over the file.

I can't replace just that because I can't open .7z files the same way I can open .zip files. It's not a folder or a pseudo-folder; the files are inaccessible. I have no choice but to extract it all at once, picking and choosing files is not an option.

Thanks for the help everyone.
I'm not really sure how your archive manager works, but the one I'm used to extracts to a new folder by default (i.e. not "over" an existing folder). Could you try this and copy over the two .dll files? (Replacing SDL.dll, as well as copying any other files/folders you haven't already.)
Also, you are using the SDL version of DF, correct?
Title: Re: DFHack 0.40.23-r1
Post by: Badger Storm on January 17, 2015, 06:09:29 am
So then the only animals that won't breed are the ones who are straight-up (no pun intended) homosexual or asexual?

EDIT: Two additional questions:

1. Can you still get baby animals from a "lover" relationship?
2. Is there any way to tell if an animal has picked a partner, and who that partner is?
Title: Re: DFHack 0.40.23-r1
Post by: flecha on January 17, 2015, 11:38:35 am
Hi to every one, I tried to use latest df hack version (40.23) with df 40.24 but it crashes every time I start the game, how did you solve the issue in order to play df 40.24 with df hack?
Title: Re: DFHack 0.40.23-r1
Post by: Warmist on January 17, 2015, 11:39:43 am
Hi to every one, I tried to use latest df hack version (40.23) with df 40.24 but it crashes every time I start the game, how did you solve the issue in order to play df 40.24 with df hack?
Don't.

Use version that is supported (e.g. if it's called dfhack 0.40.23-r1 it should be used with df 0.40.23)
Title: Re: DFHack 0.40.23-r1
Post by: flecha on January 17, 2015, 11:41:33 am
Hi to every one, I tried to use latest df hack version (40.23) with df 40.24 but it crashes every time I start the game, how did you solve the issue in order to play df 40.24 with df hack?
Don't.

Use version that is supported (e.g. if it's called dfhack 0.40.23-r1 it should be used with df 0.40.23)

Thanks for the quick reply, I will do that
Title: Re: DFHack 0.40.23-r1
Post by: Splint on January 17, 2015, 02:05:31 pm
You know what, PTW.

I've found myself in need of the map cleaning function as of late.
Title: Re: DFHack 0.40.23-r1
Post by: Evrett33 on January 17, 2015, 10:25:00 pm
I'm sure you guys hate the "is it done yet" but can we get a ballpark time for .24 compatibility? I keep checking this place every day only to have my little heart rent asunder by the absence of apparent progress. Weeks from now because your busy? Just putting the finishing touches for tomorrow? Just a ballpark so we know when to check back.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 17, 2015, 10:55:34 pm
Most of the remaining work is running scripts to find Windows offsets (which needs to be done on Windows) and find start_dwarf_count (which can be found for all platforms on any platform). It really depends on when someone gets around to it, but a release can be made fairly quickly once it's done. You can check recent df-structures commits (https://github.com/dfhack/df-structures/commits/master) for progress.
Title: Re: DFHack 0.40.23-r1
Post by: Max™ on January 18, 2015, 06:00:59 am
It is really close though, as I mentioned above, the dev branch actually compiled and worked well enough to load up the game and terminal properly, but was missing a bunch of globals needed to actually use the various plugins (though I'm sure some worked, just not the ones I checked) and I think most of those have been found from what lethosor just said, I poked at some of the tools but I don't have anything windows on here at all, and didn't have any luck getting stuff to work right with arch due to never having actually played with them before... so it goes.
Title: Re: DFHack 0.40.23-r1
Post by: Kebra on January 18, 2015, 07:06:36 am
Can i use createitem to create a CAGE with a specificed animal/creature inside?
Title: Re: DFHack 0.40.23-r1
Post by: Hesperid on January 18, 2015, 07:09:43 am
Can i use createitem to create a CAGE with a specificed animal/creature inside?

No, createitem doesn't handle creating creature structures, and occupied cages also have an actual legitimate creature with creature data inside them.
Title: Re: DFHack 0.40.23-r1
Post by: jomen on January 18, 2015, 09:25:04 am
Hi everyone ,

have juste one question. Is it possible to rename dwarves with dfhack ? I mean without using nickname.
Title: Re: DFHack 0.40.23-r1
Post by: Max™ on January 18, 2015, 11:35:18 am
Hmmm, I have no idea how buggy it could be, but there is a name entry accessible with gm-editor.

Well, good news is, the first name can be edited really easily...

The bad news is, the rest of the name requires you to know the numbers corresponding to the words used in game.
(http://i.imgur.com/2AXgzNA.png)

Ebsas (Candy) is her first name, but then Adoredeath, and her title, are represented under the words/parts of speech tags and it's like 7 entries that just list the numbers, I think it was like 1768 for "Adore" as a guess...
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 18, 2015, 01:48:27 pm
OMG SO CLOSE, EXCITE TIME IS NEAR, it actually starts up and everything properly, still missing some globals though:
Spoiler (click to show/hide)

Still, the fact that it didn't just crash or load df without dfhack is good right?

Compiled and built the dev branch, arch linux, df 40.24, updated the symbols.xml with the one on newer commit, I think the globals was already the most up to date one but still damn close, awesome work!

Just because it compiles doesn't mean it works.

Hi to every one, I tried to use latest df hack version (40.23) with df 40.24 but it crashes every time I start the game, how did you solve the issue in order to play df 40.24 with df hack?

This is why.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 18, 2015, 04:34:31 pm
DFHack should deactivate, not crash, if it doesn't recognize the DF version (that's how it works on OS X and Linux, at least).
Anyway, here (https://github.com/lethosor/df-structures/blob/0.40.24-linux-offsets/symbols.xml) is a copy of symbols.xml with Linux offsets for 0.40.24. You'll want to compile with the latest commit in dfhack/df-structures (2f1a0f8455814aa844e2461f834e4e9faf5f8831), since there were a number of structure changes made (or noticed) since 0.40.23.
Title: Re: DFHack 0.40.23-r1
Post by: jomen on January 18, 2015, 06:19:37 pm
Hmmm, I have no idea how buggy it could be, but there is a name entry accessible with gm-editor.

Well, good news is, the first name can be edited really easily...

The bad news is, the rest of the name requires you to know the numbers corresponding to the words used in game.
(http://i.imgur.com/2AXgzNA.png)

Ebsas (Candy) is her first name, but then Adoredeath, and her title, are represented under the words/parts of speech tags and it's like 7 entries that just list the numbers, I think it was like 1768 for "Adore" as a guess...

I Will try this thx:) . I just aim to give kids the same last name of their parents
Title: Re: DFHack 0.40.23-r1
Post by: Spacebat on January 18, 2015, 06:46:31 pm
How do you go about finding the globals the lua script doesn't locate?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 18, 2015, 07:01:16 pm
If you've located Windows globals, submitting a PR against DFHack/df-structures on Github would be very helpful. Which globals are you referring to? The debug_* flags and save_on_exit have to be located manually (but nothing requires them, as far as I know), and start_dwarf_count is located with another script.
Title: Re: DFHack 0.40.23-r1
Post by: Spacebat on January 18, 2015, 08:33:46 pm
I am on Windows, but devel/find-offsets didn't seem to find anything new. At least, all the globals it shows are listed as "already known", and there's nothing in stdout.log. http://i.imgur.com/kl8vHYS.png

Clearly, however, some globals are not located, as it says when I start dfhack. http://i.imgur.com/hSR35oK.png
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 18, 2015, 08:49:18 pm
Ah, right. Those are located automatically on Linux/OS X, but I forgot that they have to be found manually on Windows.
Title: Re: DFHack 0.40.23-r1
Post by: Spacebat on January 18, 2015, 09:14:49 pm
That sounds unpleasant. I'd do it for you if I knew how.
Title: Re: DFHack 0.40.23-r1
Post by: Thormgrim on January 19, 2015, 12:17:40 am
I don't know if DFHack is the right place to make the requestion, but I'm wondering if anybody has done any sort of family tree helper?

I often like to at least give married couples the same nickname so I can give them the same job roles and help manage bedrooms and such.  In my latest fort it seems like all my migrants are brothers/sisters/aunts/uncles/cousins or something and I can't hope to keep track of it all with the DF interface.

Does anybody know of something that helps address this problem statement?
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 19, 2015, 12:20:36 am
I don't know if DFHack is the right place to make the requestion, but I'm wondering if anybody has done any sort of family tree helper?

I often like to at least give married couples the same nickname so I can give them the same job roles and help manage bedrooms and such.  In my latest fort it seems like all my migrants are brothers/sisters/aunts/uncles/cousins or something and I can't hope to keep track of it all with the DF interface.

Does anybody know of something that helps address this problem statement?

http://www.bay12forums.com/smf/index.php?topic=112381.0
Title: Re: DFHack 0.40.23-r1
Post by: Arkangel on January 19, 2015, 09:58:31 am
Seedwatch appears to not be working for a lot of the new plants, specifically the ones without edible seeds, I believe.

Looks like it's not necessarily an issue with the seeds, but with the new growths system. For instance, seedwatch works for asparagus, but not for blueberries, bilberries, or blackberries.
Title: Re: DFHack 0.40.23-r1
Post by: Max™ on January 19, 2015, 11:42:09 am
DFHack should deactivate, not crash, if it doesn't recognize the DF version (that's how it works on OS X and Linux, at least).
Anyway, here (https://github.com/lethosor/df-structures/blob/0.40.24-linux-offsets/symbols.xml) is a copy of symbols.xml with Linux offsets for 0.40.24. You'll want to compile with the latest commit in dfhack/df-structures (2f1a0f8455814aa844e2461f834e4e9faf5f8831), since there were a number of structure changes made (or noticed) since 0.40.23.
Code: [Select]
  ,d88b.d88b,
  88888888888
  `Y8888888Y'
    `Y888Y'
      `Y'
Title: Re: DFHack 0.40.23-r1
Post by: Incantatar on January 19, 2015, 12:10:48 pm
So is the dev version stable on linux 40_24? If yes any reason not to upload it?
Title: Re: DFHack 0.40.23-r1
Post by: notfood on January 19, 2015, 12:19:29 pm
So is the dev version stable on linux 40_24? If yes any reason not to upload it?

I've been testing Lethosor df-structures update and it works well, haven't found any issue.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 19, 2015, 12:35:34 pm
It was actually txtsd who found those offsets - I just added them to the right places in symbols.xml.


So is the dev version stable on linux 40_24? If yes any reason not to upload it?
There are still several Windows offsets missing.
Title: Re: DFHack 0.40.23-r1
Post by: Incantatar on January 20, 2015, 03:59:13 am
After googling a shitload of error messages and installing a shitload of packages i'm at 34% and:
 
Code: [Select]
"libprotoc.so: undefined reference to pthread_once"
collect2: error: ld returned 1 exit status
make[2]: *** [depends/protobuf/protoc] Fehler  1
make[1]: *** [depends/protobuf/CMakeFiles/protoc-bin.dir/all] Fehler 2
(Fehler = error)

Google tells me to to use gcc with the -ptthread or -lpthread command. Can someone explain me how i do this?


Edit: Solved it. I deleted everything in /build and compiled again, which worked out fine. A million warnings but no errors.
Title: Re: DFHack 0.40.23-r1
Post by: txtsd on January 20, 2015, 02:26:58 pm
It was actually txtsd who found those offsets - I just added them to the right places in symbols.xml.

I've been playing 40.24 (linux) with those offsets, and been using DT with the ini generated using devel/export-dt-ini, and the game has been running fine!

Although, I've had a problem since 40.23
Whenever I Save Game, the game crashes and vomits this log https://bpaste.net/show/9166214c4fa1
It's happening with 40.24 also. Very rarely does it not crash.
Running quicksave from dfhack works fine, no probs.
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 20, 2015, 02:53:21 pm
Are you using a graphics set?

Edit: Solved it. I deleted everything in /build and compiled again, which worked out fine. A million warnings but no errors.
If you're using a newer version of GCC, the "struct is too small"-type warnings are expected.
Title: Re: DFHack 0.40.23-r1
Post by: txtsd on January 20, 2015, 03:10:37 pm
Are you using a graphics set?
Nope, just a tileset with minor d_init.txt edits for trees and Pillar tile.
The only RAW changes are [ETHIC:EAT_SAPIENT_OTHER:ACCEPTABLE] and [ETHIC:EAT_SAPIENT_KILL:ACCEPTABLE]
Title: Re: DFHack 0.40.23-r1
Post by: Nopenope on January 21, 2015, 12:42:52 am

I've been testing Lethosor df-structures update and it works well, haven't found any issue.
Yes it builds and run but almost all plugins won't load due to missing offsets, if that counts as an issue.
Title: Re: DFHack 0.40.23-r1
Post by: notfood on January 21, 2015, 03:32:37 am

I've been testing Lethosor df-structures update and it works well, haven't found any issue.
Yes it builds and run but almost all plugins won't load due to missing offsets, if that counts as an issue.

It builds, runs and all plugins load (except for twbt).

I don't even have the save issue txtsd is having.

(http://i.imgur.com/cThu7uk.png)
Title: Re: DFHack 0.40.23-r1
Post by: Incantatar on January 21, 2015, 08:23:13 am
Yes, the plugins except twbt load.

On another note, am i the only one who gets the
Code: [Select]
cannot open ~/df_40_24/data/save/region1/raw/init.lua: file or folder not found error/warning? I get it with all DFHack releases iirc even in 34.11. I think putting an empty file there helps but what's the reason of this warning?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 21, 2015, 01:07:01 pm

I've been testing Lethosor df-structures update and it works well, haven't found any issue.
Yes it builds and run but almost all plugins won't load due to missing offsets, if that counts as an issue.
What platform are you using? I've only located offsets for OS X and Linux (they're on different branches at the moment), and there aren't any missing besides debug flags and start_dwarf_count (which is on another branch, also for OS X and Linux only as the script to find it isn't working with the Windows version).


Yes, the plugins except twbt load.

On another note, am i the only one who gets the
Code: [Select]
cannot open ~/df_40_24/data/save/region1/raw/init.lua: file or folder not found error/warning? I get it with all DFHack releases iirc even in 34.11. I think putting an empty file there helps but what's the reason of this warning?
Never seen it. What platform are you using?
Edit: It looks like that message is only suppressed if the error message contains "No such file or directory", which isn't a very portable way of handling it.
Title: Re: DFHack 0.40.23-r1
Post by: Roses on January 21, 2015, 05:11:41 pm
Is there a current way to see what functions are waiting to be called with dfhack.timeout?
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 21, 2015, 05:16:55 pm
Any plans for multiple onLoad.init files?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 21, 2015, 05:21:58 pm
Any plans for multiple onLoad.init files?
What do you mean, exactly? You can already use per-save onLoad.init files, as well as a global onLoadWorld.init. If you want to load another file from within those, you can use the "script" command.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 21, 2015, 05:22:34 pm
Meaning mod-wise, like the init.d folder for init.lua.
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 22, 2015, 12:37:07 am
I think there's a command to read in a blah.init file and execute it but I forget how.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 22, 2015, 12:56:54 am
I guess I could always replace my onLoad.init with an init.lua filled with dfhack.run_command...
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 22, 2015, 02:16:40 am
Any plans for multiple onLoad.init files?
What do you mean, exactly? You can already use per-save onLoad.init files, as well as a global onLoadWorld.init. If you want to load another file from within those, you can use the "script" command.

I think there's a command to read in a blah.init file and execute it but I forget how.

What he said. It's the "script" command.
Title: Re: DFHack 0.40.23-r1
Post by: Incantatar on January 22, 2015, 03:39:22 am
Yes, the plugins except twbt load.

On another note, am i the only one who gets the
Code: [Select]
cannot open ~/df_40_24/data/save/region1/raw/init.lua: file or folder not found error/warning? I get it with all DFHack releases iirc even in 34.11. I think putting an empty file there helps but what's the reason of this warning?
Never seen it. What platform are you using?
Edit: It looks like that message is only suppressed if the error message contains "No such file or directory", which isn't a very portable way of handling it.

Ah, then it isn't surpressed because the message is in German.
Code: [Select]
cannot open /home/solis/Spiele/df_40_24/data/save/region3/raw/init.lua: Datei oder Verzeichnis nicht gefunden I had this message on Windows and now on GNU/Linux.

Title: Re: DFHack 0.40.23-r1
Post by: Spacebat on January 22, 2015, 04:41:37 am
Since it hasn't been progressing, I've attempted to find some offsets myself, but I can't figure out how to translate the offsets in symbols.xml to addresses. When I take the base address of "Dwarf Fortress.exe" + offset, I just end up in empty memory or something else that obviously isn't right. I'm using Cheat Engine.
Title: Re: DFHack 0.40.23-r1
Post by: Warmist on January 22, 2015, 07:47:55 am
Since it hasn't been progressing, I've attempted to find some offsets myself, but I can't figure out how to translate the offsets in symbols.xml to addresses. When I take the base address of "Dwarf Fortress.exe" + offset, I just end up in empty memory or something else that obviously isn't right. I'm using Cheat Engine.
IIRC the offsets in symbols.xml might be for binary file so they could be offset by 0x400000. In cheat engine that might look like "Dwarf Fortress.exe" + offset-0x400000
Title: Re: DFHack 0.40.23-r1
Post by: txtsd on January 22, 2015, 08:06:36 am
Since it hasn't been progressing, I've attempted to find some offsets myself, but I can't figure out how to translate the offsets in symbols.xml to addresses. When I take the base address of "Dwarf Fortress.exe" + offset, I just end up in empty memory or something else that obviously isn't right. I'm using Cheat Engine.

Does the Windows version of dfhack not have `devel/find-offsets`?
Title: Re: DFHack 0.40.23-r1
Post by: lethosor on January 22, 2015, 08:19:40 am
Since it hasn't been progressing, I've attempted to find some offsets myself, but I can't figure out how to translate the offsets in symbols.xml to addresses. When I take the base address of "Dwarf Fortress.exe" + offset, I just end up in empty memory or something else that obviously isn't right. I'm using Cheat Engine.
IIRC the offsets in symbols.xml might be for binary file so they could be offset by 0x400000. In cheat engine that might look like "Dwarf Fortress.exe" + offset-0x400000
No, they're memory offsets. You might want to try +0x400000 (on Windows) if cheat engine is using file offsets.

Since it hasn't been progressing, I've attempted to find some offsets myself, but I can't figure out how to translate the offsets in symbols.xml to addresses. When I take the base address of "Dwarf Fortress.exe" + offset, I just end up in empty memory or something else that obviously isn't right. I'm using Cheat Engine.

Does the Windows version of dfhack not have `devel/find-offsets`?
It does, but some offsets that are found with df_misc scripts on OS X and Linux have to be found manually on Windows (such as created_item_type, IIRC).
Title: Re: DFHack 0.40.23-r1
Post by: Dirst on January 22, 2015, 11:10:48 am
Any plans for multiple onLoad.init files?
What do you mean, exactly? You can already use per-save onLoad.init files, as well as a global onLoadWorld.init. If you want to load another file from within those, you can use the "script" command.

I think there's a command to read in a blah.init file and execute it but I forget how.

What he said. It's the "script" command.
I think the request was some way to automatically hoover up on-load scripts that come with mods, so the player doesn't need to stitch them together manually.  This might simplify mod merging.

I'm picturing this as a standard bit in DFHack's onload script that runs every file in the raw/scripts folder that matches a specific filename pattern, maybe onload_*.lua|onload_*.rb.  It should be deterministically before or after the onload.init script at the root of raw.  Or put it in the raw/onload.init file, but I think the feature would be more user-proof if it functioned with the main file missing.
Title: Re: DFHack 0.40.23-r1
Post by: Gorobay on January 22, 2015, 11:57:36 am
How can I create a new entity in DFHack? When I try
Code: [Select]
df.global.world.entities.all:insert(0, {new=true, type=1, id=df.global.entity_next_id})DF crashes when saving the world. When I add
Code: [Select]
entity_raw=another_entity.entity_rawto the new entity, it saves, but DF crashes when gets to the "Loading civilized populations" part of loading the world.
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 22, 2015, 12:24:31 pm
I think the request was some way to automatically hoover up on-load scripts that come with mods, so the player doesn't need to stitch them together manually.  This might simplify mod merging.

I'm picturing this as a standard bit in DFHack's onload script that runs every file in the raw/scripts folder that matches a specific filename pattern, maybe onload_*.lua|onload_*.rb.  It should be deterministically before or after the onload.init script at the root of raw.  Or put it in the raw/onload.init file, but I think the feature would be more user-proof if it functioned with the main file missing.

I'll add it to the list.

Is the goal to make it easier for homebrewed combinations of mods?

How can I create a new entity in DFHack? When I try
Code: [Select]
df.global.world.entities.all:insert(0, {new=true, type=1, id=df.global.entity_next_id})DF crashes when saving the world. When I add
Code: [Select]
entity_raw=another_entity.entity_rawto the new entity, it saves, but DF crashes when gets to the "Loading civilized populations" part of loading the world.

One problem is it looks like you aren't updating entity_next_id.

If I understand what you're doing then it probably can't be done. Certain things get read from raw files every time the game loads so it will almost definitely crash if it loads all the raw entities and then sees a reference to an entity that doesn't exist yet because it was created at runtime before it was saved. My guess is that the save code does some sort of check which catches this and crashes as a sanity check because it can't happen in vanilla DF.


Creating a new civilization/group should be possible but I think that's a different struct.

edit: Never mind. entity_raw is probably the one you can't create more of and making new entities is fine.
Title: Re: DFHack 0.40.23-r1
Post by: Dirst on January 22, 2015, 12:47:11 pm
I think the request was some way to automatically hoover up on-load scripts that come with mods, so the player doesn't need to stitch them together manually.  This might simplify mod merging.

I'm picturing this as a standard bit in DFHack's onload script that runs every file in the raw/scripts folder that matches a specific filename pattern, maybe onload_*.lua|onload_*.rb.  It should be deterministically before or after the onload.init script at the root of raw.  Or put it in the raw/onload.init file, but I think the feature would be more user-proof if it functioned with the main file missing.

I'll add it to the list.

Is the goal to make it easier for homebrewed combinations of mods?
A starter pack's mod manager could in principle merge the scripts together, so yes this would be aimed at players throwing random and/or homebrewed mods together.  But it would also make the mod manager's job easier.
Title: Re: DFHack 0.40.23-r1
Post by: Gorobay on January 22, 2015, 01:01:40 pm
One problem is it looks like you aren't updating entity_next_id.
[...]
edit: Never mind. entity_raw is probably the one you can't create more of and making new entities is fine.
Now I do update df.global.entity_next_id, but it still has the same problem. I tried making a new population and adding its id to the new entity’s populations, but that didn’t work either.

Are there any scripts that successfully create entities that I can use as examples?
Title: Re: DFHack 0.40.23-r1
Post by: Roses on January 22, 2015, 01:34:21 pm
I'm trying to add announcements and combat log text to my scripts, I looked through the API and found
Code: [Select]
dfhack.gui.makeAnnouncement(type,flags,pos,text,color[,is_bright])and
Code: [Select]
dfhack.gui.addCombatReport(unit,slot,report_index)
But I am unsure what the type, flags, and slot should all be for a given announcement (also pos?). Anyone have any examples or a list of what the valid entries are?

EDIT: Also
Code: [Select]
dfhack.run_script('unit/body-change -unit 3399 -temperature fire -all')Is not working, it says
Code: [Select]
C:\Users\Miles\Desktop\My_DF2\hack\lua\dfhack.lua:410: Could not find script uni
t/body-change -unit 3399 -temperature fire -all
stack traceback:
        [C]: in function 'error'
        C:\Users\Miles\Desktop\My_DF2\hack\lua\dfhack.lua:410: in function 'run_
script'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        C:\Users\Miles\Desktop\My_DF2\hack\lua\dfhack.lua:366: in function 'inte
rpreter'
        C:\Users\Miles\Desktop\My_DF2\hack\scripts/lua.lua:47: in main chunk
        (...tail calls...)
Note that putting that exact string into the command line works fine.

EDIT2: @Gorobay, I'm pretty sure its because you have a lot of fields that are left undefined if you just make a new one with type and id. Try instead
Code: [Select]
old = df.global.world.entities.all[0]
new = old:new()
new.id = entity_next_id
new.type = 1
blah
blah
blah
Title: Re: DFHack 0.40.23-r1
Post by: 4kn on January 22, 2015, 02:32:10 pm
excuse me for interrupting, but what about 40.24?
Title: Re: DFHack 0.40.23-r1
Post by: Dirst on January 22, 2015, 02:32:16 pm
Roses, I found the Announcement command from Rubble (probably several versions old by now) that is much easier to use.

After all of the preparatory work is done building your string, it basically comes down to

dfhack.gui.showAnnouncement("Hello world!", _G["COLOR_RED"])

At the time I lifted the script, milo was manually echoing the announcement into the game's logfile, but the showAnnouncement method now seems to do that by itself.

Of course, this doesn't have as many ways to customize as the code you showed above.  For example, the snippet here has no location, so there's no way for the player to zoom to the location.

Edit: Here is the documentation for showAnnouncement and makeAnnouncement (https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#id58).  Probably just need to experiment with the flags or find a script somewhere that uses it.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 22, 2015, 03:14:30 pm
I'm trying to add announcements and combat log text to my scripts, I looked through the API and found
Code: [Select]
dfhack.gui.makeAnnouncement(type,flags,pos,text,color[,is_bright])and
Code: [Select]
dfhack.gui.addCombatReport(unit,slot,report_index)
But I am unsure what the type, flags, and slot should all be for a given announcement (also pos?). Anyone have any examples or a list of what the valid entries are?

https://github.com/DFHack/df-structures/blob/master/df.announcements.xml

I think the request was some way to automatically hoover up on-load scripts that come with mods, so the player doesn't need to stitch them together manually.  This might simplify mod merging.

I'm picturing this as a standard bit in DFHack's onload script that runs every file in the raw/scripts folder that matches a specific filename pattern, maybe onload_*.lua|onload_*.rb.  It should be deterministically before or after the onload.init script at the root of raw.  Or put it in the raw/onload.init file, but I think the feature would be more user-proof if it functioned with the main file missing.

I'll add it to the list.

Is the goal to make it easier for homebrewed combinations of mods?

Well, personally, I'm doing it so that others can do that more easily. I ended up going with a dfhack.run_command in my init.d/fortbent.lua file:

Code: [Select]
dfhack.run_command('script',SAVE_PATH..'/raw/fortbent_onload.init')
Title: Re: DFHack 0.40.23-r1
Post by: Gorobay on January 22, 2015, 03:16:25 pm
EDIT2: @Gorobay, I'm pretty sure its because you have a lot of fields that are left undefined if you just make a new one with type and id.
I wrote the following script as a test:
Code: [Select]
local old = df.global.world.entities.all[0]
local new = old:new()
new.id = df.global.entity_next_id
new.type = 1
df.global.world.entities.all:insert('#', new)
The game crashes when I exit the current mode and offload the world.

I have found reading the source code (https://github.com/DFHack/dfhack/blob/master/library/modules/Gui.cpp) helpful for determining what the GUI functions do. The slot parameter of addCombatReport must be 0, 1, or 2 for combat, hunting, or sparring.
Title: Re: DFHack 0.40.23-r1
Post by: IndigoFenix on January 22, 2015, 03:19:14 pm
Is there any simple way of getting the products of a reaction that is linked to a LUA_HOOK function?  The example function includes output_items as a parameter, but as far as I can tell it is always empty
Title: Re: DFHack 0.40.23-r1
Post by: Roses on January 22, 2015, 03:34:09 pm
Is there any simple way of getting the products of a reaction that is linked to a LUA_HOOK function?  The example function includes output_items as a parameter, but as far as I can tell it is always empty

reaction.products

code where I use it
Code: [Select]
function upgradeitem(reaction,unit,input_items,input_reagents,output_items,call_native)
local ptype = reaction.products[0].mat_type
local pindx = reaction.products[0].mat_index
local product = dfhack.matinfo.decode(ptype,pindx)
local args = {}
for i,x in ipairs(product.material.syndrome[0].syn_class) do
args[i] = x.value
end

local dur = 0
if #args == 2 then dur = tonumber(args[2]) end

local sitems = {}
if args[0] == 'this' then
-- Upgrade only the input items with preserve reagent
for i,x in ipairs(input_reagents) do
if x.flags.PRESERVE_REAGENT then sitems[i] = input_items[i] end
end
elseif args[0] == 'all' then
-- Upgrade all items of the same type as input
local itemList = df.global.world.items.all
local k = 1
for j,y in ipairs(input_reagents) do
if y.flags.PRESERVE_REAGENT then
for i,x in ipairs(itemList) do
if itemSubtypes(x) then
if x.subtype.id == y.subtype.id then
sitems[k] = itemList[i]
k = k + 1
end
end
end
end
end
else
-- Randomly upgrade one specific item
local itemList = df.global.world.items.all
local k = 1
for j,y in ipairs(input_reagents) do
if y.flags.PRESERVE_REAGENT then
for i,x in ipairs(itemList) do
if itemSubtypes(x) then
if x.subtype.id == y.subtype.id then
sitems[k] = itemList[i]
k = k + 1
end
end
end
end
end
local rando = dfhack.random.new()
sitems = {sitems[rando:random(#sitems)]}
end

if args[1] == 'upgrade' then
-- Increase items number by one
for _,x in ipairs(sitems) do
local name = x.subtype.id
if dur > 0 then sid = x.subtype.subtype end
local namea = split(name,'_')
local num = tonumber(namea[#namea])
num = num + 1
namea[#namea] = tostring(num)
name = table.concat(namea,'_')
item_index = itemSubtypes(x)
for i=0,dfhack.items.getSubtypeCount(item_index)-1,1 do
item_sub = dfhack.items.getSubtypeDef(item_index,i)
if item_sub.id == name then x:setSubtype(item_sub.subtype) end
end
if dur > 0 then dfhack.timeout(dur,'ticks',createcallback(x,sid)) end
end
elseif args[1] == 'downgrade' then
-- Decrease items number by one
for _,x in ipairs(sitems) do
local name = x.subtype.id
if dur > 0 then sid = x.subtype.subtype end
local namea = split(name,'_')
local num = tonumber(namea[#namea])
num = num - 1
if num > 0 then namea[#namea] = tostring(num) end
name = table.concat(namea,'_')
item_index = itemSubtypes(x)
for i=0,dfhack.items.getSubtypeCount(item_index)-1,1 do
item_sub = dfhack.items.getSubtypeDef(item_index,i)
if item_sub.id == name then x:setSubtype(item_sub.subtype) end
end
if dur > 0 then dfhack.timeout(dur,'ticks',createcallback(x,sid)) end
end
else
-- Change item to new item
for _,x in ipairs(sitems) do
if dur > 0 then sid = x.subtype.subtype end
item_index = itemSubtypes(x)
for i=0,dfhack.items.getSubtypeCount(item_index)-1,1 do
item_sub = dfhack.items.getSubtypeDef(item_index,i)
if item_sub.id == args[1] then x:setSubtype(item_sub.subtype) end
end
if dur > 0 then dfhack.timeout(dur,'ticks',createcallback(x,sid)) end
end
end
end

-- START Taken from hire-guard.lua
local eventful = require 'plugins.eventful'
local utils = require 'utils'

function string.starts(String,Start)
   return string.sub(String,1,string.len(Start))==Start
end

dfhack.onStateChange.loadUpgradeItem = function(code)
local registered_reactions
if code==SC_MAP_LOADED then
--registered_reactions = {}
for i,reaction in ipairs(df.global.world.raws.reactions) do
-- register each applicable reaction (to avoid doing string check
-- for every lua hook reaction (not just ours), this way uses identity check
if string.starts(reaction.code,'LUA_HOOK_UPGRADE_ITEM') then
-- register reaction.code
eventful.registerReaction(reaction.code,upgradeitem)
-- save reaction.code
--table.insert(registered_reactions,reaction.code)
registered_reactions = true
end
end
--if #registered_reactions > 0 then print('HireGuard: Loaded') end
if registered_reactions then print('Upgradable Items: Loaded') end
elseif code==SC_MAP_UNLOADED then
--[[ doesn't seem to be working, and probably not needed
registered_reactions = registered_reactions or {}
if #registered_reactions > 0 then print('HireGuard: Unloaded') end
for i,reaction in ipairs(registered_reactions) do
-- un register each registered reaction (to prevent persistance between
-- differing worlds (probably irrelavant, but doesn't hurt)
-- un register reaction.code
eventful.registerReaction(reaction.code,nil)
end
registered_reactions = nil -- clear registered_reactions
--]]
end
end

-- if dfhack.init has already been run, force it to think SC_WORLD_LOADED to that reactions get refreshed
if dfhack.isMapLoaded() then dfhack.onStateChange.loadUpgradeItem(SC_MAP_LOADED) end
-- END Taken from hire-guard.lua

EDIT2: @Gorobay, I'm pretty sure its because you have a lot of fields that are left undefined if you just make a new one with type and id.
I wrote the following script as a test:
Code: [Select]
local old = df.global.world.entities.all[0]
local new = old:new()
new.id = df.global.entity_next_id
new.type = 1
df.global.world.entities.all:insert('#', new)
The game crashes when I exit the current mode and offload the world.

I have found reading the source code (https://github.com/DFHack/dfhack/blob/master/library/modules/Gui.cpp) helpful for determining what the GUI functions do. The slot parameter of addCombatReport must be 0, 1, or 2 for combat, hunting, or sparring.

You might also have to change the value of save_file_id. Also I'm not sure if its going to freak out over having duplicate events and such.
Title: Re: DFHack 0.40.23-r1
Post by: IndigoFenix on January 22, 2015, 04:04:25 pm
Is there any simple way of getting the products of a reaction that is linked to a LUA_HOOK function?  The example function includes output_items as a parameter, but as far as I can tell it is always empty

reaction.products

Not that, that's the data from the reaction's object.  I want the actual items produced from the reaction.

I'm trying to make a function that runs after a particular reaction that produces a tool.  I want the function to run some script and then set the 'maker' field of the tool to a certain number based on that script.  How would I go about doing that?
Title: Re: DFHack 0.40.23-r1
Post by: Roses on January 22, 2015, 04:22:52 pm
Is there any simple way of getting the products of a reaction that is linked to a LUA_HOOK function?  The example function includes output_items as a parameter, but as far as I can tell it is always empty

reaction.products

Not that, that's the data from the reaction's object.  I want the actual items produced from the reaction.

I'm trying to make a function that runs after a particular reaction that produces a tool.  I want the function to run some script and then set the 'maker' field of the tool to a certain number based on that script.  How would I go about doing that?

Ah, I see what you mean. I misunderstood. As far as I know output_items should be what you want. If it isn't then I am of no help.
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 22, 2015, 04:30:35 pm
Code: [Select]
dfhack.run_script('unit/body-change -unit 3399 -temperature fire -all')Is not working, it says
Code: [Select]
C:\Users\Miles\Desktop\My_DF2\hack\lua\dfhack.lua:410: Could not find script uni
t/body-change -unit 3399 -temperature fire -all
stack traceback:
        [C]: in function 'error'
        C:\Users\Miles\Desktop\My_DF2\hack\lua\dfhack.lua:410: in function 'run_
script'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        C:\Users\Miles\Desktop\My_DF2\hack\lua\dfhack.lua:366: in function 'inte
rpreter'
        C:\Users\Miles\Desktop\My_DF2\hack\scripts/lua.lua:47: in main chunk
        (...tail calls...)
Note that putting that exact string into the command line works fine.


For now try run_command instead of run_script.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 22, 2015, 04:52:10 pm
Or you could do this instead:

dfhack.run_script('unit/body-change', '-unit', '3399', '-temperature', 'fire', '-all')
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 22, 2015, 04:56:21 pm
I think the problem is that run_script might not look for script in quite as many places as it's supposed to. You're allowed to have per-save scripts folders. I might have messed that up slightly. run_command circumvents internal Lua stuff so it shouldn't be a problem there.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 22, 2015, 04:58:14 pm
run_script runs save scripts AFAIK. I haven't had a problem with it.

Then again, I haven't tested it too rigorously.
Title: Re: DFHack 0.40.23-r1
Post by: IndigoFenix on January 22, 2015, 05:00:21 pm
Is there any simple way of getting the products of a reaction that is linked to a LUA_HOOK function?  The example function includes output_items as a parameter, but as far as I can tell it is always empty

reaction.products

Not that, that's the data from the reaction's object.  I want the actual items produced from the reaction.

I'm trying to make a function that runs after a particular reaction that produces a tool.  I want the function to run some script and then set the 'maker' field of the tool to a certain number based on that script.  How would I go about doing that?

Ah, I see what you mean. I misunderstood. As far as I know output_items should be what you want. If it isn't then I am of no help.

Well, if I use print(output_items) it prints out <vector<item*>: number>, but I can't figure out how to read or write to it.  output_items[0] is out of bounds, printall(output_items) does nothing, even though the reaction is clearly producing something.
Title: Re: DFHack 0.40.23-r1
Post by: Gorobay on January 22, 2015, 05:02:38 pm
You might also have to change the value of save_file_id. Also I'm not sure if its going to freak out over having duplicate events and such.
Looks like it still freaks out: setting the save_file_id to 1 + the maximum of all other save_file_ids didn’t fix it. Maybe I can work around this using dfhack.persistent.
Title: Re: DFHack 0.40.23-r1
Post by: Roses on January 22, 2015, 05:05:34 pm
You might also have to change the value of save_file_id. Also I'm not sure if its going to freak out over having duplicate events and such.
Looks like it still freaks out: setting the save_file_id to 1 + the maximum of all other save_file_ids didn’t fix it. Maybe I can work around this using dfhack.persistent.

Yeah I am not sure about adding an entity. But what are you trying to do? There may be other ways to handle it.

EDIT: switching run_script to run_command fixed the issue
Title: Re: DFHack 0.40.23-r1
Post by: PeridexisErrant on January 22, 2015, 09:12:40 pm
I think the request was some way to automatically hoover up on-load scripts that come with mods, so the player doesn't need to stitch them together manually.  This might simplify mod merging.

I'm picturing this as a standard bit in DFHack's onload script that runs every file in the raw/scripts folder that matches a specific filename pattern, maybe onload_*.lua|onload_*.rb.  It should be deterministically before or after the onload.init script at the root of raw.  Or put it in the raw/onload.init file, but I think the feature would be more user-proof if it functioned with the main file missing.

I'll add it to the list.

Is the goal to make it easier for homebrewed combinations of mods?
A starter pack's mod manager could in principle merge the scripts together, so yes this would be aimed at players throwing random and/or homebrewed mods together.  But it would also make the mod manager's job easier.

Regardless, I'll need to add some special-casing to the mod merger, since it currently skips anything not ending in '.txt'. 

The easiest way will simply be to test for file ending '.init', '.lua', or '.rb' and spoof an empty file as the vanilla text; and the usual merge logic can then combine the files.  Multiple files will be combined, per the usual merge logic, with no change if they're identical.
Title: Re: DFHack 0.40.23-r1
Post by: Gorobay on January 22, 2015, 09:41:59 pm
Yeah I am not sure about adding an entity. But what are you trying to do? There may be other ways to handle it.
I am trying to add proper linguistics to the game. I was representing languages as entities, so that historical figures could have links to languages they knew, and civilizations could have links to their default languages. It worked perfectly, except for the crashing. Anything that allows such links would work; I think I might try sites next.
Title: Re: DFHack 0.40.23-r1
Post by: Spacebat on January 23, 2015, 12:17:49 am

No, they're memory offsets. You might want to try +0x400000 (on Windows) if cheat engine is using file offsets.
IIRC the offsets in symbols.xml might be for binary file so they could be offset by 0x400000. In cheat engine that might look like "Dwarf Fortress.exe" + offset-0x400000

Thanks, but neither of these worked.
Title: Re: DFHack 0.40.23-r1
Post by: Boltgun on January 23, 2015, 04:06:26 am
I think the request was some way to automatically hoover up on-load scripts that come with mods, so the player doesn't need to stitch them together manually.  This might simplify mod merging.

I'm picturing this as a standard bit in DFHack's onload script that runs every file in the raw/scripts folder that matches a specific filename pattern, maybe onload_*.lua|onload_*.rb.  It should be deterministically before or after the onload.init script at the root of raw.  Or put it in the raw/onload.init file, but I think the feature would be more user-proof if it functioned with the main file missing.

I'll add it to the list.

Is the goal to make it easier for homebrewed combinations of mods?
A starter pack's mod manager could in principle merge the scripts together, so yes this would be aimed at players throwing random and/or homebrewed mods together.  But it would also make the mod manager's job easier.

Regardless, I'll need to add some special-casing to the mod merger, since it currently skips anything not ending in '.txt'. 

The easiest way will simply be to test for file ending '.init', '.lua', or '.rb' and spoof an empty file as the vanilla text; and the usual merge logic can then combine the files.  Multiple files will be combined, per the usual merge logic, with no change if they're identical.

I might be reading that wrong, but isn't that already done with an init.d subfolder loading all lua files there on save load?

It is worth extending that to rb and init files  so you can add reaction triggers easily.
Title: Re: DFHack 0.40.23-r1
Post by: expwnent on January 23, 2015, 11:39:31 am

I might be reading that wrong, but isn't that already done with an init.d subfolder loading all lua files there on save load?

It is worth extending that to rb and init files  so you can add reaction triggers easily.

Right now that only works for Lua and Ruby scripts, not for dfhack commands like dfhack.init.
Title: Re: DFHack 0.40.23-r1
Post by: Dirst on January 23, 2015, 02:14:28 pm

I might be reading that wrong, but isn't that already done with an init.d subfolder loading all lua files there on save load?

It is worth extending that to rb and init files  so you can add reaction triggers easily.

Right now that only works for Lua and Ruby scripts, not for dfhack commands like dfhack.init.
Good point, what I originally proposed was Lua/Ruby scripts, but what I really meant was init files with DFHack commands.  Each mod can have its own init file that registers reactions, etc.  Since an init file can call scripts easily, it's probably best to process only init files automatically.
Title: Re: DFHack 0.40.23-r1
Post by: Putnam on January 23, 2015, 02:21:53 pm
No, there are good reasons to have an init.d/*.lua or init.lua file. The onUnload() function is necessary for me to avoid a crash upon starting a second new game in Fortbent, for example.
Title: Re: DFHack 0.40.23-r1
Post by: Dirst on January 23, 2015, 03:05:25 pm
No, there are good reasons to have an init.d/*.lua or init.lua file. The onUnload() function is necessary for me to avoid a crash upon starting a second new game in Fortbent, for example.
Sheesh I'm unclear today.  No good would come from removing the existing feature to auto-run Lua.  I was trying to clarify that a way to auto-run .init files would be helpful if mods could seamlessly add to the onload queue without physically merging the onload.init file at the root of raw.  So kind of what I said above, except that it runs each ./scripts/*.init either just before or just after the ./onload.init file.
Title: Re: DFHack 0.40.23-r1
Post by: Centigrade on January 23, 2015, 09:05:18 pm
I used reveal, saved while reveal was on, loaded the save, and now cannot unreveal. Is this intended, or is there a workaround?
Title: Re: DFHack 0.40.23-r1
Post by: cdombroski on January 23, 2015, 09:27:30 pm
I used reveal, saved while reveal was on, loaded the save, and now cannot unreveal. Is this intended, or is there a workaround?
I don't remember if it's a known bug/feature, but the workaround is to use revflood.
Title: Re: DFHack 0.40.23-r1
Post by: Centigrade on January 23, 2015, 09:44:24 pm
I used reveal, saved while reveal was on, loaded the save, and now cannot unreveal. Is this intended, or is there a workaround?
I don't remember if it's a known bug/feature, but the workaround is to use revflood.
Thanks friend! Worked as desired.
Title: Re: DFHack 0.40.24-r0
Post by: expwnent on January 23, 2015, 11:04:41 pm
New release!
Title: Re: DFHack 0.40.24-r0
Post by: Putnam on January 23, 2015, 11:38:13 pm
Why r0?
Title: Re: DFHack 0.40.24-r0
Post by: BigD145 on January 23, 2015, 11:40:18 pm
Why r0?

"Not all globals have been located yet, so this is an r0. Most plugins should work fine. The ones that do not should automatically unload themselves."
Title: Re: DFHack 0.40.24-r0
Post by: txtsd on January 24, 2015, 12:25:32 am
New release!
Post #2000! Nice!
Title: Re: DFHack 0.40.24-r0
Post by: Deon on January 24, 2015, 05:11:25 am
New release!
Yessss! Thank you!
Now I can concentrate on up-to-date modding :).
Title: Re: DFHack 0.40.24-r0
Post by: ptb_ptb on January 24, 2015, 08:35:03 am
Haha, nice timing!

I just, this morning, installed Linux under VMware just so I could use the dfhack with unofficial linux memory layout.  :P
Title: Re: DFHack 0.40.24-r0
Post by: Scruffy on January 24, 2015, 08:50:10 am
Ah. 40.24 r0.
Thanks for you hard work.
Been waiting for this before updating from 40.23
Title: Re: DFHack 0.40.24-r0
Post by: Meneth on January 24, 2015, 09:04:43 am
I'm testing on Windows, seems to work well enough. Plugins "search", "sort", "strangemood" and "zone" have missing globals.
Title: Re: DFHack 0.40.24-r0
Post by: Broseph Stalin on January 24, 2015, 11:02:18 am
Fantastic.
Title: Re: DFHack 0.40.24-r0
Post by: Abadrausar on January 24, 2015, 11:30:09 am
nanoforts  are  now  an  astonishing  and  full  featured

  possibility,  many  thanks  to  everyone  involved!
Title: Re: DFHack 0.40.24-r0
Post by: lethosor on January 24, 2015, 01:32:20 pm
I'm testing on Windows, seems to work well enough. Plugins "search", "sort", "strangemood" and "zone" have missing globals.
Are you sure those are the only ones with missing globals (not just the only ones visible in the console)?

nanoforts  are  now  an  astonishing  and  full  featured

  possibility,  many  thanks  to  everyone  involved!

What do you mean? Toady is the only one that had anything to do with the addition of that option in vanilla DF.
Title: Re: DFHack 0.40.24-r0
Post by: Evrett33 on January 24, 2015, 01:39:46 pm
why wasnt there communication with Toady prior to release of .24? to prevent month long delays in the releasing of utilities..are you guys not on speaking terms anymore?
Title: Re: DFHack 0.40.24-r0
Post by: expwnent on January 24, 2015, 01:50:55 pm
df-structures updates are, and have always been, independent of Toady.
Title: Re: DFHack 0.40.24-r0
Post by: Meneth on January 24, 2015, 02:04:17 pm
I'm testing on Windows, seems to work well enough. Plugins "search", "sort", "strangemood" and "zone" have missing globals.
Are you sure those are the only ones with missing globals (not just the only ones visible in the console)?
Those are the ones visible in the console. I didn't test anything except what gets loaded by default.
Title: Re: DFHack 0.40.24-r0
Post by: Putnam on January 24, 2015, 02:08:49 pm
why wasnt there communication with Toady prior to release of .24? to prevent month long delays in the releasing of utilities..are you guys not on speaking terms anymore?

Yeah, there was never communication with Toady prior to any release.
Title: Re: DFHack 0.40.24-r0
Post by: lethosor on January 24, 2015, 02:11:56 pm
I'm testing on Windows, seems to work well enough. Plugins "search", "sort", "strangemood" and "zone" have missing globals.
Are you sure those are the only ones with missing globals (not just the only ones visible in the console)?
Those are the ones visible in the console. I didn't test anything except what gets loaded by default.
Have you tried scrolling up?

why wasnt there communication with Toady prior to release of .24? to prevent month long delays in the releasing of utilities..are you guys not on speaking terms anymore?
I found addresses for OS X and Linux a few weeks or so ago. We were waiting for some Windows offsets, which I don't know how to find and have no way to test.
Also, I sometimes hear about releases before they happen from Toady (or when he's planning another long release cycle). That doesn't help memory research at all, as it requires an actual executable.
Title: Re: DFHack 0.40.24-r0
Post by: Meneth on January 24, 2015, 02:24:33 pm
Have you tried scrolling up?
Yes, those are the ones visible when the dfhack window is scrolled to the top. Did you expect more plugins to have problems?
Title: Re: DFHack 0.40.24-r0
Post by: Dirst on January 24, 2015, 03:34:40 pm
Yeah, there was never communication with Toady prior to any release.

I found addresses for OS X and Linux a few weeks or so ago. We were waiting for some Windows offsets, which I don't know how to find and have no way to test.
Also, I sometimes hear about releases before they happen from Toady (or when he's planning another long release cycle). That doesn't help memory research at all, as it requires an actual executable.

Would it even help to have Toady export some debugging report from his compiler to catalog the offsets?  At some level, Toady's compiler already knows where everything is.  Obviously he's under no obligation to help, but it's a much much simpler thing than the API idea that keeps coming up from time to time.
Title: Re: DFHack 0.40.24-r0
Post by: fricy on January 24, 2015, 03:36:15 pm
OSX | DFHack 0.40.24-r0 (https://www.dropbox.com/s/ldqljeus06fsjm7/dfhack-0.40.24-r0-OSX.zip?dl=0)
Title: Re: DFHack 0.40.24-r0
Post by: Putnam on January 24, 2015, 04:04:42 pm
Yeah, there was never communication with Toady prior to any release.

I found addresses for OS X and Linux a few weeks or so ago. We were waiting for some Windows offsets, which I don't know how to find and have no way to test.
Also, I sometimes hear about releases before they happen from Toady (or when he's planning another long release cycle). That doesn't help memory research at all, as it requires an actual executable.

Would it even help to have Toady export some debugging report from his compiler to catalog the offsets?  At some level, Toady's compiler already knows where everything is.  Obviously he's under no obligation to help, but it's a much much simpler thing than the API idea that keeps coming up from time to time.

Toady's been burned by things like this before (though not really with any real effects, AFAIK).

It was a long time ago, but the topic's still around (http://www.bay12forums.com/smf/index.php?topic=58796.0), so I figure it shouldn't be too odd to link to it. You may understand why Toady is wary of releasing too much.
Title: Re: DFHack 0.40.24-r0
Post by: Dirst on January 24, 2015, 04:14:18 pm
Toady's been burned by things like this before (though not really with any real effects, AFAIK).

It was a long time ago, but the topic's still around (http://www.bay12forums.com/smf/index.php?topic=58796.0), so I figure it shouldn't be too odd to link to it. You may understand why Toady is wary of releasing too much.
Can't wade through 23 pages of posts, but since DFHack is still here I'm assuming Toady is okay with it.

There are two distinct questions: (1) Is it simple for Toady to generate the dubug info at compile-time, and (2) Would this be helpful to the DFHack folks?  You need a "Hell yes!" to both of those before even broaching the subject with him.  Whatever the report is, it will almost certainly be shared privately with hand-picked people.
Title: Re: DFHack 0.40.24-r0
Post by: mifki on January 24, 2015, 04:41:47 pm
Toady's been burned by things like this before (though not really with any real effects, AFAIK).

It was a long time ago, but the topic's still around (http://www.bay12forums.com/smf/index.php?topic=58796.0), so I figure it shouldn't be too odd to link to it. You may understand why Toady is wary of releasing too much.
Can't wade through 23 pages of posts, but since DFHack is still here I'm assuming Toady is okay with it.

There are two distinct questions: (1) Is it simple for Toady to generate the dubug info at compile-time, and (2) Would this be helpful to the DFHack folks?  You need a "Hell yes!" to both of those before even broaching the subject with him.  Whatever the report is, it will almost certainly be shared privately with hand-picked people.

Full debug info would make reverse-engineering very easy - something that Toady doesn't want (and we don't need). We need only data structures, and I don't know how to export them alone.
Title: Re: DFHack 0.40.24-r0
Post by: Dirst on January 24, 2015, 04:46:36 pm
Full debug info would make reverse-engineering very easy - something that Toady doesn't want (and we don't need). We need only data structures, and I don't know how to export them alone.
That answers my question... so it's hard to export something useful without giving away everything.  That's a shame.
Title: Re: DFHack 0.40.24-r0
Post by: Seluin on January 24, 2015, 06:20:09 pm
Has start_dwarf_count not been located yet for 40.24-r0? I know it never was on 40.23. It's not working for me on Windows.
Title: Re: DFHack 0.40.24-r0
Post by: lethosor on January 24, 2015, 06:24:52 pm
Has start_dwarf_count not been located yet for 40.24-r0? I know it never was on 40.23. It's not working for me on Windows.
It's been located on OS X and Linux. I tried to locate it on Windows, but the script to do so seems to break when analyzing the 0.40.24 Windows (SDL) executable.
Title: Re: DFHack 0.40.24-r0
Post by: LeoCean on January 24, 2015, 09:04:24 pm
Has start_dwarf_count not been located yet for 40.24-r0? I know it never was on 40.23. It's not working for me on Windows.
It's been located on OS X and Linux. I tried to locate it on Windows, but the script to do so seems to break when analyzing the 0.40.24 Windows (SDL) executable.

Noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.. Hopefully it can be found on 40.25 cause that's what I'm looking most forward to.
Title: Re: DFHack 0.40.24-r0
Post by: Putnam on January 24, 2015, 09:09:48 pm
More likely 0.41.01 than 0.40.25.
Title: Re: DFHack 0.40.24-r0
Post by: Max™ on January 24, 2015, 10:22:09 pm
Hmmm, wasn't there a script to make someone into a citizen?

I reclaimed a fort with the intention of forcing moods and then retiring it to grab the artifact loot and play with it as an adventurer, but didn't remember to change the civ to the one that lost the fort, so the baroness and two consorts (? kinky) were marked as hostile but weren't doing anything. All I could think was "if I can convert them I'll get three more artifacts out of the fort!" but can't remember if I was just imagining there being a recent script for it. Something like makeown maybe?

I ended up doing it by hand with gm-editor (civ id, pop id, and cultural id swapped to the same ones as my dorfs, and set resident under flags2 to false, they show up in the unit list normally and such, though I had to add in material/item preferences as well to make them useful for mood forcing) but I could swear there was an easier way than that.
Title: Re: DFHack 0.40.24-r0
Post by: lethosor on January 24, 2015, 10:40:53 pm
tweak makeown?
Title: Re: DFHack 0.40.24-r0
Post by: Max™ on January 24, 2015, 10:50:37 pm
...and they heard a sound of thunder, as my palm slammed into my forehead with unbelievable ferocity.
Title: Re: DFHack 0.40.24-r0
Post by: se5a on January 25, 2015, 05:35:11 am
Does DFHack have any tools/plugins which might tell me whats causing a crash?
game/save/world is a couple of versions old, and updated with each new version of DF, which may be causing a problem...
Title: Re: DFHack 0.40.24-r0
Post by: Spacebat on January 25, 2015, 05:58:00 am
Good news! Quietust found the remaining offsets, now we just need expwnent to update the main repo with them.
Title: Re: DFHack 0.40.24-r0
Post by: PeridexisErrant on January 25, 2015, 06:11:48 am
Good news! Quietust found the remaining offsets, now we just need expwnent to update the main repo with them.

...Just after I spent *three hours* uploading a pack with r0. 

Awesome news nonetheless, and I'll deal with that in two days when I have a decent uplink again.
Title: Re: DFHack 0.40.24-r0
Post by: Naryar on January 25, 2015, 06:19:08 am
Whoo ! .24 is here !

All hail expwnent !
Title: Re: DFHack 0.40.24-r0
Post by: Mokkun on January 25, 2015, 12:28:55 pm
Hmm, seems that little bug I had a while back have reapeared. It seems it do not recognise targeted creature/item for commands like changeitem and gui\gm-editor, there are however no problems whit getting water in the right place whit liquids, or info from probe or cprobe. may be the same as last time?
Fresh download of Dwarf fortress 40,24 whit Phobeus graphics, and download of dfhack .40.24-r0
Win7 pro,

btw. thanks to all who works on DFhack for your work.
Title: Re: DFHack 0.40.24-r0
Post by: lethosor on January 25, 2015, 01:31:35 pm
If you're selecting the units with [k], that is to be expected. The reason that this release is named r0 is because several offsets are missing on Windows, causing many things (such as that) to fail to work properly. Quietust has located the remaining offsets, so that should work in r1.
Title: Re: DFHack 0.40.24-r0
Post by: YAHG on January 25, 2015, 01:43:59 pm
Quietust has located the remaining offsets, so that should work in r1.

O0 Boo yeah!
Title: Re: DFHack 0.40.24-r0
Post by: expwnent on January 25, 2015, 02:18:16 pm
OSX link now on github.
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 25, 2015, 02:29:45 pm
r1 is up for Windows.
Title: Re: DFHack 0.40.24-r1
Post by: Dirst on January 25, 2015, 03:05:50 pm
r1 is up for Windows.
Praise the DFHackers for their incredibly useful way of praising the Toad!
Title: Re: DFHack 0.40.24-r1
Post by: Henour on January 25, 2015, 03:09:20 pm
Is Automelt buggy for more then one automelt stockpile?

I have a furniture stockpile set to Automelt and the two Copperchests which are in it haven't been designated for melting in a year or so they have been sitting there.

The first automelt stockpile I created on the other hand works without issues....
Title: Re: DFHack 0.40.24-r1
Post by: fricy on January 25, 2015, 03:14:45 pm
OSX | DFHack 0.40.24-r1 (https://www.dropbox.com/s/h9j25bfdinqxbua/dfhack-0.40.24-r1-OSX.zip?dl=0)

I have a furniture stockpile set to Automelt and the two Copperchests
I'm pretty sure chests cannot be melted at all. Long time DF bug.  (http://dwarffortresswiki.org/index.php/23a:Known_bugs_and_issues#Unmeltable_Chests) This link is from 23a, but the bug was still in 34.11 and haven't heard from it being fixed since.
Nope. Supposed to be fixed in 40.05 (http://www.bay12games.com/dwarves/mantisbt/view.php?id=2493). Can you test chest melting without automelt?
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 25, 2015, 03:28:51 pm
OSX link now on github.
Title: Re: DFHack 0.40.24-r1
Post by: Henour on January 25, 2015, 03:40:16 pm
OSX | DFHack 0.40.24-r1 (https://www.dropbox.com/s/h9j25bfdinqxbua/dfhack-0.40.24-r1-OSX.zip?dl=0)

I have a furniture stockpile set to Automelt and the two Copperchests
I'm pretty sure chests cannot be melted at all. Long time DF bug.  (http://dwarffortresswiki.org/index.php/23a:Known_bugs_and_issues#Unmeltable_Chests) This link is from 23a, but the bug was still in 34.11 and haven't heard from it being fixed since.
Nope. Supposed to be fixed in 40.05 (http://www.bay12games.com/dwarves/mantisbt/view.php?id=2493). Can you test chest melting without automelt?
I've been marking chests for melting manually on and off for a while now. Since there are non in my smelters (and also not in the Stockpile) it seems to be working.
Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 25, 2015, 05:36:28 pm
0.40.24-r1 Linux build (http://dffd.bay12games.com/file.php?id=10495)
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 25, 2015, 06:20:43 pm
Linux build now in github.
Title: Re: DFHack 0.40.24-r0
Post by: Mokkun on January 25, 2015, 06:36:32 pm
If you're selecting the units with [k], that is to be expected. The reason that this release is named r0 is because several offsets are missing on Windows, causing many things (such as that) to fail to work properly. Quietust has located the remaining offsets, so that should work in r1.
Yupp, fixed whit the new version.
Thanks Quietust..
(Hmm, feels strange to thank someone from the Q-Contium) ;)
Title: Re: DFHack 0.40.24-r1
Post by: Vndetta on January 25, 2015, 07:22:14 pm
Is there a way to remove the Starving/Dehydrated status from a dwarf in fortress mode? Alternately, is there a way (aside from "siren") to wake a sleeping dwarf? I've saved the fort just moments before a sleeping dwarf dehydrates to death in my dining hall and I really would like to save him. Siren doesn't seem to wake him (or at least, not in time) and gm-editor is a bit confusing. I am using DFHack with v.0.23.
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 25, 2015, 07:24:39 pm
All of those things are regulated by well-named numbers in unit->counters2; that's what you should go into with gm-editor.
Title: Re: DFHack 0.40.24-r1
Post by: Max™ on January 25, 2015, 08:49:48 pm
Yup, exhaustion, sleep timer, thirst timer, hunger timer, stomach contents, stomach food, all can be rather handy for that... haven't played with vomit timer, they do that enough on their own.
Title: Re: DFHack 0.40.24-r1
Post by: notfood on January 25, 2015, 09:29:20 pm
hfs-pit.lua wasn't working, this fixes it.

Code: [Select]
diff --git a/scripts/hfs-pit.lua b/scripts/hfs-pit.lua
index 9592d0a..b9e4760 100644
--- a/scripts/hfs-pit.lua
+++ b/scripts/hfs-pit.lua
@@ -20,7 +20,7 @@ wallOff = tonumber(args[2])
 stairs = tonumber(args[3])
 
 --Get the layer of the underworld
-for index,value in ipairs(df.global.world.cur_savegame.map_features) do
+for index,value in ipairs(df.global.world.features.map_features) do
     local featureType=value:getType()
     if featureType==9 then --Underworld
         underworldLayer = value.layer
Title: Re: DFHack 0.40.24-r1
Post by: Devast on January 26, 2015, 01:07:44 am
is/will there be a way to trigger invasions?
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 26, 2015, 01:18:35 am
The short answer: It don't work no more and I have no idea how I could make it work. Armies are weird.
The long answer: ARMIES ARE WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEIRD
Title: Re: DFHack 0.40.24-r1
Post by: Rose on January 26, 2015, 01:29:20 am
On the same note...

How do we track an adventurer's position in the world?

Also is it possible to teleport the adventurer to arbitary locations?
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 26, 2015, 01:32:04 am
On the same note...

How do we track an adventurer's position in the world?

Also is it possible to teleport the adventurer to arbitary locations?

Yes, yes it is. army.unk_pos1 actually seems to represent a proper world position.

EDIT: But the adventurer apparently ceases to be a proper army the instant they leave city limits. Still, my poor adventurer ended up in a jungle halfway to the western border of a large world.
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 26, 2015, 11:30:17 am
hfs-pit.lua wasn't working, this fixes it.

Code: [Select]
diff --git a/scripts/hfs-pit.lua b/scripts/hfs-pit.lua
index 9592d0a..b9e4760 100644
--- a/scripts/hfs-pit.lua
+++ b/scripts/hfs-pit.lua
@@ -20,7 +20,7 @@ wallOff = tonumber(args[2])
 stairs = tonumber(args[3])
 
 --Get the layer of the underworld
-for index,value in ipairs(df.global.world.cur_savegame.map_features) do
+for index,value in ipairs(df.global.world.features.map_features) do
     local featureType=value:getType()
     if featureType==9 then --Underworld
         underworldLayer = value.layer

Thanks!

The short answer: It don't work no more and I have no idea how I could make it work. Armies are weird.
The long answer: ARMIES ARE WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEIRD


We don't know either. The army structs haven't been mapped out yet. Once they are we can probably do much more advanced stuff than in the old days, like choosing who comes along to fight and what equipment they have and how many of them there are, etc, etc.

On the same note...

How do we track an adventurer's position in the world?

Also is it possible to teleport the adventurer to arbitary locations?

Yes, yes it is. army.unk_pos1 actually seems to represent a proper world position.

EDIT: But the adventurer apparently ceases to be a proper army the instant they leave city limits. Still, my poor adventurer ended up in a jungle halfway to the western border of a large world.

Thanks!
Title: Re: DFHack 0.40.24-r1
Post by: Jairl on January 26, 2015, 12:13:40 pm
I seem to be plagued with dwarves standing on the build site :(

Is there a gui/gm-editor that targets buildings or otherwise a simplistic way to change the construction flag. (Assuming it is only a flag)
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 26, 2015, 12:36:20 pm
You could change the traffic designation of the build tile.
Title: Re: DFHack 0.40.24-r1
Post by: Jairl on January 26, 2015, 01:49:29 pm
I never really understood how that is suppose to work. Traffic designations don't forbid dwarves from standing in a location, they just make it unfavorable to path to it. Though, the dwarf is standing on the light green part of the screwpump so it shouldn't really matter that much. (I've also tried forcibly moving the job location but the game seems to insist something is there).

More so, hollowing out the area shows that there are two tiles that are having this issue, every other tile works fine.
Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 26, 2015, 02:01:52 pm
You could try fix/item-occupancy
Title: Re: DFHack 0.40.24-r1
Post by: Jairl on January 26, 2015, 05:09:52 pm
I still don't understand what causes it, it seems to only affect 2 particular tiles (in the surrounding area); but, for future reference, I hob-cobbled this together. Question though, why can't I call member functions using OOP notation rather than the physical notation. (I mean, I know the actual member function does include an argument to pass the member, but shouldn't lua handle this?)

local m = dfhack.gui.getSelectedBuilding()
local q = m.getMaxBuildStage(m)
m.setBuildStage(m,q)
m.flags.exists = 1
m.flags.in_update = 1

actually, now that I look closer, it isn't fully initialized still.... ugg.
Title: Re: DFHack 0.40.24-r1
Post by: mifki on January 26, 2015, 05:24:31 pm
m.getMaxBuildStage(m)  --->   m:getMaxBuildStage()
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 26, 2015, 05:42:53 pm
Also, m:setBuildStage(q) after that.
Title: Re: DFHack 0.40.24-r1
Post by: Baffler on January 26, 2015, 10:13:31 pm
Is there any way to change a dwarf's orientation? I'm trying to build a fort through natural births instead of immigration. Combined with age I only have 1 eligible couple out of 30 dwarves.
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 26, 2015, 10:14:53 pm
Yeah, check out gaydar and see how it finds orientation. It can be changed with a few flips of the boolean.
Title: Re: DFHack 0.40.24-r1
Post by: PeridexisErrant on January 26, 2015, 10:36:00 pm
How do I run a command on map load?  I want to put something like lua: dfhack.onStateChange.SC_MAP_LOADED("script commands.txt") in dfhack.init, but I have no idea what the correct command would be - or if there's a filename that would work.
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 26, 2015, 11:04:46 pm
Code: [Select]
dfhack.onStateChange.whatever=function(code)
    if code==SC_MAP_LOADED then
        dfhack.run_command('deramp') --you can replace 'deramp' with whatever
    end
end

And put that in an init.d/whatever.lua file.
Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 27, 2015, 12:31:20 am
I'm pretty sure you need "function " at the beginning of the first line.
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 27, 2015, 12:55:09 am
Yep, fixed.
Title: Re: DFHack 0.40.24-r1
Post by: Rumrusher on January 27, 2015, 05:10:22 am
The bit about adventurer is that they are technically an army, but the game doesn't make a priority like the travel system before,
so now it's an flag set on a lone single army lost in a sea of growing troops. with enough poking and head scratching you could have it set up where all the moving 'armies' are following your adventurer. or join the adventurer's group.

the idea of armies moving around while your in fort mode means there's a chance for fort mode to go borderless, and allow the player to 'scroll' from one site to another.
Title: Re: DFHack 0.40.24-r1
Post by: PeridexisErrant on January 27, 2015, 05:36:04 am
the idea of armies moving around while your in fort mode means there's a chance for fort mode to go borderless, and allow the player to 'scroll' from one site to another.

... What. Make it so.
Title: Re: DFHack 0.40.24-r1
Post by: Boltgun on January 27, 2015, 03:17:04 pm
I am trying to bring back summoning using spawnunit, finding a 0.40x version from Rumrusher. It's all fine when I run it, the creature even appear in the animal screen, sometimes. (I need to locate this screen  but nvm).

However if I save and reload, the creature becomes hostile despite belonging to the civilization. I tried comparing it with a normal pet using gm-editor but I could not figure what's different. The civ_id is right, population is set to -1 as expected.

Here's the script, it's pretty much the same that Rumrusher posted:
https://gist.github.com/Devduweb/9299841e7169445f8cce

I tried commenting the nemesis creation call but the result is the same. Any idea of how I can make sure that df remember the creature being friendly? Thanks.
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 27, 2015, 03:43:30 pm
spawnunit still has a few issues, like the one you said. Thank you for testing it, but it may take a while to fix. I'll include it in the main library once it's fully functional.
Title: Re: DFHack 0.40.19-r1
Post by: catten on January 27, 2015, 04:37:35 pm
Is it possible to get the exact material of a tile from a lua script?

Anyone? I asked before elsewhere and was ignored there too (a long time ago), could I at least get a yes or no?

I'm not sure if it is possible to get exact material (it should be, but I'm not aware how to do it). I do have a script that changes a tile to a specific inorganic (but it has some issues recognizing ramps and open grass and etc...)

The relevant code is
Code: [Select]
function findMineralEv(block,inorganic) -- Taken from Warmist's constructor.lua
 for k,v in pairs(block.block_events) do
  if df.block_square_event_mineralst:is_instance(v) and v.inorganic_mat==inorganic then
   return v
  end
 end
end
function set_vein(x,y,z,mat) -- Taken from Warmist's constructor.lua
    local b=dfhack.maps.ensureTileBlock(x,y,z)
    local ev=findMineralEv(b,mat.index)
    if ev==nil then
        ev=df.block_square_event_mineralst:new()
        ev.inorganic_mat=mat.index
        ev.flags.vein=true
        b.block_events:insert("#",ev)
    end
    dfhack.maps.setTileAssignment(ev.tile_bitmask,math.fmod(x,16),math.fmod(y,16),true)
end
function changeType(x,y,z,material,dur)
 local mat
 if material ~= 'clear' then
  mat = dfhack.matinfo.find(material)
  set_vein(x,y,z,mat)
 else
  clear_vein(x,y,z)
 end
end
You'll notice that the heart of it comes from Warmist, so he would probably be a better person to ask than me.

I've been using something similar, but ran into a problem: some tiles have more than one mineral event, and when that happens I can't tell reliably which event is the real one. For example, in one case I encountered a tile with both Red Tourmaline and Bituminous Coal mineral events, in that order, and the game rendered it as coal; another tile had both Jet and Bituminous Coal, in that order, but this time the game rendered it as jet.

How does the game decide which of several mineral events is the "real" one?

Update: I've looked at several examples now, and so far it looks like the highest-numbered material token wins. The examples above are explained by the fact that Red Tourmaline is 108, Bituminous Coal is 207, and Jet is 217.
Title: Re: DFHack 0.40.24-r1
Post by: Raidau on January 27, 2015, 11:14:22 pm
Does my function library has any chance to be included in DFHack release? I made reaction class and material reaction product lookup, subtype lookup, some other stuff... My scripts use those quite frequently and i wonder if someone else could be interested.
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 27, 2015, 11:39:35 pm
Heh, I'd just send a pull request and figure it out from there.
Title: Re: DFHack 0.40.24-r1
Post by: Max™ on January 28, 2015, 12:32:15 am
I am trying to bring back summoning using spawnunit, finding a 0.40x version from Rumrusher. It's all fine when I run it, the creature even appear in the animal screen, sometimes. (I need to locate this screen  but nvm).

However if I save and reload, the creature becomes hostile despite belonging to the civilization. I tried comparing it with a normal pet using gm-editor but I could not figure what's different. The civ_id is right, population is set to -1 as expected.

Here's the script, it's pretty much the same that Rumrusher posted:
https://gist.github.com/Devduweb/9299841e7169445f8cce

I tried commenting the nemesis creation call but the result is the same. Any idea of how I can make sure that df remember the creature being friendly? Thanks.
When I converted the inhabitants of a reclaim (due to being stupid and forgetting to check under tweak for makeown) I had to toggle flags2 > resident to false, they became friendly at that point, and after doing the civ id/cultural id/pop id to the same as my dorfs they were fully controllable.
Title: Re: DFHack 0.40.24-r1
Post by: Boltgun on January 28, 2015, 02:19:09 am
I am trying to bring back summoning using spawnunit, finding a 0.40x version from Rumrusher. It's all fine when I run it, the creature even appear in the animal screen, sometimes. (I need to locate this screen  but nvm).

However if I save and reload, the creature becomes hostile despite belonging to the civilization. I tried comparing it with a normal pet using gm-editor but I could not figure what's different. The civ_id is right, population is set to -1 as expected.

Here's the script, it's pretty much the same that Rumrusher posted:
https://gist.github.com/Devduweb/9299841e7169445f8cce

I tried commenting the nemesis creation call but the result is the same. Any idea of how I can make sure that df remember the creature being friendly? Thanks.
When I converted the inhabitants of a reclaim (due to being stupid and forgetting to check under tweak for makeown) I had to toggle flags2 > resident to false, they became friendly at that point, and after doing the civ id/cultural id/pop id to the same as my dorfs they were fully controllable.

resident was false already, cultural id of the summoner was -1 but I added a check just in case, I set population_id to the summoner's, still hostile after reload. Same with setting resident to true.

If I do tweak makeown on the already hostile creature, it stays hostile. I think there is simply something missing.

spawnunit still has a few issues, like the one you said. Thank you for testing it, but it may take a while to fix. I'll include it in the main library once it's fully functional.

Aww, I'll try poking around in case I figure it out. Otherwise I'll try playing with makeown instead.
Title: Re: DFHack 0.40.24-r1
Post by: Max™ on January 28, 2015, 08:26:52 am
Hmmm, it's fascinating that it resists the makeown script actually...
Title: Re: DFHack 0.40.24-r1
Post by: Boltgun on January 28, 2015, 01:59:05 pm
Hmmm, it's fascinating that it resists the makeown script actually...

I checked the flags that makeown edits and those were already set to false.
I also tried spawning a dog for dwarves, in case the entity caused it but the bug also happen there.

Side is is set to 0 properly, it's enemy status to -1. Since this behavior happens with and without a nemesis, I'll compare unk variables until I find something different. If not perhaps it has something to do with armies.

<insert a funny picture of succubi running in every directions from an adorable puppy>
Title: Re: DFHack 0.40.24-r1
Post by: Max™ on January 28, 2015, 04:14:45 pm
Wait, aren't there mood flags in there, I've seen a few like soldier mood and such, it isn't one of those is it?
Title: Re: DFHack 0.40.24-r1
Post by: Meph on January 28, 2015, 06:57:23 pm
Just a quick question: I'm using the newest dfhack, but if I type in "rendermax light" into the console, I just get "file not found: data/save/regionX/raw/rendermax.lua". It it not included in the current build?

I'm running PRINTMODE:TWBT and PRINTMODE:TWBT_LEGACY and in theory should be able to use rendermax.
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 28, 2015, 07:02:35 pm
It's included, but it's in the hack/raw folder instead of the standard raw folder.
Title: Re: DFHack 0.40.24-r1
Post by: Meph on January 29, 2015, 11:00:31 am
Ah, thank you, I found it.

Testing shows that my FPS go from solid 150FPS to impressive 5-8FPS when I enable it though... maybe thats my netbook? I ran it simultaniously with TWBT.

And startdwarf.rb (to pick number of starting units) and the embark points script both seem to be disfunctional with 40.x. Do updated versions exist?

The scripts look super simple:

startdwarf.rb
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'))

and

points.lua
Code: [Select]
df.global.world.worldgen.worldgen_parms.embark_points=tonumber(...)
Title: Re: DFHack 0.40.24-r1
Post by: Boltgun on January 29, 2015, 11:07:58 am
Testing shows that my FPS go from solid 150FPS to impressive 5-8FPS when I enable it though... maybe thats my netbook? I ran it simultaniously with TWBT.

It's likely that it kills FPS on a netbook even if it seemed okay otherwise.
Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 29, 2015, 11:14:04 am
startdwarf works for me in 0.40.24. Make sure you're using a version of DFHack that has the necessary offset (i.e. not r0).
Title: Re: DFHack 0.40.24-r1
Post by: Putnam on January 29, 2015, 11:16:59 am
startdwarf works for me in 0.40.24. Make sure you're using a version of DFHack that has the necessary offset (i.e. not r0).

I thought it was only found on mac/linux?
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 29, 2015, 11:27:46 am
I'm pretty sure it's missing from Windows.
Title: Re: DFHack 0.40.24-r1
Post by: Roses on January 29, 2015, 02:19:13 pm
Any idea why this is happening?

Code: [Select]
[DFHack]# tile/material-change -floor -unit 3387 -plan 5x5_X -material GOLD
C:\Users\Miles\Desktop\My_DF2\hack\lua\utils.lua:595: error: invalid arg: 1: flo
or
stack traceback:
        [C]: in function 'error'
        C:\Users\Miles\Desktop\My_DF2\hack\lua\utils.lua:595: in function 'proce
ssArgs'
        ...les\Desktop\My_DF2\hack\scripts/tile/material-change.lua:95: in main
chunk
        (...tail calls...)

I think I know what it is saying, but it doesn't make sense, since I have
Code: [Select]
validArgs = validArgs or utils.invert({
 'help',
 'plan',
 'location',
 'material',
 'dur',
 'unit',
 'floor',
 'remove'
})
local args = utils.processArgs({...}, validArgs)
In my code.
Title: Re: DFHack 0.40.24-r1
Post by: scamtank on January 29, 2015, 02:43:22 pm
I'm pretty sure it's missing from Windows.

Looking at the symbols.xml quickly it's like the only one that's outright missing, too. It's taunting us.
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 29, 2015, 02:54:02 pm
Any idea why this is happening?

Code: [Select]
[DFHack]# tile/material-change -floor -unit 3387 -plan 5x5_X -material GOLD
C:\Users\Miles\Desktop\My_DF2\hack\lua\utils.lua:595: error: invalid arg: 1: flo
or
stack traceback:
        [C]: in function 'error'
        C:\Users\Miles\Desktop\My_DF2\hack\lua\utils.lua:595: in function 'proce
ssArgs'
        ...les\Desktop\My_DF2\hack\scripts/tile/material-change.lua:95: in main
chunk
        (...tail calls...)

I think I know what it is saying, but it doesn't make sense, since I have
Code: [Select]
validArgs = validArgs or utils.invert({
 'help',
 'plan',
 'location',
 'material',
 'dur',
 'unit',
 'floor',
 'remove'
})
local args = utils.processArgs({...}, validArgs)
In my code.

I think I know what's happening. You need to exit and restart DF or temporarily add 'validArgs = nil' to your script.

DFHack keeps track of the global variables of each script. They persist even if you change the script. I suspect you added the floor option while DFHack was running, so the 'validArgs or ...' returns validArgs because validArgs isn't nil.
Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 29, 2015, 03:02:04 pm
startdwarf works for me in 0.40.24. Make sure you're using a version of DFHack that has the necessary offset (i.e. not r0).

I thought it was only found on mac/linux?
Quietust found it for 0.40.24 on Windows but apparently nobody added it to symbols.xml. Should be 0xB4C833.
Title: Re: DFHack 0.40.24-r1
Post by: Meph on January 29, 2015, 03:07:53 pm
So I add this to it?

Code: [Select]
        <vtable-address name='start_dwarf_count' value='0xB4C833'/>
Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 29, 2015, 03:11:45 pm
No, it's a global (and already has a line in symbols.xml). Find the start_dwarf_count line for Windows (here (https://github.com/DFHack/df-structures/blob/master/symbols.xml#L217)) and add the offset to it.
Title: Re: DFHack 0.40.24-r1
Post by: Meph on January 29, 2015, 03:19:36 pm
I did, looks like this now:

Code: [Select]
        <global-address name='start_dwarf_count' value='0xB4C833'/>
But doesnt work. Still have 7 embark units.
Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 29, 2015, 03:27:17 pm
What's the output of ":lua ~dfhack.internal.getAddress('start_dwarf_count')"?
Title: Re: DFHack 0.40.24-r1
Post by: scamtank on January 29, 2015, 03:27:56 pm
Please, Meph. This isn't hard!

(http://i.imgur.com/GQBXbJp.png)
Title: Re: DFHack 0.40.24-r1
Post by: Meph on January 29, 2015, 03:30:55 pm
Neat. :)

Could you please post the line in symbols.xml, or whatever else you changed?

PS: I personally prefer RAWs. :P
Title: Re: DFHack 0.40.24-r1
Post by: scamtank on January 29, 2015, 03:33:17 pm
There's absolutely nothing weird about it. Symbols.xml in the \hack directory, the section right underneath the big evil Windows flag.

Code: [Select]
...
        <global-address name='save_on_exit' value='0x1839D92'/>

        code

        <global-address name='start_dwarf_count' value='0xB4C833'/>

        generated standingorders

        <global-address name='standing_orders_gather_minerals' value='0x00e80e64'/>
...
Title: Re: DFHack 0.40.24-r1
Post by: Meph on January 29, 2015, 03:50:15 pm
Ah, found my mistake. There are 4 entries of start_dwarf_count, while I only changed one of them. Fixed now, works. Thanks for the help and the patience.
Title: Re: DFHack 0.40.24-r1
Post by: fricy on January 29, 2015, 03:55:36 pm
Ah, found my mistake. There are 4 entries of start_dwarf_count, while I only changed one of them. Fixed now, works. Thanks for the help and the patience.
Well, you need to change only one of them, but it needs to be the correct one. The others are for Linux and Mac.
Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 29, 2015, 04:00:04 pm
Ah, found my mistake. There are 4 entries of start_dwarf_count, while I only changed one of them. Fixed now, works. Thanks for the help and the patience.
Well, you need to change only one of them, but it needs to be the correct one. The others are for Linux and Mac.
There's also one in the commented-out section at the start of the file.
Title: Re: DFHack 0.40.24-r1
Post by: Meph on January 29, 2015, 04:05:33 pm
HAhahahaaa.... *dies

So I just broke startdwarf on mac and linux. :D (no worries, I know how to fix it now)
Title: Re: DFHack 0.40.24-r1
Post by: Gorobay on January 29, 2015, 04:56:42 pm
Given a unit, how can I determine what site they live in?
Title: Re: DFHack 0.40.24-r1
Post by: YAHG on January 29, 2015, 05:04:43 pm
Spoiler (click to show/hide)

Sweet thanks, I got it working now and I feel pretty damn cool about it too :).
Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 29, 2015, 09:06:37 pm
Please, Meph. This isn't hard!

Spoiler (click to show/hide)
By the way, what's displaying the "reshape_graphics" line in that screenshot? (TwbT?)
Title: Re: DFHack 0.40.24-r1
Post by: PeridexisErrant on January 29, 2015, 09:41:57 pm
Yep.
Title: Re: DFHack 0.40.24-r1
Post by: Raidau on January 30, 2015, 12:56:06 am
Given a unit, how can I determine what site they live in?

Such information is stored inside historical figure object, not unit (unit has a reference to HF). But I am not sure if there is real data there, because when I check my dwarves they all have no site_links. Maybe its all about sites themselves, not HFs
Title: Re: DFHack 0.40.24-r1
Post by: Nopenope on January 30, 2015, 03:52:55 am
Is rendermax compatible with twbt as of .40.24r1? Ils it normal that the dfhack console should hang whenever I attempt to enable rendermax?
Title: Re: DFHack 0.40.24-r1
Post by: PeridexisErrant on January 30, 2015, 04:49:44 am
Is rendermax compatible with twbt as of .40.24r1? Ils it normal that the dfhack console should hang whenever I attempt to enable rendermax?

No, they're not compatible (since both replace the renderer).  I don't know what "normal" behavior might be, but I'd expect hanging or crashes.
Title: Re: DFHack 0.40.24-r1
Post by: Meph on January 30, 2015, 05:06:06 am
Are you sure? I had both running at the same time. FPS went rock bottom, but both multilevel and lightning showed correctly.
Title: Re: DFHack 0.40.24-r1
Post by: fricy on January 30, 2015, 05:20:06 am
Is rendermax compatible with twbt as of .40.24r1? Ils it normal that the dfhack console should hang whenever I attempt to enable rendermax?
No, they're not compatible (since both replace the renderer).  I don't know what "normal" behavior might be, but I'd expect hanging or crashes.

They are compatible in theory. In reality on 40.24 TWBT mode crashes (at least on osx), and TWBT_LEGACY is slow as hell.
Title: Re: DFHack 0.40.24-r1
Post by: Meph on January 30, 2015, 05:31:24 am
I'm on Win7, TWBT_LEGACY. It runs fine without Rendermax, both together are slow. But no crashes.
Title: Re: DFHack 0.40.24-r1
Post by: Gorobay on January 30, 2015, 01:55:22 pm
Given a unit, how can I determine what site they live in?

Such information is stored inside historical figure object, not unit (unit has a reference to HF). But I am not sure if there is real data there, because when I check my dwarves they all have no site_links. Maybe its all about sites themselves, not HFs
Some units have a hist_figure_id of -1. I guess for those I can assume they live in the currently loaded site, but how can I determine what site is currently loaded?
Title: Re: DFHack 0.40.24-r1
Post by: Warmist on January 30, 2015, 03:10:11 pm
Given a unit, how can I determine what site they live in?

Such information is stored inside historical figure object, not unit (unit has a reference to HF). But I am not sure if there is real data there, because when I check my dwarves they all have no site_links. Maybe its all about sites themselves, not HFs
Some units have a hist_figure_id of -1. I guess for those I can assume they live in the currently loaded site, but how can I determine what site is currently loaded?
I'm not sure how it's determined from UNIT side but from site side there are two ways: either it's in list of historical figure or it's in population. Population is non-important unit list, usually race, caste and num of units (e.g. number of crows in site).
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 30, 2015, 03:45:50 pm
All of your dwarves should be histfigs. Invaders and merchants might not be, unless there was a recent change to that.
Title: Re: DFHack 0.40.24-r1
Post by: Gorobay on January 30, 2015, 05:11:40 pm
All of your dwarves should be histfigs. Invaders and merchants might not be, unless there was a recent change to that.
I should have specified: I am dealing with adventurer mode.

I'm not sure how it's determined from UNIT side but from site side there are two ways: either it's in list of historical figure or it's in population. Population is non-important unit list, usually race, caste and num of units (e.g. number of crows in site).
How can I determine the currently loaded site, so I know what site to get all that information from?
Title: Re: DFHack 0.40.24-r1
Post by: expwnent on January 30, 2015, 09:40:41 pm
Ah, ok. In adventure mode many units are non-histfigs. Talking to them may or may not be enough to make them histfigs. The threshold to become historical is very low.
Title: Re: DFHack 0.40.24-r1
Post by: Max™ on January 31, 2015, 08:25:35 am
We're talking "In Hematite 110, Soandso McUnimportant settled in Somewhere." type of low here btw.
Title: Re: DFHack 0.40.24-r1
Post by: Gorobay on January 31, 2015, 05:23:33 pm
Is it even possible to know what site is currently loaded?
Title: Re: DFHack 0.40.24-r1
Post by: Vivalas on January 31, 2015, 10:15:37 pm
Is there a way to disable the happiness counter in the bottom right? In older versions it was usefull, but now I feel it kind of cheating given the obscurity of dwarf's "stress" levels in 0.40.


Title: Re: DFHack 0.40.24-r1
Post by: lethosor on January 31, 2015, 10:27:13 pm
Is there a way to disable the happiness counter in the bottom right? In older versions it was usefull, but now I feel it kind of cheating given the obscurity of dwarf's "stress" levels in 0.40.
Are you saying that you think using the happiness monitor is cheating, or that the happiness monitor is "cheating" to display its values? Also, stress levels are in no way more obscure than the previous happiness values - neither of them are directly accessible in vanilla DF, while both are accessible with utilities. (It's easier to determine a range of possible happiness values in vanilla DF, but the thoughts and preferences screen also provides information about stress, albeit less straightforward.)
I've been meaning to allow dwarfmonitor's UI components to be enabled/disabled individually (more for the purpose of minimizing UI clutter), but haven't gotten around to it yet.
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on January 31, 2015, 11:41:18 pm
New release! It's quite soon after r1 but there's a lot of new work done so check the news in the front post!
Title: Re: DFHack 0.40.24-r2
Post by: Roses on January 31, 2015, 11:53:05 pm
Has reaction-trigger been updated to include reagents and products?
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on January 31, 2015, 11:55:18 pm
No, but it's close. The old LUA_HOOK system no longer requires the LUA_HOOK prefix on buildings so I just have to write reaction-product-trigger and it'll be done.

It does have multiline command in .init files and it does have the new all-in-one script / module system.

Linux (gcc 4.9.2) and Mac OSX versions are now on github.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 01, 2015, 06:43:16 pm
A GCC 4.5 build for Linux is also up on Github (https://github.com/DFHack/dfhack/releases/tag/0.40.24-r2) now.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 01, 2015, 08:51:43 pm
I'm investigating a strange add-spatter crash that occurs when loading any save. Has anyone else noticed this in DFHack 0.40.24-r2?
Edit: It seems to be an eventful crash, actually. Expwnent is investigating.

Edit 2: A fixed plugin for OS X has been added to the release on Github. OS X users should download "add-spatter.plug.dylib" in addition to the DFHack bundle and replace hack/plugins/add-spatter.plug.dylib with it. It isn't clear if this bug affects other platforms or not, but it's a fairly longstanding issue. It likely only showed up in this release due to a strange compiler coincidence, but if there are additional reports of this happening (especially on other platforms), we may put up a new release tomorrow.
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on February 02, 2015, 06:10:02 am
Just a thought. With the new script_environment calls, is it possible to create a fluid interface to mimic objects? A sort of "return this" that return the environment?

Something that would allow a syntax like this:
Code: [Select]
dfhack.script_environment('add-thought')
    .setTought(x)
    .setSeverity(10)
    .addEmotionToUnit(u)

Otherwise it's really convenient, if it wasn't for the speech files, an entire mod would be contained in a save.

By the way, will LUA_HOOK be deprecated or will it still be supported?
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on February 02, 2015, 06:17:15 am
wouldn't it be better to use named arguments?
Code: [Select]
dfhack.script_environment('add-thought'){ thought=x, severity=10, unit=u}
seriously why add some strange state-object that has no clear use?

Edit: also this could be simplified to:
Code: [Select]
dfhack.script_environment['add-thought']{ thought=x, severity=10, unit=u}
of for names without "-" and other non-programmer friendly symbols:
Code: [Select]
dfhack.script_environment.thoughts{ thought=x, severity=10, unit=u}
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on February 02, 2015, 06:39:04 am
wouldn't it be better to use named arguments?
Code: [Select]
dfhack.script_environment('add-thought'){ thought=x, severity=10, unit=u}
seriously why add some strange state-object that has no clear use?

Edit: also this could be simplified to:
Code: [Select]
dfhack.script_environment['add-thought']{ thought=x, severity=10, unit=u}
of for names without "-" and other non-programmer friendly symbols:
Code: [Select]
dfhack.script_environment.thoughts{ thought=x, severity=10, unit=u}

Yes, that's the kind of syntax I was looking for. Features are getting more complex with df updates and we're having functions calls that are more difficult to write properly, let alone debug.
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on February 02, 2015, 06:50:17 am
Imo we need debugger support for lua going forwards. For that we need sockets lib i think and then you can integrate it into zerobrane studio.

Looks simple but it might not be but i think adding this to some big todo list might be smart.
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on February 02, 2015, 03:09:46 pm
Just in case anyone's confused by that syntax:

function{a=b,c=d}

is exactly equal to

function({a=b,c=d})

it's just a shortcut
Title: Re: DFHack 0.40.24-r2
Post by: Roses on February 04, 2015, 01:07:01 am
Question about items.

1. If an item is part of a stack, is each part of the stack its own item, or is the stack itself just a single item? For example, if a unit is carrying 25 arrows, is it 25 distinct items (in terms of df.global.world.item.all) or is it one item that when a unit fires generates another item?
2. When using dfhack.items.moveToGround(), are the correct flags turned true/false? What I mean is if an item is in a container in a units inventory and I use that dfhack command will it be removed from the container and the inventory correctly?
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on February 04, 2015, 01:10:20 am
Question about items.

1. If an item is part of a stack, is each part of the stack its own item, or is the stack itself just a single item? For example, if a unit is carrying 25 arrows, is it 25 distinct items (in terms of df.global.world.item.all) or is it one item that when a unit fires generates another item?
2. When using dfhack.items.moveToGround(), are the correct flags turned true/false? What I mean is if an item is in a container in a units inventory and I use that dfhack command will it be removed from the container and the inventory correctly?
1. Stack is one item. I.e. all items have quantity (or amount) field. Except bodyparts, those are tricky...
2. yes. though i had some experience where it failed to move it at all. Forget when, maybe when moving out of the building or something... Then "remove item" withouot uncategorize and moveToGround worked.
Title: Re: DFHack 0.40.24-r2
Post by: Roses on February 04, 2015, 04:02:24 am
1. Hmm, that makes it a little more difficult. I am trying to update my projectile script with the option of using held items instead of creating them from scratch. I suppose I will have to check if the item is in a stack, generate a new item of the same type if it is, and lower the stack count by one. Would have been so much easier if they were all single items.
2. I did have a small issue with moving an item out of a building, but I just set the flag to false manually and it solved the issue. As long as it takes the item out of containers/inventory correctly, thats all I need for now.
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on February 04, 2015, 04:21:43 am
1. Hmm, that makes it a little more difficult. I am trying to update my projectile script with the option of using held items instead of creating them from scratch. I suppose I will have to check if the item is in a stack, generate a new item of the same type if it is, and lower the stack count by one. Would have been so much easier if they were all single items.
2. I did have a small issue with moving an item out of a building, but I just set the flag to false manually and it solved the issue. As long as it takes the item out of containers/inventory correctly, thats all I need for now.
1. yeah a lot of my ideas would be easier if it was split items. Maybe somebody should add split/combine functions in the items module now that we can sort-of create items...
2. It's better to remove and move then to mess with flags. Sometimes they are cached in strange places and either it will crash later or just leave parts of it somewhere thus growing each time it's used. For exactly what happens you should see the source code though.
Title: Re: DFHack 0.40.24-r2
Post by: Roses on February 04, 2015, 02:02:31 pm
1. yeah a lot of my ideas would be easier if it was split items. Maybe somebody should add split/combine functions in the items module now that we can sort-of create items...
2. It's better to remove and move then to mess with flags. Sometimes they are cached in strange places and either it will crash later or just leave parts of it somewhere thus growing each time it's used. For exactly what happens you should see the source code though.
1. I'll see what I can put together, but it will probably just start out as a hack for my script that can be expanded to something more robust.
2. So you are saying use dfhack.items.remove(item, no_uncat) and then use dfhack.items.moveToGround()?
New Question!
3. How does dfhack.items.createItem() work? Specifically, does it put the item on the map or does dfhack.items.moveToGround() need to be called after to actually get the item into the game world?
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on February 04, 2015, 02:07:45 pm
1. yeah a lot of my ideas would be easier if it was split items. Maybe somebody should add split/combine functions in the items module now that we can sort-of create items...
2. It's better to remove and move then to mess with flags. Sometimes they are cached in strange places and either it will crash later or just leave parts of it somewhere thus growing each time it's used. For exactly what happens you should see the source code though.
1. I'll see what I can put together, but it will probably just start out as a hack for my script that can be expanded to something more robust.
2. So you are saying use dfhack.items.remove(item, no_uncat) and then use dfhack.items.moveToGround()?
New Question!
3. How does dfhack.items.createItem() work? Specifically, does it put the item on the map or does dfhack.items.moveToGround() need to be called after to actually get the item into the game world?
2. i would try using it and if any moveToXXXX() returns false then consider first doing dfhack.items.remove(item,true)
3. put on ground by the feet for target unit.
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on February 04, 2015, 03:41:05 pm
I think I identified what the vector "world_unk_90" does.

It's a big pile of coordinates, each describing a 12x12 square somewhere on the map. Each one is set perfectly over a murky pool. These squares can overlap. I can see at least one square having willows grow outside it, so it's probably not a straight "plants with [WET] can grow in these zones" listing caused by the presence of pools.

Spoiler (click to show/hide)

Here are the first few I plotted out. The coordinates point to the corners only, but I painted out the whole squares for visibility.
Title: Re: DFHack 0.40.24-r2
Post by: Roses on February 04, 2015, 04:23:47 pm
1. yeah a lot of my ideas would be easier if it was split items. Maybe somebody should add split/combine functions in the items module now that we can sort-of create items...
1. I'll see what I can put together, but it will probably just start out as a hack for my script that can be expanded to something more robust.

It's not really elegant, and certainly not universal, but this seems to do the trick for me.
Code: [Select]
   if item.stack_size == 1 then
    dfhack.items.moveToGround(item,{locSource.x,locSource.y,locSource.z+height})
   else
    item.stack_size = item.stack_size - 1
item = dfhack.items.createItem(itemType,itemSubtype,item.mat_type,item.mat_index,dfhack.items.getHolderUnit(item))
dfhack.items.moveToGround(item,{locSource.x,locSource.y,locSource.z+height})
   end
  end
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on February 05, 2015, 12:14:34 am
I think I identified what the vector "world_unk_90" does.

It's a big pile of coordinates, each describing a 12x12 square somewhere on the map. Each one is set perfectly over a murky pool. These squares can overlap. I can see at least one square having willows grow outside it, so it's probably not a straight "plants with [WET] can grow in these zones" listing caused by the presence of pools.
<..>

Wet plants can grow in [WET] biomes, so that is totally different. I think it's regions where water can collect when it rains IF it lands on murky pool.
Title: Re: DFHack 0.40.24-r2
Post by: Meph on February 05, 2015, 12:07:59 pm
They also grow next to rivers, ponds, underground ponds and unterwater in underground ponds.
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on February 05, 2015, 12:23:38 pm
I figured it was more along the lines of "box where worldgen is allowed to generate an organic-shaped pit with a MURKY_POOL bottom", but at least there's some sort of label now.

I've been looking at "world_unk_3c" too. Its coordinates mark single tiles with contaminants, but it's inconsistent. On one map it's four patches of cave blob fluid in the deepest reaches of the caverns, on the other it's a slew of bloodstains and dustings of mud in corridors and canals. The DFHack tile cleaning tools don't seem to touch the vector.
Title: Re: DFHack 0.40.24-r2
Post by: ptb_ptb on February 05, 2015, 12:59:53 pm
Hey there, I've got a weird bug that appears to be related to dfhack (although I can't see how).

http://www.bay12games.com/dwarves/mantisbt/view.php?id=8787

Some time into a fortress puppies stopped being born, and surface animals stopped arriving at the fortress. That went on for nine years. Then I disabled dfhack (by renaming SDLreal.dll as SDL.dll) and a short while later I'm getting puppies again. Seems a bit unlikely for a coincidence, any ideas?
Title: Re: DFHack 0.40.24-r2
Post by: Centigrade on February 06, 2015, 05:26:46 am
How do you change a soil layer with DF hack?

changelayer BLACK_SAND yields: No such material!

I have tried every variation I can think of: SAND, SOIL_SAND, SOIL_BLACK_SAND, SAND_BLACK, and I keep getting the same message.

Related to this, is there actual documentation for DFhack and the various arguments (mostly material IDs) that it can use somewhere? The writeup on github is nice, but does not cover everything.
Title: Re: DFHack 0.40.24-r2
Post by: Rose on February 06, 2015, 06:03:49 am
Have you tried INORGANIC:BLACK_SAND?
Title: Re: DFHack 0.40.24-r2
Post by: se5a on February 06, 2015, 02:39:08 pm
Is tree autochop supposed to be working properly in 40.24?
I've got a burrow set up and designated, but it appears to be chopping the whole map.

actually, never mind. I may have inadvertently hit (d)esignate now before I'd hit enter on the burrow. 
Title: Re: DFHack 0.40.24-r2
Post by: Centigrade on February 06, 2015, 07:08:22 pm
Have you tried INORGANIC:BLACK_SAND?

Neither that nor INORGANIC:SAND_BLACK yield any result, nor should they given that the examples given in the writeup on GitHub all use the material name without the preface of INORGANIC; e.g., quoting directly from said writeup:

Quote
Examples:

changelayer GRANITE
Convert layer at cursor position into granite.
changelayer SILTY_CLAY force
Convert layer at cursor position into clay even if it's stone.
changelayer MARBLE all_biomes all_layers
Convert all layers of all biomes which are not soil into marble.

So what is the argument for sand?
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on February 06, 2015, 07:15:28 pm
Hey, I'm dragging myself through Cheat Engine to breathe some life back into the weaponrack-unassign binpatch and I could use some help.

I've been running v34.11 and v40.24 side by side and triggering the bug to see what makes it happen to the squad vectors, and I think I found it. The problem is, I have no idea how to reconcile these opcode glyphs and hex runes with what I'm looking at in angavrilov's original patch .dif.

The hex addresses that the patch file says are the problem (and this thing works when applied, I tried) aren't the ones I'm looking at in the disassembly, the ones that I can disable to make the problem go away in the new version. What am I missing here?
Title: Re: DFHack 0.40.24-r2
Post by: LeoCean on February 06, 2015, 08:15:25 pm
Have you tried INORGANIC:BLACK_SAND?

Neither that nor INORGANIC:SAND_BLACK yield any result, nor should they given that the examples given in the writeup on GitHub all use the material name without the preface of INORGANIC; e.g., quoting directly from said writeup:

Quote
Examples:

changelayer GRANITE
Convert layer at cursor position into granite.
changelayer SILTY_CLAY force
Convert layer at cursor position into clay even if it's stone.
changelayer MARBLE all_biomes all_layers
Convert all layers of all biomes which are not soil into marble.

So what is the argument for sand?

I just tested it and changelayer SAND_BLACK works so either you didn't actually use that command like you said on the last page or 40.24 doesn't have it working? I don't want to redownload 40.24 to test that, so see if it works.. You will find the soil/ stone types in inorganic_stone_Name.txt

For a reference I clicked on the soil then alt tabbed to dfhack and used that command, maybe you did it differently? By mousing over it? Which may work, I'm already done testing it so...
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on February 06, 2015, 08:19:05 pm
Neither, sometimes the layer is just... somewhere else. It's confounding.
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on February 07, 2015, 01:14:32 pm
I'm pretty sure I managed to realign the weaponrack-unassign binary patch.

You make the old changes (8B 8C 24 80 00 00 00 >> 89 C1 90 90 90 90 90) not in 0x4C05C4 and 0x4C06A1, but rather 0x5BF984 and 0x5BFA61. I've tested it and it seems to be working fine, gui/rack-assign isn't losing its settings anymore and nothing else sounds like it's exploding either.
Title: Re: DFHack 0.40.24-r2
Post by: Centigrade on February 08, 2015, 06:01:26 am
Have you tried INORGANIC:BLACK_SAND?

Neither that nor INORGANIC:SAND_BLACK yield any result, nor should they given that the examples given in the writeup on GitHub all use the material name without the preface of INORGANIC; e.g., quoting directly from said writeup:

Quote
Examples:

changelayer GRANITE
Convert layer at cursor position into granite.
changelayer SILTY_CLAY force
Convert layer at cursor position into clay even if it's stone.
changelayer MARBLE all_biomes all_layers
Convert all layers of all biomes which are not soil into marble.

So what is the argument for sand?

I just tested it and changelayer SAND_BLACK works so either you didn't actually use that command like you said on the last page or 40.24 doesn't have it working? I don't want to redownload 40.24 to test that, so see if it works.. You will find the soil/ stone types in inorganic_stone_Name.txt

For a reference I clicked on the soil then alt tabbed to dfhack and used that command, maybe you did it differently? By mousing over it? Which may work, I'm already done testing it so...

Got it to work. It was either an issue with capitalisation or the cursor. Thanks!

Is it possible to paint specific sand tiles with tiletypes? I want to paint sand or clay where there exists stone.
Title: Re: DFHack 0.40.24-r2
Post by: Snergler on February 08, 2015, 02:32:56 pm
So I just installed DFHack 0.40.24-r2, and I keep crashing when I Create New World, Design New World w/ Adv Parameters, or start Object Testing Arena. It Quits cleanly. Both df and dfhack directories are vanilla and for OSX. I'm running OSX 10.9.5, and have installed XQuartz 2.7.7 (xorg-server 1.15.2)
DFHack 0.40.24-r1 runs fine w/ this same setup.
I don't have any idea what is wrong... If anybody is interested here is the stderr.log       ...I don't know if it helps
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r2
Post by: fricy on February 08, 2015, 03:16:32 pm
So I just installed DFHack 0.40.24-r2, and I keep crashing when I Create New World, Design New World w/ Adv Parameters, or start Object Testing Arena. It Quits cleanly. Both df and dfhack directories are vanilla and for OSX. I'm running OSX 10.9.5, and have installed XQuartz 2.7.7 (xorg-server 1.15.2)
DFHack 0.40.24-r1 runs fine w/ this same setup.
Hmm, could be the add-spatter crash that lethosor mentioned earlier, I'm not sure it's been fixed in the upload. You could try Macnewbie, I used my own build.
EDIT: easier changing the fixed plugin: https://github.com/DFHack/dfhack/releases/download/0.40.24-r2/add-spatter.plug.dylib
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on February 08, 2015, 03:21:13 pm
I think I managed to resuscitate the fix-armory plugin. Substituting the deprecated "StoreItemInCabinet/Chest" jobs for StoreOwnedItem and StoreItemInHospital seem to work, targeting cabinets and chests correctly. Weapon racks and armor stands work as well as they ever did.

The next problem is with the armor stand capacity patch. I'm not confident about reclaiming some other region of CC CC CC CC padding for directions, since the old "empty lots" just aren't there anymore.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 08, 2015, 04:04:15 pm
I think I managed to resuscitate the fix-armory plugin. Substituting the deprecated "StoreItemInCabinet/Chest" jobs for StoreOwnedItem and StoreItemInHospital seem to work, targeting cabinets and chests correctly. Weapon racks and armor stands work as well as they ever did.
Could you make a pull request for this?

The next problem is with the armor stand capacity patch. I'm not confident about reclaiming some other region of CC CC CC CC padding for directions, since the old "empty lots" just aren't there anymore.
If it's possible, it would be nice to implement this as a tweak instead. Binary patches can be difficult to maintain across DF versions (not to mention not portable between platforms). What exactly does that patch do?
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on February 08, 2015, 04:22:05 pm
I'll look up what that means, first. I don't have a github account seeing as how I can't code in any significant manner.

The binpatch is here on Pastebin with all the significant details. (http://pastebin.com/Cxqd0GTh) Without going into opcodes, I think this is the best description of what it does:

Quote from: ag
basically:

+ int allowed_count = 1; // to mean 2
  ...
- if (type(item) == new_type)
+ if (type(item) == new_type && --allowed_count < 0)
    return false;

to allow up to two items of the same type at the same time

It's a bit more involved than just neutering some code like the weaponrack-unassign one.
Title: Re: DFHack 0.40.24-r2
Post by: Snergler on February 08, 2015, 04:34:23 pm
Hmm, could be the add-spatter crash that lethosor mentioned earlier, I'm not sure it's been fixed in the upload. You could try Macnewbie, I used my own build.
EDIT: easier changing the fixed plugin: https://github.com/DFHack/dfhack/releases/download/0.40.24-r2/add-spatter.plug.dylib
That fixed it!(the plugin) ...guess I should of read through the thread... Thanx a bunch fricy!
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 08, 2015, 05:09:11 pm
I'll look up what that means, first. I don't have a github account seeing as how I can't code in any significant manner.
Does this (https://github.com/DFHack/dfhack/pull/543/files) look right?
Edit: Evidently I forgot to check for new notifications before submitting that.
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on February 08, 2015, 05:28:38 pm
Heh, forgot the CMake switch.

Using the hospital restock job is kinda janky, but CheckChest wouldn't do anything for the flasks and using StoreOwnedItem for box-goods as well was inconsistent. I'm sure there's room to improve.
Title: Re: DFHack 0.40.24-r2
Post by: Oriolous on February 08, 2015, 06:08:40 pm
Does the createitem command make dwarf size armors and weapons? I want to try and make a demigod to reach proper heroic status by using adamantine weapons and armor, but since I don't know if dwarves can get createitem things...
Title: Re: DFHack 0.40.24-r2
Post by: Hesperid on February 09, 2015, 12:39:45 am
Well any way you create an item, you can simply change its attributes to make it small with the gm-editor.

By setting the created_by_civilization variable to one that has small creatures, the armors seem to become small. I don't really know why :P
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on February 10, 2015, 10:50:12 am
okay trying to learn what makes the new wait command tick and so far found it's a combination of idle settings on top of making the unit an army personally made to wait in one spot.
so uhh dfhacking a unit into a new army so they can wait would seem like a bigger headache so I decided it's easier to get dfhack to automate conversations or just write a script that would transfer units from one army to another.
also the wait command makes a new army for both the waited troops and the adventurer and pops up at the bottom.

need to figure out what causes an army routes to happen and we might have a common foothold on what makes armies tick.
Title: Re: DFHack 0.40.24-r2
Post by: ptb_ptb on February 11, 2015, 06:40:11 am
I've been having a lot of trouble trying to get multiple retired adventurers to migrate to a fortress in a reasonable time.

As an alternative, is it possible to do some sort of bodyswap thing to switch one unremarkable fortress-embark dwarf with one retired (non-migrant) adventurer dwarf? Or is there any way to influence which dwarves arrive in a migration wave?
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on February 11, 2015, 09:52:58 am
I've been having a lot of trouble trying to get multiple retired adventurers to migrate to a fortress in a reasonable time.

As an alternative, is it possible to do some sort of bodyswap thing to switch one unremarkable fortress-embark dwarf with one retired (non-migrant) adventurer dwarf? Or is there any way to influence which dwarves arrive in a migration wave?
oh yeah adventurers if they don't rest at the site first will move to their first resting place.  the game tends to move around people frequently and if you say play any of your dwarves in adventure mode do expect them to bug off to some local site when you unretire the fort.

But all you need to do for getting adventurers playable in dwarf fortress is to use makeown or manually set their civ ids to the fort civ(another dwarf citizen will help with this) then remove the is resident flag.
there no bodyswapping needed though do know this is if you get said adventurer on the site.
Title: Re: DFHack 0.40.24-r2
Post by: ptb_ptb on February 11, 2015, 11:48:29 am
Hmm, the retired adventurers I used 'tweak makeown' on can't be selected for any jobs in the noble screen.
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on February 12, 2015, 02:27:33 pm
Hmm, the retired adventurers I used 'tweak makeown' on can't be selected for any jobs in the noble screen.
yeah that's the major problem with the current discovery is that it's pretty hard to figure out how to make those guys pop up in nobles, though I do remember warmist making a script called tofort which slaps the adventurer as a mayor of the site then also switches to fort mode.
edit: well then
(http://www.truimagz.com/host/fortcrush2/de/wait-thats-a-civ.png)
looks like Angels are a civ?
Spoiler (click to show/hide)
need to figure out how to make these sites okay for reclaim and retire...
Title: Re: DFHack 0.40.24-r2
Post by: Hurkyl on February 12, 2015, 05:09:13 pm
I found a bug in the Sand indicator -- it told me a region had sand, but as far as I can tell it only has sandy loam. :(
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 12, 2015, 05:15:51 pm
Have you made any modifications to the raws? Is there any sand listed by "prospect all"?
Title: Re: DFHack 0.40.24-r2
Post by: Hurkyl on February 12, 2015, 07:13:58 pm
Have you made any modifications to the raws? Is there any sand listed by "prospect all"?
I hadn't changed anything other than what the LNP launcher can do. I didn't think to try prospect to check for sand; I wish I hadn't deleted the save now so I could help debug. :(
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on February 13, 2015, 10:42:47 am
Have you made any modifications to the raws? Is there any sand listed by "prospect all"?
I hadn't changed anything other than what the LNP launcher can do. I didn't think to try prospect to check for sand; I wish I hadn't deleted the save now so I could help debug. :(
According to the source code, embark-tools watches for any material tokens that started with "SAND_", and the underscore should have excluded sandy loam.
Title: Re: DFHack 0.40.24-r2
Post by: utunnels on February 13, 2015, 07:19:40 pm
For some reason I can no longer search worn out items in trading menu. Typing x has no effect.
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on February 13, 2015, 07:58:09 pm
Some more basic structure stuff that's unlabeled for some reason.

world.entities.historical_entity.entity_raws.anon1 is the entity type as per the order in the raws, 0-5 corresponding to dwarves, elves, humans, goblins, kobolds and cave furries by default. The divine guardian entities start from 6 and go onward from there.

I don't know what anon2 means yet exactly, but each one of the above types seems to have its own series of 32-bit integers, identical to the letter. My dwarves have the longest one at 1008 entries, followed by humans at 491, elves and goblins at 292 & 235 and finished by kobolds and cave tribals at 112 and 97 respectively. Divine guardians are the shortest with only 27 integers, but each one seems to have its own specific unique contents despite the identical length.

e: well, duh. My LAYER_LINKED entity raws are exactly 97 lines long discounting the ENTITY:xyz headline and Toady's comments. Each integer corresponds to a line of text in the raws.
Title: Re: DFHack 0.40.24-r2
Post by: Sutremaine on February 13, 2015, 08:17:34 pm
Can someone help with updating an older script?

This one here: Encumbrance calculator (http://www.bay12forums.com/smf/index.php?topic=136748.msg5045463#msg5045463)

Using it as it is results in the speed column being messed up, pushing lines of the table out of alignment. Some of the speeds are listed as 1.#INF, some as 10.

I took a look at the script, and found the line         d.speed = round(100000/dfhack.units.computeMovementSpeed(v))

computeMovementSpeed leads me back to the Units.h module, containing         DFHACK_EXPORT int computeMovementSpeed(df::unit *unit);

I can't do anything with that. So I saw there was a getStrength(v) function with the note "from getPhysicalAttrValue in Units.cpp, which is not exported for lua", and I tried to adapt it to get the unit's speed instead. It didn't work.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 13, 2015, 09:27:12 pm
For some reason I can no longer search worn out items in trading menu. Typing x has no effect.
Has this ever worked? Are you referring to the search plugin?

Some more basic structure stuff that's unlabeled for some reason.
The reason it's unlabeled is because nobody has identified it. (As a side note, you should never use anon_* names in scripts - these are fields that don't actually have a name at all, but are assigned that name in order to compile and be visible. Any changes a structure can change the names of its anon_* fields.)

Quote from: scamtank
I don't know what anon2 means yet exactly, but each one of the above types seems to have its own series of 32-bit integers, identical to the letter. My dwarves have the longest one at 1008 entries, followed by humans at 491, elves and goblins at 292 & 235 and finished by kobolds and cave tribals at 112 and 97 respectively. Divine guardians are the shortest with only 27 integers, but each one seems to have its own specific unique contents despite the identical length.

e: well, duh. My LAYER_LINKED entity raws are exactly 97 lines long discounting the ENTITY:xyz headline and Toady's comments. Each integer corresponds to a line of text in the raws.
Do you mean pointers (e.g. 0x86414ba6) instead of integers? DF is probably storing the raw text of the raws (similar to many other raw structures) as pointers to character arrays.
Title: Re: DFHack 0.40.24-r2
Post by: utunnels on February 13, 2015, 09:36:13 pm
For some reason I can no longer search worn out items in trading menu. Typing x has no effect.
Has this ever worked? Are you referring to the search plugin?
I don't recall.
x is a valid keyword in the enhanced stocks menu and trade depot menu(bring goods to depot). Maybe they are not the same thing at all.
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on February 13, 2015, 10:06:15 pm
Do you mean pointers (e.g. 0x86414ba6) instead of integers? DF is probably storing the raw text of the raws (similar to many other raw structures) as pointers to character arrays.

Yeah, that's it I guess. I'm still disoriented enough from my attempt to rebuild the armorstand-capacity patch that I just see absolute hex values.

And I'm not really running custom scripts of any sort, I'm just banging rocks together with gm-editor and gleaning out whatever patterns it gives me.
Title: Re: DFHack 0.40.24-r2
Post by: Rose on February 15, 2015, 10:43:12 am
How hard would it be to move the RPC calls into another thread? Or would I have to make my own netcode for that? Because I have discovered that, at least with the current implementation, I can't do realtime stuff with it, as any request needs to wait till the next frame to get a reply.
Title: Re: DFHack 0.40.24-r2
Post by: Sutremaine on February 15, 2015, 08:57:09 pm
How do you find the current speed of a dwarf? I can get the number that Dwarf Therapist gives, but that doesn't take into account encumbrance.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on February 15, 2015, 09:03:05 pm
Would it be possible to see how adventure mode displays speed, is it the same speed in fort mode?

I made an album with some of the screenshots that seemed relevant to this:
http://imgur.com/a/dD0Rt
Here are a couple of shots which seemed especially relevant though I'm not totally sure how to deciper them, but as I recall this:
Spoiler (click to show/hide)
Was full speed normal movement (5.0 displayed, dorflet vampire) with no noticeable encumbrance.

This:
Spoiler (click to show/hide)
Was full speed normal movement (0.2 displayed, dorflet vampire) carrying a slade slab.

I think this:
Spoiler (click to show/hide)
Was full speed normal movement (5.0 displayed, dorflet vampire) carrying a platinum slab.

All movement was in the same direction (north) after building up to full speed and I hit the z menu while moving before pulling up the gm-editor and checking the action -> bottom entry (only three, one is like (-1, none) for moving, (2, eat) or something for others, then the current action id, then a bunch of numbers and letters, that one) -> raw_data (http://i.imgur.com/oyOv7ys.png) and some of those numbers look like the gait/stealth/buildup stuff, but the changes to the top value look relevant for encumbrance/speed.


Edit, more testing:
5.0 movement, dorflet vampire, 0 plat slabs:
Spoiler (click to show/hide)
5.0 movement, dorflet vampire, 1 plat slab, to 1.0 movement, 5 plat slabs:
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r2
Post by: Hesperid on February 16, 2015, 11:59:26 am
Searching in the trade depot for "x" has definitely worked before. In fact, it's how I used to dump all my unwanted worn clothing before dfhack utilities like cleanowned.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 16, 2015, 12:52:59 pm
Oh, searching? Which depot screen (marking goods to be brought to the depot or trading)?
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on February 16, 2015, 04:33:36 pm
so digging through the choices it seems that you can totally invoke anyone into being a companion.
without needing a slab or fighting legion of angels. though I don't know if this works on hostile units.
(http://www.truimagz.com/host/fortcrush2/de/please-adopt.png)
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on February 16, 2015, 05:10:42 pm
...adopt?
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on February 16, 2015, 06:18:06 pm
...adopt?
I think it's ties to prisoner rescue option
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on February 16, 2015, 08:06:06 pm
Aye, one of the prisoner rescue choices available until you get the adorable "soandso embraces soandso" bit when talking with a friendly unit.

More to the point, how did you turn them into companions?
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on February 17, 2015, 02:53:16 am
Aye, one of the prisoner rescue choices available until you get the adorable "soandso embraces soandso" bit when talking with a friendly unit.

More to the point, how did you turn them into companions?
invokeServiceBounding option.
the bonding option you get for demons work on anyone you talk to if you give access to that option.
so I had an eagle and axeman forever bound to me so it's a in-game force companion option.
though I wonder if it works on hostile units
Code: [Select]
df.global.ui_advmode.conversation.choices[15].choice.type=163
df.global.ui_advmode.conversation.choices[14].choice.type=162
df.global.ui_advmode.conversation.choices[15].title="Invoke obediance By using The True Name"
df.global.ui_advmode.conversation.choices[14].title="Banish By using The True Name"
just pick a option then rewrite it to include this. though if I was more Dfhackfu I would just make this an insert choice option.
haven't tested the Title bit but here's a small script I call Invoke.lua
I guess banishing works the same way and you can straight up Talk someone to nonexistence.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on February 17, 2015, 03:00:12 am
I'm reminded of Exalted and the social-fu high essense solars convincing someone they're dead so well the person actually dies.
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on February 17, 2015, 03:53:46 am
Huh, look at that, unit_action.talk.unk_0 is the topic type. Just banished a human with that method, now unk_0 is 162. unk_3c is the unit being talked to and unk_40 seems to increment by one every time the unit talks.
Title: Re: DFHack 0.40.24-r2
Post by: Rusty_knight on February 17, 2015, 04:56:21 am
Is it possible to enter arena mode from fortress mode and spawn creatures in 40.24? I'm using DF 40.24 with Phoebus's tileset and this is what I get
Spoiler (click to show/hide)
Also, is it possible to "hire" human caravan guards or take some goblin "slaves" in 40.24? How exactly? Will they breed?
Spoiler (click to show/hide)
And also can I mass-edit tiles using DFHack? For example, turn all tiles designated for mining into open space.
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on February 17, 2015, 05:51:35 am
Is it possible to enter arena mode from fortress mode and spawn creatures in 40.24? I'm using DF 40.24 with Phoebus's tileset and this is what I get
Spoiler (click to show/hide)
Also, is it possible to "hire" human caravan guards or take some goblin "slaves" in 40.24? How exactly?
Spoiler (click to show/hide)
And also can I mass-edit tiles using DFHack? For example, turn all tiles designated for mining into open space.
we got a script to spawn creatures with out needing to switch to arena mode(you can do this by using Modeset but it's not a tile set issue more so doing so kinda doesn't fill out the creature list for arena and you need another script.), but Fiddling with arena mode will end up with everyone set to independent and hostile to everyone because their unit.combat_side is set to 0 in every other mode.
 
Code: [Select]
function FillArena()
--add races to the arena spawn list
local arena_spawn=df.global.world.arena_spawn
arena_spawn.race:resize(0)
arena_spawn.caste:resize(0)
for num,race in pairs(df.global.world.raws.creatures.all) do
for caste_id,caste in pairs(race.caste) do
arena_spawn.race:insert("#",num)
arena_spawn.caste:insert("#",caste_id)
end
end
makeown script will hire those folks but god we don't have a good script/plugin for editing those guys into the fort.
Title: Re: DFHack 0.40.24-r2
Post by: Rusty_knight on February 17, 2015, 06:01:10 am
we don't have a good script/plugin for editing those guys into the fort
I don't understand this part. Do you mean that they wouldn't get involved in the fortress activities and given any jobs?
Also your fillarena script doesn't work for me.
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on February 17, 2015, 06:24:46 am
we don't have a good script/plugin for editing those guys into the fort
I don't understand this part. Do you mean that they wouldn't get involved in the fortress activities and given any jobs?
yeah pretty much unless their the same civ from the same group from the same culture or what ever they won't work, also you need to remove the resident flag from them so they could pop up.
and even then you need to do more fancy dfhackin to get them into the noble screen and the military.

edit: Wrote up a nice extra dialog script that grants you the Powers of an Angelic God slab. now you too can tell lil jimmy to Go to hell or Bound just about Anything to your control with nothing but words.
(http://www.truimagz.com/host/fortcrush2/de/Invoke-in-action-part-1-bonding.gif)
(http://www.truimagz.com/host/fortcrush2/de/Invoke-in-action-part-2-banishing.gif)
the bound option is a 100% no way around it companion granter
the banish option just does what it says on the tin, though it pretty much raptures the hell out of anyone you use it on so don't expect any corpses when using it. best for if you REALLY want someone dead great for assassinations.
Spoiler: invoke.lua (click to show/hide)
Title: Re: DFHack 0.40.24-r2
Post by: Incantatar on February 18, 2015, 08:06:56 am
When i try to save a stockpile setting i get this error:
Code: [Select]
stockpiles_save ./stocksettings/Material SP Feeder ./hack/lua/plugins/stockpiles.lua:142: Cannot invoke field (global).stockpiles.stockpiles_save(): C++ exception: CHECK failed: (bytes_produced_by_serialization) == (byte_size_before_serialization): Byte size calculation and serialization were inconsistent.  This may indicate a bug in protocol buffers or it may be caused by concurrent modification of the message..
stack traceback:
[C]: in function 'stockpiles_save'
./hack/lua/plugins/stockpiles.lua:142: in function <./hack/lua/plugins/stockpiles.lua:130>
Title: Re: DFHack 0.40.24-r2
Post by: TheKaspa on February 18, 2015, 03:56:43 pm
Is it possible to load a script while loading a save?
I want to load a simple list of workflow orders, but I don't know how to do it
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 18, 2015, 04:31:12 pm
You can save commands in a text file and run them with the "script" command. I believe workflow data is saved in each world that uses it, so you shouldn't need to do this more than once per world.
Title: Re: DFHack 0.40.24-r2
Post by: Sutremaine on February 18, 2015, 06:36:26 pm
I made an album with some of the screenshots that seemed relevant to this:

[snipped for brevity]
...I think I'll just train them up until they're not encumbered by their regular gear. Then the DT-identical speeds will be accurate for my purposes.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on February 18, 2015, 09:15:04 pm
Yeah, it's confusing as heck, at best it looks like you could pull the top value from that list, but I can't find it when you aren't moving!

It does seem to have an accurate depiction of modified movement speed though, as it shows the change from grabbing a plat slab which didn't actually slow me down, but still put the value from like 624... to 557... or something.
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on February 19, 2015, 02:12:10 am
Hmm. I can't really think of a proper scientific way to determine army stuff. There are too many unknown variables at this point. Any advice?
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on February 19, 2015, 02:24:00 am
Hmm. I can't really think of a proper scientific way to determine army stuff. There are too many unknown variables at this point. Any advice?
I know a few fields...
Code: [Select]
unk_48[0] -> is_player (or sth like that)
unk_pos1 -> position
some array i forgot, has first id as nemesis id of traveling unit. (will look when i get home)
Title: Re: DFHack 0.40.24-r2
Post by: TheKaspa on February 19, 2015, 03:34:35 am
You can save commands in a text file and run them with the "script" command. I believe workflow data is saved in each world that uses it, so you shouldn't need to do this more than once per world.

Yes I know, but I want to be able to replicate the orders in another fort.
Title: Re: DFHack 0.40.24-r2
Post by: PeridexisErrant on February 19, 2015, 05:13:35 am
Is it possible to load a script while loading a save?
I want to load a simple list of workflow orders, but I don't know how to do it
You can save commands in a text file and run them with the "script" command. I believe workflow data is saved in each world that uses it, so you shouldn't need to do this more than once per world.
Yes I know, but I want to be able to replicate the orders in another fort.

Here's the process (similar to autobutcher export):
Done!
Title: Re: DFHack 0.40.24-r2
Post by: TheKaspa on February 19, 2015, 05:50:05 am
Thanks!
Title: Re: DFHack 0.40.24-r2
Post by: Rusty_knight on February 19, 2015, 08:32:13 am
same civ from the same group from the same culture or what ever
What defines that? Unit's "civ_id"? What else?
also you need to remove the resident flag from them so they could pop up.
You mean set it to "false"? If so, they're showing up in the units list, but their status is "tame" and no labours can be given to them.
and even then you need to do more fancy dfhackin to get them into the noble screen and the military
What exactly? I was looking through various scripts (none of which worked supposedly because they were written for older versions of DF or maybe they shouldn't work with other races at all?) like Warmist's "addToFort" and dfhack sources, but since I know neither LUA (though it looks very simple by itself I'm not familiar with the DFHack's LUA API and some pieces of code which people use in their scripts aren't documented), nor C++ or ruby I have troubles understanding it.
I'm currently trying to understand how Warmist's script works step by step by putting single lines of it into my "example" script and seeing what it gives in console but maybe his script should work only for dwarven caravan guards and animals in the first place?
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on February 19, 2015, 09:43:52 pm
same civ from the same group from the same culture or what ever
What defines that? Unit's "civ_id"? What else?
also you need to remove the resident flag from them so they could pop up.
You mean set it to "false"? If so, they're showing up in the units list, but their status is "tame" and no labours can be given to them.
and even then you need to do more fancy dfhackin to get them into the noble screen and the military
What exactly? I was looking through various scripts (none of which worked supposedly because they were written for older versions of DF or maybe they shouldn't work with other races at all?) like Warmist's "addToFort" and dfhack sources, but since I know neither LUA (though it looks very simple by itself I'm not familiar with the DFHack's LUA API and some pieces of code which people use in their scripts aren't documented), nor C++ or ruby I have troubles understanding it.
I'm currently trying to understand how Warmist's script works step by step by putting single lines of it into my "example" script and seeing what it gives in console but maybe his script should work only for dwarven caravan guards and animals in the first place?

well the thing is dwarf fortress is pretty anti-multi-race forts, warmist found a way via Raw hacking the game to get around this way back in 40d era, that method is kinda lost in time, what's left is well the ability to alter the mainfort's Race id which chances who's the playable civ's race site is, like changing the fort from dwarves to goblins will set all the 'tame' goblins to peasant and all the dwarves to 'tame', though you might want to makesure the site has citizen goblins first before attempting dfusion set current race.
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on February 19, 2015, 09:45:15 pm
Friendship's still around and working.

Next version it'll be fully obsolete though.
Title: Re: DFHack 0.40.24-r2
Post by: Rusty_knight on February 20, 2015, 03:23:49 am
well the thing is dwarf fortress is pretty anti-multi-race forts, warmist found a way via Raw hacking the game to get around this way back in 40d era, that method is kinda lost in time, what's left is well the ability to alter the mainfort's Race id which chances who's the playable civ's race site is, like changing the fort from dwarves to goblins will set all the 'tame' goblins to peasant and all the dwarves to 'tame', though you might want to makesure the site has citizen goblins first before attempting dfusion set current race.
Well, there's certainly a way to do to it through RAW edit, as "Succubus Dungeon" mod uses it and this was the first thing I'm looked into. But when I tried to do that myself I got dwarf civs full to the brim of "slave" goblins, probably due to their non-eating, non-drinking and biological immortality. And whether the sizes of clothes and armor will be suitable for such "slaves" is a big question.
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on February 20, 2015, 03:44:51 am
Well, there's certainly a way to do to it through RAW edit, as "Succubus Dungeon" mod uses it and this was the first thing I'm looked into. But when I tried to do that myself I got dwarf civs full to the brim of "slave" goblins, probably due to their non-eating, non-drinking and biological immortality. And whether the sizes of clothes and armor will be suitable for such "slaves" is a big question.

The solution was simply to transform the units into your fort race and use makeown + some flags and historic figure manipulation. It only look multi race because you, as a player, go through a whole process with these creatures to make that happen.

In the current version the imported creatures do not appear in the noble screen but are ok for the military. I need to find out what I missed there.

In the world scale, you have to remember that positions tend to be chosen based on personality and immortal creatures have the chance to train speech forever, but afaik humans are the most likely to take over.
Title: Re: DFHack 0.40.24-r2
Post by: Rusty_knight on February 20, 2015, 11:37:10 am
Is there a way to change an ordinary item or its quality into artifact one?
Title: Re: DFHack 0.40.24-r2
Post by: Telgin on February 21, 2015, 01:01:17 am
Is there a reliable way to add reactions from the raws into buildings after genning a world?  I accidentally forgot one until I was quite a ways into a fort.  I could also have sworn there used to be a way to get DFHack to reparse the reactions and add them for you somehow, but I might just be imagining things.

I found the addReactionToShop function in the eventful Lua plugin, but when I run it I only see "Reaction" added to the building, not the real reaction.  Said reaction is always red and can't be added.

I'm guessing this is because the game hasn't even loaded the reaction I added.  Does that plugin only let you add reactions that were part of the world when you genned it, or those created dynamically in a Lua script?

Maybe I can just change an existing reaction I don't want and use it to add that to the building...
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on February 21, 2015, 04:01:06 am
Is there a reliable way to add reactions from the raws into buildings after genning a world?  I accidentally forgot one until I was quite a ways into a fort.  I could also have sworn there used to be a way to get DFHack to reparse the reactions and add them for you somehow, but I might just be imagining things.

I found the addReactionToShop function in the eventful Lua plugin, but when I run it I only see "Reaction" added to the building, not the real reaction.  Said reaction is always red and can't be added.

I'm guessing this is because the game hasn't even loaded the reaction I added.  Does that plugin only let you add reactions that were part of the world when you genned it, or those created dynamically in a Lua script?

Maybe I can just change an existing reaction I don't want and use it to add that to the building...
There is one way: "devel\inject-raws.lua"
First backup everything! Then do "devel\inject-wars reaction REACTION_NAME". Then edit raws (i.e. add it do reactions.txt or other.txt and to civ and to building). Then save and reload.
Title: Re: DFHack 0.40.24-r2
Post by: jomen on February 22, 2015, 06:06:01 am
Hi Everyone !

Want to know something. Is there a way to get a creature imprisoned or captured with Dfhack . Or if i cant capture , teleport somewhere in a locked place ?

Edit : Actually , i already try to teleport the unit but it doesn't work , i totally don't understand the teleport script.
Title: Re: DFHack 0.40.24-r2
Post by: TheKaspa on February 22, 2015, 07:41:30 am
Is there a way to "count" with a script the workshops that need fuel to work?
I would like to automate the increment of COAL bar in a workflow instruction, so that by building another smelter the workflow instruction could be raised by, say, 10 coal bars.
Title: Re: DFHack 0.40.24-r2
Post by: Badger Storm on February 22, 2015, 07:32:24 pm
Good news: I got a new computer!  OS X Yosemite.  Much lighter, and with nicer sound to boot.

Bad news: apparently the exterminate command doesn't work after migrating all my stuff to this new computer.  Any ideas?
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 22, 2015, 08:59:15 pm
That would be https://github.com/DFHack/dfhack/issues/560. Try the ruby library from here (https://github.com/DFHack/dfhack/blob/develop/plugins/ruby/libruby187.osx.tar.gz) (click "raw", download, unarchive, save the resulting .dylib file at "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib" - you'll have to create a few of those folders).
A working ruby library (i.e. that one) should be included in the next release.
Title: Re: DFHack 0.40.24-r2
Post by: Telgin on February 24, 2015, 06:34:12 pm
Is there a reliable way to add reactions from the raws into buildings after genning a world?  I accidentally forgot one until I was quite a ways into a fort.  I could also have sworn there used to be a way to get DFHack to reparse the reactions and add them for you somehow, but I might just be imagining things.

I found the addReactionToShop function in the eventful Lua plugin, but when I run it I only see "Reaction" added to the building, not the real reaction.  Said reaction is always red and can't be added.

I'm guessing this is because the game hasn't even loaded the reaction I added.  Does that plugin only let you add reactions that were part of the world when you genned it, or those created dynamically in a Lua script?

Maybe I can just change an existing reaction I don't want and use it to add that to the building...
There is one way: "devel\inject-raws.lua"
First backup everything! Then do "devel\inject-wars reaction REACTION_NAME". Then edit raws (i.e. add it do reactions.txt or other.txt and to civ and to building). Then save and reload.

Thanks, that's precisely what I was looking for.  Worked like a charm!
Title: Re: DFHack 0.40.24-r2
Post by: Thormgrim on February 27, 2015, 05:57:53 pm
once upon a time, in the trading screen, DFHACK enabled ctrl-enter to select an item (or whole stack) and advance to the next item in the list.  it made buying up all the fish and cheese in a caravan much easier.
now ctrl-enter selects the entire caravan for some reason.

is there a new keybinding for the old action?
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on February 27, 2015, 06:36:45 pm
DFHack previously used Shift-Enter, which now selects all items (this is a feature in vanilla DF, introduced at some point in the 0.40.xx series). You can now use Shift-Down (or Shift-Up) to accomplish the same thing.
Title: Re: DFHack 0.40.24-r2
Post by: Thormgrim on February 28, 2015, 12:36:38 am
DFHack previously used Shift-Enter, which now selects all items (this is a feature in vanilla DF, introduced at some point in the 0.40.xx series). You can now use Shift-Down (or Shift-Up) to accomplish the same thing.

THANK YOU KIND SIR
Title: Re: DFHack 0.40.24-r2
Post by: danaris on February 28, 2015, 07:39:02 am
DFHack previously used Shift-Enter, which now selects all items (this is a feature in vanilla DF, introduced at some point in the 0.40.xx series). You can now use Shift-Down (or Shift-Up) to accomplish the same thing.

...any chance of getting a related shortcut to buy a container and move past the items inside the container?
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on March 01, 2015, 12:45:07 am
Uniforms. Uniforms?
The unk_4 in an entity's uniform data seems to be the "role" id that either says what it's linked to or determines the pieces. There's at least four types that I've seen.

Type 0 occurs all over the place, mostly entities centered around proc-gen lords and forced administrators of all races. Hoods, cloaks or both, at least one decorated with the civ symbol. Capes can also be used where available, but robes and dresses don't seem eligible. The materials aren't restricted, but the items may be limited to certain specific colors which are always available in dye form to the parent civ.

Types 1 and 2 I've seen only associated with religious sites. They're similar to above.

Type 3 is the most common one, seen usually with the actual human/dwarven kingdoms, but never with elves. They consist of the highest ARMORLEVEL stuff available, usually breastplates and helmets. One or both garments have the civ symbol. They don't have an armorlevel requirement per se, but they're always restricted to "material_class = 16" (Armor).

e: welp, found one right off the bat. Sure enough, they're outfitted with helmets and mail shirts.
Title: Re: DFHack 0.40.24-r2
Post by: Descan on March 02, 2015, 01:50:03 am
Does teleport.lua not work? Or better yet, is there a way to instantly smooth certain stone walls? I want my well cistern smoothed but I can't get a dwarf down there.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 02, 2015, 02:09:17 am
Ah, bad news is that no, it doesn't seem to work for anyone I've seen, good news is: kinda, but unfortunately it will turn the wall into a bunch of columns if you just use tiletypes to do it.

If I needed to move a dorf somewhere badly enough I'd just use gm-editor to change their position if I couldn't find how to get someone down there otherwise.
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 02, 2015, 02:24:10 am
Wait, teleport.lua? That ought to be working. What exactly is wrong?
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 02, 2015, 03:30:21 am
Hmmm, it was broken last time I tried it, brb. Uh, apparently it's been a while since I tried it last because I don't even have it in my dfhack 40.24r2 install. Missed it when scrolling back up to the help text, replaced it with a fresh one from your page anyways and it spit out this:
Code: [Select]
[DFHack]# teleport showpos
./hack/lua/dfhack.lua:436: /home/thefunk/.df24/hack/scripts/teleport.lua:15: syntax error near '=='
stack traceback:
        [C]: in function 'error'
        ./hack/lua/dfhack.lua:436: in function <./hack/lua/dfhack.lua:418>
        (...tail calls...)
Title: Re: DFHack 0.40.24-r2
Post by: fricy on March 02, 2015, 04:20:38 am
@expwnent/lethosor: considering the tons of new code in dfhack/develop is there any timeline for 40.24-r3?
Title: Re: DFHack 0.40.24-r2
Post by: Descan on March 02, 2015, 09:31:11 am
I didn't know gm-editor... was a thing. Or that it could move dwarfs.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 02, 2015, 10:31:16 am
It can also wreck your shit, but yeah, it exposes pretty much everything you can play with, it just has no safety uh... anything, one of the dialogues mentions that you are very liable to screw stuff up badly if you aren't careful and know what you're doing.

If all you're after is moving a dorf then at the top should be a pos entry after using it with them selected, I always have to check and make sure which way the values move stuff, I wanna say x-minus is west, x-plus is east, y-minus is north, y-plus is south, z-minus is down, z-plus is up.

If you really aren't sure what to put there, find something at the right position and grab the pos for it with gm-editor then just use that for your dorf, assuming putnam doesn't pop up with a fixed teleport.lua beforehand.
Title: Re: DFHack 0.40.24-r2
Post by: Roses on March 02, 2015, 01:41:47 pm
Does anyone have experience with adding wounds to units with DFHack? Every time I try to add a wound using gm-editor or just the command line it reverts back after a few ticks.
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on March 02, 2015, 02:01:06 pm
Does anyone have experience with adding wounds to units with DFHack? Every time I try to add a wound using gm-editor or just the command line it reverts back after a few ticks.
It might just heal... Wounds are complicated to say the least.

Let's see... I had a script that adds a wound... A heart ripping out script.  here  (https://gist.github.com/warmist/8450238)

The wound just removes the heart and adds a HUGE amount of bleed per tick (without the bleeding ripping out a heart does nothing... dwarves can be heartless strangely). So more complicated stuff like damaging tissues and breaking bones or even figureing out how much bleeding to add for heart removal (also it would be fun to add a hole through to the heart :) ) is left as an exercise to the reader ;)
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 02, 2015, 02:05:54 pm
putnam doesn't pop up with a fixed teleport.lua beforehand.

what's broken
Title: Re: DFHack 0.40.24-r2
Post by: Descan on March 02, 2015, 04:45:29 pm
Better yet, tell us how to use it properly.
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 02, 2015, 04:48:27 pm
teleport -unit (unit id) -x x -y y -z z Will teleport the unit to the coordinates specified.

teleport -showunitid will show the unit ID.

teleport -showpos will show the current position.

Omitting the unit ID will teleport the selected unit and omitting the position values will teleport the specified unit to the cursor.
Title: Re: DFHack 0.40.24-r2
Post by: Descan on March 02, 2015, 04:49:30 pm
And how do you find a unit id? Or how do you teleport the cursor unit to a specific position?
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 02, 2015, 04:50:16 pm
That was a misclick post, edited with rest of info.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 03, 2015, 12:43:30 am
It spit this and variations of this for me when I tried it out earlier, hence why I posted the error message :P
Code: [Select]
[DFHack]# teleport showpos
./hack/lua/dfhack.lua:436: /home/thefunk/.df24/hack/scripts/teleport.lua:15: syntax error near '=='
stack traceback:
        [C]: in function 'error'
        ./hack/lua/dfhack.lua:436: in function <./hack/lua/dfhack.lua:418>
        (...tail calls...)

Now, I do see that I am missing the - before showpos, but even just trying to do teleport ls or teleport man or whatnot gives the errors so I figure it is probably deeper than a missing hyphen in the command but I haven't played with it too extensively since I just tend to use gm-editor if I need to move something immediately or to an odd place.
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 03, 2015, 12:52:58 am
Thank you! I needed an actual error to know what to fix.

...There is no == in all of that file. That's odd. I can't find what that error is.

Also, you really shouldn't teleport using gm-editor. It causes unit occupancy units. See teleport to see how to properly do it.
Title: Re: DFHack 0.40.24-r2
Post by: Descan on March 03, 2015, 01:13:20 am
Did you check out dfhack.lua lines 418-436? It looks like the actual error is occurring there, not necessarily in teleport.lua. I think.
Title: Re: DFHack 0.40.24-r2
Post by: Roses on March 03, 2015, 03:07:22 am
Does anyone have experience with adding wounds to units with DFHack? Every time I try to add a wound using gm-editor or just the command line it reverts back after a few ticks.
It might just heal... Wounds are complicated to say the least.

Let's see... I had a script that adds a wound... A heart ripping out script.  here  (https://gist.github.com/warmist/8450238)

The wound just removes the heart and adds a HUGE amount of bleed per tick (without the bleeding ripping out a heart does nothing... dwarves can be heartless strangely). So more complicated stuff like damaging tissues and breaking bones or even figureing out how much bleeding to add for heart removal (also it would be fun to add a hole through to the heart :) ) is left as an exercise to the reader ;)

Hmm, I may be able to use that to achieve what I am thinking, but I will have to investigate wounds a bit more in arena first I think. Get a good bench mark for numbers and such.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 03, 2015, 05:56:01 am
Thank you! I needed an actual error to know what to fix.

...There is no == in all of that file. That's odd. I can't find what that error is.

Also, you really shouldn't teleport using gm-editor. It causes unit occupancy units. See teleport to see how to properly do it.
Yeah, it is kinda a way to encourage me to not use it too much though, find different ways to do things instead of porting around.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 03, 2015, 06:46:36 am
Did you check out dfhack.lua lines 418-436? It looks like the actual error is occurring there, not necessarily in teleport.lua. I think.
No, the trackback lists the most recent function call first. The syntax error is occurring when attempting to load the actual script (which does occur in dfhack.lua, but the error message also mentions the problem in teleport.lua).
Title: Re: DFHack 0.40.24-r2
Post by: Descan on March 03, 2015, 12:28:48 pm
I was able to use teleport.lua as long as I filled out both unitID and position. If I omitted one, I got errors. Here's a screenshot.
Tiny Pic because my internet is shit right now. (http://oi60.tinypic.com/hv9ibt.jpg)
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 03, 2015, 01:19:25 pm
I was able to use teleport.lua as long as I filled out both unitID and position. If I omitted one, I got errors. Here's a screenshot.
Tiny Pic because my internet is shit right now. (http://oi60.tinypic.com/hv9ibt.jpg)
You could just copy the text from the console.
Edit: I think this requires using the console menu on Windows - I'm not entirely sure how to do that, but it's either accessible by right-clicking the title bar or clicking on the dwarf icon.
Title: Re: DFHack 0.40.24-r2
Post by: Roses on March 03, 2015, 01:20:33 pm
I was able to use teleport.lua as long as I filled out both unitID and position. If I omitted one, I got errors. Here's a screenshot.
Tiny Pic because my internet is shit right now. (http://oi60.tinypic.com/hv9ibt.jpg)

It looks to me like you didn't have your cursor set somewhere. You can try putting a printall(pos) right before teleport(unit,pos). I'm guessing you will get nil or something like that.

Does anyone have experience with adding wounds to units with DFHack? Every time I try to add a wound using gm-editor or just the command line it reverts back after a few ticks.
It might just heal... Wounds are complicated to say the least.

Let's see... I had a script that adds a wound... A heart ripping out script.  here  (https://gist.github.com/warmist/8450238)

The wound just removes the heart and adds a HUGE amount of bleed per tick (without the bleeding ripping out a heart does nothing... dwarves can be heartless strangely). So more complicated stuff like damaging tissues and breaking bones or even figureing out how much bleeding to add for heart removal (also it would be fun to add a hole through to the heart :) ) is left as an exercise to the reader ;)

Hmm, I may be able to use that to achieve what I am thinking, but I will have to investigate wounds a bit more in arena first I think. Get a good bench mark for numbers and such.

So I have spent quite a bit of time looking through wounds, from what I can tell there are three main components. The first is adding the actual wound to the unit. Namely;
Code: [Select]
[lua]# ~unit.body.wounds[0]
<unit_wound: 0x1606de90>
id                       = 1
parts                    = <vector<unit_wound.T_parts*>: 0x1606de94>
age                      = 343
attacker_unit_id         = 3
attacker_hist_figure_id  = -1
flags                    = <unit_wound.T_flags: 0x1606deb0>
syndrome_id              = -1
pain                     = 0
nausea                   = 0
dizziness                = 0
paralysis                = 0
numbness                 = 0
fever                    = 0
curse                    = nil
Then you have to add the parts that the wound affects. Each wound can have more than one body part affected, although it usually appears to be the same body part with different layers.
Code: [Select]
[lua]# ~unit.body.wounds[0].parts[0]
<unit_wound.T_parts: 0x13da0dc0>
global_layer_idx         = 64
body_part_id             = 15
layer_idx                = 0
contact_area             = 24
surface_perc             = 100
strain                   = 49900
effect_perc1             = <vector<int16_t>: 0x13da0dd4>
effect_perc2             = <vector<int16_t>: 0x13da0de4>
effect_type              = <vector<wound_effect_type>: 0x13da0df4>
edged_curve_perc         = 29
flags1                   = <wound_damage_flags1: 0x13da0e08>
flags2                   = <wound_damage_flags2: 0x13da0e0c>
bleeding                 = 0
pain                     = 5
nausea                   = 0
dizziness                = 0
paralysis                = 0
numbness                 = 0
swelling                 = 0
impaired                 = 0
cur_penetration_perc     = 99
max_penetration_perc     = 100
jammed_layer_idx         = -1
unk_v406_1               = 0
Lastly, the corresponding body part AND layer must have the correct values and flags set.
Code: [Select]
[lua]# ~unit.body.components
<body_component_info: 0x15ff4c98>
body_part_status         = <vector<body_part_status>: 0x15ff4c98>
numbered_masks           = <vector<uint32_t>: 0x15ff4ca8>
nonsolid_remaining       = <vector<uint32_t>: 0x15ff4cb8>
layer_status             = <vector<body_layer_status>: 0x15ff4cc8>
layer_wound_area         = <vector<uint32_t>: 0x15ff4cd8>
layer_cut_fraction       = <vector<uint32_t>: 0x15ff4ce8>
layer_dent_fraction      = <vector<uint32_t>: 0x15ff4cf8>
layer_effect_fraction    = <vector<uint32_t>: 0x15ff4d08>
With all three of these things I have managed to add persistent wounds (although in about 10% of my trials the damage was undone and the wound removed, but that may have been because the wound healed, or there is another check somewhere that I am unaware of for certain wounds).

So it seems adding wounds to units is at least possible, now the issue is getting correct values for everything. I could definitely use some help in that department. What would be awesome is if anytime you are playing and one of your units gets a cool wound you could post all the values. Or if you have a fort that has lived through a bunch of different sieges and monster attacks I can go through the units (both alive and dead) and get a set of wounds, ranging from stubbed toes to torn in half. My hope is to build a, sort of, wound database, that I can use in modding and scripts to simulate an adventuring system inside of fortress mode.
Title: Re: DFHack 0.40.24-r2
Post by: Descan on March 03, 2015, 01:24:35 pm
No, I had my cursor set.

Jeeze, you try and be helpful, and people call you an idiot...
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 03, 2015, 01:33:16 pm
Oh, you passed -x twice in the second command. For me, the script works when passed only -x, -y, and -z parameters if a unit is selected. (It could provide more user-friendly error messages when arguments are missing/invalid, though.) If it doesn't work for you, make sure your copy of the script matches the one in the repo (https://github.com/DFHack/dfhack/blob/master/scripts/teleport.lua).
Title: Re: DFHack 0.40.24-r2
Post by: Roses on March 03, 2015, 01:41:24 pm
No, I had my cursor set.

Jeeze, you try and be helpful, and people call you an idiot...

Oh I see the problem. (I really didn't mean to suggest you were an idiot, its my fault for not reading your error log carefully enough). One sec for a fix.

EDIT: I am sure there is a more elegant way to do this, but I just threw it together, just copy and paste this in between the 'local pos =' and 'teleport()' (at the end of the file)
Code: [Select]
if df.global.T_cursor:is_instance(pos) then
  postemp = {x=0,y=0,z=0}
  postemp.x = pos.x
  postemp.y = pos.y
  postemp.z = pos.z
  pos = postemp
 end
For those of you wondering, it appears the getTileBlock function will not accept an global.T_cursor type. Hence it won't work when using the cursor.
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on March 03, 2015, 01:59:50 pm
No, I had my cursor set.

Jeeze, you try and be helpful, and people call you an idiot...

Oh I see the problem. (I really didn't mean to suggest you were an idiot, its my fault for not reading your error log carefully enough). One sec for a fix.

EDIT: I am sure there is a more elegant way to do this, but I just threw it together, just copy and paste this in between the 'local pos =' and 'teleport()' (at the end of the file)
Code: [Select]
if df.global.T_cursor:is_instance(pos) then
  postemp = {x=0,y=0,z=0}
  postemp.x = pos.x
  postemp.y = pos.y
  postemp.z = pos.z
  pos = postemp
 end
For those of you wondering, it appears the getTileBlock function will not accept an global.T_cursor type. Hence it won't work when using the cursor.

yes there is:
Code: [Select]
thing_that_needs_pos(copyall(df.global.pos))
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 03, 2015, 03:49:37 pm
Also, I'm pretty sure you shouldn't be putting the unit ID in parentheses.
Title: Re: DFHack 0.40.24-r2
Post by: Descan on March 03, 2015, 07:16:48 pm
Well when it wasn't working, I kept trying different things. >_>
Title: Re: DFHack 0.40.24-r2
Post by: Propman on March 04, 2015, 12:44:45 am
Fiddling with my raws a bit, I've come across a rather peculiar error.

Code: [Select]
...d\Desktop\Mashup Fortress\hack\lua\plugins\stockflow.lua:390: attempt to index local 'entity' (a nil value)
stack traceback:
...d\Desktop\Mashup Fortress\hack\lua\plugins\stockflow.lua:390: in function 'collect_reactions'
...d\Desktop\Mashup Fortress\hack\lua\plugins\stockflow.lua:34: in function <...d\Desktop\Mashup Fortress\hack\lua\plugins\stockflow.lua:33>
Could not load stockflow world data!

Interesting bit is that reverting all my raws from before the error doesn't make it go away. Doesn't seem to affect gameplay yet (mostly conducting arena mode tests), though it's somewhat annoying to see that line of text each loadup.
Title: Re: DFHack 0.40.24-r2
Post by: scamtank on March 04, 2015, 01:44:53 am
That's a problem with arena mode. Stockflow tries to look up things about civilizations, but since there's no actual world out there to collect from, it throws a fit in red text.
Title: Re: DFHack 0.40.24-r2
Post by: breadman on March 04, 2015, 12:32:07 pm
DFHack previously used Shift-Enter, which now selects all items (this is a feature in vanilla DF, introduced at some point in the 0.40.xx series). You can now use Shift-Down (or Shift-Up) to accomplish the same thing.

...any chance of getting a related shortcut to buy a container and move past the items inside the container?

Should be possible, though not quite as easy as the current ones.  I've added to my list of suggestions to consider.

That's a problem with arena mode. Stockflow tries to look up things about civilizations, but since there's no actual world out there to collect from, it throws a fit in red text.

Sorry about that.  I'll look into it.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 05, 2015, 02:32:40 am
With all three of these things I have managed to add persistent wounds (although in about 10% of my trials the damage was undone and the wound removed, but that may have been because the wound healed, or there is another check somewhere that I am unaware of for certain wounds).
Silly question, but did you check the has_breaks under flags2?

I ask because I've done basically the reverse of what you're talking about and until I flip the non-body flags I either keep flashing the wounded tile indicator, can't hold things, or can't stand up (even if you lose a limb and revert the wound totally, until you put stance/grasp count back to 2 you don't get the use returned), oh and the vision/breathing flags, but I forget if those are flags2 or flags3.

Quote
So it seems adding wounds to units is at least possible, now the issue is getting correct values for everything. I could definitely use some help in that department. What would be awesome is if anytime you are playing and one of your units gets a cool wound you could post all the values. Or if you have a fort that has lived through a bunch of different sieges and monster attacks I can go through the units (both alive and dead) and get a set of wounds, ranging from stubbed toes to torn in half. My hope is to build a, sort of, wound database, that I can use in modding and scripts to simulate an adventuring system inside of fortress mode.

I'll grab screenshots next time I get a cool wound worth keeping and try to preserve the values for ya, I did that with facial hair recently since my old urist mclegendary save was before I knew you could add beards to dorfgirls so world-gen dorfgirls lack them. I found out mclegendary got married shortly before I actually grabbed him for adventuring and decided to include his wife in the adventure but she lacked a beard. A rather kludgey way to do it is to simply scramble the style/lengths by changing the race in gm-editor, when you unpause (fort mode) or move/step time forward (adventure mode) you revert to your original race with your hair styles within normal ranges for your civ.

I was trying to figure out more about how to tweak the parts specifically and did some comparing with the males around her, ended up putting together a little cheatsheet with the values:
Code: [Select]
very short neatly combed sideburns
very long double braided moustache
very long neatly combed beard
long double braided hair

tissue_style    tissue_style_id         tissue_style_type       tissue_length
1               2                       39                      150
1               2                       39                      150
2               0                       37                      156
2               1                       38                      246
-1              -1                      -1                      -300000
-1              -1                      -1                      -300000
2               3                       36                      137
2               3                       36                      137
-1              -1                      -1                      -300000
-1              -1                      -1                      -300000
-1              -1                      -1                      -300000
-1              -1                      -1                      -300000

Tissue style and style type don't change for dorfs from the same civ, looks like the first two values are sideburns, third is moustache, fourth is beard, five and six are always -1/-30000 (though these are 1 and 2 for beardless dorf girls, while the last four are missing entirely, body hair maybe?), then seven and eight are hair, with the tissue style and length parts under their respective headings.
Title: Re: DFHack 0.40.24-r2
Post by: Roses on March 05, 2015, 01:25:07 pm
With all three of these things I have managed to add persistent wounds (although in about 10% of my trials the damage was undone and the wound removed, but that may have been because the wound healed, or there is another check somewhere that I am unaware of for certain wounds).
Silly question, but did you check the has_breaks under flags2?

I ask because I've done basically the reverse of what you're talking about and until I flip the non-body flags I either keep flashing the wounded tile indicator, can't hold things, or can't stand up (even if you lose a limb and revert the wound totally, until you put stance/grasp count back to 2 you don't get the use returned), oh and the vision/breathing flags, but I forget if those are flags2 or flags3.

Yes, there are a couple other flags and other things that need to be changed for more serious wounds. Interestingly enough the logic for the stance/grasp tags are kind of weird.
Title: Re: DFHack 0.40.24-r2
Post by: Rose on March 06, 2015, 03:56:28 am
stuff
Stonesense reads and supports all of the hair styles, and displays them. I've forgotten how we did it, but a read through the source should prove helpful.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 06, 2015, 12:38:04 pm
With all three of these things I have managed to add persistent wounds (although in about 10% of my trials the damage was undone and the wound removed, but that may have been because the wound healed, or there is another check somewhere that I am unaware of for certain wounds).
Silly question, but did you check the has_breaks under flags2?

I ask because I've done basically the reverse of what you're talking about and until I flip the non-body flags I either keep flashing the wounded tile indicator, can't hold things, or can't stand up (even if you lose a limb and revert the wound totally, until you put stance/grasp count back to 2 you don't get the use returned), oh and the vision/breathing flags, but I forget if those are flags2 or flags3.

Yes, there are a couple other flags and other things that need to be changed for more serious wounds. Interestingly enough the logic for the stance/grasp tags are kind of weird.
Oh lord yeah they are, the order you flip mos twounds doesn't matter much, but doing stance/grasp before wounds reverts every time.

stuff
Stonesense reads and supports all of the hair styles, and displays them. I've forgotten how we did it, but a read through the source should prove helpful.
Wait, I wasn't here at the time, you also helped make stonesense?
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 06, 2015, 12:39:26 pm
Wait, I wasn't here at the time, you also helped make stonesense?
Japa is... impressive.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 06, 2015, 12:42:14 pm
[SPEAKER:TRANS_NAME] is dumbfounded for a second. A legend, here? I have been a poster for part of a year of my life, Japa, will you lead me to glory and a warrior's death?
Title: Re: DFHack 0.40.24-r2
Post by: Rose on March 06, 2015, 11:37:52 pm
Nah, I used to be an adventurer like you, until I took an arrow to the knee.
Title: Re: DFHack 0.40.24-r2
Post by: Descan on March 07, 2015, 12:11:07 pm
I now want to stab you. When's the next flight to India Whiterun?
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on March 07, 2015, 01:07:08 pm
Nah, I used to be an adventurer like you, until I took an arrow to the knee.
so.... you got married? Good on ya.
though back to DFhack news. I have no idea how buildings pop up on site, though I can sure as hell manipulate the current site buildings.
Title: Re: DFHack 0.40.24-r2
Post by: milo christiansen on March 07, 2015, 01:46:38 pm
I just discovered two thing that may be DFHack bugs.

1) item-trigger constantly spams the console with errors (something about a nil value), at least it doesn't crash anymore.
2) Adding a reaction to a hardcoded building with eventful adds the reaction all right, it's just impossible to do it (it always shows red).

EDIT: Oh, and I had a statue with an image of "`./stocksettings' of Ace" on it in one of my forts, sometimes the persistence API is awesome!
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 07, 2015, 09:46:35 pm
Nah, I used to be an adventurer like you, until I took an arrow to the knee.
so.... you got married? Good on ya.
though back to DFhack news. I have no idea how buildings pop up on site, though I can sure as hell manipulate the current site buildings.
Considering the way things reload layout/connections when you zone in/out of say, a dorf fort, perhaps you could find something useful at the boundary of the changing portion?

The area under the above-ground fortress seems to scramble the layout when it unloads from memory, while the portions which extend beyond it underground remain as they are, hence the occasional "spawned in a fortress with no exit" or the reverse "found abandonded fort with supposed beast and no access to it" bugs.

How do you access the building properties to edit them?
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 07, 2015, 11:32:27 pm
1) item-trigger constantly spams the console with errors (something about a nil value), at least it doesn't crash anymore.

What exactly does it say and what inputs did you give it?
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 09, 2015, 12:50:37 pm
After seeing about the 700th person make this mistake (with myself earlier on that list), would it be possible for someone with better coding skills than mine to make a quick error-checker for raws?  Just scan the files on launch and when a world is generated to make sure each raw has a file name, internal name, and OBJECT: tag that match.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 09, 2015, 02:30:20 pm
After seeing about the 700th person make this mistake (with myself earlier on that list), would it be possible for someone with better coding skills than mine to make a quick error-checker for raws?  Just scan the files on launch and when a world is generated to make sure each raw has a file name, internal name, and OBJECT: tag that match.
Should be simple enough. What exactly should the OBJECT: check involve? Most vanilla files appear to be named according to the objects they contain (e.g. inorganic_other.txt contains [OBJECT:INORGANIC]), but I'm not sure if this holds true for mods.
Edit: Here (https://github.com/lethosor/dfhack-scripts/blob/master/raw-lint.lua) is something. It doesn't work in the arena yet, unfortunately.
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 09, 2015, 03:56:44 pm
After seeing about the 700th person make this mistake (with myself earlier on that list), would it be possible for someone with better coding skills than mine to make a quick error-checker for raws?  Just scan the files on launch and when a world is generated to make sure each raw has a file name, internal name, and OBJECT: tag that match.
Should be simple enough. What exactly should the OBJECT: check involve? Most vanilla files appear to be named according to the objects they contain (e.g. inorganic_other.txt contains [OBJECT:INORGANIC]), but I'm not sure if this holds true for mods.
Edit: Here (https://github.com/lethosor/dfhack-scripts/blob/master/raw-lint.lua) is something. It doesn't work in the arena yet, unfortunately.
Thanks.  Off the top of my head, I'm pretty sure that the matching should be:

Filename: x_y.txt
Internal name: x_y
[OBJECT:X]

The idea is just to put a warning in the console if a modder forgets to put some or all of the heading in a raw file, so it'd need to be a lightweight thing that could be more or less always-on.

Edit: X is usually but not always just the uppercase of x.  You seem to have nailed the exceptions in your script... good job!
Title: Re: DFHack 0.40.24-r2
Post by: Felton on March 12, 2015, 12:07:02 am
Is there a better way to check what menu is displayed than "Gui::getFocusString(Core::getTopViewscreen()).c_str()"?

I'd like my code to be able to tell the difference between these menus:
"(b)Building"
"(b)>(C)Wall/Floor/Stairs/Track"
"(b)>(e)Furnaces"

but that code gives me "dwarfmode/Build/Type" for all 3 states.

What other methods or variables can I take into account?
Title: Re: DFHack 0.40.24-r2
Post by: utunnels on March 12, 2015, 12:30:15 am
How do I get cleanowned to only confiscate but not dump?
It also doesn't confiscate scattered AND worn items at the same time.
Title: Re: DFHack 0.40.24-r2
Post by: endlessblaze on March 12, 2015, 06:24:54 pm
I followed the instructions but It wont work, can you upload a DF install with DFhack already in it?
Title: Re: DFHack 0.40.24-r2
Post by: PeridexisErrant on March 12, 2015, 06:56:44 pm
I followed the instructions but It wont work, can you upload a DF install with DFhack already in it?
http://lazynewbpack.com/
Title: Re: DFHack 0.40.24-r2
Post by: endlessblaze on March 12, 2015, 07:25:17 pm
thanks....now lets hope I don't have to wait an hour (that's the actual estimated time btw, my internet sometimes slows down a lot, I hope it picks up some)
now what about adding scripts to it? I know it comes with a few but I was hoping to get some more.
Title: Re: DFHack 0.40.24-r2
Post by: PeridexisErrant on March 12, 2015, 07:49:36 pm
what about adding scripts to it? I know it comes with a few but I was hoping to get some more.
There's not all that much to add, since the default ships with a lot of scripts.  You can find others around in various places, but they're generally either mod-specific or unfinished/untested/unstable - there's a reason they're not in by default.
Title: Re: DFHack 0.40.24-r2
Post by: endlessblaze on March 12, 2015, 08:23:48 pm
ahhh...i see.

well im still downloading, hopefully it wont corrupt. (i had to give up my turn in the first secession fort it was ever my turn in because the file kept corrupting from download interruptions)
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 12, 2015, 09:13:03 pm
I followed the instructions but It wont work, can you upload a DF install with DFhack already in it?
What platform are you using? Are there any errors displayed? There's no need to download an entire pack if you'd rather not, particularly on a slow connection.
Title: Re: DFHack 0.40.24-r2
Post by: endlessblaze on March 12, 2015, 09:19:03 pm
i got it now.
sometimes my connection is slow sometimes its fast, its a bit fickle
Title: Re: DFHack 0.40.24-r2
Post by: Felton on March 13, 2015, 06:30:17 pm
Where is a good place to ask questions about the DFHack c++ API?

I've tried here and reddit and googled every combination of related words I can think of, but no luck.

I'd love to be able to contribute back to the project.

Thanks
Title: Re: DFHack 0.40.24-r2
Post by: endlessblaze on March 13, 2015, 07:27:04 pm
how would I go about using this to make necromancers?
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 13, 2015, 08:15:53 pm
Well, Putnam linked me to the lua API: https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst but I'm not sure how useful that is for C++ as I am not a wizard myself.

As for necromancers Rumrusher found a trick for necros if you have control of them: createitem a slab, gm-editor the slab, subtype 6 should be secrets, change the secrets type and if you have no modded secrets added then one of the first five or six should be life and death.

Note that adding reading to a unit under your control won't work, but if you add the skill to an npc and then assume control it works fine.
Title: Re: DFHack 0.40.24-r2
Post by: endlessblaze on March 13, 2015, 09:24:04 pm
what about spawning creatures

forcing migrant waves?

creating sieges
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 13, 2015, 09:30:02 pm
Think those are all tied to the same script which is still being worked on last I heard.
Title: Re: DFHack 0.40.24-r2
Post by: endlessblaze on March 13, 2015, 09:34:02 pm
oh....

also there is something I would like to point out

DFhack list all the divine metals as grey.

blazeing metal, bright metal, and black metal don't sound grey.


Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 13, 2015, 11:08:20 pm
They're gray. It's odd.

what about spawning creatures

forcing migrant waves?

creating sieges


1. Being worked on.

2. modtools/force should still work for that.

3. I have no idea when that will be done.
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on March 14, 2015, 01:53:12 am
Well, Putnam linked me to the lua API: https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst but I'm not sure how useful that is for C++ as I am not a wizard myself.

As for necromancers Rumrusher found a trick for necros if you have control of them: createitem a slab, gm-editor the slab, subtype 6 should be secrets, change the secrets type and if you have no modded secrets added then one of the first five or six should be life and death.

Note that adding reading to a unit under your control won't work, but if you add the skill to an npc and then assume control it works fine.
you could end up with vamperism or werewolfism doing this so bewarned you could end up a vampire with no way to drinking blood.
Title: Re: DFHack 0.40.24-r2
Post by: milo christiansen on March 14, 2015, 08:45:20 pm
1) item-trigger constantly spams the console with errors (something about a nil value), at least it doesn't crash anymore.

What exactly does it say and what inputs did you give it?

I am away from a computer that has DF right now, so I'll just try to give all I can remember.

The input I gave it didn't seem to make any difference in testing, if you want the exact information download Rubble and look at "addons/User/Speluncaphobia/DFHack".

The error is something about attempting to index a nil value, I checked and it was the "equip handler" function, forgot its exact name.
The value it was trying to index was named "table" if I remember correctly.

The error came up continuously while DF was unpaused.
Title: Re: DFHack 0.40.24-r2
Post by: HooliganintheFort on March 14, 2015, 11:47:10 pm
Is there a way to instantly dig out designations?
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 15, 2015, 07:43:12 am
Hmmm, does tiletypes have a designation flag?

I'd suggest fastdwarf 1 1 unless you REALLY need it dug out now because you can get weird behaviors from tiletypes if you aren't really careful about making sure all the right stuff is in place.
Title: Re: DFHack 0.40.24-r2
Post by: HARD on March 15, 2015, 12:28:05 pm
is there any script to change population cap?
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 15, 2015, 12:35:24 pm
There's this (https://github.com/lethosor/dfhack-scripts/blob/master/settings-manager.lua), or you could just edit d_init.txt. (If you mean changing it in-game, that should be possible with the former, although I'm not sure if I've implemented it yet.)
Edit: Should be implemented now.
Title: Re: DFHack 0.40.24-r2
Post by: HooliganintheFort on March 15, 2015, 12:47:22 pm
Hmmm, does tiletypes have a designation flag?

I'd suggest fastdwarf 1 1 unless you REALLY need it dug out now because you can get weird behaviors from tiletypes if you aren't really careful about making sure all the right stuff is in place.

Alright, thanks for the help.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 15, 2015, 06:07:54 pm
Hey, is it possible to call a dfhack script from a reaction?
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 15, 2015, 07:27:52 pm
Yes, with modtools/reaction-trigger. You can get the documentation for that by using the command modtools/reaction-trigger -help
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 15, 2015, 11:13:49 pm
There's this (https://github.com/lethosor/dfhack-scripts/blob/master/settings-manager.lua), or you could just edit d_init.txt. (If you mean changing it in-game, that should be possible with the former, although I'm not sure if I've implemented it yet.)
Edit: Should be implemented now.
Oh my god where has this been and why did I not even consider that you could do this?

I assume the way twbt switches the display method means it couldn't be hotswapped, but could it be toggled to enable/disable on reboot through the manager?
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 16, 2015, 08:37:55 am
1) item-trigger constantly spams the console with errors (something about a nil value), at least it doesn't crash anymore.

What exactly does it say and what inputs did you give it?

I am away from a computer that has DF right now, so I'll just try to give all I can remember.

The input I gave it didn't seem to make any difference in testing, if you want the exact information download Rubble and look at "addons/User/Speluncaphobia/DFHack".

The error is something about attempting to index a nil value, I checked and it was the "equip handler" function, forgot its exact name.
The value it was trying to index was named "table" if I remember correctly.

The error came up continuously while DF was unpaused.

The most likely explanation is that the plugin uses persistent data incorrectly in the following way.

Code: [Select]
local persist = require('persist-table')
persist.GlobalTable.foo.bar = 'asdf' %error: foo does not exist yet

--instead do this
persist.GlobalTable.foo = persist.GlobalTable.foo or {}
persist.GlobalTable.foo.bar = 'asdf' %foo definitely exists here

This would throw an exception every time the script tries to access that persistent subtable.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 16, 2015, 08:53:54 am
this is going to be a stupid question, but how do you run a dfhack script?
Title: Re: DFHack 0.40.24-r2
Post by: milo christiansen on March 16, 2015, 08:58:06 am
Can anyone confirm that eventful adding a reaction to a hardcoded building does not work (correctly)?
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 16, 2015, 10:13:36 am
this is going to be a stupid question, but how do you run a dfhack script?
Type its name in the console and press Enter.
If you're asking how to run a script that doesn't come with DFHack, you need to save it in (or copy it into) the hack/scripts folder in your DF folder, making sure to keep the correct extension (i.e. scriptname.lua, not scriptname.lua.txt).
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 16, 2015, 10:37:34 am
yeah that whole lua.txt thing messed me up, I am trying to run the spawn unit script (https://gist.github.com/warmist/8563110)
but when I run
Code: [Select]
spawn-unit DWARF 0 dwarfy I get this error
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 16, 2015, 10:40:49 am
spawn unit doesn't work in this version.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 16, 2015, 10:41:51 am
Does it work in a previous version? EDIT is there an alternative to spawn-unit?
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 16, 2015, 11:15:43 am
yeah that whole lua.txt thing messed me up, I am trying to run the spawn unit script (https://gist.github.com/warmist/8563110)
but when I run
Code: [Select]
spawn-unit DWARF 0 dwarfy I get this error
Spoiler (click to show/hide)
As a quick-and-dirty fix, try replacing anon_4 with own_interaction and anon_5 with own_interaction_delay

Then it will probably run without errors, though I doubt it will be fully functional.  Those are the replacements I made in a customized version of a spawning script that I use in my mod, which I've since found out that animal training status doesn't survive a save and reload.

Where I found the not-quite-fix: http://www.bay12forums.com/smf/index.php?topic=138898.msg5371693#msg5371693 (http://www.bay12forums.com/smf/index.php?topic=138898.msg5371693#msg5371693)
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on March 16, 2015, 12:06:05 pm
I gave porting spawnunit a try but spawned creatures go berserk on reload. I need to give it another look but there is too much stuff on the stove.

https://gist.github.com/Devduweb/9299841e7169445f8cce

Edit: Disregard the comment at the start of the file, it's wrong. Do spawnunit -help to see the arguments.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 16, 2015, 12:13:39 pm
I tried changing the anon_4 and anon_5 to own_interaction and own_interaction_delay respectively, but it still does not work.
Title: Re: DFHack 0.40.24-r2
Post by: Warmist on March 16, 2015, 12:24:21 pm
Can anyone confirm that eventful adding a reaction to a hardcoded building does not work (correctly)?
It only works with custom workshops. Intended use is that you add reactions based on something (e.g. only if you have important person X or you mined X of Y etc...). Adding reactions to hardcoded workshops is um... a lot of work (for anyone who wants to do it: interpose ALL the workshop types).
Title: Re: DFHack 0.40.24-r2
Post by: milo christiansen on March 16, 2015, 12:42:01 pm
The thing is the documentation claims that it should work. Adding a reaction to, for example, the masons shop works enough to have it show up, but it stays red all the time.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 16, 2015, 12:43:06 pm
Is there any other way to spawn a unit other then using the spawn-unit script?
Title: Re: DFHack 0.40.24-r2
Post by: milo christiansen on March 16, 2015, 12:45:27 pm
No, but some mods used a creature transformation to get something similar.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 16, 2015, 12:46:34 pm
I know that was the plan until I found out about the spawn-unit script, do we have any idea when it will be fixed?
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on March 16, 2015, 12:50:44 pm
I know that was the plan until I found out about the spawn-unit script, do we have any idea when it will be fixed?

If I can find some info about what changed with hostility and site populations on 0.40.x I can fix the last remaining kinks. That's the hard part because I tried unfolding creature, soul and hist figure data and did not find the issue.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 16, 2015, 12:57:42 pm
I am not sure what you mean, this script (https://gist.github.com/Devduweb/9299841e7169445f8cce) keeps throwing up this error when ever I do spawn-unit human
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 16, 2015, 01:13:33 pm
I know that was the plan until I found out about the spawn-unit script, do we have any idea when it will be fixed?

Warmist is supposed to be working on it I think.
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 16, 2015, 03:51:08 pm
I am not sure what you mean, this script (https://gist.github.com/Devduweb/9299841e7169445f8cce) keeps throwing up this error when ever I do spawn-unit human
Spoiler (click to show/hide)

spawn-unit -race HUMAN -caste 0 -name Hyoomon

Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 16, 2015, 04:21:10 pm
wow, thanks.
Edit: now dfhack pauses for a second, and then when I look in dwarf fortress there is nothing new.
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on March 16, 2015, 04:29:16 pm
wow, thanks.
Edit: now dfhack pauses for a second, and then when I look in dwarf fortress there is nothing new.

I just fixed it, you can try again with this newer version.

https://gist.github.com/Devduweb/9299841e7169445f8cce
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 16, 2015, 04:35:49 pm
I know that was the plan until I found out about the spawn-unit script, do we have any idea when it will be fixed?

Warmist is supposed to be working on it I think.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 16, 2015, 05:36:13 pm
There's this (https://github.com/lethosor/dfhack-scripts/blob/master/settings-manager.lua), or you could just edit d_init.txt. (If you mean changing it in-game, that should be possible with the former, although I'm not sure if I've implemented it yet.)
Edit: Should be implemented now.
Oh my god where has this been and why did I not even consider that you could do this?

I assume the way twbt switches the display method means it couldn't be hotswapped, but could it be toggled to enable/disable on reboot through the manager?
To answer my question, yes you can add {'TWBT', 'TWBT'}, to the print_mode list and it will activate/deactivate it as expected on restarting df which is incredibly handy since it is still a bit buggy in adventure mode.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 17, 2015, 06:32:11 am
Thank you so much boltgun, would it be possible for me to package this script with my mod?
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on March 17, 2015, 06:35:53 am
Sure, but I warn you that after saving and reloading spawned units will be attacked by your dwarves.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 17, 2015, 07:00:07 am
Hum, I did not think to test it in dwarf mode let me see one thing.

Edit. I had no problem with saving and reloading.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 17, 2015, 11:08:33 am
I am having trouble with modtools/reaction-trigger I put this into onLoad.INIT
Code: [Select]
modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ spawn-unit -race AUTOMANTON ]but it asks me to point my pointy thing somewhere, how do I make it spawn the creature at the workshop where the reaction happened?
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on March 17, 2015, 11:44:21 am
I am having trouble with modtools/reaction-trigger I put this into onLoad.INIT
Code: [Select]
modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ spawn-unit -race AUTOMANTON ]but it asks me to point my pointy thing somewhere, how do I make it spawn the creature at the workshop where the reaction happened?

You need to supply the position. I cannot test it right now but something like this may work.

Code: [Select]
modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ spawn-unit -race AUTOMANTON -position \LOCATION]
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 17, 2015, 12:01:46 pm
It does not work :(
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 17, 2015, 12:07:50 pm
Try
Code: [Select]
modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ spawn-unit -race AUTOMATON -position [ \\LOCATION ] ]
Note the spacing and the double backslashes.

Edit: Fixed spelling of automaton.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 17, 2015, 12:24:31 pm
is this right
Code: [Select]
modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ spawn-unit -race AUTOMATON -position [ \\LOCATION ] ] because it still says to point my pointy thing somewhere.
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 17, 2015, 12:48:18 pm
is this right
Code: [Select]
modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ spawn-unit -race AUTOMATON -position [ \\LOCATION ] ] because it still says to point my pointy thing somewhere.
The new script is checking location differently than the old script I had duct-taped together, so I'm not sure exactly what's going on.  The \\LOCATION is actually a list of three numbers, thus the square brackets around it, and that doesn't seem to be getting slotted into spawn-unit's arguments properly.  With a "blank" position, it is defaulting to the cursor location.  If that gives an X-coordinate of -3000, it means the "pointy thing" isn't displayed currently.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 17, 2015, 01:04:02 pm
could I call the location of the workshop and then input that some how?
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 17, 2015, 01:36:02 pm
Code: [Select]
modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ devel/print-args -race AUTOMATON -position [ \\LOCATION ] ]

Try this.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 17, 2015, 01:47:06 pm
same thing
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on March 17, 2015, 03:49:05 pm
I must have broken the parameter, that'll be fixed in a day or two.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 17, 2015, 06:08:17 pm
cool
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 17, 2015, 10:19:13 pm
I must have broken the parameter, that'll be fixed in a day or two.
Is this going to find its way into DFHack r3, or would I need to package this inside a mod that uses it?  Would you prefer me to direct people to download it separately?

I'd rather call a "standard" script and excise as much as possible from the mod-specific scripts I'm using.  The mod-specific logic can be used to construct appropriate parameters for spawn-unit (there are 48 different possibilities, basically because I'm a glutton for punishment).
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on March 18, 2015, 03:01:44 am
Hopefully that would be in a future version of dfhack once its bugs are taken care of, there is also a few things missing with orientation flags and probably the noble screen too.
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 18, 2015, 06:35:17 am
Hopefully that would be in a future version of dfhack once its bugs are taken care of, there is also a few things missing with orientation flags and probably the noble screen too.
Thanks.

It just so happens that I'm using the script to spawn genderless non-sentient creatures, so those bugs wouldn't affect the bugs I'm spawning :)
Title: Re: DFHack 0.40.24-r2
Post by: Uzu Bash on March 18, 2015, 10:19:24 am
'die' command takes a long time to shut down. Why is it better to allow it to than just killing the process? What is it that dfhack must do before releasing the thread?
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 18, 2015, 10:28:50 am
"die" exits immediately and shouldn't be calling any exit handlers. It could take longer to exit depending on how much memory DF is using, but not too long.
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 19, 2015, 05:21:12 am
same thing

That can't be right. What does it print? If it doesn't print anything then reaction-trigger isn't firing.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 19, 2015, 05:51:45 am
no it prints point your pointy thing somewhere
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 19, 2015, 06:34:25 am
Then you probably typed it in wrong because print-args doesn't work that way.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 19, 2015, 11:56:37 am
where am I supposed to put modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ devel/print-args -race AUTOMATON -position [ \\LOCATION ] ] I put it in onLoad.INIT
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 19, 2015, 11:59:10 am
where am I supposed to put modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ devel/print-args -race AUTOMATON -position [ \\LOCATION ] ] I put it in onLoad.INIT
That is the right place, but make sure it is the ONLY reaction-trigger tied to that reaction.  Only one will trigger.
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 19, 2015, 02:01:43 pm
I'm sorry  :'( I forgot to put it in, now it prints
Code: [Select]
Invoking: modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ spawn-unit -race AUTOMATON -position [ \\LOCATION ] ]
Cannot write field coord.1: not found.
stack traceback:
[C]: in ?
[C]: in function 'assign'
...\Desktop\df_40_24_win_modded/hack/scripts/spawn-unit.lua:359: in function 'place'
...\Desktop\df_40_24_win_modded/hack/scripts/spawn-unit.lua:425: in function 'f'
...rs\Aidan\Desktop\df_40_24_win_modded\hack\lua\dfhack.lua:434: in function <...rs\Aidan\Desktop\df_40_24_win_modded\hack\lua\dfhack.lua:418>
(...tail calls...)
[C]: in function 'runCommand'
...rs\Aidan\Desktop\df_40_24_win_modded\hack\lua\dfhack.lua:454: in function '_run_command'
...rs\Aidan\Desktop\df_40_24_win_modded\hack\lua\dfhack.lua:469: in function 'run_command'
...24_win_modded/hack/scripts/modtools/reaction-trigger.lua:106: in function 'doAction'
...24_win_modded/hack/scripts/modtools/reaction-trigger.lua:146: in function <...24_win_modded/hack/scripts/modtools/reaction-trigger.lua:75>
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 19, 2015, 02:02:39 pm
wait what It is still not doing
modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ devel/print-args -race AUTOMATON -position [ \\LOCATION ] ]
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 19, 2015, 02:48:15 pm
alright I put the hole devlog thing in onLoad.INIT created the workshop tried to make an automaton, and nothing dfhack says nothing.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 19, 2015, 02:48:48 pm
alright I put the hole devlog thing in onLoad.INIT created the workshop tried to make an automaton, and nothing dfhack says nothing.
It should be onLoad.init (if your filesystem is case-sensitive).
Title: Re: DFHack 0.40.24-r2
Post by: Urist McCoder on March 20, 2015, 04:06:29 pm
after many tries I put modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ devel/print-args -race AUTOMATON -position [ \\LOCATION ] ] in onLoad.init and it printed this
Code: [Select]
-race
AUTOMATON
-position
[
103
100
84
]
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 20, 2015, 07:51:57 pm
after many tries I put modtools/reaction-trigger -reactionName CREATE_AUTOMATON -command [ devel/print-args -race AUTOMATON -position [ \\LOCATION ] ] in onLoad.init and it printed this
Code: [Select]
-race
AUTOMATON
-position
[
103
100
84
]

Ok, that means arguments are being passed as they are supposed to be passed so the issue is with whatever version of spawn unit you have.
Title: Re: DFHack 0.40.24-r2
Post by: Uzu Bash on March 21, 2015, 04:03:35 am
The modtools don't run as simply as the documentation states. Is there something else a user must do to make it operate as described? And if so, could that not be included in the documentation?
Title: Re: DFHack 0.40.24-r2
Post by: Arx on March 21, 2015, 11:05:44 am
There appears to be a bug with ShowUnitSyndromes:

Quote from: Error
E: NoMethodError: undefined method `unk_6c' for #<DFHack::CreatureInteractionEffectBodyTransformationst:0xa9d14454>
 ./hack/scripts/ShowUnitSyndromes.rb:761
 ./hack/scripts/ShowUnitSyndromes.rb:863
 ./hack/scripts/ShowUnitSyndromes.rb:1013:in `collect'
 ./hack/ruby/ruby-autogen-defs.rb:391:in `each'
 ./hack/ruby/ruby-autogen-defs.rb:391:in `each'
 ./hack/scripts/ShowUnitSyndromes.rb:863:in `collect'
 ./hack/scripts/ShowUnitSyndromes.rb:863
 ./hack/scripts/ShowUnitSyndromes.rb:924:in `[]'

There is currently a human caravan on the map. It displays "Dwarves: " and the name of one dwarf before the error.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 21, 2015, 04:54:50 pm
Try the development version (https://github.com/DFHack/dfhack/blob/develop/scripts/show-unit-syndromes.rb) - note that it was renamed to "show-unit-syndromes" after DFHack 0.40.24-r2.
Title: Re: DFHack 0.40.24-r2
Post by: Uzu Bash on March 22, 2015, 02:12:25 pm
How do these modtools run again? The tools by name aren't recognized as commands.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 22, 2015, 02:15:51 pm
What do you mean? What are you attempting to do?
Title: Re: DFHack 0.40.24-r2
Post by: Uzu Bash on March 22, 2015, 03:05:21 pm
"add-syndrome" and "syndrome-trigger" in adv mode.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 22, 2015, 03:24:54 pm
The scripts are in the "modtools" subdirectory, so you need to use "modtools/add-syndrome", etc.
Title: Re: DFHack 0.40.24-r2
Post by: Uzu Bash on March 22, 2015, 06:52:39 pm
I think gm-editor is the easier way to go about this, but it's still kind of cryptic. The "?" key doesn't do anything, so either that's unimplemented or I've unbound the correct key. Also, I can't seem to simply clear a flag or vector entry, or edit it in any way. Is there a way to dump the data here to file?
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 22, 2015, 08:08:13 pm
The "?" key should work unless you've removed your HELP binding (which would also prevent access to the in-game help feature).
Title: Re: DFHack 0.40.24-r2
Post by: Uzu Bash on March 22, 2015, 08:42:57 pm
I wouldn't say I missed the in-game help; it's better than it used to be, but it's still obviated by the wiki.

I cannot seem to get rid of a syndrome. I don't think the character is the source of it, but I don't know what to edit to remove it. add-syndrome command breaks with an error, as does ShowAllSyndromes, and the syntax to run sydromes-util is still non-obvious to anyone who doesn't already know.
Title: Re: DFHack 0.40.24-r2
Post by: Putnam on March 22, 2015, 10:15:42 pm
"an error" is very non-specific.
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 22, 2015, 10:49:12 pm
I finally had some spare time, and here is my fix for the spawn-unit script so that it can process \\LOCATION properly.
I also had to coerce the caste ID into a number by adding 0 to it.  I'm sure there's a more graceful way to handle that, but I don't know it.

Code: (spawn-unit.lua) [Select]
--create unit at pointer or given location and with given civ (usefull to pass -1 for enemy). Usage e.g. "spawn-unit -race DWARF -caste 0 -name Dwarfy"
--[=[
    arguments
        -help
            print this help message
        -race <RACE_ID>
            The raw id of the creature's race, mandatory
        -caste <number>
            The caste's number, optional
        -name <doggy>
            The unit's name, optional
        -position [ x y z ]
            The unit's position, will try to use the cursor if ommited
        -civ_id
            The unit's civilisation or -1 for hostile, will be the player's if ommited

    Example : spawn-unit -race HUMAN -caste 0 -name Bob

    Made by warmist, but edited by Putnam for the dragon ball mod to be used in reactions
Hotfix by Dirst to repair location parameter

    TODO:
        throw a proper error if the user attempt to run it from the console, without good args
        orientation
        chosing a caste based on ratios
        birth time
        death time
        real body size
        blood max
        check if soulless and skip make soul
        set weapon body part
        nemesis/histfig : add an 'arrived on site' event
        generate name
--]=]
local utils=require 'utils'

-- Picking a caste or gender at random
local function getRandomCasteId(race_id)
    local cr = df.creature_raw.find(race_id)
    local caste_id, casteMax

    casteMax = #cr.caste - 1

    if casteMax > 0 then
        return math.random(0, casteMax)
    end

    return 0
end

local function getCaste(race_id,caste_id)
    local cr=df.creature_raw.find(race_id)

    return cr.caste[caste_id+0]
end

local 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

local function getBodySize(caste,time)
    --TODO: real body size...
    return caste.body_size_1[#caste.body_size_1-1] --returns last body size
end

local function genAttribute(array)
    local a=math.random(0,#array-2)
    return math.random(array[a],array[a+1])
end

local function norm()
    return math.sqrt((-2)*math.log(math.random()))*math.cos(2*math.pi*math.random())
end

local function normalDistributed(mean,sigma)
    return mean+sigma*norm()
end

local 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

local 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: 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.personality.traits) do
        local min,mean,max
        min=caste.personality.a[k]
        mean=caste.personality.b[k]
        max=caste.personality.c[k]
        tmp_soul.personality.traits[k]=clampedNormal(min,mean,max)
    end
    --[[natural skill fix]]
    for k, skill in ipairs(caste.natural_skill_id) do
        local rating = caste.natural_skill_lvl[k]
        utils.insert_or_update(tmp_soul.skills,
            {new=true,id=skill,experience=caste.natural_skill_exp[k],rating=rating}, 'id')
    end
   
    unit.status.souls:insert("#",tmp_soul)
    unit.status.current_soul=tmp_soul
end

local 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
    local unit=df.unit:new()

    -- Pick a random caste is none are set
    if nil == caste_id then
        caste_id = getRandomCasteId(race_id)
    end

    caste = getCaste(race_id,caste_id)

    unit:assign{
        race=race_id,
        caste=caste_id,
        sex=caste.gender,
    }

    unit.relations.birth_year=df.global.cur_year-15 --AGE is set here
    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.relations.birth_time=??
    --unit.relations.old_time=?? --TODO add normal age
    --[[ interataction stuff, probably timers ]]--
    local num_inter=#caste.body_info.interactions  -- new for interactions
    unit.curse.own_interaction:resize(num_inter) -- new for interactions
    unit.curse.own_interaction_delay:resize(num_inter) -- new for interactions
    --[[ body stuff ]]
   
    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
    --[[ body components ]]
    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}
    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
    --[[ largely unknown stuff ]]
    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
   
    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)
   
    --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)
   
    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)
   
    --finally set the id
    unit.id=df.global.unit_next_id
    df.global.unit_next_id=df.global.unit_next_id+1
    df.global.world.units.all:insert("#",unit)
    df.global.world.units.active:insert("#",unit)
   
    return unit
end

local 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
 
local function createFigure(trgunit,he,he_group)
    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
    -- ...
    hf.info.skills = {new=true}
 
 
    he.histfig_ids:insert('#', hf.id)
    he.hist_figures:insert('#', hf)
    if he_group then
        he_group.histfig_ids:insert('#', hf.id)
        he_group.hist_figures:insert('#', hf)
        hf.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=he_group.id,link_strength=100})
    end
    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

local function  allocateNewChunk(hist_entity)
    hist_entity.save_file_id=df.global.unit_chunk_next_id
    df.global.unit_chunk_next_id=df.global.unit_chunk_next_id+1
    hist_entity.next_member_idx=0
    print("allocating chunk:",hist_entity.save_file_id)
end

local function allocateIds(nemesis_record,hist_entity)
    if hist_entity.next_member_idx==100 then
        allocateNewChunk(hist_entity)
    end
    nemesis_record.save_file_id=hist_entity.save_file_id
    nemesis_record.member_idx=hist_entity.next_member_idx
    hist_entity.next_member_idx=hist_entity.next_member_idx+1
end
 
local function createNemesis(trgunit,civ_id,group_id)
    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(4)
    --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]]
    nem.unk10=-1
    nem.unk11=-1
    nem.unk12=-1
    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=-1
 
    local he=df.historical_entity.find(civ_id)
    he.nemesis_ids:insert("#",id)
    he.nemesis:insert("#",nem)
    local he_group
    if group_id~=-1 then
        he_group=df.historical_entity.find(group_id)
    end
    if he_group then
        he_group.nemesis_ids:insert("#",id)
        he_group.nemesis:insert("#",nem)
    end
    allocateIds(nem,he)
    nem.figure=createFigure(trgunit,he,he_group)
end

-- Do the placement, returns the freshly spawned unit
function place(args)
    if not args.race then
        qerror("Please provide a race")
    end

local pos = {}
if args.position then
    pos.x=args.position[1]
pos.y=args.position[2]
pos.z=args.position[3]
else
    pos = copyall(df.global.cursor)
end

    if pos.x == -30000 then
        qerror("Point your pointy thing somewhere")
    end

    local i
    local race_id = findRace(args.race)
    local u = CreateUnit(race_id,args.caste)

    u.pos:assign(pos)
       
    if args.name then
        u.name.first_name = args.name
        u.name.has_name = true
    end

    local group_id
    if df.global.gamemode == df.game_mode.ADVENTURE then
        u.civ_id = args.civ_id or df.global.world.units.active[0].civ_id
        group_id = -1
    else   
        u.civ_id = args.civ_id or df.global.ui.civ_id
    end

    if args.civ_id == -1 then
        group_id = group_id or -1
    else
        group_id = group_id or df.global.ui.group_id
    end

    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,group_id)
    end

    return u
end

validArgs = validArgs or utils.invert({
    'help',
    'race',
    'caste',
    'name',
    'position',
    'civ_id',
})

local args = utils.processArgs({...}, validArgs)

if args.help then
 print([[scripts/spawn-unit.lua
arguments
    -help
        print this help message
    -race <RACE_ID>
        The raw id of the creature's race, mandatory
    -caste <number>
        The caste's number, optional
    -name <doggy>
        The unit's name, optional
    -position [ x y z ]
        The unit's position, will try to use the cursor if ommited
    -civ_id
        The unit's civilisation or -1 for hostile, will be the player's if ommited
]])
 return
end

if args.race then
    place(args) --Creature (ID), caste (number), name, x,y,z , civ_id(-1 for enemy, optional) for spawn.
end


I would like to start using the "standard" script for my mod (to take advantage of ongoing development), but to do that I'd need to request an -age parameter.  An alternative would be -newborn (age zero), -baby, -child and -adult flags.

Edit: It doesn't seem to like passing -civ_id -1, because the parser seems to think that -1 is a flag rather than a value.
Title: Re: DFHack 0.40.24-r2
Post by: Roses on March 23, 2015, 12:26:44 am
Use \-1

Question about syndromes. This is kind of complicated to I'll just skip right to an example;

If I use add-syndrome to add a syndrome with an END I am guessing it will behave just as normal and finish at the appropriate time. But what if, instead, I used add-syndrome to add a syndrome with no END and instead removed said syndrome at a later time? Would that function the same way? Or is there something special that the game does when it ends a syndrome naturally, versus getting removed with a script?
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 23, 2015, 12:53:25 am
It didn't like -civ_id \-1 either ("inavlid escape sequence").  For now I'll add a -hostile flag to override the civ to -1 if it's present, but if there is a general solution I'd rather go with what's going to be in the spawn-unit.lua that everyone else is using.

Code: (tesb-spawn-unit.lua) [Select]
--create unit at pointer or given location and with given civ (usefull to pass -1 for enemy). Usage e.g. "spawn-unit -race DWARF -caste 0 -name Dwarfy"
--[=[
    arguments
        -help
            print this help message
        -race <RACE_ID>
            The raw id of the creature's race, mandatory
        -caste <number>
            The caste's number, optional
        -age <number>
            The unit's age in years, defaults to 15 if omitted
        -name <doggy>
            The unit's name, optional
        -position [ x y z ]
            The unit's position, will try to use the cursor if omitted
        -civ_id
            The unit's civilisation, will be the player's if omitted
        -hostile
            Overrides the civ_id to -1

    Example : spawn-unit -race HUMAN -caste 0 -name Bob

    Made by warmist, but edited by Putnam for the dragon ball mod to be used in reactions
Modified by Dirst for use in The Earth Strikes Back mod

    TODO:
        throw a proper error if the user attempt to run it from the console, without good args
        orientation
        chosing a caste based on ratios
        birth time
        death time
        real body size
        blood max
        check if soulless and skip make soul
        set weapon body part
        nemesis/histfig : add an 'arrived on site' event
        generate name
--]=]
local utils=require 'utils'

-- Picking a caste or gender at random
local function getRandomCasteId(race_id)
    local cr = df.creature_raw.find(race_id)
    local caste_id, casteMax

    casteMax = #cr.caste - 1

    if casteMax > 0 then
        return math.random(0, casteMax)
    end

    return 0
end

local function getCaste(race_id,caste_id)
    local cr=df.creature_raw.find(race_id)

    return cr.caste[tonumber(caste_id)]
end

local 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

local function getBodySize(caste,time)
    --TODO: real body size...
    return caste.body_size_1[#caste.body_size_1-1] --returns last body size
end

local function genAttribute(array)
    local a=math.random(0,#array-2)
    return math.random(array[a],array[a+1])
end

local function norm()
    return math.sqrt((-2)*math.log(math.random()))*math.cos(2*math.pi*math.random())
end

local function normalDistributed(mean,sigma)
    return mean+sigma*norm()
end

local 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

local 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: 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.personality.traits) do
        local min,mean,max
        min=caste.personality.a[k]
        mean=caste.personality.b[k]
        max=caste.personality.c[k]
        tmp_soul.personality.traits[k]=clampedNormal(min,mean,max)
    end
    --[[natural skill fix]]
    for k, skill in ipairs(caste.natural_skill_id) do
        local rating = caste.natural_skill_lvl[k]
        utils.insert_or_update(tmp_soul.skills,
            {new=true,id=skill,experience=caste.natural_skill_exp[k],rating=rating}, 'id')
    end
   
    unit.status.souls:insert("#",tmp_soul)
    unit.status.current_soul=tmp_soul
end

local function CreateUnit(race_id,caste_id,unit_age)
    local race=df.creature_raw.find(race_id)
    if race==nil then error("Invalid race_id") end

unit_age = unit_age or 15
   
local caste
    local unit=df.unit:new()

    -- Pick a random caste is none are set
    if nil == caste_id then
        caste_id = getRandomCasteId(race_id)
    end

    caste = getCaste(race_id,caste_id)

    unit:assign{
        race=race_id,
        caste=caste_id,
        sex=caste.gender,
    }

    unit.relations.birth_year=df.global.cur_year-unit_age --AGE is set here
    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.relations.birth_time=df.global.cur_year_tick
    --unit.relations.old_time=?? --TODO add normal age
    --[[ interataction stuff, probably timers ]]--
    local num_inter=#caste.body_info.interactions  -- new for interactions
    unit.curse.own_interaction:resize(num_inter) -- new for interactions
    unit.curse.own_interaction_delay:resize(num_inter) -- new for interactions
    --[[ body stuff ]]
   
    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
    --[[ body components ]]
    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}
    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
    --[[ largely unknown stuff ]]
    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
   
    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)
   
    --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)
   
    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)
   
    --finally set the id
    unit.id=df.global.unit_next_id
    df.global.unit_next_id=df.global.unit_next_id+1
    df.global.world.units.all:insert("#",unit)
    df.global.world.units.active:insert("#",unit)
   
    return unit
end

local 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
 
local function createFigure(trgunit,he,he_group)
    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
    -- ...
    hf.info.skills = {new=true}
 
 
    he.histfig_ids:insert('#', hf.id)
    he.hist_figures:insert('#', hf)
    if he_group then
        he_group.histfig_ids:insert('#', hf.id)
        he_group.hist_figures:insert('#', hf)
        hf.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=he_group.id,link_strength=100})
    end
    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

local function  allocateNewChunk(hist_entity)
    hist_entity.save_file_id=df.global.unit_chunk_next_id
    df.global.unit_chunk_next_id=df.global.unit_chunk_next_id+1
    hist_entity.next_member_idx=0
    print("allocating chunk:",hist_entity.save_file_id)
end

local function allocateIds(nemesis_record,hist_entity)
    if hist_entity.next_member_idx==100 then
        allocateNewChunk(hist_entity)
    end
    nemesis_record.save_file_id=hist_entity.save_file_id
    nemesis_record.member_idx=hist_entity.next_member_idx
    hist_entity.next_member_idx=hist_entity.next_member_idx+1
end
 
local function createNemesis(trgunit,civ_id,group_id)
    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(4)
    --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]]
    nem.unk10=-1
    nem.unk11=-1
    nem.unk12=-1
    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=-1
 
    local he=df.historical_entity.find(civ_id)
    he.nemesis_ids:insert("#",id)
    he.nemesis:insert("#",nem)
    local he_group
    if group_id~=-1 then
        he_group=df.historical_entity.find(group_id)
    end
    if he_group then
        he_group.nemesis_ids:insert("#",id)
        he_group.nemesis:insert("#",nem)
    end
    allocateIds(nem,he)
    nem.figure=createFigure(trgunit,he,he_group)
end

-- Do the placement, returns the freshly spawned unit
function place(args)
    if not args.race then
        qerror("Please provide a race")
    end

local pos = {}
if args.position then
    pos.x=args.position[1]
pos.y=args.position[2]
pos.z=args.position[3]
else
    pos = copyall(df.global.cursor)
end

    if pos.x == -30000 then
        qerror("Point your pointy thing somewhere")
    end

    local i
    local race_id = findRace(args.race)
    local u = CreateUnit(race_id,args.caste,args.age)

    u.pos:assign(pos)
       
    if args.name then
        u.name.first_name = args.name
        u.name.has_name = true
    end

if args.hostile then
    args.civ_id = -1
end

    local group_id
    if df.global.gamemode == df.game_mode.ADVENTURE then
        u.civ_id = args.civ_id or df.global.world.units.active[0].civ_id
        group_id = -1
    else   
        u.civ_id = args.civ_id or df.global.ui.civ_id
    end

    if args.civ_id == -1 then
        group_id = group_id or -1
    else
        group_id = group_id or df.global.ui.group_id
    end

    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,group_id)
    end

    return u
end

validArgs = validArgs or utils.invert({
    'help',
    'race',
    'caste',
    'age',
    'name',
    'position',
    'civ_id',
    'hostile',
})

local args = utils.processArgs({...}, validArgs)

if args.help then
 print([[scripts/spawn-unit.lua
arguments
    -help
        print this help message
    -race <RACE_ID>
        The raw id of the creature's race, mandatory
    -caste <number>
        The caste's number, optional
-age <number>
    The unit's age in years, defaults to 15 if omitted
-name <doggy>
        The unit's name, optional
    -position [ x y z ]
        The unit's position, will try to use the cursor if ommited
    -civ_id
        The unit's civilisation, will be the player's if ommited
    -hostile
        Overrides the civ_id to -1
]])
 return
end

if args.race then
    place(args) --Creature (ID), caste (number), age, name, x,y,z , civ_id(-1 for enemy, optional) for spawn.
end
Title: Re: DFHack 0.40.24-r2
Post by: Boltgun on March 23, 2015, 03:48:15 am
A specific flag will be more explicit instead of -1 anyway.

There is the xyz2pos(x,y,z) and pos2xyz(pos). Handling position with those format still leads me to a lot of error somehow.
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 23, 2015, 11:36:02 am
Use \-1

Question about syndromes. This is kind of complicated to I'll just skip right to an example;

If I use add-syndrome to add a syndrome with an END I am guessing it will behave just as normal and finish at the appropriate time. But what if, instead, I used add-syndrome to add a syndrome with no END and instead removed said syndrome at a later time? Would that function the same way? Or is there something special that the game does when it ends a syndrome naturally, versus getting removed with a script?

Not completely sure but I think it's fine except for transformations. It might even be fine for transformations. I haven't tested it thoroughly. Let me know how it goes. That ought to be documented.

It didn't like -civ_id \-1 either ("inavlid escape sequence").  For now I'll add a -hostile flag to override the civ to -1 if it's present, but if there is a general solution I'd rather go with what's going to be in the spawn-unit.lua that everyone else is using.

Code: (tesb-spawn-unit.lua) [Select]
--create unit at pointer or given location and with given civ (usefull to pass -1 for enemy). Usage e.g. "spawn-unit -race DWARF -caste 0 -name Dwarfy"
--[=[
    arguments
        -help
            print this help message
        -race <RACE_ID>
            The raw id of the creature's race, mandatory
        -caste <number>
            The caste's number, optional
        -age <number>
            The unit's age in years, defaults to 15 if omitted
        -name <doggy>
            The unit's name, optional
        -position [ x y z ]
            The unit's position, will try to use the cursor if omitted
        -civ_id
            The unit's civilisation, will be the player's if omitted
        -hostile
            Overrides the civ_id to -1

    Example : spawn-unit -race HUMAN -caste 0 -name Bob

    Made by warmist, but edited by Putnam for the dragon ball mod to be used in reactions
Modified by Dirst for use in The Earth Strikes Back mod

    TODO:
        throw a proper error if the user attempt to run it from the console, without good args
        orientation
        chosing a caste based on ratios
        birth time
        death time
        real body size
        blood max
        check if soulless and skip make soul
        set weapon body part
        nemesis/histfig : add an 'arrived on site' event
        generate name
--]=]
local utils=require 'utils'

-- Picking a caste or gender at random
local function getRandomCasteId(race_id)
    local cr = df.creature_raw.find(race_id)
    local caste_id, casteMax

    casteMax = #cr.caste - 1

    if casteMax > 0 then
        return math.random(0, casteMax)
    end

    return 0
end

local function getCaste(race_id,caste_id)
    local cr=df.creature_raw.find(race_id)

    return cr.caste[tonumber(caste_id)]
end

local 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

local function getBodySize(caste,time)
    --TODO: real body size...
    return caste.body_size_1[#caste.body_size_1-1] --returns last body size
end

local function genAttribute(array)
    local a=math.random(0,#array-2)
    return math.random(array[a],array[a+1])
end

local function norm()
    return math.sqrt((-2)*math.log(math.random()))*math.cos(2*math.pi*math.random())
end

local function normalDistributed(mean,sigma)
    return mean+sigma*norm()
end

local 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

local 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: 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.personality.traits) do
        local min,mean,max
        min=caste.personality.a[k]
        mean=caste.personality.b[k]
        max=caste.personality.c[k]
        tmp_soul.personality.traits[k]=clampedNormal(min,mean,max)
    end
    --[[natural skill fix]]
    for k, skill in ipairs(caste.natural_skill_id) do
        local rating = caste.natural_skill_lvl[k]
        utils.insert_or_update(tmp_soul.skills,
            {new=true,id=skill,experience=caste.natural_skill_exp[k],rating=rating}, 'id')
    end
   
    unit.status.souls:insert("#",tmp_soul)
    unit.status.current_soul=tmp_soul
end

local function CreateUnit(race_id,caste_id,unit_age)
    local race=df.creature_raw.find(race_id)
    if race==nil then error("Invalid race_id") end

unit_age = unit_age or 15
   
local caste
    local unit=df.unit:new()

    -- Pick a random caste is none are set
    if nil == caste_id then
        caste_id = getRandomCasteId(race_id)
    end

    caste = getCaste(race_id,caste_id)

    unit:assign{
        race=race_id,
        caste=caste_id,
        sex=caste.gender,
    }

    unit.relations.birth_year=df.global.cur_year-unit_age --AGE is set here
    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.relations.birth_time=df.global.cur_year_tick
    --unit.relations.old_time=?? --TODO add normal age
    --[[ interataction stuff, probably timers ]]--
    local num_inter=#caste.body_info.interactions  -- new for interactions
    unit.curse.own_interaction:resize(num_inter) -- new for interactions
    unit.curse.own_interaction_delay:resize(num_inter) -- new for interactions
    --[[ body stuff ]]
   
    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
    --[[ body components ]]
    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}
    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
    --[[ largely unknown stuff ]]
    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
   
    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)
   
    --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)
   
    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)
   
    --finally set the id
    unit.id=df.global.unit_next_id
    df.global.unit_next_id=df.global.unit_next_id+1
    df.global.world.units.all:insert("#",unit)
    df.global.world.units.active:insert("#",unit)
   
    return unit
end

local 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
 
local function createFigure(trgunit,he,he_group)
    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
    -- ...
    hf.info.skills = {new=true}
 
 
    he.histfig_ids:insert('#', hf.id)
    he.hist_figures:insert('#', hf)
    if he_group then
        he_group.histfig_ids:insert('#', hf.id)
        he_group.hist_figures:insert('#', hf)
        hf.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=he_group.id,link_strength=100})
    end
    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

local function  allocateNewChunk(hist_entity)
    hist_entity.save_file_id=df.global.unit_chunk_next_id
    df.global.unit_chunk_next_id=df.global.unit_chunk_next_id+1
    hist_entity.next_member_idx=0
    print("allocating chunk:",hist_entity.save_file_id)
end

local function allocateIds(nemesis_record,hist_entity)
    if hist_entity.next_member_idx==100 then
        allocateNewChunk(hist_entity)
    end
    nemesis_record.save_file_id=hist_entity.save_file_id
    nemesis_record.member_idx=hist_entity.next_member_idx
    hist_entity.next_member_idx=hist_entity.next_member_idx+1
end
 
local function createNemesis(trgunit,civ_id,group_id)
    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(4)
    --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]]
    nem.unk10=-1
    nem.unk11=-1
    nem.unk12=-1
    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=-1
 
    local he=df.historical_entity.find(civ_id)
    he.nemesis_ids:insert("#",id)
    he.nemesis:insert("#",nem)
    local he_group
    if group_id~=-1 then
        he_group=df.historical_entity.find(group_id)
    end
    if he_group then
        he_group.nemesis_ids:insert("#",id)
        he_group.nemesis:insert("#",nem)
    end
    allocateIds(nem,he)
    nem.figure=createFigure(trgunit,he,he_group)
end

-- Do the placement, returns the freshly spawned unit
function place(args)
    if not args.race then
        qerror("Please provide a race")
    end

local pos = {}
if args.position then
    pos.x=args.position[1]
pos.y=args.position[2]
pos.z=args.position[3]
else
    pos = copyall(df.global.cursor)
end

    if pos.x == -30000 then
        qerror("Point your pointy thing somewhere")
    end

    local i
    local race_id = findRace(args.race)
    local u = CreateUnit(race_id,args.caste,args.age)

    u.pos:assign(pos)
       
    if args.name then
        u.name.first_name = args.name
        u.name.has_name = true
    end

if args.hostile then
    args.civ_id = -1
end

    local group_id
    if df.global.gamemode == df.game_mode.ADVENTURE then
        u.civ_id = args.civ_id or df.global.world.units.active[0].civ_id
        group_id = -1
    else   
        u.civ_id = args.civ_id or df.global.ui.civ_id
    end

    if args.civ_id == -1 then
        group_id = group_id or -1
    else
        group_id = group_id or df.global.ui.group_id
    end

    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,group_id)
    end

    return u
end

validArgs = validArgs or utils.invert({
    'help',
    'race',
    'caste',
    'age',
    'name',
    'position',
    'civ_id',
    'hostile',
})

local args = utils.processArgs({...}, validArgs)

if args.help then
 print([[scripts/spawn-unit.lua
arguments
    -help
        print this help message
    -race <RACE_ID>
        The raw id of the creature's race, mandatory
    -caste <number>
        The caste's number, optional
-age <number>
    The unit's age in years, defaults to 15 if omitted
-name <doggy>
        The unit's name, optional
    -position [ x y z ]
        The unit's position, will try to use the cursor if ommited
    -civ_id
        The unit's civilisation, will be the player's if ommited
    -hostile
        Overrides the civ_id to -1
]])
 return
end

if args.race then
    place(args) --Creature (ID), caste (number), age, name, x,y,z , civ_id(-1 for enemy, optional) for spawn.
end

Sorry if I missed it, but do you have an exact example of  \-1 failing? What does devel/print-args output? If it doesn't work then that's a bug in processArgs.
Title: Re: DFHack 0.40.24-r2
Post by: Roses on March 23, 2015, 12:06:54 pm
Use \-1

Question about syndromes. This is kind of complicated to I'll just skip right to an example;

If I use add-syndrome to add a syndrome with an END I am guessing it will behave just as normal and finish at the appropriate time. But what if, instead, I used add-syndrome to add a syndrome with no END and instead removed said syndrome at a later time? Would that function the same way? Or is there something special that the game does when it ends a syndrome naturally, versus getting removed with a script?

Not completely sure but I think it's fine except for transformations. It might even be fine for transformations. I haven't tested it thoroughly. Let me know how it goes. That ought to be documented.

I suppose it can be tested pretty easily by just creating two syndromes that are the same with different names, expect one has an END and the other doesn't then terminating the one that doesn't with add-syndrome. I'll test how this functions for various types of syndromes.

The only problem I forsee in actual practice is how to make sure you get rid of the correct syndrome. For instance, if you have syndrome A on a unit and they get another syndrome A, how do you tell add-syndrome to remove the first syndrome A? Similarly, what if you add to the duration or reset it instead of making a new instance? Is there anyway to modify a dfhack.timeout call to add more time?

EDIT: So it has been a while since I have actually gone through DFHack and seeing what there is, I have noticed a couple things that I may have missed before, or may be new, and have a couple questions.

actions
1. Am I correct in assuming that these are the actions that the unit performed?
2. I notice things like parry, block, dodge, suckblood, etc... Is it possible to use these in item-trigger? For instance, instead of -onStrike can we create an -onParry?
3. If a unit performs an action I assume a timer gets set for that specific action. Would it be possible to make a "quick" like spell, where the timer is reset allowing the unit to attack, dodge, or whatever more often/quickly?

interactions
4. I see both interaction_delay and own_interaction_delay in the curse section. Are these referencing syndrome vs innate interactions?
5. Similarly to 3, if I set the delay to 0 will they be able to use the interaction again before they normally would be?

used items
6. Can we now artificially make a dwarf attached to an item? Like make a cursed item where when the dwarf picks it up they are super affectionate to it?
7. What game play effects does attachement have?

EDIT2: Another question. I know the text for a dwarf's thoughts and preferences are based on things that dfhack can manipulate, but is there a way to get that text to use in a different area? What I am hoping to do is restructure the way you view a unit by creating another gui, and was hoping I could separate out certain things.
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 23, 2015, 03:17:36 pm
Sorry if I missed it, but do you have an exact example of  \-1 failing? What does devel/print-args output? If it doesn't work then that's a bug in processArgs.
Other than my "invalid escape sequence" quote, you didn't miss anything.  It might be a bit before I have time to replicate under controlled conditions, but the first version of spawn-unit.lua I posted ought to exhibit the error.  If it makes a difference, -civ_id was the last argument on the command line.
Title: Re: DFHack 0.40.24-r2
Post by: expwnent on March 24, 2015, 05:40:51 am
Sorry if I missed it, but do you have an exact example of  \-1 failing? What does devel/print-args output? If it doesn't work then that's a bug in processArgs.
Other than my "invalid escape sequence" quote, you didn't miss anything.  It might be a bit before I have time to replicate under controlled conditions, but the first version of spawn-unit.lua I posted ought to exhibit the error.  If it makes a difference, -civ_id was the last argument on the command line.

Code: [Select]
modtools/force -eventType \-1

#[...]modtools/force.lua:58: Invalid eventType: -1

This crashes (correctly) on line 58, after utils.processArgs.
Title: Re: DFHack 0.40.24-r2
Post by: thepaan on March 25, 2015, 08:51:07 pm
I'm trying to find the biome for a specific embark tile like this. (http://i.imgur.com/CX5SpiM.png)

I've messed around a little with
Code: [Select]
dfhack.maps.getRegionBiome()I can get the following, but don't know how to interpret the output to get the info as in the first image above. (http://i.imgur.com/QhEvh0d.png)

Is there a reference document or something I can read that explains the output? Or, should I be approaching it differently?

Any assistance is greatly appreciated.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 26, 2015, 03:54:46 pm
Wouldn't that just be the elevation/rainfall stuff? It's very low, moist, would have vegetation if not for being underwater, it's very warm, not evil at all, decent drainage, below average volcanism, high savagery.
Title: Re: DFHack 0.40.24-r2
Post by: lethosor on March 26, 2015, 03:59:19 pm
A landmass_id of -1 could refer to an ocean as well.
Title: Re: DFHack 0.40.24-r2
Post by: Eldin00 on March 26, 2015, 04:53:31 pm
Elevation, rainfall, drainage, and temperature are the main factors that go into determining biome. From the wiki entry for biome: Elevation <= 99 is ocean, elevation >= 300 is mountain. Low enough temperature creates glacier. Otherwise, drainage and rainfall create a base biome. If it's warm enough, (wiki suggests cutoff is near 65) it is the tropical variant. If it's cold enough, it becomes tundra or taiga (depending on what the base type was). If you have wetlands, look at the salinity to determine freshwater/saltwater. The only bit I'm not sure how to differentiate from just the info in that screenshot is broadleaf vs conifer forest.

The wiki has a table to determine the base biome type from drainage and rainfall, but the values in that table are taken from an older version and should probably be checked to make sure that they are still accurate.
Title: Re: DFHack 0.40.24-r2
Post by: thepaan on March 26, 2015, 05:20:17 pm
Elevation, rainfall, drainage, and temperature are the main factors that go into determining biome...

I think I can deal with that, but is there a function which provides that information for the local window? Right now I can only find info for the region, but I'd like it to go down to the local scale.
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 26, 2015, 08:35:26 pm
Elevation, rainfall, drainage, and temperature are the main factors that go into determining biome...

I think I can deal with that, but is there a function which provides that information for the local window? Right now I can only find info for the region, but I'd like it to go down to the local scale.
Also, try running your query somewhere with a lake and somewhere else with a river to see if the structure changes.  Don't want the tool to have unrealistic expectations of data stability.
Title: Re: DFHack 0.40.24-r2
Post by: Dirst on March 27, 2015, 11:07:18 pm
Sorry if I missed it, but do you have an exact example of  \-1 failing? What does devel/print-args output? If it doesn't work then that's a bug in processArgs.

Thanks for the advice.  It turns out that the error was in the calling script and not the called one!  Apparently backslashes inside Lua strings need to be treated carefully.  When I built the string with \\-1, it got into the string as \-1, which then executed properly in a dfhack.run_command() call.  A single backslash led to an invalid escape sequence with the string.

Now I know... and knowing is half the battle.
Title: Re: DFHack 0.40.24-r2
Post by: Uzu Bash on March 28, 2015, 10:58:31 am
re advfort: Are workshop products limited by civ? Playing an outsider adventurer, haven't tried it with an adventurer from a civ. A lot of things are not showing up in the lists, including all weapons and armor.

Surprisingly, no booze is available. I had a barrel and several boozables in my backpack, also tried putting them on the workshop's center tile, but didn't get any option other than 'Extract from Plant'.
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 29, 2015, 03:34:15 am
Yeah, they're definitely linked to civ, you can see it with other stuff too, I had a typo in one of the lightly modded wanderer's friend/mod reactions I was tinkering with to make a large dagger with bone and a rock, I left out the _large part after dagger apparently so it just cycled through the different weapon types available by default, so dorfs made axes, hammers, short swords, spears, picks, while elfs made spears, bows, long swords, and so forth.
Title: Re: DFHack 0.40.24-r2
Post by: Uzu Bash on March 29, 2015, 10:12:17 am
I figured that was the case with weapon/armor, but booze? Even before the plant explosion, dwarves could put anything through a still, and now they can embark in completely unfamiliar biomes and make alcohol out of anything they forage. Are dwarves explicitly all-inclusive, and do any other civs really have limitations with regard to booze? Or am I doing something wrong?
Title: Re: DFHack 0.40.24-r2
Post by: Max™ on March 29, 2015, 11:46:13 am
Outsiders start with a weird civ that I think is hardcoded (or if there is any way to alter it I haven't heard of it being found so I simply assume it is hardcoded) and it only has access to a few things.
Title: Re: DFHack 0.40.24-r2
Post by: Rumrusher on March 29, 2015, 06:25:01 pm
Outsiders start with a weird civ that I think is hardcoded (or if there is any way to alter it I haven't heard of it being found so I simply assume it is hardcoded) and it only has access to a few things.
you mean no civ? they start with no Civ at all which is why they don't get the chance to claim rights as those who start with one.
something about claiming a site makes a new entity I guess branching off of an old Civ. it's one of the things that caused vampires to no fight you if you outed them as an outcast, mostly due to they suddenly lose their Civ alignment and act like their an Wild animal this also happens to normal peasants if you slap a -1 to their Civ_id.  it was the thing that made Civil bogeymen before.
then there's the bit where if you do attempt to claim a new site it kinda boots you out of the position you had in the old entity, or how I see it when I had an adventurer lose access to their starting camp after becoming a lord in the hamlet next door then lost the ability to claim any more sites.

or it could be pulling from the Cave citizen Entity Raw and those has to have some kind of workshop to function making all that leather.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on March 30, 2015, 12:12:55 pm
New release! See first post for details, changelog, and download link.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on March 30, 2015, 01:02:23 pm
Great work as always.
Title: Re: DFHack 0.40.24-r3
Post by: Meph on March 30, 2015, 08:09:22 pm
Awesome :)

Especially the catsplosion update and modtools/reaction-product-trigger.

There are a couple of things missing in dfhack that I use, custom scripts from 34.11 that still work in 40.24. Startdwarf for example, I think you are still missing the offsets for windows, which I do have. UristDaVincis Add-X-to-Civ scripts, you can add specific materials (or remove them) from civs. Or add pets, mounts, minions, etc.

Not sure if Autofixhandedness is included in dfhack, but I think I remember that I had to copy it too. (custom gloves get left/right assigned) as did slayrace.

What would be required for you to add them in the next official release?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on March 30, 2015, 08:12:43 pm
For them to work.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on March 30, 2015, 08:17:12 pm
Fricy added the start_dwarf_count offset for Windows. "slayrace" is now "exterminate" (and has been included in DFHack under one of these names since 0.34.11, or possibly earlier).

Also (not mentioned in the first post), there is an OS X build on Github, as well as builds without Stonesense for OS X and Linux.
Title: Re: DFHack 0.40.24-r3
Post by: FukkenSaved on March 30, 2015, 09:12:19 pm
Autohauler is still a work in progress and I'd appreciate any ideas offered. It currently discourages hauling too much and for practical usage I'd recommend disabling AH and enabling hauling for most dwarves when too much of a backlog accumulates, maybe every two months. There still needs to be a backlog to ensure full employment, although clearly we want food hauled as soon as possible.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on March 30, 2015, 09:24:56 pm
Oh my bloodgod... a search function in gm-editor... there are... no words... should have waited until the next version... so I could have sent a poet.
Title: Re: DFHack 0.40.24-r3
Post by: milo christiansen on April 02, 2015, 01:02:20 pm
YES! Finally the new building-hacks!

It will be a new age for powered workshops! (animal treadmills here I come)
Title: Re: DFHack 0.40.24-r3
Post by: IndigoFenix on April 02, 2015, 02:36:35 pm
Just a question: Is spawnunit working properly now?  As in, creatures don't become hostile when loading a saved file?
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 02, 2015, 03:25:03 pm
Just a question: Is spawnunit working properly now?  As in, creatures don't become hostile when loading a saved file?

No.
Title: Re: DFHack 0.40.24-r3
Post by: milo christiansen on April 02, 2015, 03:31:36 pm
Found a bug: when workflow re-adds a canceled repeat job the new job will not run when unsuspended.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 02, 2015, 06:28:27 pm
So I have been experimenting with adding emotions to units in the hopes of being able to mimic things like "fear" spells. Now I have gotten the emotions to register (i.e. in the thoughts and preferences section is says "He experienced fear lately"/"He experienced terror recentely" etc...) But it doesn't seem to have any impact on the actual dwarf. That is to say, no matter what severity, or how many of them, he never gets afraid or anything like that. Are those emotions only linked to a happiness counter? Is there a way to make a dwarf run away in fear? I noticed there is a cowardly flag, and the BRAVERY trait, but fiddling with those only seemed to change descriptions of the dwarf.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 02, 2015, 11:07:04 pm
...You know, there's an add-thought script included with DFHack.

I wrote it myself, and yeah, I had to manually add the stress change associated with the emotion. I'm not sure if there's some specific threshold for extreme emotion reactions or if perhaps it's determined by personality.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 03, 2015, 02:16:08 am
...You know, there's an add-thought script included with DFHack.

I wrote it myself, and yeah, I had to manually add the stress change associated with the emotion. I'm not sure if there's some specific threshold for extreme emotion reactions or if perhaps it's determined by personality.

No I didn't know that :) I will definitely have to play around with that. It looks great (as all your stuff does :) ) Is there a list of thoughts and emotions somewhere?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 03, 2015, 02:29:19 am
https://github.com/DFHack/df-structures/blob/master/df.unit-thoughts.xml

With the script, you can actually get the emotion by name, too.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 03, 2015, 03:08:10 am
https://github.com/DFHack/df-structures/blob/master/df.unit-thoughts.xml

With the script, you can actually get the emotion by name, too.

Didn't even notice the gui, fantastic good sir!
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 03, 2015, 08:12:22 am
https://github.com/DFHack/df-structures/blob/master/df.unit-thoughts.xml

With the script, you can actually get the emotion by name, too.

Didn't even notice the gui, fantastic good sir!
Roses admired a fine script lately.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 03, 2015, 11:04:20 am
See, this is why I felt the need to point out where I got the getselectedunit stuff from, I didn't come up with it, and anyways more people checking out your scripts is a good thing, so many useful toys and clever tricks. :P
Title: Re: DFHack 0.40.24-r3
Post by: SMASH! on April 03, 2015, 11:07:59 am
One of my dwarfs got his ear mangled and he doesn't want to take care of it, even if it is covered in pus. Are there any scripts to heal creature (or tear the ear, lol)? I found some, but they seem to be outdated. Thanks.
Title: Re: DFHack 0.40.24-r3
Post by: milo christiansen on April 03, 2015, 11:24:53 am
To whoever added that new argument to the Lua hook function signature and didn't add it to the docs or change log: You suck.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 03, 2015, 11:49:59 am
What exactly are you referring to?
Title: Re: DFHack 0.40.24-r3
Post by: milo christiansen on April 03, 2015, 12:04:20 pm
The old Lua hook functions had 7 arguments, the one's needed by eventful in 40.24-r3 have 8.

And instead of tacking the new argument on to the end of the list (which would allow old hook functions to continue working) it was added between the second and third arguments (which breaks ABSOLUTELY EVERY SINGLE LUA HOOK, IN EVERY SINGLE MOD).

Old list: reaction, unit, in_items, in_reag, out_items, call_native
New list: reaction, reaction_product, unit, in_items, in_reag, out_items, call_native
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 03, 2015, 12:06:22 pm
Where's that function defined?
Edit: If you're referring to the onReactionComplete event, that looks like it was changed in https://github.com/DFHack/dfhack/commit/e5e0d93ef1e01386b45f241931dd50ffe04e0652
Title: Re: DFHack 0.40.24-r3
Post by: milo christiansen on April 03, 2015, 12:07:55 pm
In the eventful Lua module ("lua/plugins/eventful.lua") in the body of the "register" function.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 03, 2015, 12:20:47 pm
It looks like that should only affect registerReaction(), not all Lua hooks: https://github.com/DFHack/dfhack/blob/0849099f2083e100cae6f64940b4eff4c28ce2eb/Lua%20API.rst#examples
I do agree that this should have been documented (the documentation in r3 doesn't mention it at all), but I don't really think adding it after call_native would have made much sense either. It would be easier to maintain compatibility if Lua allowed keyword arguments, which it unfortunately doesn't. It might be possible to pass all arguments to Lua event handlers in a single table, although that would break compatibility again. Thoughts?
Title: Re: DFHack 0.40.24-r3
Post by: milo christiansen on April 03, 2015, 12:31:59 pm
(by Lua hooks I meant reaction hooks, sorry for the confusion)

I agree that putting it after call_native wouldn't make much sense, but it would have preserved compatibility.

My big problem is the lack of mention in the change log and the documentation that wasn't updated. Change logs are holy items that MUST be up to date at all times, else you risk irate users who suddenly have mods stop working for no apparent reason.

Edit: Typos are the bane of civilization.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 03, 2015, 02:15:35 pm
You're right. I'm sorry. I should have documented it better. At least it has better functionality now. modtools/reaction-product-trigger should be able to replace all existing Lua hooks.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 03, 2015, 03:09:43 pm
Now I feel bad, want a hug expwnent?
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 04, 2015, 12:43:03 pm
Aw, shucks.
Title: Re: DFHack 0.40.24-r3
Post by: Uzu Bash on April 05, 2015, 12:51:44 am
How would I use gm-editor to transport my adventurer from the fast travel screen? I have a broken save I'm trying to recover to playability, but I'm stuck in fast travel so I can't directly select my character, and I can't leave fast travel without crashing. I can't guess the lua command required to target my character, but it's probably obvious to anyone who doesn't need documentation. Could someone please inform me?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 05, 2015, 12:54:49 am
I have no freaking idea.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 05, 2015, 01:05:41 am
Yeah I'm stumped there too, I was trying to figure out what the "fast-travel status" was myself a while back, I'm sure there's a string you can give it that will open up a particular unit in the editor, but I'm not sure how you would actually pull it out of travel mode...

Can you move in travel mode at all? If you could get to a site you can retire at it should unretire you out of travel mode right, or is that part of the problem?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 05, 2015, 01:14:52 am
You're not a unit in the map screen, you're an army.

And I've only been able to find the player army when on the city travel screen.
Title: Re: DFHack 0.40.24-r3
Post by: Uzu Bash on April 05, 2015, 01:26:36 am
Can you move in travel mode at all?
I've tried everything; the answer is no. This question wouldn't be here if I could. The character's coordinates should be accessible somewhere, shouldn't it? I can browse armies, but none of the coords there match the format I expected.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 05, 2015, 02:18:18 am
Hmmm, I was poking around at different stuff from the API, which string did you use to pull up armies btw?

Oh, and I felt it important to ask if you can move at all because I've had saves where I was able to move a bit but when I tried to leave travel mode it would crash, but I never tried to see if I could retire to recover them as it hadn't came to me at the time.
Title: Re: DFHack 0.40.24-r3
Post by: Uzu Bash on April 05, 2015, 07:45:10 am
"df.global.world.armies" and "df.global.world.army_ controllers". But I don't see anything that identifies them. None of these number lengths max unit id's.

Yeah, I can't even move a single tile. I tried all directions and sneak mode. I think it's because I'm over a corrupted unit and it may be trying to ambush me to bring in me into the local area. That's why I think if I could just change my world position to another tile and reload, I could come out of fast travel and try another approach.

EDIT: Historical figure #176278, is actually in the list at #176281. unitid (#148006) is also saved here, but not much else that the unit data would be constructed from. Current soul has a different unitid (#147918). squad id 487, no indication of army id there.

What is the heirarchy for referencing a historical figure?
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on April 05, 2015, 03:35:33 pm
 oh hey I have a script for finding such adventurer army...

Code: [Select]
for k,v in pairs(df.global.world.armies.all) do
if v.unk_48[0]== true  then
print(k)
end
end

this will print out a code that looks up the army in the global world armies list.
all you need to do next is to say use the search function in gm-editor to locate the army.
Title: Re: DFHack 0.40.24-r3
Post by: Uzu Bash on April 05, 2015, 04:17:25 pm
Thanks, that worked at least output something! I was trying to use gm-editor's built-in function command, but couldn't get the syntax. At least I recognize my char's nemesis id at the top of army 1c, but the rest of these numbers are completely unfamiliar. How do I interpret these pos? They're not region or world coords.
Title: Re: DFHack 0.40.24-r3
Post by: Insanegame27 on April 05, 2015, 05:30:34 pm
has the makeown script been updated yet?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 05, 2015, 05:42:21 pm
Does it work?
Also, it's a tweak (i.e. part of the tweak plugin), not a script - you'll want to use "tweak makeown".
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 05, 2015, 06:11:45 pm
HO HO HO!

Worked out that I was army 40, so I did gui/gm-editor df.global.world.armies.all[40] > pos1 *edit* > pos2 *edit*

x288 y204:
Spoiler (click to show/hide)

x288 y405:
Spoiler (click to show/hide)

x488 y606:
Spoiler (click to show/hide)

x0 y0:
Spoiler (click to show/hide)

x0 y815:
Spoiler (click to show/hide)

x815 y0:
Spoiler (click to show/hide)

x815 y815:
Spoiler (click to show/hide)

I stopped and moved around a bit and pulled up the armies screen while resting, it didn't list the same way as while moving but I was able to check and find the ones that had controller_id = -1, controller = nil and narrow that down to the one with unk_48, 0 = true but it didn't work like I expected when I tried to teleport while sleeping, I think there is something else that controls move state vs rest state.

Generally once you start moving in travel mode it looks like your army ends up on the bottom of the list each time, but until you move it will be mixed in through the list, and it looks like once you start moving and don't exit travel mode you remain the same army on the list.

Trying to put an x or y greater than 815 and less than 0 on a 17x17 crashes as expected, btw.

For what it's worth that implies 48 possible coordinates per 1x1 world map tile, which sounds about right from the zoom travel map vs wilderness travel map scaling.
Title: Re: DFHack 0.40.24-r3
Post by: Uzu Bash on April 05, 2015, 06:51:14 pm
The army's coords were roughly 6400 x 4400, the world coords of my last incident was roughly 102000 x 70000, so the scale was throwing me off. Also I expected a controller id attached to the same entity as my incident records. Since I'm lord of an independent city-state, I'm technically the CUSTOM_LAW_MAKER of that entity.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 05, 2015, 08:00:31 pm
Yeah, with a 100x100 world you're getting coords up to 4800x4800 in army mode, so I can see why that would be confusing, I poked at a couple 1 digit changes and couldn't see what it was doing until I ended up on a river and went "ohhhhhh" and started hopping all over the place.

Note that it was pure coincidence that I hopped from city to city to city in the first three screenshots, just added 200 and saw where I landed.
Title: Re: DFHack 0.40.24-r3
Post by: sweitx on April 05, 2015, 08:43:00 pm
Regarding the stockflow plugin, perhaps it would be easier to make it work more like workflow that's tied to a stockpile (having read a separate thread about the difficulty of having stockpile generate jobs in connected workshops)?
Instead of using job manager, stockpile will suspend/resume relevant job in the "Take from" workshops. Then each stockpile can "borrow" the workflow's interface to set up a set number/stacks of items to maintain in the stockpile.

Instead of having stockpile "create" the job, require user to create a job on repeat in the linked workshop. The stockflow UI can indicate if it can detect a relevant job it can control in the linked workshops.
Title: Re: DFHack 0.40.24-r3
Post by: NullForceOmega on April 07, 2015, 02:42:23 pm
I have used DFhack with every version of DF since 31.25, and you guys have done incredible work on it, that said, I have several problems with the latest iterations of the toolset.

1) What the hell is the init example file written in, I can read it in notepad but it becomes a horrific unformatted mess that is nearly impossible to understand.
2) I do NOT like having DFhack automatically utilize the init example on startup, there are more than a few plugins I simply don't want running AT ALL in DF, as for why this is a problem see #1
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on April 07, 2015, 03:03:27 pm
It's, uh, pretty straightforward ASCII.

(http://i.imgur.com/JlZ3cPA.png)

I'd blame whatever you're doing to read it, honestly.
Title: Re: DFHack 0.40.24-r3
Post by: fricy on April 07, 2015, 03:04:57 pm
I have used DFhack with every version of DF since 31.25, and you guys have done incredible work on it, that said, I have several problems with the latest iterations of the toolset.

1) What the hell is the init example file written in, I can read it in notepad but it becomes a horrific unformatted mess that is nearly impossible to understand.
2) I do NOT like having DFhack automatically utilize the init example on startup, there are more than a few plugins I simply don't want running AT ALL in DF, as for why this is a problem see #1

1) Blame (http://en.wikipedia.org/wiki/Newline) Microsoft and use notepad++ (http://notepad-plus-plus.org/download/v6.7.5.html)
2) The example is there to help customize the configuration to your liking. Edit the file to disable unwanted plugins. See 1)
Title: Re: DFHack 0.40.24-r3
Post by: NullForceOmega on April 07, 2015, 03:10:37 pm
I do not want the effing thing to run AT ALL unless I'm telling it what to do, what part of that is hard to comprehend?  And so I take issue with DFhack automatically running something I can't even read.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 07, 2015, 03:15:58 pm
The issue is that whatever you're using to read the file isn't respecting the newlines in it. You can use another editor or create a dfhack.init file (like the message states) to be used instead, which can contain whatever you want.
Anyway, what plugins don't you want to run? Most of the defaults are fairly reasonable, in my opinion.
Title: Re: DFHack 0.40.24-r3
Post by: NullForceOmega on April 07, 2015, 03:22:23 pm
I don't want to have any of the workflow stuff running, I don't really feel the need to have any of the trade stuff, I do not want max wheelbarrow at all, the advmode-contained thing does not need to be active, I don't have any idea what the hell the farm plot stuff is at all, so I would massively prefer to not have that, and I don't use the mouse for anything except switching active windows so to hell with that also, so almost everything that is enabled by default I don't want running.  Pretty much the only Items I do want are the stable material, stable cursor, and military tweaks.  ANd my problem with the init example is that windows does not acknowledge that is any type of file at all, so I have to manually tell it to load it in notepad, and that completely breaks its formatting.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 07, 2015, 03:27:43 pm
Here's the default dfhack.init-example: https://github.com/DFHack/dfhack/blob/master/dfhack.init-example
The only workflow-related things are keybindings, which won't actually work if you don't enable the plugin itself. Most tweaks (fast-trade, tradereq-pet-gender, farm-plot-select) are bugfixes or add a key or two to some screens to make things easier - "tweak help" or "help tweak" should list all of them. I can understand disabling things like autotrade and the max-wheelbarrow tweak if you don't expect to use them, but most of these tools won't impact performance unless you're actively using them.
If you like, you can save that file to "dfhack.init" and edit it to your liking, or create an empty dfhack.init file in the DF folder.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 07, 2015, 03:51:16 pm
I do not want the effing thing to run AT ALL unless I'm telling it what to do, what part of that is hard to comprehend?  And so I take issue with DFhack automatically running something I can't even read.

It's perfectly easy to understand and people are comprehending exactly what you're saying, but you're not comprehending that they're telling you how to edit the file so that it doesn't run at all and being belligerent about it.
Title: Re: DFHack 0.40.24-r3
Post by: NullForceOmega on April 07, 2015, 04:03:00 pm
Thank you lethosor, I appreciate your help.  Have a nice day Putnam.

Edit: new though related problem; I copied the Init example from the git repository, edited it and renamed it dfhack.init, now dfhack doesn't recognize it even existing and wants to use dfhack.init-example, but that file no longer exists.  Now what?
Title: Re: DFHack 0.40.24-r3
Post by: Uzu Bash on April 07, 2015, 04:42:38 pm
May I suggest enabling plugins that run in real time in a separate file? That way you could comment out the line that loads it until you're ready to troubleshoot it for instability, discrepancies, or performance issues later.

As it stands you now have to sift through each line of the main ini to sort out the bells, whistles, friendly conveniences and practical annoyances when you'd really just rather play the game with commands that only fire when they're explicitly entered.
Title: Re: DFHack 0.40.24-r3
Post by: SquatchHammer on April 07, 2015, 05:01:09 pm
To the DF hack devs. Windows recognizes any thing past a period as the type of file. For example dfhack-run.exe, windows recognizes its an executable file, while dfhack.init-example reads as INIT-EXAMPLE file. I think this is the whole problem with Null's problem. So really it should read as dfhack-example.init and I wouldnt be surprised if it ran fine.
Title: Re: DFHack 0.40.24-r3
Post by: Antsan on April 07, 2015, 05:44:37 pm
Thank you lethosor, I appreciate your help.  Have a nice day Putnam.

Edit: new though related problem; I copied the Init example from the git repository, edited it and renamed it dfhack.init, now dfhack doesn't recognize it even existing and wants to use dfhack.init-example, but that file no longer exists.  Now what?
When saving something with Notepad on Windows, Notepad automatically appends ".txt" to the filename unless you tell it not to. Check that the name of the file actually is exactly "dfhack.init" and not "dfhack.init.txt".
If you are not seeing the file extensions of other files you normally use, you need to switch showing these on somewhere in your options. As I don't use Windows I don't know where to look for that.
Title: Re: DFHack 0.40.24-r3
Post by: SquatchHammer on April 07, 2015, 06:41:30 pm
Thank you lethosor, I appreciate your help.  Have a nice day Putnam.

Edit: new though related problem; I copied the Init example from the git repository, edited it and renamed it dfhack.init, now dfhack doesn't recognize it even existing and wants to use dfhack.init-example, but that file no longer exists.  Now what?
When saving something with Notepad on Windows, Notepad automatically appends ".txt" to the filename unless you tell it not to. Check that the name of the file actually is exactly "dfhack.init" and not "dfhack.init.txt".
If you are not seeing the file extensions of other files you normally use, you need to switch showing these on somewhere in your options. As I don't use Windows I don't know where to look for that.


Title: Re: DFHack 0.40.24-r3
Post by: Antsan on April 07, 2015, 06:59:36 pm
Thank you lethosor, I appreciate your help.  Have a nice day Putnam.

Edit: new though related problem; I copied the Init example from the git repository, edited it and renamed it dfhack.init, now dfhack doesn't recognize it even existing and wants to use dfhack.init-example, but that file no longer exists.  Now what?
When saving something with Notepad on Windows, Notepad automatically appends ".txt" to the filename unless you tell it not to. Check that the name of the file actually is exactly "dfhack.init" and not "dfhack.init.txt".
If you are not seeing the file extensions of other files you normally use, you need to switch showing these on somewhere in your options. As I don't use Windows I don't know where to look for that.


I cannot see the first picture.

The second picture already has been explained: Notepad doesn't recognize simple Newlines but needs a Newline followed by a Carriage Return (or something like that). Use a better editor.
Title: Re: DFHack 0.40.24-r3
Post by: Toady One on April 08, 2015, 12:08:37 am
Please try to remain calm in the thread.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 08, 2015, 12:32:58 am
I read that in a voice like the Lumpy Space Portal Frog (https://www.youtube.com/watch?feature=player_detailpage&v=6CSZcTHmH-o#t=96) from Adventure Time... I don't know why.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on April 08, 2015, 01:30:14 pm
 wonder if you could edit the file type from your window explorer?
but then again could one say alter a file to be txt use notepad then edit the type to be what ever?
I made this neat gif of how one alter the .init-example to be just init for anyone who want to just skip the start up message about not finding a init.
(http://www.truimagz.com/host/fortcrush2/de/how-to-guide-on-editing-init-files.gif)
 I tend to use flash developer for my notepad ++ editing. it has no lua function but it does the job.
Title: Re: DFHack 0.40.24-r3
Post by: Uzu Bash on April 08, 2015, 07:29:23 pm
You could open notepad and then just drag any file into it. I have textpad and notepad++ installed, so I just open with right-click context menu. Even opens binaries in hex view, with the right plugins.

EDIT: Btw, question; how do you cancel/interrupt a job in advfort? When a job can't be completed and it hangs on the last tick, isn't it possible to escape the job or mode?
Title: Re: DFHack 0.40.24-r3
Post by: utunnels on April 08, 2015, 08:23:24 pm
Is there a way to make a tile inside or outside?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 08, 2015, 09:43:56 pm
tiletypes sv 1 or 0 for skyview, st 1 or 0 for subterranean, l 1 or 0 for light, h 1 or 0 for hidden

There is a killscreen command to make hung advfort tasks go away but I forget what it is.
Title: Re: DFHack 0.40.24-r3
Post by: utunnels on April 08, 2015, 09:52:25 pm
Oh, thanks.
Title: Re: DFHack 0.40.24-r3
Post by: ancistrus on April 09, 2015, 08:11:46 pm
Is there a way to enable building of magma forge on a map with no magma ?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 09, 2015, 08:13:39 pm
https://github.com/DFHack/dfhack#feature

...wait, a map with no magma?
Title: Re: DFHack 0.40.24-r3
Post by: ancistrus on April 09, 2015, 11:04:12 pm
Yes. Building a magma forge on a map with magma is hardly something I would need help with.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 09, 2015, 11:07:14 pm
I'm with Putnam here, how did you get a map with no magma? None as in it is like twenty billion leagues under your embark or none as in you can dig all the way down and just hit SMR or slade or simply run out of room?
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 10, 2015, 02:48:44 am
If you changed worldgen you might be able to get it so there's no magma sea or underworld. I have no idea how to make a magma forge under those circumstances though. There might be people who know about the lore of changing building types. Try making a regular forge and changing it into a magma forge somehow. Tinker around with lua and ~ or gm-editor.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 10, 2015, 04:18:07 am
Wouldn't it be easier to spawn nine tiles of magma under where you plan to put the magma forte?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 10, 2015, 04:38:50 am
Spawning magma with liquids doesn't actually allow you to make magma forges.
Title: Re: DFHack 0.40.24-r3
Post by: Boltgun on April 10, 2015, 05:35:22 am
To unlock magma forges you need an 'underground water' or volcano pipe features on the map to mark as discovered so I guess there is no way to enable them on a site without any.

Feature script (https://github.com/Devduweb/DF-succubus/blob/master/scripts/succubus/feature.lua)

Perhaps you can generate a feature and inject it into df.global.world.features.map_features, and perhaps it won't crash the game.
Title: Re: DFHack 0.40.24-r3
Post by: ancistrus on April 10, 2015, 06:51:20 am
To clarify, I was exerimenting with making a fort that would keep the highest framerate possible.
Title: Re: DFHack 0.40.24-r3
Post by: Snergler on April 10, 2015, 11:44:19 am
I think that tiletypes can be used to enable magma workshops, by painting an tile with the MAGMA material. you can use the FLOOR shape(you might have to make the tile visible with HIDDEN 0) then use gui/liquids to fill the hole with lava.
Title: Re: DFHack 0.40.24-r3
Post by: breadman on April 10, 2015, 02:53:15 pm
Regarding the stockflow plugin, perhaps it would be easier to make it work more like workflow that's tied to a stockpile (having read a separate thread about the difficulty of having stockpile generate jobs in connected workshops)?
Instead of using job manager, stockpile will suspend/resume relevant job in the "Take from" workshops. Then each stockpile can "borrow" the workflow's interface to set up a set number/stacks of items to maintain in the stockpile.

Instead of having stockpile "create" the job, require user to create a job on repeat in the linked workshop. The stockflow UI can indicate if it can detect a relevant job it can control in the linked workshops.

There's an interesting idea in here, but I really don't like most of the details.  As it stands, I don't see how this idea improves upon workflow itself.  Particularly since it relies on all three of the most complicated parts of workflow.

Stockflow was originally intended as a proof of concept for an idea proposed for inclusion in the base game.  That's the only reason the bookkeeper is involved in its default mode.  That's also why the UI is limited to one or two lines in the stockpile screen, and an almost exact duplicate of an existing screen.

It also happens to predate workshop links, and you're right that workshop links could be a very interesting way to automatically suspend and resume jobs in a workshop.  However, it's much harder than it sounds to determine which jobs are relevant, so I would be more inclined to suspend and resume all jobs in the linked workshop.

So, the core idea, which actually would be simpler than stockflow:  A single line on the stockpile screen (tentatively "A: Automate Selected"), when the selected stockpile link points to a workshop, toggles a flag on that link's line (like the R and S flags on workshop jobs).  Every so often, each workshop with any flagged links checks those linked stockpiles.  If any input stockpiles are empty, or all output stockpiles are full, then all jobs in the workshop are suspended; otherwise, all suspended jobs in the workshop are resumed.

This might cause problems for a job actively in progress when the workshop is checked, which could perhaps be mitigated by running the check every single tick.  Similarly, it doesn't prevent workshop jobs from getting cancelled, though checking every single tick could reduce the likelihood.

And therein lies the problem.  The point of stockflow is to set up each stockpile once, and never worry about it again.  I don't want to deal with jobs disappearing from workshops, which is why I like having the manager create new ones every so often.  Then again, flagging links would give me control over which workshop handles which job, at the expense of requiring a separate workshop for each job.  (Yes, relevance could eliminate that requirement, but face it, I never got around to determining for certain whether an item on the ground is truly stockpiled correctly, and that's only half of the problem.)

Overall, I don't think I'm going to write such a plugin, and I would be opposed to modifying stockflow to be more like workflow, but if you want to write a third stock management plugin, be my guest.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 11, 2015, 12:49:58 am
Mmph. Just managed to successfully teleport an army into my fortress.

The game promptly crashed.

(This is how I knew that I actually managed to teleport them into my fortress)

EDIT: HOLY SHIT I JUST FORCED A SIEGE (http://imgur.com/M4CM6Tv.png)
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 11, 2015, 12:59:07 am
Yeah, I got the hang of moving myself around but I'm leery of trying to do it to another army for exactly that reason.

Could try to put them on a tile near your borders maybe?

Edit response: so you're what now... a double wizard?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 11, 2015, 01:00:49 am
unk_pos2 refers to the tile that they will go to next, so I put them on the border with them moving into a tile that happens to be inside my fortress.

World tiles have 17x17 region tiles have 3x3 army tiles, btw.

To my surprise, they actually besieged the place. Holy crap. Imma see if I can figure out a way to get these results consistently (all in all, it was about 5 minutes of fiddling with unk_pos2 and the controller's positions until it stopped teleporting them)
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 11, 2015, 01:02:31 am
Nice, I was thinking the pos2 might do that!
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 11, 2015, 01:35:46 am
What state were the unk_48 flags in? I dropped 100 gobs on my fort as an adventurer but they're non-hostile.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 11, 2015, 01:55:58 am
Here's what I got.

Code: [Select]
function isGoblinEntity(entity_id)
    return df.historical_entity.find(entity_id).entity_raw.code=='EVIL'
end

function forceIt()
    for k,v in ipairs(df.global.world.armies.all) do
        if v.controller and v.controller.entity_id~=-1 and isGoblinEntity(v.controller.entity_id) then
            local fortress=df.world_site.find(df.global.ui.site_id)
            local entry_position={x=(fortress.global_min_x*3),y=math.floor((fortress.global_min_y+fortress.global_max_y)*1.5)} --x*1.5 more properly x*3/2, but same thing
            v.unk_pos1.x=entry_position.x-1
            v.unk_pos2.x=entry_position.x+1
            v.unk_pos1.y=entry_position.y
            v.unk_pos2.y=entry_position.y
            v.controller.pos_x=v.unk_pos1.x
            v.controller.pos_y=v.unk_pos1.y
            if #v.unk_pos_x>0 then
                v.unk_pos_x[0]=v.unk_pos2.x
                v.unk_pos_y[0]=v.unk_pos2.y
            else
                v.unk_pos_x:insert('#',v.unk_pos2.x)
                v.unk_pos_y:insert('#',v.unk_pos2.y)
            end
            print('Diverted Army #'..v.id..' to fortress')
            return true
        end
    end
    return false
end

forceIt()

It ain't workin. What'd you do?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 11, 2015, 02:36:17 am
I uh, didn't do wizardry, I just pulled up gui/gm-editor df.global.world.armies.all as an adventurer and found where my home fort was (right around 440 by 389) then I found where an army with the goblin race number under unk_2c was, the first entry seems to be the count so I set that to 50, moved the controller over to my fort along with the gobs and uh...
Spoiler (click to show/hide)

That definitely looks siege-y to me.

Oh yeah, the first army zooped back to the controller, the non-hostile one, so I found one that was due to move next tick, that might have been part of why it worked out so well.

Tried to play around with different variations of the same trick in fortress mode, works fine as an adventurer, but in fort mode they just don't appear on map that way, even checked by grabbing one of my dorfs and making them an adventurer and there were asterisks on top of the fort when I went to travel outside, while the ones I had set next to it to move towards the fort were just chilling out.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 11, 2015, 05:13:15 pm
the first entry

Of what?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 11, 2015, 06:12:50 pm
Oh, sorry, uh, this:
(http://i.imgur.com/slkZi1K.png)

474 is the dorf race in the mod I'm using, 477 being goblins, unk_0 gave me the number of units, one army I moved near me had two sleeping gobs in it with two entries under unk_2c so I put the unk_0 to 50 in each and ended up with a 3x3 tent that had 100 sleeping gobs in it. Couldn't get them to react normally so I grabbed an army that was about to move and did the same thing, ended up with ~50 gobs sieging my fort in adventurer mode.

Couldn't get the same trick to work in fortress mode though.
Title: Re: DFHack 0.40.24-r3
Post by: 4maskwolf on April 11, 2015, 11:40:58 pm
...

As impressed as I am at all the stuff you guys do here, I'm more impressed by the fact that you somehow managed to draw the ire of Toady in this thread...
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on April 11, 2015, 11:52:37 pm
It feel it was directed more at the guy who got indignant when he couldn't operate a basic text file.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 12, 2015, 12:47:25 am
Oh, sorry, uh, this:
(http://i.imgur.com/slkZi1K.png)

474 is the dorf race in the mod I'm using, 477 being goblins, unk_0 gave me the number of units, one army I moved near me had two sleeping gobs in it with two entries under unk_2c so I put the unk_0 to 50 in each and ended up with a 3x3 tent that had 100 sleeping gobs in it. Couldn't get them to react normally so I grabbed an army that was about to move and did the same thing, ended up with ~50 gobs sieging my fort in adventurer mode.

Couldn't get the same trick to work in fortress mode though.

So unk_2c is a vector of creature manifests or something like that, hmm? If you were to change 477 to 474, you'd get dwarves, I guess.

Okay, so army #5361 is sieging when forced but army #5630 is not. I diffed 'em, so here's the diff:

-snip-

(and the function used to get the results)

Code: [Select]
function deep_diff(struct1,struct2,prefix)
    prefix=prefix or tostring(struct1):sub(2,-14)
    for k,v in pairs(struct1) do
        if pcall(function() pairs(v) end) then
            if type(k)=='number' then
                deep_diff(struct1[k],struct2[k],prefix..'['..k..']')
            else
                deep_diff(struct1[k],struct2[k],prefix..'.'..k)
            end
        else
            if struct1[k]~=struct2[k] then
                print(prefix..'.'..k,struct1[k],struct2[k])
            end
        end
    end
end

EDIT: It's probably something in army_controller.unk_44 or army_controller.unk_58, neither of which I can access by Lua.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 12, 2015, 04:39:28 am
Still closer and closer though to a consistent method.
Title: Re: DFHack 0.40.24-r3
Post by: Rose on April 12, 2015, 10:35:05 am
have you guys found a way to teleport the current adventurer consistently?
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on April 12, 2015, 04:01:01 pm
I'm hankering for a way to get rid of specific native reactions.

Code: [Select]
function removeNative(shop_name,name)
    _registeredStuff.shopNonNative=_registeredStuff.shopNonNative or {}
    local shops=_registeredStuff.shopNonNative
    shops[shop_name]=shops[shop_name] or {}
    if name~=nil then
        table.insert(shops[shop_name],name)
    else
        shops[shop_name].all=true
    end
    postWorkshopFillSidebarMenu._library=onPostSidebar
    dfhack.onStateChange.eventful=unregall
end

Am I interpreting this wrong, or does eventful.removeNative have some capacity to target a certain job instead of wiping the workshop clean?
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on April 12, 2015, 04:02:41 pm
have you guys found a way to teleport the current adventurer consistently?
uhh yeah you need to find the adventurer first in the sea of armies which is done with a search function then alter the position of the army.
what kinda hard is finding the other guys in the sea of armies or pushing them to one point or another.
but yeah with this someone could group a bunch of military dwarves(using adventure mode to recruit them all then tell them all to wait in one spot) then send them after other players forts using dfhack.

Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 12, 2015, 06:32:41 pm
have you guys found a way to teleport the current adventurer consistently?
Well, you need a script that will check df.global.world.armies.all for the first entry under unk_48 to be true, that will be the player army.

Then editing pos1 works pretty simply.

Posted this string of screenshots earlier after I found which army mine was I just put that in brackets like gui/gm-editor df.global.world.armies[88] or whatever, it stays the same until you leave travel mode apparently. Doing that I took these four screenshots one right after the other:
Spoiler (click to show/hide)

From x815 y815 to x0 y0 and both corners seems pretty consistent to me.

Did the same with other armies and sometimes there is a situation where it has a controller it is following or moving towards which will have posx and posy listed under controller (player army always has nil here) and you can find armies which have pos1 and pos2 differing by 1 which indicates they're moving of course, and is how I like to make sure I'm not dropping a sleeping army on top of a site, but moving myself around even with companions is surprisingly straightforward.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on April 13, 2015, 01:13:06 am
Code: [Select]
local armies=df.global.world.armies.all
function find_player_army()
for k,v in ipairs(armies) do
if v.unk_48[0] then
return v
end
end
end
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 13, 2015, 02:49:16 am
Well hell that's much easier.

Hmmm, it doesn't give an error, but it doesn't return a value either, tried saving it as findarmy, findarmy.lua, but I'm not sure what is missing. Do you need to make it check for true under unk_48[0]?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 13, 2015, 07:48:06 pm
"x" will always evaluate as true if "x==true" evaluates as true in Lua.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on April 13, 2015, 08:43:39 pm
"x" will always evaluate as true if "x==true" evaluates as true in Lua.

But not the other way round - "x" will evaluate to true if x = 0, but "x==true" obviously will not. Unrelated to the current topic though.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 13, 2015, 08:49:07 pm
Thus why I didn't say that they were equivalent :P
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 13, 2015, 09:03:21 pm
Does that print something for you when you try it? I'm sure I'm missing something because it doesn't give an error, but it doesn't give a value either.

I saved this:
Code: [Select]
local armies=df.global.world.armies.all
function find_player_army()
for k,v in ipairs(armies) do
if v.unk_48[0] then
return v
end
end
end

As findarmy.lua under hack/scripts, I run findarmy and it just gives a new empty line without an error or anything.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 13, 2015, 09:10:51 pm
print(find_player_army().id)

add that at the bottom
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 14, 2015, 02:25:00 am
Hmmm, I think it works out easier (unless you know a simple way to open an army with the id directly) if you change it to this:
Code: [Select]
local armies=df.global.world.armies.all
function find_player_army()
        for k,v in ipairs(armies) do
                if v.unk_48[0] then
                        return k
                end
        end
end
print(find_player_army())
Which spits out 80 for my army just now, and I can put that in gui/gm-editor df.global.world.armies.all[80] and open it up... could that be done in the script itself?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 14, 2015, 02:34:35 am
Better would be to print the ID so you can use df.army.find(id).
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 14, 2015, 02:46:29 am
Well fuck, that's much easier.

So, I'm gonna learn how to sew and make you a big fucking cobalt blue hat with a big gold crescent moon on it, k?

lol
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 14, 2015, 02:51:25 am
Another hint: df.(something).find works for, like, everything. df.weapon.find, df.army_controller.find, df.world_site.find, df.historical_figure.find, df.historical_entity.find, df.item.find, df.entity_raw.find, df.creature_raw.find...
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 14, 2015, 05:42:32 am
Yup, was just playing with that, very neat. Incidentally I think I've got an adventurer mode version of propel rumrusher was fiddling with working... the testing has been really painful and derpy looking, poor kids I was rescuing have been sitting there wondering why I'd randomly jump into the ground face first, hop off the ground and fly into a tree and so forth.

It's workable but dangerous as shit, had to check out how various other scripts failed safely because the way I was using the cursor as a target AND to set the speed meant you zoomed off at relativistic velocities towards -30000 x/y/z without a cursor, buuuutttt...
Spoiler (click to show/hide)
I was standing a tile away from the base of a three z high gobby tower just before taking that shot. :D
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 14, 2015, 09:06:53 am
Fun fact: DF itself uses -30000 as a constant internally to represent invalid or nonexistent locations.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 14, 2015, 02:34:14 pm
Yup, which means turning yourself into a projectile with speed based on your cursor position while having no cursor REALLY freaking hurts.

Still, being able to go from here:
Spoiler (click to show/hide)

To here on a parabolic trajectory (with a hand free so you can grab the tree >.>):
Spoiler (click to show/hide)

Is pretty freaking cool. As is doing the Tarzan thing and leaping tree to tree.

Though dbz-ing elves waaaaay the hell across the map is awesome! I say dbz-ing because one swung at me from one z-level up as I went by from below and I decided 'nah, screw this guy' so I grabbed him and launched myself aimed way up and through him. It turned out way cooler than I hoped:
Spoiler (click to show/hide)

At least until you try to jump so far that you explode mid-tackle, shotgun blasting the elf you were tackling with your gear and armor before they also explode...
Spoiler (click to show/hide)

Got a good hearty laugh out of me though!
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on April 14, 2015, 11:13:00 pm
best way to avoid death by falling is to wear clothes of none so that it would cause a Pass right through option when you hit the ground.
I notice this when riding on minecarts made of that material.
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on April 14, 2015, 11:15:19 pm
Wear a void to protect yourself from the laws of physics.

genius
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 14, 2015, 11:16:15 pm
That's... actually a really cool idea, fantasy-wise. Items made of literal nothing making attacks go through you.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 15, 2015, 01:00:11 am
No luck, just goes straight to bruising the skin.
Title: Re: DFHack 0.40.24-r3
Post by: endlessblaze on April 15, 2015, 02:34:06 pm
What if you set the ground below you to nothing? :o

I would test it myself but I'm crap with lua, and yes, I tried it even before I had ever heard of DF
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 15, 2015, 08:36:45 pm
Hmmm, I found that if you null your speed and flip the right flags you don't take damage.

I tested this by launching myself on an absolutely suicidal trajectory (like 15 x and z difference) and pulling up the proj_list in gm-editor quickly at the top of the arc, with the right changes you just drop to the ground and only need to stand up, no impact or skidding or slamming into anything.

I tried to figure out how to trigger this at the very top of a jump in a couple ways, I got it where it doesn't error when I added these lines:
Code: [Select]
roof = proj.target_pos.z - proj.cur_pos.z

if roof==0 then
        proj.speed_x=0
        proj.speed_y=0
        proj.speed_z=0
        proj.flags.parabolic=false
        proj.flags.has_hit_ground=true
        unitSource.flags1.projectile=false
 end
Because those are the flags/speed changes that caused me to drop from like 15 z up with no damage.

Unfortunately I'm not sure how to actually make it do a check like "if you're about to slam into something" or "if you're at the top of a jump" or "if your speed_z becomes negative" properly.

Note that I doubled the speed boosts because x/y/z*20000 let me consistently pass through the target_pos, though you do overshoot it sometimes, anyone got an idea how to make it flip those flags mid-jump when certain conditions are met, I was digging through the gui/gm-editor df lists to see if I could find a collisions index or something but I haven't had any luck yet.

Edit: nevermind, it isn't working now, not sure what happened but it's erroring me with those lines added in and I'm not even able to reproduce the "drop from way up in the air safely" result.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on April 15, 2015, 09:46:35 pm
notice something funny with jump, if you give to many jump commands you will fling the person from point to point
or well fling into themselves
(http://www.truimagz.com/host/fortcrush2/de/multiple-jump-commands.png)
this was with the pointer 1 tile next to the dwarf and activating the jump command 8 times
the poor dwarf was sent back to the original position and flung over time and time again so much that his last position didn't clear up and smack into himself
going so fast you hit yourself in the past present and future.
so uhh remember kids don't attempt to shine spark unless you have loads of muscle and fat to absorb the blow, or ancient bird people armor.
oh well best slap some mechanic where if someone grappled then jumping takes them with you.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 15, 2015, 10:19:54 pm
I did that when I tried flipping some of the flags off without nulling the speed. I could move around but I kept getting jostled back in the direction of my flight path and if I moved far enough that way I could get the "You jump out of your flight path!" message.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 16, 2015, 11:29:56 pm
Oh man Lua is fast.

Like, way faster than I thought. This code is causing 0 FPS hit (70 before, 70 after) in a fortress of 103:

Code: [Select]
onUnitAction=dfhack.event.new()

local actions_already_checked=actions_already_checked or {}

local function action_already_checked(unit_id,action_id)
    local unit_action_checked=actions_already_checked[unit_id]
    if unit_action_checked then
        return unit_action_checked[action_id]
    end
end

onUnitAction.print=function(unit,action)
    print('Unit #'..unit.id..' is using action of type '..df.unit_action_type[action.type])
end

function checkForActions()
    for k,v in ipairs(df.global.world.units.active) do
        for _,action in ipairs(v.actions) do
            if not action_already_checked(v.id,action.id) then
                onUnitAction(v,action)
                actions_already_checked[v.id]=actions_already_checked[v.id] or {}
                actions_already_checked[v.id][action.id]=true
            end
        end
    end
end

require('repeat-util').scheduleEvery('onAction',1,'ticks',checkForActions)

It's going through the entire active units vector every tick. I'm impressed.

And I'm going to exploit this so hard.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 17, 2015, 06:26:30 am
That's part of why I first suggested Rumrusher use the actions list to try to get jump working, inserting a new (2)Jump action with the desired coordinates before I figured out what he was doing to make it adventurer mode usable. I didn't even think about how complex some of the checks are. Hell, gm-editor is like that too isn't it? You can pull up some of the lists like the full global events and it only barely hesitates.

Also, I'm... kinda aroused by you talking about hard code exploitation, why is this?
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 17, 2015, 12:57:13 pm
Oh man Lua is fast.

Like, way faster than I thought. This code is causing 0 FPS hit (70 before, 70 after) in a fortress of 103:

Code: [Select]
onUnitAction=dfhack.event.new()

local actions_already_checked=actions_already_checked or {}

local function action_already_checked(unit_id,action_id)
    local unit_action_checked=actions_already_checked[unit_id]
    if unit_action_checked then
        return unit_action_checked[action_id]
    end
end

onUnitAction.print=function(unit,action)
    print('Unit #'..unit.id..' is using action of type '..df.unit_action_type[action.type])
end

function checkForActions()
    for k,v in ipairs(df.global.world.units.active) do
        for _,action in ipairs(v.actions) do
            if not action_already_checked(v.id,action.id) then
                onUnitAction(v,action)
                actions_already_checked[v.id]=actions_already_checked[v.id] or {}
                actions_already_checked[v.id][action.id]=true
            end
        end
    end
end

require('repeat-util').scheduleEvery('onAction',1,'ticks',checkForActions)

It's going through the entire active units vector every tick. I'm impressed.

And I'm going to exploit this so hard.

Hmm, I wonder if it would be possible make "mines" where you store a location in a persistent variable, and every tick you check if anyone is on that location. Then if there is you trigger a script and remove the location from persistent storage (or not, depending on if you want the mine to trigger more than once)

EDIT: Does anyone have any experience with calling frames? What I mean is, I want my custom unit frame to be able to link directly to the units health screen.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 17, 2015, 01:08:47 pm
Hmm, I wonder if it would be possible make "mines" where you store a location in a persistent variable, and every tick you check if anyone is on that location. Then if there is you trigger a script and remove the location from persistent storage (or not, depending on if you want the mine to trigger more than once)
I had a similar idea that I wanted to watch all of the unmined bits of specific stones (should be manageable since they're single-tile-clusters).  The backstory of the mod implies that interesting things ought to happen if one of those tiles comes in contact with magma.  My thinking was that I'd need a plug-in for this, setting up a data structure for each type of stone-of-interest with a linked list of coordinates, and checking them every hundred ticks or so (spacing out the different types of tiles to prevent FPS stutters).

But if Lua is that fast, I might not need a plug-in and be able to check them every tick.  Then I can get rid of the boil-away-stone inhaled syndrome dependency and spawn Awakened Stones directly.  It would help if I could figure out who had just mined the tile.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 17, 2015, 03:39:12 pm
Note that that is going through every unit, which is still, oh, an order of magnitude smaller than every tile. I wouldn't recommend pushing it, but you could always try.

However, Roses: oh, yes, very much. The fact that the move action contains where they're moving to means that you can even use the onAction event.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 17, 2015, 04:14:33 pm
Note that that is going through every unit, which is still, oh, an order of magnitude smaller than every tile. I wouldn't recommend pushing it, but you could always try.
The idea was to scan the tiles on load and build the lists to check periodically.  Essentially running prospect all every tick isn't the path to high FPS!  My whole concept depends on what kind of persistent data is available to Lua.  I could encode the "linked list" in a string, but a real Lua list would be much better.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 17, 2015, 05:18:36 pm
Putnam: if you monitor the announcements event you might be able to do most of what that script does using only eventful.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 17, 2015, 05:20:55 pm
Yeah, except for exactly what I want to do, heh (which is modify attacks and movement before they actually go through)
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 17, 2015, 05:29:25 pm
Yeah, except for exactly what I want to do, heh (which is modify attacks and movement before they actually go through)

Hmm...there should probably be an event for that. There isn't but there should be. Action initiated or something.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 17, 2015, 05:41:15 pm
Yeah, except for exactly what I want to do, heh (which is modify attacks and movement before they actually go through)

Hmm...there should probably be an event for that. There isn't but there should be. Action initiated or something.

Speaking of which, I would love for there to be options for parry's and dodges and such.

And on another note, I figured out how to get all of the information from the Thoughts and Preferences screen without actually being in that screen. Which means it is possible to use that information in custom gui.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 17, 2015, 05:42:03 pm
Parrys and dodges can be deduced from announcement events but you have to filter it yourself.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 18, 2015, 09:43:05 pm
Anyone know why this isn't working?

Code: [Select]
modtools/interaction-trigger -suppressAttack -onAttackStr "test for super saiyan" -command [ dragonball/super_saiyan_trigger -unit \\ATTACKER_ID ]
It's suppressing the attack perfectly, but the command isn't going at all.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on April 19, 2015, 06:40:29 am
I don't know how I did it but
Spoiler (click to show/hide)
there's now a directional Aim for throwing folks now.
 (https://gist.github.com/Rumrusher/97db45deccf7a54d291a)
also learn a valuable lesson on don't try to get a dragon to mount a Roc, dragons will use their fire and burn everyone riding even the mount.
kinda wonder if community arena going to be adding mounts to the options?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 19, 2015, 02:41:59 pm
[Phil Ken Sebben]Ha ha ha, dorf tossing![/Phil Ken Sebben]

I hereby propose the script be called launch btw.


I'm uh, not ready to deal with Rocs being mounted by Dragons given your tendencies to produce horrifying hybrid crimes against nature.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 20, 2015, 08:46:24 pm
Question. I have been using dfhack.screen._doSimulateInput() but can only seem to get it to simulate pressing Enter (i.e. dfhack.screen._doSimulateInput(screen,{1}) ). For some reason whenever I try to get a different button press simulated it does nothing, in this case trying to get 'r' pressed, which is supposidly represented by 18. Any thoughts? Maybe the function dfhack.screen.getKeyDisplay() is just not giving me the right information?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 20, 2015, 08:52:51 pm
dfhack.screen.getKeyDisplay(18) means that the interface key with an ID of 18 is displayed as "r" in-game. That key is MOVIE_RECORD, which will only work in the movie [;] menu. You should be passing df.interface_key.KEY_ID to simulateInput(), where KEY_ID is a valid ID listed in interface.txt or "@df.interface_key" in the interactive lua interpreter.

Edit: Also, gui.simulateInput() is a more flexible wrapper around _doSimulateInput, although you'll have to import the gui module (e.g. gui = require('gui')).
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 20, 2015, 09:10:27 pm
Interesting. Then I basically just got lucky it worked with enter. Is there a way to automatically look up a key id? And I wasn't using the gui function because I wanted to manipulate screens that aren't visible or active and I thought that only allowed current screen manipulation
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 20, 2015, 10:05:15 pm
Both functions take a screen as their first argument, although they should be identical for your purposes.
You'll have to experiment to find most key IDs, although they're typically self-explanatory (searching interface.txt can be helpful). DFHack bindings usually use keys like CUSTOM_F, CUSTOM_SHIFT_R, etc. (which are also used for custom reaction hotkeys in workshops).
Title: Re: DFHack 0.40.24-r3
Post by: Rogue Yun on April 22, 2015, 06:57:59 pm
Would it be possible for someone to make a quick fix in the building plan plugin by adding the ability to plan for hatch covers? I'd really appreciate it, as I appreciate everything that has been done to make dwarf fortress the best gaming experience I've ever known. Thanks in advance!

Side note:
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on April 23, 2015, 06:41:01 pm
Is there a way to change stress levels through gui/gm-editor? If so, where?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 23, 2015, 07:03:14 pm
unit.status.current_soul.personality, IIRC. Maybe it was just in current_soul.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on April 23, 2015, 07:28:51 pm
unit.status.current_soul.personality.stress_level

That's pretty deep, no wonder I couldn't find it. It also has the thoughts and personality of the creature, which I've also been looking for. Thanks!
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 23, 2015, 09:12:07 pm
I wonder what all is different between the uh, I think world.history.figures and the stuff under world.units because I messed up trying to use dfusion to make two particular dorfs the parents of a dorflet and she ended up with a random human histfig as her dad, nothing I tried under units let me change it, but I was able to fix it under figures to get the relationships right.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 23, 2015, 09:14:05 pm
Not so much what is different as what is the same; they're vectors of two completely different objects.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 24, 2015, 05:48:31 am
Good point, but yeah, the historical figures section is what finally let me fix said parent links, also where deities and certain other links can be found.

Gar:
Spoiler (click to show/hide)
Urist:
Spoiler (click to show/hide)
Romlam:
Spoiler (click to show/hide)

Had to add the histfig_hf_link_childst to Urist manually but once that was right they react normally and it shows up right in legends:
(http://i.imgur.com/yrXi0DJ.png)
Previously it had a random human listed as her father, think he might have been dead for twenty something years at that.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 24, 2015, 08:15:48 am
Anyone know why this isn't working?

Code: [Select]
modtools/interaction-trigger -suppressAttack -onAttackStr "test for super saiyan" -command [ dragonball/super_saiyan_trigger -unit \\ATTACKER_ID ]
It's suppressing the attack perfectly, but the command isn't going at all.

That looks like the right syntax. I'm not sure. Have you tried testing with devel/print-args?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 24, 2015, 08:56:33 am
During all of this current_soul searching, has anyone happened upon the values required to make a creature into a functioning member of the fort?  When I use warmist's spawn-unit script to make an animal, it's fine for hostile ones but unreliable for friendly ones.  Giving it the player's civ_id will make it appear "Tame" on the units list (and keep it from attacking) but "Not Tame" on the z/Animals list (which prevents it from being a pet) even if I gm-editor its training level.  I recall reading that the creature can revert to hostile when the game is saved and re-loaded, but I haven't witnessed this personally.

Comparing the gm-editor screens for a natural specimen and a spawned specimen hasn't gotten me anywhere, but that's because I'm not familiar with the object model.  If someone can point me to the proper attributes and values, I think I can make the Lua code changes necessary.

The immediate use of proper fort membership would be to enable war-training and such for spawned animals, and I have plans for assigning specific creatures as pets of specific dwarves in a later expansion.

And, it doesn't get said nearly often enough that DFHack and the other third-party tools are awesome and invaluable additions to the DF game and community.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 24, 2015, 04:13:19 pm
Anyone know why this isn't working?

Code: [Select]
modtools/interaction-trigger -suppressAttack -onAttackStr "test for super saiyan" -command [ dragonball/super_saiyan_trigger -unit \\ATTACKER_ID ]
It's suppressing the attack perfectly, but the command isn't going at all.

That looks like the right syntax. I'm not sure. Have you tried testing with devel/print-args?

No.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 24, 2015, 05:32:02 pm
During all of this current_soul searching, has anyone happened upon the values required to make a creature into a functioning member of the fort?  When I use warmist's spawn-unit script to make an animal, it's fine for hostile ones but unreliable for friendly ones.  Giving it the player's civ_id will make it appear "Tame" on the units list (and keep it from attacking) but "Not Tame" on the z/Animals list (which prevents it from being a pet) even if I gm-editor its training level.  I recall reading that the creature can revert to hostile when the game is saved and re-loaded, but I haven't witnessed this personally.

Comparing the gm-editor screens for a natural specimen and a spawned specimen hasn't gotten me anywhere, but that's because I'm not familiar with the object model.  If someone can point me to the proper attributes and values, I think I can make the Lua code changes necessary.

The immediate use of proper fort membership would be to enable war-training and such for spawned animals, and I have plans for assigning specific creatures as pets of specific dwarves in a later expansion.

And, it doesn't get said nearly often enough that DFHack and the other third-party tools are awesome and invaluable additions to the DF game and community.

Did you give it the civ_id for both unit.civ_id and unit.status.current_soul.civ_id? I was able to turn animals into tame members that appear as tame both in the units screen and the z/animals. Although this was with already existing animals, and not those spawned by the script. (I also changed all of the unit.animal tokens to -1, not sure what effect that actually has though)
Title: Re: DFHack 0.40.24-r3
Post by: Bo-Rufus CMVII on April 24, 2015, 06:13:40 pm
Can I safely upgrade r2-->r3 on Linux just by copying the newer files on top of the current installation?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 24, 2015, 06:33:51 pm
I would remove (or rename) the "hack" folder (and "stonesense" if it exists) first, assuming you don't have anything important in them.
Title: Re: DFHack 0.40.24-r3
Post by: Mrandom on April 24, 2015, 07:32:01 pm
Hi, to what extent does "modtools/force" work in 40.24 now? Or is it going to be replaced by "spawn-unit" in the future?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 24, 2015, 07:40:08 pm
It works entirely, except for sieges. I've been working on siege spawning, but that seems to rely on some variables that I cannot modify at all.

EDIT: This isn't working either:
Code: [Select]
modtools/reaction-trigger -reactionName WISH_DB_ADV -command [ dragonball/wish -unit \\WORKER_ID ]
I tested that with print-args and it printed nothing.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 24, 2015, 10:07:30 pm
During all of this current_soul searching, has anyone happened upon the values required to make a creature into a functioning member of the fort?  When I use warmist's spawn-unit script to make an animal, it's fine for hostile ones but unreliable for friendly ones.  Giving it the player's civ_id will make it appear "Tame" on the units list (and keep it from attacking) but "Not Tame" on the z/Animals list (which prevents it from being a pet) even if I gm-editor its training level.  I recall reading that the creature can revert to hostile when the game is saved and re-loaded, but I haven't witnessed this personally.

Comparing the gm-editor screens for a natural specimen and a spawned specimen hasn't gotten me anywhere, but that's because I'm not familiar with the object model.  If someone can point me to the proper attributes and values, I think I can make the Lua code changes necessary.

The immediate use of proper fort membership would be to enable war-training and such for spawned animals, and I have plans for assigning specific creatures as pets of specific dwarves in a later expansion.

And, it doesn't get said nearly often enough that DFHack and the other third-party tools are awesome and invaluable additions to the DF game and community.

Did you give it the civ_id for both unit.civ_id and unit.status.current_soul.civ_id? I was able to turn animals into tame members that appear as tame both in the units screen and the z/animals. Although this was with already existing animals, and not those spawned by the script. (I also changed all of the unit.animal tokens to -1, not sure what effect that actually has though)
I couldn't find a civ_id attribute under unit.status.current_soul, but I did find two attributes that fix the is-it-tame-or-not dilemma:

unit.flags1.tame = true
unit.training_level = 7


The problem is that for some reason no one in this fort is adopting any pets (natural nor spawned), so I can't be sure this is everything needed.  I did notice that my Starting Seven have

unit.flags1.tame = false
unit.training_level = 9


Those are the default values that a spawned unit would have.  Is there a way to spotcheck a creature for being an intelligent race/caste before I set these flags?  It could be hacked by checking if the species matches the player's civ, but that won't be robust to multi-species forts that are just around the corner.

Edit: Success! New test embark, and this time the spawned critter was adopted right away.  Now to see what happens if I bring in a domesticated dwarf.

Edit 2: Okay, the dwarf spawned with no relationships (and thus no religion), which I expected.  He doesn't have a dream, so something is unfinished there.  The game is fine leaving him with no name, he's listed as Peasant (tame) on the units list, and will take labor assignments.  I'm glad he didn't show up on the z/animals list :)

So, this is not the way to make a well-rounded citizen for your fort, but it'd be unrealistic to expect that.  For now, no need to spotcheck for intelligent species since citizen forging is beyond the current version's capabilities anyway.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 24, 2015, 10:30:35 pm
Is there a way to spotcheck a creature for being an intelligent race/caste before I set these flags?  It could be hacked by checking if the species matches the player's civ, but that won't be robust to multi-species forts that are just around the corner.

Code: [Select]
local caste=df.creature_raw.find(unit.race).caste[unit.caste]
if caste.flags.CAN_SPEAK and caste.flags.CAN_LEARN then
    --stuff
end
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 24, 2015, 10:36:04 pm
Is there a way to spotcheck a creature for being an intelligent race/caste before I set these flags?  It could be hacked by checking if the species matches the player's civ, but that won't be robust to multi-species forts that are just around the corner.

Code: [Select]
local caste=df.creature_raw.find(unit.race).caste[unit.caste]
if caste.flags.CAN_SPEAK and caste.flags.CAN_LEARN then
    --stuff
end
Of course, the minute I decide that it'd be a lot of work for little practical benefit, you go ahead and build it.  Must be part dwarven ;)
Title: Re: DFHack 0.40.24-r3
Post by: Bo-Rufus CMVII on April 24, 2015, 11:27:10 pm
I would remove (or rename) the "hack" folder (and "stonesense" if it exists) first, assuming you don't have anything important in them.
Thanks

(Keywords for future searchers: upgrade dfhack update dfhack)
Title: Re: DFHack 0.40.24-r3
Post by: Mrandom on April 25, 2015, 01:40:54 am
It works entirely, except for sieges. I've been working on siege spawning, but that seems to rely on some variables that I cannot modify at all.

EDIT: This isn't working either:
Code: [Select]
modtools/reaction-trigger -reactionName WISH_DB_ADV -command [ dragonball/wish -unit \\WORKER_ID ]
I tested that with print-args and it printed nothing.

"force" is a great feature, one of my favorite, in fact. Excuse me if I'm using it in a wrong way, but it seems not working on r7 and r10...The only eventType that works are Caravan and Migrants, and I cannot specify a civ id after "-civ" for Caravan but can only use entity enums like "FOREST", "PLAINS", "MOUNTAIN", etc.

Here are some test cases I tried both under r7 and r10:

Code: [Select]
modtools/force -eventType CivAttack -civ EVIL   // Invalid eventType, line 58
modtools/force -eventType FeatureAttack -civ EVIL // nothing happens, FeatureAttack is an enum from eventType, probably replacement for CivAttack
modtools/force -eventType Caravan -civ PLAINS // a random (maybe the first?) human civilization sends a caravan
modtools/force -eventType Caravan -civ 5034(entity-id) //cannot write field time_event.entity:incompatible pointer type, line 76
modtools/force -eventType Migrants // works regardless of -civ
modtools/force -eventType Caravan(or Diplomat) //game crash, probably need error catch for the second arg?
modtools/force -eventType (AnyOtherType) // nothing happens
modtools/force -eventType (InvalidEventType) //often throws an error, occasionally crashes the game. probably an error check would be better?

Test environment:
Platform: Windows 8.1
Settings: default pop cap, no aquifer, Mayday graphics, default dfhack utilities

Also I wonder what exactly to expect from all the Wildlife event types and NightCreature. I managed to make "WildlifeCurious" to work inconsistently by editing some args in the gui/gm-editor. It generated animals like gray langur or honey badger.
 
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 25, 2015, 01:43:44 am
IIRC it was never supposed to be entity IDs.

Also, r7 and r10?
Title: Re: DFHack 0.40.24-r3
Post by: Mrandom on April 25, 2015, 10:17:45 am
Oh I thought the LNP integrated utilities use the LNP's version number. My bad. My DFHack version is 0.40.24-r3.

The "-help" print-out includes the following: "
-civ entity
        specify the civ of the event, if applicable
        examples:
            player
            MOUNTAIN
            EVIL
            28
"

So I thought "28" is an entity ID. What is it then? A raw-entity ID?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 25, 2015, 02:34:40 pm
Huh, weird. I should probably do a passover of the force code.

EDIT: My previous problems with my onload.init file was mainly a problem with the way I was calling it using the script command from a lua init, making it so that, if done in adventure mode, it would load in a context where events wouldn't properly run.
Title: Re: DFHack 0.40.24-r3
Post by: yxe on April 26, 2015, 01:59:30 pm
Hi,

I have a problem with the enhanced stock view...

Currently it doesn't resize itself to the screen size, and the description length of the items its too short and some descriptions
can't be readed.

Spoiler (click to show/hide)

there is some option where I can change this ??
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 26, 2015, 03:36:05 pm
It works entirely, except for sieges. I've been working on siege spawning, but that seems to rely on some variables that I cannot modify at all.

EDIT: This isn't working either:
Code: [Select]
modtools/reaction-trigger -reactionName WISH_DB_ADV -command [ dragonball/wish -unit \\WORKER_ID ]
I tested that with print-args and it printed nothing.

Ok, it must be broken. I'll take a look.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 26, 2015, 03:39:41 pm
It works entirely, except for sieges. I've been working on siege spawning, but that seems to rely on some variables that I cannot modify at all.

EDIT: This isn't working either:
Code: [Select]
modtools/reaction-trigger -reactionName WISH_DB_ADV -command [ dragonball/wish -unit \\WORKER_ID ]
I tested that with print-args and it printed nothing.

Ok, it must be broken. I'll take a look.

Nope.

EDIT: My previous problems with my onload.init file was mainly a problem with the way I was calling it using the script command from a lua init, making it so that, if done in adventure mode, it would load in a context where events wouldn't properly run.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 26, 2015, 04:06:35 pm
Haha I guess I need to improve my reading comprehension. Thanks.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 26, 2015, 06:19:39 pm
Will interaction-trigger fire when a regional interaction affects a creature, maybe using the HIST string as if were the verb?

I'm trying to run this script on each instance of a specific species of vermin that appears.

I have a work-around, but it doesn't do quite what I want.

Edit: typing on a phone sucks.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 27, 2015, 01:19:55 am
Will interaction-trigger fire when a regional interaction affects a creature, maybe using the HIST string as if were the verb?

I'm trying to run this script on each instance of a specific species of vermin that appears.

I have a work-around, but it doesn't do quite what I want.

Edit: typing on a phone sucks.

If you are just tryting to run a script on each vermin then I would suggest making the regional interaction only effect a certain syndrome class and then simply using syndrome-trigger instead. Unless I am not understanding what you mean.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 27, 2015, 02:49:28 am
For interaction-trigger it would have to show up in the event log. It doesn't look at historical events.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 27, 2015, 05:00:08 am
Thanks Roses and expwnent, I'll have the regional interaction target all castes of that creature with a syndrome and trigger off of that instead.  It's better than the whole species mysteriously getting CLEANed by the environment every week.
Title: Re: DFHack 0.40.24-r3
Post by: Boltgun on April 28, 2015, 02:56:02 pm
I finally figured what was wrong with spawnunit. Comparing side to side a natural pet with a spawned one I made o differences and fixed them:
Code: [Select]
    unit.flags2.resident = false;
    unit.flags3.body_temp_in_range = true;
    unit.population_id = -1
    unit.status.current_soul.unit_id = unit.id -- Was not set when creating the soul

    unit.animal.population.region_x = -1
    unit.animal.population.region_y = -1
    unit.animal.population.unk_28 = -1
    unit.animal.population.population_idx = -1
    unit.animal.population.depth = -1

    unit.counters.soldier_mood_countdown = -1
    unit.counters.death_cause = -1

    unit.enemy.anon_4 = -1
    unit.enemy.anon_5 = -1
    unit.enemy.anon_6 = -1

The last three anon values are the most important. Those caused the creature to initiate a fight when the save was reloaded (I suppose that's when the enemy cache was to be rebuilt). This did not cause a loyalty cascade and the animal was listed as a perfectly tame pet, only it acted like an enemy. By default it was set to 0.

The other values might have their own importance. I'll clean the script out of its debugging stuff and send it. Note that I am focusing in creating animals, so there is still issues in creating citizens.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 28, 2015, 04:19:27 pm
So I was trying to figure out how to poke around in various things easier and I realized that I didn't need to go through and type out gui/gm-editor df.global since you can just replace the
Code: [Select]
qerror("No valid target found") line with
Code: [Select]
my_trg=df.global
So it will load up as normal when targeting a dorf or item, but it defaults to loading the df.global page, is there a good reason to not do this?
Title: Re: DFHack 0.40.24-r3
Post by: Bo-Rufus CMVII on April 28, 2015, 07:48:24 pm
Is this a bug?  I never noticed it under 0.34.

If you reveal the map, dig a bit, and then unreveal, the new dig is blacked out.  Even a dwarf in the new area when you unreveal will not make its own tile visible.

Apparently they cannot path through the area either.  Plus if you re-designate some at the edge to dig (to make them go there), they will decide that it's not a valid dig spot, the designation is removed, and the square is blacked out again.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on April 28, 2015, 07:49:26 pm
That also happened in 0.34, and AFAIK has happened ever since reveal was released. Use revflood to fix it.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 28, 2015, 07:56:14 pm
That's expected, since "reveal" stores information about which tiles were revealed when it was run, allowing "unreveal" to revert its changes.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 28, 2015, 08:33:53 pm
You can also use tiletypes h 0 on those squares to unhide them.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 28, 2015, 11:11:34 pm
I'm back with my troublesome vermin :)

First, I can report that Boltgun's fixes don't generate any errors when applied to normal or vermin animals.  The affected creatures also didn't rampage on a re-load, so far so good.

Second, syndrome-trigger doesn't seem to be able to find named syndromes defined in regional interactions.  I don't know how to use a regional interaction to apply a syndrome defined in a material.  Is there an event I could hook into instead that would fire when a creature (preferably a certain type) appears on the map?

Third (which isn't a DFHack thing), the vermin behavior I wanted them to have doesn't seem to work anyway: the wiki claims that vermin pets are carried by their owners, but I've yet to see that happen.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 28, 2015, 11:18:42 pm
For anyone keeping score at home, this is warmist's spawn-unit script with all of the hotfixes I know about:

Code: (spawn-unit.lua) [Select]
--create unit at pointer or given location and with given civ (usefull to pass -1 for enemy). Usage e.g. "spawn-unit -race DWARF -caste 0 -name Dwarfy"
--[=[
    arguments
        -help
            print this help message
        -race <RACE_ID>
            The raw id of the creature's race, mandatory
        -caste <number>
            The caste's number, optional
-age <number>
    The unit's age in years, defaults to 15 if omitted
        -name <doggy>
            The unit's name, optional
        -position [ x y z ]
            The unit's position, will try to use the cursor if omitted
        -civ_id
            The unit's civilisation, will be the player's if omitted

    Example : spawn-unit -race HUMAN -caste 0 -name Bob

    Made by warmist, but edited by Putnam for the dragon ball mod to be used in reactions
Modified by Dirst for use in The Earth Strikes Back mod, incorporating fixes discovered
by Boltgun

    TODO:
        throw a proper error if the user attempt to run it from the console, without good args
        orientation
        chosing a caste based on ratios
        birth time
        death time
        real body size
        blood max
        check if soulless and skip make soul
        set weapon body part
        nemesis/histfig : add an 'arrived on site' event
        generate name
--]=]
local utils=require 'utils'

-- Picking a caste or gender at random
local function getRandomCasteId(race_id)
    local cr = df.creature_raw.find(race_id)
    local caste_id, casteMax

    casteMax = #cr.caste - 1

    if casteMax > 0 then
        return math.random(0, casteMax)
    end

    return 0
end

local function getCaste(race_id,caste_id)
    local cr=df.creature_raw.find(race_id)

    return cr.caste[tonumber(caste_id)]
end

local 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

local function getBodySize(caste,time)
    --TODO: real body size...
    return caste.body_size_1[#caste.body_size_1-1] --returns last body size
end

local function genAttribute(array)
    local a=math.random(0,#array-2)
    return math.random(array[a],array[a+1])
end

local function norm()
    return math.sqrt((-2)*math.log(math.random()))*math.cos(2*math.pi*math.random())
end

local function normalDistributed(mean,sigma)
    return mean+sigma*norm()
end

local 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

local 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: 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.personality.traits) do
        local min,mean,max
        min=caste.personality.a[k]
        mean=caste.personality.b[k]
        max=caste.personality.c[k]
        tmp_soul.personality.traits[k]=clampedNormal(min,mean,max)
    end
    --[[natural skill fix]]
    for k, skill in ipairs(caste.natural_skill_id) do
        local rating = caste.natural_skill_lvl[k]
        utils.insert_or_update(tmp_soul.skills,
            {new=true,id=skill,experience=caste.natural_skill_exp[k],rating=rating}, 'id')
    end
   
    unit.status.souls:insert("#",tmp_soul)
    unit.status.current_soul=tmp_soul
end

local function CreateUnit(race_id,caste_id,unit_age)
    local race=df.creature_raw.find(race_id)
    if race==nil then error("Invalid race_id") end

unit_age = unit_age or 15
   
local caste
    local unit=df.unit:new()

    -- Pick a random caste is none are set
    if nil == caste_id then
        caste_id = getRandomCasteId(race_id)
    end

    caste = getCaste(race_id,caste_id)

    unit:assign{
        race=race_id,
        caste=caste_id,
        sex=caste.gender,
    }

    unit.relations.birth_year=df.global.cur_year-unit_age --AGE is set here
    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.relations.birth_time=df.global.cur_year_tick
    --unit.relations.old_time=?? --TODO add normal age
    --[[ interataction stuff, probably timers ]]--
    local num_inter=#caste.body_info.interactions  -- new for interactions
    unit.curse.own_interaction:resize(num_inter) -- new for interactions
    unit.curse.own_interaction_delay:resize(num_inter) -- new for interactions
    --[[ body stuff ]]
   
    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
    --[[ body components ]]
    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}
    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
    --[[ largely unknown stuff ]]
    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
   
    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)
   
    --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)
   
    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)
   
    --finally set the id
    unit.id=df.global.unit_next_id
    df.global.unit_next_id=df.global.unit_next_id+1
    df.global.world.units.all:insert("#",unit)
    df.global.world.units.active:insert("#",unit)

    return unit
end

local 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
 
local function createFigure(trgunit,he,he_group)
    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
    -- ...
    hf.info.skills = {new=true}
 
 
    he.histfig_ids:insert('#', hf.id)
    he.hist_figures:insert('#', hf)
    if he_group then
        he_group.histfig_ids:insert('#', hf.id)
        he_group.hist_figures:insert('#', hf)
        hf.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=he_group.id,link_strength=100})
    end
    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

local function  allocateNewChunk(hist_entity)
    hist_entity.save_file_id=df.global.unit_chunk_next_id
    df.global.unit_chunk_next_id=df.global.unit_chunk_next_id+1
    hist_entity.next_member_idx=0
    print("allocating chunk:",hist_entity.save_file_id)
end

local function allocateIds(nemesis_record,hist_entity)
    if hist_entity.next_member_idx==100 then
        allocateNewChunk(hist_entity)
    end
    nemesis_record.save_file_id=hist_entity.save_file_id
    nemesis_record.member_idx=hist_entity.next_member_idx
    hist_entity.next_member_idx=hist_entity.next_member_idx+1
end
 
local function createNemesis(trgunit,civ_id,group_id)
    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(4)
    --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]]
    nem.unk10=-1
    nem.unk11=-1
    nem.unk12=-1
    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=-1
 
    local he=df.historical_entity.find(civ_id)
    he.nemesis_ids:insert("#",id)
    he.nemesis:insert("#",nem)
    local he_group
    if group_id~=-1 then
        he_group=df.historical_entity.find(group_id)
    end
    if he_group then
        he_group.nemesis_ids:insert("#",id)
        he_group.nemesis:insert("#",nem)
    end
    allocateIds(nem,he)
    nem.figure=createFigure(trgunit,he,he_group)
end

-- Do the placement, returns the freshly spawned unit
function place(args)
    if not args.race then
        qerror("Please provide a race")
    end

local pos = {}
if args.position then
    pos.x=args.position[1]
pos.y=args.position[2]
pos.z=args.position[3]
else
    pos = copyall(df.global.cursor)
end

    if pos.x == -30000 then
        qerror("Point your pointy thing somewhere")
    end

    local i
    local race_id = findRace(args.race)
    local u = CreateUnit(race_id,args.caste,args.age)

    u.pos:assign(pos)
       
    if args.name then
        u.name.first_name = args.name
        u.name.has_name = true
    end

if args.cid_id then args.civ_id = tonumber(args.civ_id) end

    local group_id
    if df.global.gamemode == df.game_mode.ADVENTURE then
        u.civ_id = args.civ_id or df.global.world.units.active[0].civ_id
        group_id = -1
    else   
        u.civ_id = args.civ_id or df.global.ui.civ_id
   end

    if args.civ_id == -1 then
        group_id = group_id or -1
    else
        group_id = group_id or df.global.ui.group_id
-- If a friendly animal, make it domesticated.  From Boltgun & Dirst
local caste=df.creature_raw.find(u.race).caste[u.caste]
if not(caste.flags.CAN_SPEAK and caste.flags.CAN_LEARN) then
-- Fix friendly animals (from Boltgun)
u.flags2.resident = false;
u.flags3.body_temp_in_range = true;
u.population_id = -1
u.status.current_soul.unit_id = u.id

u.animal.population.region_x = -1
u.animal.population.region_y = -1
u.animal.population.unk_28 = -1
u.animal.population.population_idx = -1
u.animal.population.depth = -1

u.counters.soldier_mood_countdown = -1
u.counters.death_cause = -1

u.enemy.anon_4 = -1
u.enemy.anon_5 = -1
u.enemy.anon_6 = -1

-- And make them tame (from Dirst)
u.flags1.tame = true
u.training_level = 7
end

end

    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,group_id)
    end

    return u
end

validArgs = validArgs or utils.invert({
    'help',
    'race',
    'caste',
'age',
    'name',
    'position',
    'civ_id',
})

local args = utils.processArgs({...}, validArgs)

if args.help then
 print([[scripts/spawn-unit.lua
arguments
    -help
        print this help message
    -race <RACE_ID>
        The raw id of the creature's race, mandatory
    -caste <number>
        The caste's number, optional
-age <number>
    The unit's age in years, defaults to 15 if omitted
-name <doggy>
        The unit's name, optional
    -position [ x y z ]
        The unit's position, will try to use the cursor if ommited
    -civ_id
        The unit's civilisation, will be the player's if ommited

]])
 return
end

if args.race then
    place(args) --Creature (ID), caste (number), age, name, x,y,z , civ_id(-1 for enemy, optional) for spawn.
end
Title: Re: DFHack 0.40.24-r3
Post by: Roses on April 28, 2015, 11:22:08 pm
Sorry, I have only been able to loosely follow what has been going on with the spawn unit script, so these questions may have already been answered.

1. Does it allow for spawning of both friendly and hostile animals?
2. Does it allow for spawning of hostile entity creatures (they don't have to be entity members, but just CAN_SPEAK or CAN_LEARN invaders?)
3. Does it allow for spawning of friendly civ members? (from what I have read this is still a no)
4. Does the friendly and hostile animals extend to semi and megabeasts?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 28, 2015, 11:41:17 pm
Sorry, I have only been able to loosely follow what has been going on with the spawn unit script, so these questions may have already been answered.

1. Does it allow for spawning of both friendly and hostile animals?
2. Does it allow for spawning of hostile entity creatures (they don't have to be entity members, but just CAN_SPEAK or CAN_LEARN invaders?)
3. Does it allow for spawning of friendly civ members? (from what I have read this is still a no)
4. Does the friendly and hostile animals extend to semi and megabeasts?
1. Yes.  Give the animal a civ_id of -1 to make it hostile.  You'll need to escape it as \-1 on the command line.
2. I think right now it assumes any animal that's not -1 is friendly to the fort.  Would need some additional checks of the provided civ_id to iron out the kinks.  Intelligent creatures skip all of the fixes, so I'm not sure exactly how they'll behave.
3. Badly.  You end up with a nameless peasant with no relationships or personality.  Might be what you want if you're going for a golem.
4. It uses the text creature ID and the numeric caste (picking one at random if none is provided), so there's no reason it shouldn't work with semi and megabeasts at a basic level.  Obviously, they won't have lairs or anything, and I highly doubt it would trigger announcements.
Title: Re: DFHack 0.40.24-r3
Post by: Boltgun on April 29, 2015, 02:16:13 am
Nice cleanup Dirst, I'll use that one.

I also added orientation in my local. Creatures spawn asexual so animals will have the 'marry' flag for the opposite sex as true and intelligent creatures will be based on raws. I think we are getting to the stability of the 0.34 version of this script.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 29, 2015, 06:42:58 am
Nice cleanup Dirst, I'll use that one.

I also added orientation in my local. Creatures spawn asexual so animals will have the 'marry' flag for the opposite sex as true and intelligent creatures will be based on raws. I think we are getting to the stability of the 0.34 version of this script.

i fixed a line in the code I posted above (it was really really late).

Asexual creatures don't matter in my case since I'm using it to spawn genderless creatures, but we are trying for something of general usefulness.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on April 29, 2015, 08:07:15 am
Excellent work on spawn-unit. I'll take a look at it this weekend if I can and polish it up a bit and try fix the rest of the problems for civ members and such.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on April 29, 2015, 06:00:53 pm
When using gm-editor to view a prepared meal, in ingredients.item_foodst.T_ingredients:<numbers>, there is a variable called unk_10. That variable controls the quality of the individual ingredients.
Title: Re: DFHack 0.40.24-r3
Post by: utunnels on April 29, 2015, 08:36:37 pm
(http://i.imgur.com/sNjQtUb.png)

Why is it "unknown mode" instead of "Dwarf Fortress"?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on April 29, 2015, 08:43:37 pm
That's one of my scripts (so this thread (http://www.bay12forums.com/smf/index.php?topic=143875.0) would be more appropriate). I'm assuming that's an unretired fortress, which is a game type new to 0.40.xx that that script doesn't yet recognize. You can run "load-screen disable" to check if you'd like.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on April 30, 2015, 07:26:22 am
Second, syndrome-trigger doesn't seem to be able to find named syndromes defined in regional interactions.  I don't know how to use a regional interaction to apply a syndrome defined in a material.  Is there an event I could hook into instead that would fire when a creature (preferably a certain type) appears on the map?
I was looking around the Lua API, and it sounds like Eventful's onSyndrome callback might be able to hear stuff done by regional interactions.  Anyone happen to know if it's just the same interface that syndrome-trigger uses?

Thanks!
Title: Re: DFHack 0.40.24-r3
Post by: endlessblaze on April 30, 2015, 07:31:23 am
Come to think of it, is there a command or something to change a regional interaction?

Say an evil biome has thralling clouds, could you change the clouds into say.....skin necroses? Maybe healing for good biomes?
Title: Re: DFHack 0.40.24-r3
Post by: Qrox on April 30, 2015, 09:13:29 am
I was just thinking of creating a trade helper but stuck on finding a function that returns an item's trade value. So long I just found a function that returns an item's base value, and two functions that returns an item's improvements value and dye value in trade respectively. And a struct that seemingly contains a caravan's trade value modifiers, but which I can't fathom its meaning. Am I missing anything here?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on April 30, 2015, 07:53:33 pm
I was just thinking of creating a trade helper but stuck on finding a function that returns an item's trade value. So long I just found a function that returns an item's base value, and two functions that returns an item's improvements value and dye value in trade respectively. And a struct that seemingly contains a caravan's trade value modifiers, but which I can't fathom its meaning. Am I missing anything here?
The various skills involved in assessing value and negotiating for said value, the mental attributes associated with said skills/involved directly, the presence of an accidentally activated pressure washing system, uh, I assume the trade value modifiers are the stuff requested for next year right?

Come to think of it, is there a command or something to change a regional interaction?

Say an evil biome has thralling clouds, could you change the clouds into say.....skin necroses? Maybe healing for good biomes?
Oh dear, that's a hell of an idea, though I think that stuff is a pain to hack that directly, much less permanently.
Title: Re: DFHack 0.40.24-r3
Post by: Qrox on May 03, 2015, 01:34:51 am
I was just thinking of creating a trade helper but stuck on finding a function that returns an item's trade value. So long I just found a function that returns an item's base value, and two functions that returns an item's improvements value and dye value in trade respectively. And a struct that seemingly contains a caravan's trade value modifiers, but which I can't fathom its meaning. Am I missing anything here?
The various skills involved in assessing value and negotiating for said value, the mental attributes associated with said skills/involved directly, the presence of an accidentally activated pressure washing system, uh, I assume the trade value modifiers are the stuff requested for next year right?

Ughhh... I think I'll just shelve it until I've got time to do !!SCIENCE!! with that. And thanks.
On another note, does anyone know how to do binary search on a sorted vector? (namely, df.global.world.plants.* vectors). There is a binary search function in utils.lua but it only supports lua functions as comparators and the vectors are sorted by address. My current workaroud is to use tostring(element) to get a string containing the elements' addresses but I fear such a filthy workaround could break at any time.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on May 03, 2015, 11:11:09 am
I was looking around the Lua API, and it sounds like Eventful's onSyndrome callback might be able to hear stuff done by regional interactions.  Anyone happen to know if it's just the same interface that syndrome-trigger uses?

Thanks!

onSyndrome should detect anything, including syndromes added by other scripts.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 03, 2015, 03:40:13 pm
I was just thinking of creating a trade helper but stuck on finding a function that returns an item's trade value. So long I just found a function that returns an item's base value, and two functions that returns an item's improvements value and dye value in trade respectively. And a struct that seemingly contains a caravan's trade value modifiers, but which I can't fathom its meaning. Am I missing anything here?
The various skills involved in assessing value and negotiating for said value, the mental attributes associated with said skills/involved directly, the presence of an accidentally activated pressure washing system, uh, I assume the trade value modifiers are the stuff requested for next year right?

Ughhh... I think I'll just shelve it until I've got time to do !!SCIENCE!! with that. And thanks.
On another note, do anyone knows how to do binary search on a sorted vector? (namely, df.global.world.plants.* vectors). There is a binary search function in utils.lua but it only supports lua functions as comparators and the vectors are sorted by address. My current workaroud is to use tostring(element) to get a string containing the elements' addresses but I fear such a filthy workaround could break at any time.

df.(type).find(id)
Title: Re: DFHack 0.40.24-r3
Post by: Qrox on May 03, 2015, 08:57:10 pm
I was just thinking of creating a trade helper but stuck on finding a function that returns an item's trade value. So long I just found a function that returns an item's base value, and two functions that returns an item's improvements value and dye value in trade respectively. And a struct that seemingly contains a caravan's trade value modifiers, but which I can't fathom its meaning. Am I missing anything here?
The various skills involved in assessing value and negotiating for said value, the mental attributes associated with said skills/involved directly, the presence of an accidentally activated pressure washing system, uh, I assume the trade value modifiers are the stuff requested for next year right?

Ughhh... I think I'll just shelve it until I've got time to do !!SCIENCE!! with that. And thanks.
On another note, do anyone knows how to do binary search on a sorted vector? (namely, df.global.world.plants.* vectors). There is a binary search function in utils.lua but it only supports lua functions as comparators and the vectors are sorted by address. My current workaroud is to use tostring(element) to get a string containing the elements' addresses but I fear such a filthy workaround could break at any time.

df.(type).find(id)

Nope, that function expects a number as parameter and treat it as the index or the id. What I want to do is to find a specific object inside a vector sorted by its element's memory address...
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 03, 2015, 09:00:12 pm
Why exactly would you want that?

(Trying to make sure there's no easier way to do what you want)
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 03, 2015, 09:14:28 pm
Do you mean the index of an object inside of a vector?
Title: Re: DFHack 0.40.24-r3
Post by: Qrox on May 03, 2015, 11:50:35 pm
I was trying to get rid of all the excessive dead plants in my map, so I made a script to walk through all the columns and find out the dead ones. And then I found there are df.global.world.plants.* which also contain the plants. So I have to remove them from those vectors too. Sadly, I just made deeper research and found the vectors are not sorted by address, it's just a false positive on a rough look. So my method will not work. Curiously there's no clue how the vectors are sorted or are they even sorted. I'm now curious how the game remove plants from all these vectors. (Linear search is a way but then the script slows to a crawl)

to lethosor: Yes, df.plant.find() treats the parameter as the index of an object in df.global.world.plants.all, and df.plant.find(ind) is equivalent to df.global.world.plants.all[ind] (iterated through the vector and it's true for every object inside it on game load)

Edit: when I removed the plants from all the vectors do I have to manually free the memory or is it automatically handled by dfhack? And to be honest I don't know how to free a c object from lua script. Google doesn't tell me either.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 03, 2015, 11:53:25 pm
to lethosor: Yes, df.plant.find() treats the parameter as the index of an object in df.global.world.plants.all, and df.plant.find(ind) is equivalent to df.global.world.plants.all[ind] (iterated through the vector and it's true for every object inside it on game load)

No, it's plant id, not index in .all. The two are are important to distinguish, at least in most cases.
Title: Re: DFHack 0.40.24-r3
Post by: Qrox on May 04, 2015, 12:08:07 am
to lethosor: Yes, df.plant.find() treats the parameter as the index of an object in df.global.world.plants.all, and df.plant.find(ind) is equivalent to df.global.world.plants.all[ind] (iterated through the vector and it's true for every object inside it on game load)

No, it's plant id, not index in .all. The two are are important to distinguish, at least in most cases.

I know items have an id but are you sure plants also have it? there are site_id and srb_id but they seem to be a constant -1
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on May 04, 2015, 05:12:14 pm
Where is the time until laying eggs in gm-editor?
Title: Re: DFHack 0.40.24-r3
Post by: Roses on May 05, 2015, 12:52:35 pm
Questions:

1. If I give a unit several interactions is it possible to tell them not to use them all right away? Can I give them any logic behind using them? (besides the USAGE_HINT) Or staggering their usage?
2. Is there a function for computing the weight of a unit? I know there is the dfhack.units functions for figuring out speed and age and such, wondering if there is one for weight.
3. If I use add a syndrome with add-syndrome command with modtools/item-trigger -onEquip is it smart enough to know to remove the syndrome when the item is unequiped or do I need to add an -onUnequip version?
4. Similarly, does -onEquip only work if the actual inventory changes? What happens if I use another script to change one of the items material or subtype? Will it still run -onEquip or -onUnequip?
5. Does -onStrike only run if the target is wounded? What about if the attack is blocked/parried/dodged?
6. With the decoupling of movement and attack speeds, does CE_SPEED_CHANGE still affect both or just movement?
7. I am planning on either making a seperate plugin or an addition to the item-trigger script by allowing for -onParry and -onBlock. Currently the only way I see to do that is by using the eventful onReport and parsing the report for the required information. Is there another way to do it? Possibly an onAction event? I suppose if I make it a seperate plugin I could make it something like action-trigger and allow for dodging and such too?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 05, 2015, 01:06:27 pm
No clue on weight, and last time I tried to make a race and be clever by trying to use dragonbreath with a clean hint I was glad I had made them fireimmune super because they just sat around all day bathing each other in dragonfire.

Speed change just works on movement, weapons are by tick, I can say that for sure after running around at 9.9 speed and having other creatures trading swings with me despite being fast enough to hurl them through the air, run past them, and then jump out of their way as they slide to a stop.

Does anyone know where the check to see if you have something adjacent to grab takes place?

Similarly would it be possible to have a check for when a unit was about to slam into something so you could say, zero the speed back out? I tried tracking how it takes place in a jump but had no luck.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 05, 2015, 02:32:17 pm
1. You could always have each interaction give the next one in sequence
2. I don't think one exists right now
3. You have to add the -onUnequip version
4. It will not
5. I believe so
6. Movement only
7. I made an onAction event in the DBZ mod that I use for some silly ki stuff, but it gets slow as the game gets more bloated (due to incrementing through every single unit in the active vector every tick).
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 05, 2015, 06:03:52 pm
7 is what I worry about from trying to make a check for ground impact next tick.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on May 05, 2015, 07:12:23 pm
Thanks for the reply.

@Max, I'm not sure if it would help but there is the eventful event onProjUnitCheckMovement. I suppose you could use that and check and see if there are any obstacles next to the creature whenever it moves.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 05, 2015, 11:23:03 pm
Ooooh, didn't even notice that, gonna check it out thanks!
Title: Re: DFHack 0.40.24-r3
Post by: figment on May 06, 2015, 12:05:00 am
Hi. Long time lurker.  I thought I'd post a little Windows - 0.40.24-r3 only plugin/hack for Adventure Mode Region Teleportation. 

So basically this is Adventure Mode World/Region map teleportation by site.  You can do this without going to the map so can use it while in a site or deep underground.

I missed the discussion on Adventure Mode teleport a couple of weeks ago and decided to find my own way to make this happen.  I did this because I sort of got tired of hunting down sites like vaults which showed up in Legends but I had difficulty actually locating.  Turns out it seems to be fairly complex operations but with some hacking I found some functions that when called seem to do the correct thing and teleport the adventurer from one map to another without too many consequences that I have found.

I don't know if this is properly generalizable to other platforms or other versions as I'm effectively using functions directly.  I did try to make it slightly more generic by using an Array of Bytes (AOB) scan rather than a fixed address to find the functions but those are easily broken by a recompile but at least have chance of working on future releases out of the box.

The source can be pulled from my github repo (advutils branch) if interested.

Release Notice: https://github.com/figment/dfhack/releases/tag/v1.0
Binaries:  https://github.com/figment/dfhack/releases/download/v1.0/dfhack-0.40.24-r3-Windows-adv_teleport-v1.zip

Usage:
gui/adv_teleport

The above will present a menu of nearby sites which allow teleportation. Scripting can be done directly via the adv_teleport(world.x,world.y,region.x,region.y) in plugins.advutils.  Generically, I added a Sites dialog similar to the Materials dialog based on that code so it could be useful for other things and maybe that could be useful enough to include in the main trunk.  The site dialog sorts by distance from current location and gives some basic filter options for finding interesting locations.

It does not support same map teleportation at this time and instead sets you down from orbit on the region of interest as you would coming off the map.  I also give an option to offset from the center so that you are not necessarily placed on top of multi-story building and only have the option to climb down.  I did use this to quickly escape from vaults and caves after getting lost or not wanting to climb out.

I believe if you are a traveling at night you can still get boogeymen intercepting you so I guess beware.  As the same map teleport also seems not currently achievable then I guess some of my next investigations might be there unless someone has a good way to do this now.  I've never visited hell in adventure mode so that could be cool for a few moments anyway and presumably that would be the way to do it unless you really work for it.

Also this is using direct function calls and df has so many global variables it sort of scares me so state could be corrupted by using this so save early and save often if you use it.  Having said that I've been using it without any observable side effects for some time but would welcome feedback if people found it useful or have issues with it.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 06, 2015, 12:52:17 am
Interesting method, I just added a check in gm-editor for travel mode that makes it open the adventurer army pos_1 and make use of the brief hop into travel mode when resting to exit underground sites by whacking my gm-editor keybind.
Title: Re: DFHack 0.40.24-r3
Post by: Box on May 06, 2015, 08:33:52 am
Hi. Long time lurker.  I thought I'd post a little Windows - 0.40.24-r3 only plugin/hack for Adventure Mode Region Teleportation.

-snip-

oh my god i love you so much

I was trying to cross the ocean in adventure mode because I got tired of trying to walk around it and saw land on the other side but it was lagging so badly and took so long I tried using teleport commands I found around which led me to putnam's instant_transmission teleport since the ordinary teleport.lua command is nonfunctional and it's actually not useful at all except for getting yourself stuck underground.  You saved me!

Initial testing shows it worked absolutely fine.
Title: Re: DFHack 0.40.24-r3
Post by: figment on May 06, 2015, 09:07:33 am
Glad it worked for you.  That is basically the reason I did it.  And released it since I already put work into productizing it. In my last game I had to swim across and ocean and that is just plain boring. Also couldn't find a site I was searching for.

I will try the Army pos technique and see if I can make use of it.  It is probably the reliable long term solution and also cross platform way but still seems like its not quite there. 

The next problem i had was finding people so a quick view by name look up is probably the next script.  Already have one working but want an easier to use version.  This was inspired by trying to find a vampire (not that it helps as they wont fight you and you have to become a murderer anymore) and a demon but having difficulty.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 06, 2015, 02:26:33 pm
Well, the army method probably wouldn't be too hard to expand into a full script, but I really prefer incorporating it into gm-editor so I haven't poked too much at trying to do it. It does have the limitation that you have to either be able to rest or travel to use it since otherwise it won't be able to find your army and open it up.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 06, 2015, 02:44:15 pm
Box: What's wrong with teleport.lua? It was working for me the last time I checked (which was at least after v0.40.20, if not v0.40.24).
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on May 07, 2015, 02:12:50 am
Questions:

1. If I give a unit several interactions is it possible to tell them not to use them all right away? Can I give them any logic behind using them? (besides the USAGE_HINT) Or staggering their usage?
2. Is there a function for computing the weight of a unit? I know there is the dfhack.units functions for figuring out speed and age and such, wondering if there is one for weight.
3. If I use add a syndrome with add-syndrome command with modtools/item-trigger -onEquip is it smart enough to know to remove the syndrome when the item is unequiped or do I need to add an -onUnequip version?
4. Similarly, does -onEquip only work if the actual inventory changes? What happens if I use another script to change one of the items material or subtype? Will it still run -onEquip or -onUnequip?
5. Does -onStrike only run if the target is wounded? What about if the attack is blocked/parried/dodged?
6. With the decoupling of movement and attack speeds, does CE_SPEED_CHANGE still affect both or just movement?
7. I am planning on either making a seperate plugin or an addition to the item-trigger script by allowing for -onParry and -onBlock. Currently the only way I see to do that is by using the eventful onReport and parsing the report for the required information. Is there another way to do it? Possibly an onAction event? I suppose if I make it a seperate plugin I could make it something like action-trigger and allow for dodging and such too?

3. You need onUnequip.

4. It will not fire on material, it might fire on subtype. edit: I think it checks the item id so if you're careful and change it in all the right places you *might* be able to make it trigger by changing its id to the next unused one and updating everything accordingly but it would be easy to get that wrong and crash/corrupt the game so be careful.

edit2: It will definitely work if you change the id of the item, but you'd have to make sure you find every df structure that refers to that object and update it. Do a search through the xml for "id" or "item" and see the places where item ids are written down. You may run into issues if it's an artifact or named item.

5. Only if wounded. It will not fire if blocked or parried or dodged.

7. For now you'd have to do onReport, but it's easier than you think because blocks and parries and dodges are a specific element of the event_type enumeration. You might still have to parse for the attacker / defender and the weapon. I can add that to EventManager for the next version so it can reuse the code for figuring out who's who.

edit2: onAttack also won't work on counter-strikes (probably).

See also: https://github.com/DFHack/df-structures/blob/master/df.announcements.xml#L2
Title: Re: DFHack 0.40.24-r3
Post by: Dramegno on May 09, 2015, 01:17:23 pm
Hello, hopeful that this is the right place to ask this question if not please point me to the right elf.
I am experiencing a saving system issue I am using masterwork reborn .006 with the save backups enabled. now the seasonal saves work without issue, but saves saved with the dfhack quicksave command and with the vanilla save and quit option either doesn't actually save at all or gets put in what ever backup save is in the lowest rung on the list.

If you need more information tell me

also I first asked this in the masterwork reborn thread and I was told that nothing in M.R. should effect the saving system.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 09, 2015, 01:48:21 pm
Are you loading from a backup? DF will always save to the folder it was loaded from.
Also, DFHack's quicksave command will save to the folder you loaded and won't create a backup.
Title: Re: DFHack 0.40.24-r3
Post by: Dramegno on May 09, 2015, 02:55:46 pm
I have no choice but to load from the seasonal autosave backup folders. when I load the initial save that is not in a backup folder it still saves(vanilla quit/dfhack quicksave) to the last backup folder listed if it saves. seasonal autosaves always create a new backup folder. also when I check the details view of my save folder the current folder's date modified is the time I performed the quit save(haven't checked with the quicksave) and no other save folder would have a matching time.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 09, 2015, 03:17:56 pm
I have no choice but to load from the seasonal autosave backup folders.
What do you mean? What's wrong with your original save folder (the one without a date appended)?

Quote
when I load the initial save that is not in a backup folder it still saves(vanilla quit/dfhack quicksave) to the last backup folder listed if it saves.
Are you saying that DF is saving to a different folder than the one you loaded from? To make sure you're loading the correct world, what's displayed if you run ":lua print(dfhack.getSavePath())" ?

Quote
also when I check the details view of my save folder the current folder's date modified is the time I performed the quit save(haven't checked with the quicksave) and no other save folder would have a matching time.
If the original folder (without a date) is being updated, I'm not sure what the issue is.
Title: Re: DFHack 0.40.24-r3
Post by: Dramegno on May 09, 2015, 03:28:54 pm
Quote
Are you saying that DF is saving to a different folder than the one you loaded from? To make sure you're loading the correct world, what's displayed if you run ":lua print(dfhack.getSavePath())" ?
sorry I misspoke, I haven't tried quicksave on the inital save.

Quote
What do you mean? What's wrong with your original save folder (the one without a date appended)?
the inital save folder still has the inital save from embark, it does not update this folder. I got the first save folder and then the backups from the begining from each season.

When I said that the current folder is marked as being modified I was talking about the folder named current in the save folder. this folder is empty

[edit:] something that the person told me in the masterworks reborn thread that the fact that by backup save folders have two different dates in the name and that it seamed weird to him/her.
Title: Re: DFHack 0.40.24-r3
Post by: Usul on May 09, 2015, 04:11:11 pm
I have troubles with item-trigger, I can't seem to make it work with materials.
I tested this
Code: [Select]
modtools/item-trigger -checkInventoryEvery 1 -material CREATURE_MAT:GREAT_GREY_WOLF:COVENANT -command [ modtools/add-syndrome -syndrome abysswalker -target \\UNIT_ID ] -onEquip
with this material
Code: [Select]
[USE_MATERIAL_TEMPLATE:COVENANT:METAL_TEMPLATE]

[STATE_NAME_ADJ:ALL_SOLID:abysswalker]
[STATE_NAME_ADJ:LIQUID:abysswalker]
[STATE_NAME_ADJ:GAS:abysswalker]
[PREFIX:ancient]
in the proper files
and dfhack keep saying 'attempted to index a nil value'
I tried with DWARF:SKIN instead of GREAT_GREY_WOLF:COVENANT to see if it was my material, but it still doesn't work.
I was trying with a ring if that matters, does anyone see what I did wrong ?

Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 09, 2015, 04:12:51 pm
and dfhack keep saying 'attempted to index a nil value'

right click window bar

highlight edit

click "mark"

highlight error

press enter to copy

paste it here
Title: Re: DFHack 0.40.24-r3
Post by: Usul on May 09, 2015, 04:24:15 pm
yeah sorry you are right I should've posted the error

Code: [Select]
... Fortress 0.40.24/hack/scripts/modtools/item-trigger.lua:62: attempt to index
 a nil value
stack traceback:
        ... Fortress 0.40.24/hack/scripts/modtools/item-trigger.lua:62: in funct
ion 'handler'
        ... Fortress 0.40.24/hack/scripts/modtools/item-trigger.lua:102: in func
tion 'equipHandler'
        ... Fortress 0.40.24/hack/scripts/modtools/item-trigger.lua:111: in func
tion <... Fortress 0.40.24/hack/scripts/modtools/item-trigger.lua:105>
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 09, 2015, 04:33:35 pm
You didn't actually define an item, which it apparently needs.
Title: Re: DFHack 0.40.24-r3
Post by: Usul on May 09, 2015, 04:45:14 pm
Thanks I thought I could specify just the material to target whatever item is made of that, I guess I can't, then.
Hum, it seems it accept only specific ID, so no generic RING for me. I guess I'll have to do what I want another way

EDIT:It's weird I tried without any item and INORGANIC:BRONZE and it worked for everything in the Arena but the crutches and the rings I made with a reaction. I'm lost.
Title: Re: DFHack 0.40.24-r3
Post by: Snergler on May 09, 2015, 10:24:57 pm
hi, i made a simple edit to the putontable script that "builds" items into your wagon, but what i would really like is to be able to put items "inside" buildings and containers. is it possible with this same style lua script?
or perhaps using gmeditor?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 10, 2015, 12:41:32 am
Hmmm, if you can put an item in a wagon like that it should work the same way because I was playing around in df.global.world.buildings and figured out how to move a wagon so I could put it inside a carved out chunk of mountain, all of the items came with it.
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: Snergler on May 10, 2015, 03:02:48 pm
i managed to build the item as part of the wagon with the script, then used gm-editor to change the in_building flag to false.
the item remains in the wagon but is no longer "built" into it, so success!
but i have a ways to go before doing it with a script, thanks for pointing me in the right direction :)
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 10, 2015, 04:51:08 pm
[Phil Ken Sebben]Ha ha, accidental helpfulness![/Phil Ken Sebben]
Title: Re: DFHack 0.40.24-r3
Post by: endlessblaze on May 10, 2015, 06:33:20 pm
hey....how would I go about creating a dragon?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 10, 2015, 08:09:56 pm
You mean besides trying the spawnunit script?

Well, when a mommy dragon and a daddy dragon...
Title: Re: DFHack 0.40.24-r3
Post by: Dynastia on May 11, 2015, 01:38:33 am
Does anybody know how to add bee colonies to a map with no existing colonies at all?

I've tried spawnitem to spawn in some workers, drones and a queen, but they just flew around a bit and then left.
I've tried region-pops incr but anything I think to try is an 'unknown population token'.

I saw a post by Meph mentioning there's already a script command to add colonies, but I've googled everything I can think of and can't find it.

Anyone got any ideas?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on May 11, 2015, 07:23:09 pm
Hi everyone,

I'm back again with my pesky vermin.  I can't seem to get a regional interaction or even a self-targeting interaction to fire reliably.  The syndrome defined within the interaction shows up on the world syndrome list, so that's not the problem.  I tried to capture the interaction, syndrome-trigger and eventful's onSyndrome (though I'm far from sure I did that last one right).  For whatever reason, neither version of the interaction works (or at least works reliably).

Is there a way to fire a script whenever a creature spawns?  Maybe an undocumented hack of Eventful (there was mention of an EventType table that I couldn't find anywhere)?  I'll just check if it's one of my critters in civ -1, apply my Lua if it is, and do nothing if it isn't.  It's perfectly okay if the event only works on naturally spawning critters, since I can always run additional code if I'm spawning one in a script.

Basically I want any of these that pop up on the map to be immediately friendly to the player's civ (ideally, this method wouldn't assume the player is playing dwarves).  I know this code works when I run it manually:

Code: (tesb_domesticate.txt) [Select]
--modifies a specific unit to make it domesticated (and available for pet adoption)
--[=[
    argument
        <UNIT_ID>    The creature to be domesticated, mandatory

    Made by Dirst for use in The Earth Strikes Back mod
Intended use is to automatically domesticate all new instances of specific species.
TO DO:
Find a method to apply this script to all new members of the target species.
--]=]

args = {...}

local critter = df.unit.find(tonumber(args[1]))

if critter.civ_id == -1 then
if df.global.gamemode == df.game_mode.ADVENTURE then
critter.civ_id = df.global.world.units.active[0].civ_id
else   
critter.civ_id = df.global.ui.civ_id
critter.flags2.resident = false;
critter.flags3.body_temp_in_range = true;
critter.population_id = -1
critter.status.current_soul.unit_id = critter.id

critter.animal.population.region_x = -1
critter.animal.population.region_y = -1
critter.animal.population.unk_28 = -1
critter.animal.population.population_idx = -1
critter.animal.population.depth = -1

critter.counters.soldier_mood_countdown = -1
critter.counters.death_cause = -1

critter.enemy.anon_4 = -1
critter.enemy.anon_5 = -1
critter.enemy.anon_6 = -1
end

critter.flags1.tame = true
critter.training_level = 7

-- Verbose for troubleshooting purposes.

print("Critter (unit# "..args[1]..") has been domesticated.")
else
print("Critter (unit# "..args[1]..") is not wild.")
end

In fact the "k" screen updates immediately when I do this, no need to cursor off and come back like with spawn-unit.  I just can't find a way to make it run automatically.

My dwarves still aren't carrying the little guys around either.  I think the wiki might be outdated on that behavior.  However, interaction stuff didn't work any better when these guys were normal animals.

My last resort is to use Putnam's way of cycling thru every unit every N ticks, and apply the changes to any applicable critters.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on May 12, 2015, 01:50:31 am
So, this script accomplishes what I wanted, but it inefficiently checks every unit every tick.  As Putnam noted a few pages ago, this kind of thing executes pretty quickly, but I wouldn't want to contribute to an animating biome's FPS problems.

Code: (tame-all.txt) [Select]
-- Automatically tames any wild specimens of a specific species
--[=[
    argument
        <CREATURE_TOKEN>    The creature type to be domesticated, mandatory

    Made by Dirst originally for use in The Earth Strikes Back mod

--]=]

args = {...}

local 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

critter = findRace(args[1])

function checkForCritter()
    for k,v in ipairs(df.global.world.units.active) do
if v.race == critter then
if v.civ_id == -1 then
if df.global.gamemode == df.game_mode.ADVENTURE then
v.civ_id = df.global.world.units.active[0].civ_id
else   
v.civ_id = df.global.ui.civ_id
v.flags2.resident = false;
v.flags3.body_temp_in_range = true;
v.population_id = -1
v.status.current_soul.unit_id = v.id

v.animal.population.region_x = -1
v.animal.population.region_y = -1
v.animal.population.unk_28 = -1
v.animal.population.population_idx = -1
v.animal.population.depth = -1

v.counters.soldier_mood_countdown = -1
v.counters.death_cause = -1

v.enemy.anon_4 = -1
v.enemy.anon_5 = -1
v.enemy.anon_6 = -1
end

v.flags1.tame = true
v.training_level = 7
end
end
end
end

require('repeat-util').scheduleEvery('onAction',1,'ticks',checkForCritter)

To use, add the line

tame-all FRIENDLY_CRITTER

to your onload.init file.
Title: Re: DFHack 0.40.24-r3
Post by: Boltgun on May 12, 2015, 08:02:03 am
Does a self targeting syndrome is captured by syndrome trigger? If so it can be used to work around the regional biome or the spawn.
Title: Re: DFHack 0.40.24-r3
Post by: Meph on May 12, 2015, 08:05:50 am
I used that before, so yes. It definetly worked in 34.11 with the old dfhack.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on May 12, 2015, 08:18:03 am
Boltgun and Meph, I'm pretty sure the problem was the self-targeting interaction rather than catching the syndrome.  I've never had much luck with self-targeting interactions for whatever reason.  What surprised me was that a probability 100 regional interaction didn't appear when it was the only option for that biome.  Interactions just hate me.  At least the Lua code works.
Title: Re: DFHack 0.40.24-r3
Post by: Meph on May 12, 2015, 09:55:36 am
My regional interactions did not show up often either. Instead of self-targetted interactions, you can just give dwarves the interaction that targets these creatures. Make it NOT line-of-sight with a range of 500, and any of these creatures that show up should be targetted by your dwarves. :)
Title: Re: DFHack 0.40.24-r3
Post by: Roses on May 12, 2015, 01:21:47 pm
Boltgun and Meph, I'm pretty sure the problem was the self-targeting interaction rather than catching the syndrome.  I've never had much luck with self-targeting interactions for whatever reason.  What surprised me was that a probability 100 regional interaction didn't appear when it was the only option for that biome.  Interactions just hate me.  At least the Lua code works.

Can you post your interaction?
Title: Re: DFHack 0.40.24-r3
Post by: Probe1 on May 12, 2015, 09:18:30 pm
Quote
plant

A tool for creating shrubs, growing, or getting rid of them.

Subcommands:

create:   Create a new shrub/sapling.
grow:   Make saplings grow into trees.
extirpate:   Kills trees and shrubs, turning them into ashes instantly.
immolate:   Similar to extirpate, but sets the plants on fire instead. The fires can and will spread ;)

Is plant extirpate and plant immolate depreciated?  I cannot figure out how to use it.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 12, 2015, 09:30:30 pm
I never did have much luck getting those ones to work either.

So uh, I was trying to figure out for a while how the heck the reaction "imbue with material" I recall having at one point worked only to realize it was done through a script, apparently it was folded at least partially into another script but I can't figure out how to get one that makes something "Vaci Sunaclotho's skull helm" like the reaction one did, is that the only way to make it keep the name/body part stuff?

I recall playing with it some time back and accidentally making a roc feather dagger and such, was that broken by one of the more recent updates or am I just not looking in the right spot?
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on May 12, 2015, 10:44:34 pm
I suspect the problem is that if they enter the map with the syndrome already applied, DFHack doesn't trigger the event. On self interactions should work.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on May 13, 2015, 01:42:20 am
Boltgun and Meph, I'm pretty sure the problem was the self-targeting interaction rather than catching the syndrome.  I've never had much luck with self-targeting interactions for whatever reason.  What surprised me was that a probability 100 regional interaction didn't appear when it was the only option for that biome.  Interactions just hate me.  At least the Lua code works.

Can you post your interaction?
It's sort of a moot point now, though I'd like to know if I just plain did the interactions wrong.  These are the two interactions, though they wouldn't both be active at the same time.

Code: (interaction_tesb.txt) [Select]
interaction_tesb

[OBJECT:INTERACTION]

This interaction serves as a hook for a syndrome-trigger.

[INTERACTION:DOMESTICATE PET ROCK]
[I_SOURCE:REGION]
[IS_REGION:ANY]
[IS_FREQUENCY:100]
[I_TARGET:A:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[IT_AFFECTED_CREATURE:PET_ROCK:ALL]
[IT_CANNOT_TARGET_IF_ALREADY_AFFECTED]
[I_EFFECT:ADD_SYNDROME]
[IE_TARGET:A]
[IE_INTERMITTENT:WEEKLY]
[SYNDROME]
[SYN_NAME:Adorable pet rock]
[CE_MENT_ATTR_CHANGE:PATIENCE:200:1000:START:0]

[INTERACTION:GO_DOMESTIC]
[I_SOURCE:CREATURE_ACTION]
[I_TARGET:ME:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[IT_CANNOT_TARGET_IF_ALREADY_AFFECTED]
[I_EFFECT:ADD_SYNDROME]
[IE_TARGET:ME]
[SYNDROME]
[SYN_CLASS:TESB_DOMESTICATE]
[SYN_NAME:Adorable Pet Rock]
[CE_MENT_ATTR_CHANGE:PATIENCE:200:1000:START:0]

And in onload.init:

modtools/syndrome-trigger -syndrome "Adorable pet rock" -command [ tesb-domesticate \\UNIT_ID ]

which I know works when run from the console.  The regional one might have misfired because regional interactions just don't pop up as often as modders would like them to.  The self-interacting one probably misfired because the critter has an [IMMOBILE] tag, which seems to inhibit all interactions.

The whole reason I needed the script in the first place is that immobile wild animals can't get themselves caught in traps, and I really want these guys to be adoptable.  There is also a condition under which they'll be spawn-unit'ed, but those start out tame anyway.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on May 13, 2015, 08:21:10 am
I never did have much luck getting those ones to work either.

So uh, I was trying to figure out for a while how the heck the reaction "imbue with material" I recall having at one point worked only to realize it was done through a script, apparently it was folded at least partially into another script but I can't figure out how to get one that makes something "Vaci Sunaclotho's skull helm" like the reaction one did, is that the only way to make it keep the name/body part stuff?

I recall playing with it some time back and accidentally making a roc feather dagger and such, was that broken by one of the more recent updates or am I just not looking in the right spot?

You may be looking for my script which I used to call imbue, but got changed to item/subtype-change. It will let you make things like roc feather daggers and such if used with modtools/reaction-trigger.

Boltgun and Meph, I'm pretty sure the problem was the self-targeting interaction rather than catching the syndrome.  I've never had much luck with self-targeting interactions for whatever reason.  What surprised me was that a probability 100 regional interaction didn't appear when it was the only option for that biome.  Interactions just hate me.  At least the Lua code works.

Can you post your interaction?
It's sort of a moot point now, though I'd like to know if I just plain did the interactions wrong.  These are the two interactions, though they wouldn't both be active at the same time.

Code: (interaction_tesb.txt) [Select]
interaction_tesb

[OBJECT:INTERACTION]

This interaction serves as a hook for a syndrome-trigger.

[INTERACTION:DOMESTICATE PET ROCK]
[I_SOURCE:REGION]
[IS_REGION:ANY]
[IS_FREQUENCY:100]
[I_TARGET:A:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[IT_AFFECTED_CREATURE:PET_ROCK:ALL]
[IT_CANNOT_TARGET_IF_ALREADY_AFFECTED]
[I_EFFECT:ADD_SYNDROME]
[IE_TARGET:A]
[IE_INTERMITTENT:WEEKLY]
[SYNDROME]
[SYN_NAME:Adorable pet rock]
[CE_MENT_ATTR_CHANGE:PATIENCE:200:1000:START:0]

[INTERACTION:GO_DOMESTIC]
[I_SOURCE:CREATURE_ACTION]
[I_TARGET:ME:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[IT_CANNOT_TARGET_IF_ALREADY_AFFECTED]
[I_EFFECT:ADD_SYNDROME]
[IE_TARGET:ME]
[SYNDROME]
[SYN_CLASS:TESB_DOMESTICATE]
[SYN_NAME:Adorable Pet Rock]
[CE_MENT_ATTR_CHANGE:PATIENCE:200:1000:START:0]

And in onload.init:

modtools/syndrome-trigger -syndrome "Adorable pet rock" -command [ tesb-domesticate \\UNIT_ID ]

which I know works when run from the console.  The regional one might have misfired because regional interactions just don't pop up as often as modders would like them to.  The self-interacting one probably misfired because the critter has an [IMMOBILE] tag, which seems to inhibit all interactions.

The whole reason I needed the script in the first place is that immobile wild animals can't get themselves caught in traps, and I really want these guys to be adoptable.  There is also a condition under which they'll be spawn-unit'ed, but those start out tame anyway.

Well, your syndrome for the creature action interaction has each word capitalized, that could be causing the trouble. And I assume you gave the creature the correct, [CAN_DO_INTERACTION:GO_DOMESTIC]?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on May 13, 2015, 10:47:31 am
Yes, they had the interaction enabled.  But I suspect the IMMOBILE prevented it from working.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on May 13, 2015, 11:15:30 am
Ah, yes I do remember reading something about immobile animals not using interactions.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 13, 2015, 03:17:32 pm
Ohhhh, I figured subtype-change meant just weapon or armor subtype, thanks!
Title: Re: DFHack 0.40.24-r3
Post by: bennerman on May 17, 2015, 10:10:37 am
Does anyone know why adv-bodyswap isn't working, or, alternatively, if I'm doing it wrong? the console says it doesn't exist. Dfusion "change adventurer" made the swap happen but all my companions ran away, screaming about "the violence"

edit: I should specify: I swapped into one of my companions to equip him properly and give back the items I accidentally gave him. So when I did, my companions (one of whom was originally me before the swap) ran away. When I slept, hoping they'd be back when I woke up, I couldn't move at all. No injuries, just slightly hungry and thirsty, but I couldn't move.
Title: Re: DFHack 0.40.24-r3
Post by: Jordan~ on May 17, 2015, 11:45:56 am
Box: What's wrong with teleport.lua? It was working for me the last time I checked (which was at least after v0.40.20, if not v0.40.24).

Couldn't see that anyone answered this: whenever I try to use it, I just get tracebacks.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 17, 2015, 03:17:53 pm
It works for me in 0.40.24-r3. Are you using it as described in the readme (https://github.com/dfhack/dfhack#teleport)?

For example, this should teleport the selected unit to (44, 55, 167):
Code: [Select]
teleport -x 44 -y 55 -z 167
Title: Re: DFHack 0.40.24-r3
Post by: Jordan~ on May 17, 2015, 03:25:00 pm
That might be what was wrong - I tried to get coords with "teleport showpos", but that also just returned tracebacks.

Edit: It was showing coords and then tracebacks, actually. :P

Edit again: Got the position and the unit ID, entered teleport -z 73 -y30 -z 155 16028 (and with the coordinates and the unit ID the other way around), and in both cases I'm getting tracebacks and no actual teleportation happening.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 17, 2015, 03:26:29 pm
That might be what was wrong - I tried to get coords with "teleport showpos", but that also just returned tracebacks.
You have to include the hyphen: "teleport -showpos"

(In general, most plugins parse commands manually and don't require hyphens, but several scripts use a centralized method of argument processing that does require hyphens.)
Title: Re: DFHack 0.40.24-r3
Post by: Jordan~ on May 17, 2015, 03:31:49 pm
Ironically, teleport -showpos just returns tracebacks; teleport showpos returns coordinates and tracebacks.

Also tried using the cursor to indicate the unit rather than an ID. Same deal.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 17, 2015, 05:00:56 pm
There's no way "teleport showpos" can work. Can you copy and paste the traceback here? (Read: copy and paste - if you're on Windows, the relevant menu is available by clicking somewhere in the title bar.)
Title: Re: DFHack 0.40.24-r3
Post by: Jordan~ on May 17, 2015, 05:26:29 pm
Code: [Select]
...sktop\Shortcuts\Dwarf Fortress\40.24\hack\lua\dfhack.lua:454: ...Shortcuts\Dw
arf Fortress\40.24/hack/scripts/teleport.lua:15: syntax error near '=='
stack traceback:
        [C]: in function 'error'
        ...sktop\Shortcuts\Dwarf Fortress\40.24\hack\lua\dfhack.lua:454: in func
tion <...sktop\Shortcuts\Dwarf Fortress\40.24\hack\lua\dfhack.lua:425>
        (...tail calls...)
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 17, 2015, 05:40:28 pm
It looks like you've made modifications to teleport.lua - the script in the most recent release (https://github.com/DFHack/dfhack/blob/master/scripts/teleport.lua#L15) doesn't have "==" anywhere on that line. Try replacing the script with that version (clicking the "Raw" button will allow you to save it more easily).
Title: Re: DFHack 0.40.24-r3
Post by: DragonDePlatino on May 17, 2015, 08:34:05 pm
What is the command for identifying the tile under your cursor? Like, if I pointed at a grass tile, it would output "GrassLightFloor1"? I've been searching through the help files but I just can't find it...
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 17, 2015, 08:35:07 pm
There's "probe", although it'll give you a lot more information than that.
Title: Re: DFHack 0.40.24-r3
Post by: bennerman on May 17, 2015, 08:57:41 pm
Anyone re:adv-bodyswap?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 17, 2015, 09:31:57 pm
Might be a silly question but did you make sure to grab the adv-bodyswap script again? I don't think it's included in the current release.

Also I asked on Roses thread but someone here might know before they get back to it, I found this in one of my older saves and it does produce the (whatever material) rock part but it doesn't do the imbue step:
Code: [Select]
[REACTION:LUA_HOOK_IMBUE_MAT]
[NAME:imbue with material]
[ADVENTURE_MODE_ENABLED]
[REAGENT:material source:1:NONE:NONE:NONE:NONE]
[REAGENT:item:1:NONE:NONE:NONE:NONE][PRESERVE_REAGENT]
        [PRODUCT:100:1:ROCK:NONE:GET_MATERIAL_FROM_REAGENT:material source:NONE]

Is it imbue.lua that you have to put in, or base-itemimbue.lua or is there a working one for item/subtypechange.lua as Roses suggested? Is there something you have to put in the dfhack.init as well? I tried to work it out by looking through the comments in the related scripts but it isn't clicking what I'm missing yet.

I've got eventful and reaction-trigger and such in the proper folders btw.
Title: Re: DFHack 0.40.24-r3
Post by: bennerman on May 17, 2015, 09:39:02 pm
No, I didn't. where can I find it?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 18, 2015, 12:44:57 am
Hmmm, I can't actually find a working copy of said script.

Also I figured out you've got to run the base-itemimbue at least to get it active but it spits out an error:
Code: [Select]
/home/thefunk/.dfwl/hack/scripts/base_imbueitem.lua:53: attempt to index local 'product' (a nil value)
stack traceback:
        /home/thefunk/.dfwl/hack/scripts/base_imbueitem.lua:53: in function '?'
        ./hack/lua/plugins/eventful.lua:49: in function <./hack/lua/plugins/eventful.lua:47>
/home/thefunk/.dfwl/hack/scripts/base_imbueitem.lua:53: attempt to index local 'product' (a nil value)

I did have to go in and change the lua hook because I noticed the reaction in the world I already created had the wrong name, but I'm not sure what exactly is happening with the product error.
Title: Re: DFHack 0.40.24-r3
Post by: bennerman on May 18, 2015, 09:20:35 am
Crap. Anyone else? :c
Title: Re: DFHack 0.40.24-r3
Post by: Jordan~ on May 19, 2015, 02:56:54 pm
It looks like you've made modifications to teleport.lua - the script in the most recent release (https://github.com/DFHack/dfhack/blob/master/scripts/teleport.lua#L15) doesn't have "==" anywhere on that line. Try replacing the script with that version (clicking the "Raw" button will allow you to save it more easily).

Got it working! I did try tweaking a few things in the script, but I was pretty sure I saved over it with the version from the most recent release when it didn't change anything.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 19, 2015, 03:27:55 pm
teleport was broken in general until a few minutes ago (https://github.com/Putnam3145/dfhack/blob/patch-19/scripts/teleport.lua). It didn't work with the cursor and didn't give any feedback on what exactly was causing an error, which was probably pretty frustrating.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on May 20, 2015, 07:42:01 pm
It's me again about price calculation. Is cheese price incorrect in dfhack? Game shows me 10 and it's 2 in dfhack.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 20, 2015, 08:32:36 pm
That's item base value; the material value of all cheeses in-game is 5, AFAIK, so that seems right.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on May 20, 2015, 08:37:32 pm
That's item base value; the material value of all cheeses in-game is 5, AFAIK, so that seems right.

(http://i.imgur.com/TVIg1k5.png) (http://imgur.com/TVIg1k5)
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 20, 2015, 08:44:26 pm
Oh. It's not counting stack size.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on May 20, 2015, 08:48:12 pm
Oh. It's not counting stack size.

No, it does (checked the code). It was just a coincidence, sorry. Changed stack size:

(http://i.imgur.com/hHqtEvy.png) (http://imgur.com/hHqtEvy)
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 20, 2015, 10:42:58 pm
For what it's worth, you can simplify that by using dfhack.gui.getSelectedItem().
Title: Re: DFHack 0.40.24-r3
Post by: mifki on May 21, 2015, 05:08:15 pm
For what it's worth, you can simplify that by using dfhack.gui.getSelectedItem().

Thanks! What's about the price though?
Title: Re: DFHack 0.40.24-r3
Post by: Youbo on May 23, 2015, 03:41:52 pm
Hello, I just discovered gui/gm-editor and it is really fun to experiment with it but I was careless and messed up. I started with some easy stuff like changing attributes and size in arena then I went in fortress mode and tried changing things like preferences. I did not bother making a new fortress to while experimenting,figuring that I just wont save if I crash something so I used my actual fortress. Everything was fine until I tried to change a short sword into a long sword. I did it by changing the sub type. On the surface, I succeeded : it became a long sword in name,attacks,and everything while nothing crashed. Satisfied with the editor for now,I returned to playing my fortress without bothering to restart DF since I didn't do anything important(or so I thought).
But when I tried to load my fortress today,it crashed. The error log said I had duplicate long sword and unrecognized short sword weapon tokens so the entities failed to finalize. I noticed that I could load the save without crash for some reasons if I play in arena for a bit first. From my observations(my forges could make long instead of short swords) so I think I changed the whole short sword(as an type of weapon) to long sword instead of that specific one. Then I tried to undo what I did but ended up breaking both short and long swords as well as mauls. I went into my save raws but everything was fine.
What went wrong? How do I fix this? Help!
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 23, 2015, 05:03:29 pm
I cannot see how that could possibly happen from changing the subtype of a single item. What exactly did you do for the short sword?
Title: Re: DFHack 0.40.24-r3
Post by: lonjil on May 23, 2015, 08:14:04 pm
Is it possible to use dfhack when running df in text mode?
It runs, but the only way to run commands is with dfhack-run, which is annoying.
Title: Re: DFHack 0.40.24-r3
Post by: Youbo on May 23, 2015, 08:35:22 pm
I cannot see how that could possibly happen from changing the subtype of a single item. What exactly did you do for the short sword?

I changed weight_fraction and everything in subtype(the entire ''folder'',not the similarly named value inside the folder that seems to be the ID)to exactly match what was on an existing long sword.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 23, 2015, 08:36:06 pm
Is it possible to use dfhack when running df in text mode?
It runs, but the only way to run commands is with dfhack-run, which is annoying.
Technically speaking, that is using DFHack.
The command-prompt plugin should work, but you'd have to invoke it with dfhack-run as well since DFHack keybindings (bound with the "keybinding" command) rely on SDL. It would be possible to modify the plugin to add a keybinding to the main fortress mode menu (or other screens, although they'd have to be implemented individually) - I'll look at including this in the next release.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 23, 2015, 09:40:34 pm
Oh I think the short sword thing was kinda like duplicating raws by hand in game, I had the feeling it would mess things up so I didn't fiddle with it.
Title: Re: DFHack 0.40.24-r3
Post by: StagnantSoul on May 24, 2015, 02:05:15 am
Um, did I miss something? I'm using the newest version of the starter pack, and rb_eval df.gametype = :DWARF_ARENA  no longer works. It says rb_eval is not a recognized command.
Title: Re: DFHack 0.40.24-r3
Post by: lonjil on May 24, 2015, 08:45:47 am
Is it possible to use dfhack when running df in text mode?
It runs, but the only way to run commands is with dfhack-run, which is annoying.
Technically speaking, that is using DFHack.
The command-prompt plugin should work, but you'd have to invoke it with dfhack-run as well since DFHack keybindings (bound with the "keybinding" command) rely on SDL. It would be possible to modify the plugin to add a keybinding to the main fortress mode menu (or other screens, although they'd have to be implemented individually) - I'll look at including this in the next release.
Thanks.
For now I've settled on a bash script that loops dfhack-run. Unfortunaly this doesn't work with interactive commands.
Can the remote interface handle those? Then I might try to make something with it.

Edit: Here's a screengrab (http://i.imgur.com/90moBqs.png?1)
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 27, 2015, 04:31:04 am
Ok I've been looking over the lua api, various dfhack scripts, and screwing around for a while but I'm stumped.

How do you get something to add a new entry with the right tables linked in?

I was trying to do various stuff with df.global.world.artifacts.all, I tried :new(), :insert('#',foo), :assign(foo,bar) and so forth. I know I can open it up with gm-editor and alt+i insert an artifact_record manually but everything I've attempted with a script just leaves it as nil.

What am I derping out on that is super obvious and was probably right in front of my face this whole time?
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on May 27, 2015, 06:03:40 am
:insert('#',{new=true,<... other things to set>}) or  :insert('#',{new=df.some_type,<... other things to set>}) IIRC
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 27, 2015, 06:32:36 am
I would like to mail you a hug but I don't know how.
Title: Re: DFHack 0.40.24-r3
Post by: Rallor on May 27, 2015, 08:18:07 am
I'm interested in retrieving a dwarf's hairstyles and facial features using dfhack. After looking at the source code of stonesense I am under the impression these values are stored in "unit.appearance.tissue_style". At first I thought the values are in the same order as they appear in the white segment of the character description, but the values of dwarves that have the same styles do not match up. Could someone tell me how these values are matched to what you can read on the character description screen?

Spoiler: Dwarf 1 (click to show/hide)
Spoiler: Dwarf 2 (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on May 27, 2015, 08:51:51 am
I'm interested in retrieving a dwarf's hairstyles and facial features using dfhack. After looking at the source code of stonesense I am under the impression these values are stored in "unit.appearance.tissue_style". At first I thought the values are in the same order as they appear in the white segment of the character description, but the values of dwarves that have the same styles do not match up. Could someone tell me how these values are matched to what you can read on the character description screen?

Spoiler: Dwarf 1 (click to show/hide)
Spoiler: Dwarf 2 (click to show/hide)
It's weird, I grant you. The values of the properties themselves are visible in the string dump, in order:

(-1: nothing of note)
0: NEATLY_COMBED
1: BRAIDED
2: DOUBLE_BRAIDS
3: PONY_TAILS
4: CLEAN_SHAVEN

But just by looking at those makes my head hurt, even after some personal experimenting:

Bodyparts:
0 and 1: Both are sideburns?? One each for two specific properties? Length and color have their own bins.
2 and 3: Moustache and beard.
6 and 7: Both are hair, again??
Title: Re: DFHack 0.40.24-r3
Post by: Rallor on May 27, 2015, 09:10:15 am
Thank you. But what did you use, or how did you figure out what was what?
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on May 27, 2015, 09:32:46 am
gui/gm-editor is the go-to for quick tweaks, especially when you're an illiterate dong who can't operate lua from the command line like me. K-cursor a dwarf and punch it in, it'll jump straight to the unit vector.

e: Oh and just plain deduction. One's 3 is double-braided and the other's is combed, find the 2 in one and 0 in the other.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on May 27, 2015, 12:38:48 pm
I have 2 text files with appearance research... Not sure how much is integrated changed (and am too lazy to even run df and see)
Code: [Select]
unk_4cc - tissue style
unk_4dc - civ_id
unk_4ec -??
unk_4fc -??
unk_50c - lenght?

bp_modifiers->caste.bp_appearance.modifiers[caste.bp_appearance.modifier_idx[k]]
And a script called "find_hair.lua"
Code: [Select]
local race=465
local modifiers={}
local modifiers_idx={}
local caste=df.creature_raw.find(race).caste[1]
local bp=caste.bp_appearance
local unit=dfhack.gui.getSelectedUnit()
for k,v in pairs(bp.modifiers) do
    if v.noun=='hair' then
        print(k,df.appearance_modifier_type[v.type])
        modifiers_idx[k]=true
        table.insert(modifiers,v)
    end   
end
for k,v in pairs(bp.modifier_idx) do
    if modifiers_idx[v] then
        print(k,v)
    end
end
for anyone who cares :P
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 27, 2015, 01:38:14 pm
First, dear god illiterate dong is amusing as hell.

Second, thanks to your pointing out what I was missing I've just about got a perfected script to allow a createitem type script to make artifacts with proper records and names and decorations and all that noise but I'm tired so I'll work out the last few bits later. Perhaps then I'll be able to figure out why I was able to fake artifact mooding and creation with advfort reliably on one save but not on any others since.

Third, as was said, for vanilla you've got:

sideburn
sideburn
beard
moustache
nada
nada
hair
hair

Then under tissue length is the first part of stuff like repairing clean shaven beards or whatnot, and under bp_modifier I think is the second part. The values listed under tissue_length will let you figure out which ones you need under bp_modifier though there is only one hair length value there, and the second one apparently changes waviness/thickness/etc?

Interestingly, when you go through the lengths it takes to get bearded elves the way the styles are applied has the amusing effect of letting you wear your moustache, beard, and sideburns in ponytails.
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 27, 2015, 01:44:18 pm
gui/gm-editor is the go-to for quick tweaks, especially when you're an illiterate dong who can't operate lua from the command line like me. K-cursor a dwarf and punch it in, it'll jump straight to the unit vector.

e: Oh and just plain deduction. One's 3 is double-braided and the other's is combed, find the 2 in one and 0 in the other.

unit object, unit vector is the thing that contains the unit objects
Title: Re: DFHack 0.40.24-r3
Post by: DragonDePlatino on May 27, 2015, 01:51:41 pm
Second, thanks to your pointing out what I was missing I've just about got a perfected script to allow a createitem type script to make artifacts with proper records and names and decorations and all that noise but I'm tired so I'll work out the last few bits later.

Oh! Max™! I know this might not be the place to ask, but could I make a simple request while you are working with createitem? You can't spawn TRAPPARTS or TRACTION_BENCH properly, so maybe you could fix that as well?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 27, 2015, 01:52:15 pm
Is that true with gui/hack-wish?
Title: Re: DFHack 0.40.24-r3
Post by: DragonDePlatino on May 27, 2015, 01:56:27 pm
Erm...you lost me.

All I know is that if I try something like "createitem TRAPCOMP:TRAMPCOMP INORGANIC:GOLD 1" or "createitem TRACTION_BENCH:TRACTION_BENCH INORGANIC:GOLD 1" then it won't work. I have no idea what hack-wish is.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 27, 2015, 01:58:33 pm
It's a searchable GUI implementation of create-item accessible using gui/hack-wish in the DFHack console.
Title: Re: DFHack 0.40.24-r3
Post by: DragonDePlatino on May 27, 2015, 02:11:26 pm
How did I not know about this sooner?!? This would have saved me a lot of time I wasted using createitem. DFHack needs some better command documentation. D:

Yeah, it seems I can spawn components and traction benches just fine with gui/hack-wish. It's a shame it can't spawn plant growths or spawn something while controlling a creature, though. I could get a lot of usage out of those features. :/
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 27, 2015, 02:13:27 pm
spawn something while controlling a creature

???

It's a shame it can't spawn plant growths

Yeah, haven't done much research into how all that works.
Title: Re: DFHack 0.40.24-r3
Post by: DragonDePlatino on May 27, 2015, 02:22:48 pm
Spawning something while controlling a creature...

If I go into arena mode, spawn a creature and put my cursor over it, I can spawn an item with createitem. If I assume control of that creature, createitem will still work and it will spawn an item at my feet.

On the other hand, it seems I can't do this with gui/hack-wish. If I try spawning an item while I'm a creature it says "A unit needs to be selected to use hackwish".
Title: Re: DFHack 0.40.24-r3
Post by: Klisz on May 27, 2015, 02:31:15 pm
I'm interested in retrieving a dwarf's hairstyles and facial features using dfhack. After looking at the source code of stonesense I am under the impression these values are stored in "unit.appearance.tissue_style". At first I thought the values are in the same order as they appear in the white segment of the character description, but the values of dwarves that have the same styles do not match up. Could someone tell me how these values are matched to what you can read on the character description screen?

Spoiler: Dwarf 1 (click to show/hide)
Spoiler: Dwarf 2 (click to show/hide)

I think it's in the order that the tissue style units are defined in the raws for the creature in question. So for dwarves, first hair, then beard, then moustache, then sideburns.

Spawning something while controlling a creature...

If I go into arena mode, spawn a creature and put my cursor over it, I can spawn an item with createitem. If I assume control of that creature, createitem will still work and it will spawn an item at my feet.

On the other hand, it seems I can't do this with gui/hack-wish. If I try spawning an item while I'm a creature it says "A unit needs to be selected to use hackwish".

When you're controlling a creature, you're not considered to have it "selected". You need to view yourself with z, then use hackwish.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 27, 2015, 02:53:17 pm
That wouldn't explain why createitem works, though.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 27, 2015, 03:32:41 pm
I think the createitem plugin has something in there that makes it check the df.global.world.units.active[0] for the player controlled unit doesn't it?

Yep!
Code: [Select]
    df::unit *unit = Gui::getSelectedUnit(out, true);
    if (!unit)
    {
        if (*gametype == game_type::ADVENTURE_ARENA || World::isAdventureMode())
        {
            // Use the adventurer unit
            unit = world->units.active[0];
        }

Still getting the hang of the dfhack.createItem though, I was looking at uhh expwnents modtools/create-item.lua trying to figure out a better way to fake up an artifact (which was productive!) and I still feel like it shouldn't work every time I look at the parts I used but I'll be damned if it didn't start spitting out fake-ifacts for me while I was trying to get the right syntax for checking the newly spawned item id/assigning it to the artifact record.

Code: [Select]
local utils = require 'utils'

validArgs = validArgs or utils.invert({
 'help',
 'material',
 'item',
})

local args = utils.processArgs({...}, validArgs)

if args.help then
 print(
[[artifuckery.lua
arguments:
    -help
        print this help message
    -material matstring
        specify the material of the item to be created
        examples:
            INORGANIC:IRON
            CREATURE_MAT:DWARF:BRAIN
            PLANT_MAT:MUSHROOM_HELMET_PLUMP:DRINK
    -item itemstr
        specify the itemdef of the item to be created
        examples:
            WEAPON:ITEM_WEAPON_PICK
 ]])
 return
end

args.creator = df.global.world.units.active[0]

if not args.item then
 error 'Invalid item.'
end
local itemType = dfhack.items.findType(args.item)
if itemType == -1 then
 error 'Invalid item.'
end
local itemSubtype = dfhack.items.findSubtype(args.item)

args.material = dfhack.matinfo.find(args.material)
if not args.material then
 error 'Invalid material.'
end

local item = dfhack.items.createItem(itemType, itemSubtype, args.material['type'], args.mate
rial.index, args.creator)

 local base=df.global.world.items.all[2015] --I know there's a way to pick up the item made by the function above
 df.global.world.artifacts.all:new()
 df.global.world.artifacts.all:insert('#',{new=df.artifact_record})
local facts = df.global.world.artifacts.all
 for _,k in ipairs(facts) do
  if k.id==0 then
   local fake=k
   fake.id=df.global.artifact_next_id
   --fake.name = --I bet I can get these randomly generated huh
   --fake.flags = {new=df.bitarray} --still not sure how to get these to populate but they're all false anyways...
   fake.item = {new=base}
   fake.anon_1 = -1000000
   fake.anon_2 = -1000000
   fake.anon_3 = -1000000
     fake.item.flags.artifact=true
     base.flags.artifact=true
     if fake.item == 'WEAPON' then item:setSharpness(1,0) end
     if base == 'WEAPON' then item:setSharpness(1,0) end
     fake.item:setQuality(5)
     base:setQuality(5)
     --fake.item.itemdecoration or something needs to be added but they randomize on first viewing happily
     --base.itemdecoration there's also gotta be a way to have base copy over fully to fake instead of just portions
     df.global.artifact_next_id=df.global.artifact_next_id+1
   end
end

Pardon the mess, but it struck me to try something like this when I got stumped figuring out why my region7 save file can actually use advfort + these bits to trigger and complete strange moods:
Code: [Select]
function weapon()
                df.global.world.units.active[0].flags1.has_mood=true
                df.global.world.units.active[0].mood=0
                df.global.world.units.active[0].job.current_job.job_type=57
                df.global.world.units.active[0].job.mood_skill=27
                df.global.world.units.active[0].job.current_job.job_items[0].mat_type=0 --went with a cheap solution
                df.global.world.units.active[0].job.current_job.job_items[0].mat_index=8 --my first success was a coal battle axe >.<
end
-- ---------------------------------------------------------------------------
function armor()
                df.global.world.units.active[0].flags1.has_mood=true
                df.global.world.units.active[0].mood=0
                df.global.world.units.active[0].job.current_job.job_type=57
                df.global.world.units.active[0].job.mood_skill=28
                df.global.world.units.active[0].job.current_job.job_items[0].mat_type=0
                df.global.world.units.active[0].job.current_job.job_items[0].mat_index=8
I've got worlds which are generated with the exact same seeds and such, same raws, all that jazz for region8, 9, etc but none of them get past the screen where the job timer would count down after selecting the materials/using the artifake script. Keep having to devel/pop-screen out of it. Yet I go back to the first folder I tried it on and it just cranks em out all day long.
Title: Re: DFHack 0.40.24-r3
Post by: Youbo on May 27, 2015, 04:46:34 pm
No legendary DFHacker can help me with my problem? Its been a few days and still no answers. Its on page 177 if anyone is willing to help.
Even if you don't have an a solution, a simple ''That is not fixable'' will be appreciated so I can scrap the world and move on.
Thanks in advance!
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 27, 2015, 05:12:31 pm
...Oh, wow, yeah, I just noticed what you did. Uh. You could have just changed the item's subtype directly, with item:setSubtype(subtypenum). What you did there was... weird, heh.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 27, 2015, 07:53:45 pm
Most of what we do here is weird, is it not?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 27, 2015, 09:15:31 pm
...maybe
(https://i.imgur.com/MtP3GTv.png)
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 28, 2015, 01:31:16 am
Wait, did you just get the scouter display working there?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 28, 2015, 01:48:10 am
yeah

it's a viewscreen sitting on top of the military viewscreen, only actually renders in the case where units can be highlighted on the military screen, pressing LEAVESCREEN properly leaves the military screen without error, it also has a thing in the unit text-viewer viewscreen (though only for citizens, since the non-citizen unit text-viewer's parent is the default dwarf mode display and thus I can't get the unit there)
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 28, 2015, 02:05:08 am
Fascinating.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on May 28, 2015, 03:04:41 am
...maybe
(https://i.imgur.com/MtP3GTv.png)
Meh... not over 9 thousAND!
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 28, 2015, 04:03:31 am
sorry to disappoint you

(https://imgur.com/FW8Xgww.png)

coincidentally, this is the power level of the thing they're fighting

fun fact: a power level of more than ~9,000 makes you stronger than any creature in vanilla dwarf fortress

because the power level actually affects attack velocity

which is capped at 10,000 in vanilla, but can be made to go higher without issue and acting as expected
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on May 28, 2015, 04:55:50 am
Wait... What is that power level?
Title: Re: DFHack 0.40.24-r3
Post by: Dark Archon on May 28, 2015, 11:40:53 am
Is where a interface for workflow plugin in 40.24?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on May 28, 2015, 12:06:03 pm
Wait... What is that power level?
I think it's a reference to Dragonball Z.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on May 28, 2015, 04:04:00 pm
Wait... What is that power level?
I think it's a reference to Dragonball Z.
I understood that, but how it's calculated (size+hash_of_name? :D)
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 28, 2015, 04:40:12 pm
(willpower*yuki_perc+focus*shoki_perc+endurance*genki_perc+boost*weighted_average_perc)*multiplier)

boost and multiplier are gotten from syndromes (e.g super saiyan boost), caste raws (e.g cell boost) or dfhack persistent storage (e.g super saiyan multiplier)

weighted average weights by willpower, focus and endurance comparison
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 29, 2015, 03:54:02 am
YES!

https://github.com/maxthyme/dfstuff/blob/master/artifake.lua is go, a fully operational createitem type artifact making script. I'll be looking into the different random number stuff so I can add a -name option to have it generated but for now I don't mind having to go in and change them by hand if I feel like it. These are all artifacts with proper records and links to the appropriate locations and they even have spikes and two art images (which do randomize on first viewing, wish names would work that easily) so, yay, the bit from looking at putnams sparking.lua helped me work out where I needed to slot in the last pieces.

This is what I meant about the names, unless they're set you get the masterwork/decorated name displayed.
(http://i.imgur.com/dXDaZXq.png)

The vanilla items work of course, and other than the durnil (hammer/axe blend that's supposed to basically be the mounted fist of a steel colossus) those are actually vanilla named armors in the raws, just the displayed ones are different, but yeah, artifake -item ARMOR:ITEM_ARMOR_SHIRT -material ELF:LEATHER pops out an artifact elf leather shirt, hurray!
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 29, 2015, 03:56:01 am
...actually what exactly is in sparking.lua that tells you what you needed?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 29, 2015, 04:42:55 am
The way you did the fusion stuff with the skills merging and being declared properly and all that, it just helped me see where I was getting hung up and why some of the stuff I tried didn't assign the values properly.

Hell, even though I wasn't able to get it to all work in a contained fashion like it does for the skills one it still pointed me in the right direction to get things sorted and assigned correctly.

Earlier attempts I had ran the risk of crashing you when you viewed the descriptions and pretty regularly you'd get a mini-crash when saving that wasn't doing anything that I can tell but it still wasn't comforting. Now though they work just like they should.

Anyone know a good way to get random names generated? Gonna poke around at some of the stuff I saw in the api tomorrow I think and see if I can't get a -name option in there. Need to see how to make it assign left OR right too, for some reason the args kept triggering the handnedness setting so if you do -r it would give a right glove but it also set the handedness to right when I tried to use -l, which sets it back to neither. T.T
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on May 29, 2015, 10:29:55 pm
Random name generation is complicated because not all words can be all parts of speech. I don't think there's an easy way of doing it.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 30, 2015, 12:18:01 am
Hmmm, how do moody dorfs come up with them?
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on May 30, 2015, 12:32:16 am
Toady has code that we do not. We can only call DF code under very special circumstances with vmethods.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 30, 2015, 01:54:41 am
Yar, I was poking around through their little brains earlier and there's just no artifact name listed until they do it. Well, guess I'll see if I can get a way for it to insert a string for the name when called.

As a test I put this in at the end and it worked properly:
Code: [Select]
if args.name then do
  fake.name.first_name = args.name
  fake.name.language = 0
  fake.name.has_name = true
         end
      end
Made a weapon named Buttscratcher and a shield named Armybreaker as expected, I was gonna see about having it parse and split up the string but then I realized I was being derpy and I can just have it call up a prompt and populate that with the name options can't I?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 30, 2015, 01:28:12 pm
Didn't notice the name-making code in sparking.lua, eh?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 30, 2015, 03:34:06 pm
Hmmm, I did not apparently, gonna check it out.
Title: Re: DFHack 0.40.24-r3
Post by: Klisz on May 30, 2015, 04:50:13 pm
Can you use modtools/item-trigger with the hardcoded jewelry, or only with items that have subtypes?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 30, 2015, 07:52:15 pm
Didn't notice the name-making code in sparking.lua, eh?
It doesn't look like that would do what I was thinking of though, which was trying to do a similar trick you did with hack-wish except populate the prompt with say, word, forms, racechoice, translated word, move to next part of name or something along those lines.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 30, 2015, 07:57:11 pm
Haha, yeah, quick check of that tells me you may want a proper viewscreen with a proper searchable list for that. 2172 words means paging through is killer. It shouldn't be hard at all to get a list of every valid part of speech for a word, though, since word.flags[part_of_speech_num] tells you whether it's valid.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on May 30, 2015, 09:10:40 pm
Can you use modtools/item-trigger with the hardcoded jewelry, or only with items that have subtypes?

I suspect it doesn't but I'm not sure.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 30, 2015, 09:25:12 pm
Haha, yeah, quick check of that tells me you may want a proper viewscreen with a proper searchable list for that. 2172 words means paging through is killer. It shouldn't be hard at all to get a list of every valid part of speech for a word, though, since word.flags[part_of_speech_num] tells you whether it's valid.
Yup, I was looking to see how to pull up the viewscreen_layer_choose_language_namest, my first try did get a new screen pulled up but my naive attempts at populating it by just copying the entries and whatnot from the adventurer name choice screen didn't quite work.

Incidentally if I do get this working right I'll just make it a standalone script that targets stuff like gm-editor does since it seems like the sort of thing that would be appreciated for a lot more than just artifake-ing stuff. Figure that way I can release it on it's own and still have the option to call it with the -name flag from artifake. :D

But, I'm beat, fixed the gf's chromebook last night (incidentally if a c720 freezes, try opening it and removing the battery/ssd, then release and make sure the hinges are on properly so the lid switch works) and had to remove/replace a sheared bolt on the leafblower mount. Brain is frazzled.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on May 30, 2015, 10:12:39 pm
That would be great!
Title: Re: DFHack 0.40.24-r3
Post by: mifki on May 30, 2015, 11:45:21 pm
If I correctly understood what you're talking about here, there's a trick, try this one-liner:

Code: [Select]
a = df.new(df.viewscreen_setupadventurest) ; a.subscreen = 3 ; gui = require 'gui' ; gui.simulateInput(a, 'A_RANDOM_NAME') ; gui.simulateInput(a, 'A_CUST_NAME')
Title: Re: DFHack 0.40.24-r3
Post by: DragonDePlatino on May 31, 2015, 01:33:36 am
What are the tiles like LavaFloor1, LavaWall and LavaPillar? I assume they reference obsidian? That would be kinda weird considering there are already Mineral tiles...
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on May 31, 2015, 01:36:34 am
Not really, considering that there are also Layer tiles.
Title: Re: DFHack 0.40.24-r3
Post by: DragonDePlatino on May 31, 2015, 02:07:21 am
So then obsidian is supposed to be a StoneWall...? I've tried overwriting those with TWBT but it doesn't seem to affect obsidian.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 31, 2015, 02:19:31 am
If I correctly understood what you're talking about here, there's a trick, try this one-liner:

Code: [Select]
a = df.new(df.viewscreen_setupadventurest) ; a.subscreen = 3 ; gui = require 'gui' ; gui.simulateInput(a, 'A_RANDOM_NAME') ; gui.simulateInput(a, 'A_CUST_NAME')
OMFG YOU ARE A GODDAMN WIZARDNINJA!

Ok, first go at it it looks like it's selecting targets properly and it brings up the name selection screen and everything, the parent is assigned and I think the getname function is aimed right but I'm clearly missing something because I thought gui.sendInputToParent(a, 'nname') would take the currently displayed name and write it to the nname (which hopefully would be either an artifact name field or a unit name field) but no luck so far.

Code: [Select]
local gui = require 'gui'

function getTargetFromScreens()
    local my_trg
    if dfhack.gui.getCurFocus() == 'item' then
        my_trg=dfhack.gui.getCurViewscreen().item

    elseif dfhack.gui.getCurFocus() == 'dwarfmode/LookAround/Flow' then
        local t_look=df.global.ui_look_list.items[df.global.ui_look_cursor]
        my_trg=t_look.flow

    elseif dfhack.gui.getSelectedUnit(true) then
        my_trg=dfhack.gui.getSelectedUnit(true)
    elseif dfhack.gui.getSelectedItem(true) then
        my_trg=dfhack.gui.getSelectedItem(true)
end
    return my_trg
end

function getNameFromTrg(my_trg)
  local trg = my_trg
   if trg == 'item' then
     if general_refs[0].artifact_id then
       local aid = trg.general_refs[0].artifact_id
         local nname = df.global.world.artifacts.all[aid].name
     elseif trg == 'unit' then
      local nname = trg.name
     end
    end
   return nname
end

a = df.new(df.viewscreen_setupadventurest) ; a.subscreen = 3 ; gui = require 'gui' ;
gui.simulateInput(a, 'A_RANDOM_NAME') ; gui.simulateInput(a, 'A_CUST_NAME') ; gui.sendInputToParent(a, 'nname')

To be fair I'm still pretty dumbfounded at that little trick mifki did so it shouldn't be surprising if I'm not sure exactly what the hell is going on there, I mean I get what it's doing and how it's asking for the screen to be displayed properly but I don't think it's quite the same as the regular name choice screens where the dismiss writes the name, all I know for sure is that mifki scares me but I'm glad he's on the side of good.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on May 31, 2015, 03:15:24 am
Well, I don't know how the name choice screen works at all, so maybe it does something not what you need, I don't know. Actually, I don't understand what you're using sendInputToParent() for.

Anyway the trick is not to instantiate the screen you need (because you can't as we can't call constructors), but instead instantiate a screen from which there's a command to show the one you need. That parent screen will not fully work for the same reason, but hopefully it still will be able to show the screen you need (and will call its constructor properly). In this particular case you can also use it just to generate a random name and not show the name screen at all. Oh you'll also need to call parent screen's :delete() after it has created your screen.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 31, 2015, 04:29:53 am
I don't know why I was trying that either, actually but I think I got a better idea of what I need to do.

I know the screen that pops up when you do that has a viewscreen_layer_choose_language_namest.name field so I just need to work out how to make it send that to the name field from the designated target.
Spoiler (click to show/hide)

Also what do you mean about the :delete() thing, I didn't see the real adventurer screen at all from poking around with gm-editor.

Hmmm, I was sure this would work, I removed the sendinput bit from the trick you showed me and have this after it:
Code: [Select]
function getNewName()
local n = dfhack.gui.getCurViewscreen()
 if n == df.viewscreen_layer_choose_language_namest then
  local nn = n.name
 end
return nn
end

nn = nname
I assumed that would take nn (being the name from the choose screen I think) and send it to nname (being the name from the current target) but it ain't doing it yet.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on May 31, 2015, 05:02:02 am
There are multiple errors in your code, it should be something like

Code: [Select]
function getNewName()
  local n = dfhack.gui.getCurViewscreen()
  if n._type == df.viewscreen_layer_choose_language_namest then
    return n.name
  end
end

In my example, you'll need to add a:delete() because the adventurer screen has been created, even if you don't see it ;)
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 31, 2015, 05:24:17 am
There are multiple errors in your code, it should be something like

Code: [Select]
function getNewName()
  local n = dfhack.gui.getCurViewscreen()
  if n._type == df.viewscreen_layer_choose_language_namest then
    return n.name
  end
end

In my example, you'll need to add a:delete() because the adventurer screen has been created, even if you don't see it ;)
Well yeah, I'm kinda poking around making up a lot of it from what I've seen on the lua api and in other scripts+what seems like it might work, just realized I had the bit I was trying to have grab the artifact name trying to use the id for the index so I had to rejigger that.

I'll toss that bit in there too, and what, just put the ; a:delete() at the end?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 31, 2015, 05:26:59 am
lol almost choked on my cereal when my question was answered by it freezing for a sec and killing df entirely. :D

See, this is how I progress when trying to hack together some script:

1. Hmmm, I bet I could [whatever], wait, that is kinda similar to part of [some other script I've looked at]
2. Ok, let's see if this works.
Code: [Select]
/home/thefunk/.dfwl/hack/scripts/names.lua:34: ha ha, nope, suck it max3. Ok *fix those that pop up until the script runs* right, let's get started!
4.
5. Since nothing happened I poke around and see what I forgot, occasionally find a better method or at times learn I can streamline an entire block of code into a line or two, and run it again.
6. Success! Well, of a sort, there's still something that wasn't right... but *poke poke poke* that should do it.
7. Ha ha, I made a thing, awesome.
8. *play with it until it breaks then show it if it doesn't*
Title: Re: DFHack 0.40.24-r3
Post by: mifki on May 31, 2015, 05:52:25 am
It seems in this case you can only call a:delete() once you (user) finished with the name selection screen.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 31, 2015, 05:54:21 am
Yeah, cause the ways I tried it just killed df the first time and segfaulted the second (when I tried to do it without the semicolon) so hey, that's why I posted here, the stuff I know is vastly outweighed by what I don't.

How do I make it check that I'm done with the selection screen? Is that where a gui.onDismiss(a) or something would go?

Oh yeah, I meant to ask, when the next update comes around is there anything particular that can be done on linux to help finding symbols and such, and what tools should I grab to do so? I know a lot of them can be found automatically apparently with certain scripts but is that it for linux or?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 31, 2015, 07:22:44 pm
Urgh, so I figured out how to put in a line to print a check if it was getting the right targets and it confirmed that no, in fact it was not.
Code: (names.lua) [Select]
local gui = require 'gui'

function getTargetFromScreens()
    local old = dfhack.gui.getCurViewscreen()
     if old._type == viewscreen_itemst then
      if old.item.general_refs[0] then
       local aid = old.item.general_refs[0].artifact_id
        local facts = df.global.world.artifacts.all
         for _,v in facts do
          if v.id == aid then
           local nold = facts[v].name
    elseif old._type == viewscreen_dungeon_monsterstatusst then
          local nold = old.unit.name
end
                       end
                      end
                     end
    return nold
end
print(nold)

a = df.new(df.viewscreen_setupadventurest) ; a.subscreen = 3 ; gui = require 'gui' ;
gui.simulateInput(a, 'A_RANDOM_NAME') ; gui.simulateInput(a, 'A_CUST_NAME')

function getNewName()
  local n = dfhack.gui.getCurViewscreen()
  if n._type == df.viewscreen_layer_choose_language_namest then
    local new = n.name
     nold = new
   end
  end
print(new)
It's weird because if I do parts of what I think should get the right target it seems right, like gui/gm-editor dfhack.gui.getCurViewscreen().item pulls it up like I expect it to but I'm clearly missing something needed to get it to pass that along to the next part.


I also somehow removed the .name part somewhere along the line while trying to get it to print the target checks, hah.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on May 31, 2015, 08:07:51 pm
For one thing, "old._type == viewscreen_itemst" will never be true, since viewscreen_itemst will be nil unless you've set it to something. You want df.viewscreen_itemst instead. (You can also use "df.viewscreen_itemst:is_instance(old)", I believe.)
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on May 31, 2015, 08:13:07 pm
AH! See I didn't even catch that and it didn't spit an error either.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 01, 2015, 03:19:23 am
So I'm a super tard and realized there was a better way to do a lot of this and I get the feeling that it is close but I'm not sure how to have it run the function getNewName stuff until after the screen is called.
Code: (nametest.lua) [Select]
a = df.new(df.viewscreen_setupadventurest) ; a.subscreen = 3 ; gui = require 'gui' ; gui.simulateInput(a, 'A_RANDOM_NAME') ; gui.simulateInput(a, 'A_CUST_NAME')
function getNewName()
 local n = dfhack.gui.getCurViewscreen()
  if df.viewscreen_layer_choose_language_namest:is_instance(n) then
      local newn = n.name
      end
  return newn
end

if dfhack.gui.getCurViewscreen().parent == df.viewscreen_itemst then
 local trg = dfhack.gui.getCurViewscreen().parent.item.general_refs[0].artifact_id
 local fact = df.artifact_record.find(trg)
 local oldn = fact.name
elseif dfhack.gui.getCurViewscreen().parent == df.viewscreen_dungeon_monsterstatusst then
 local trg = dfhack.gui.getCurViewscreen().parent.unit
 local oldn = trg.name
return oldn
end
newn = oldn

Argh, so I was looking at the classes stuff and I think I got the general idea enough that this will load without errors but it still isn't getting the right targets post init.
Code: (nametest.lua) [Select]
name_change = defclass(name_change, choices)
choices = df.new(df.viewscreen_setupadventurest) ; choices.subscreen = 3 ; gui = require 'gui' ; gui.simulateInput(choices, 'A_RANDOM_NAME') ; gui.simulateInput(choices, 'A_CUST_NAME')


function name_change:init()
 local n = dfhack.gui.getCurViewscreen()
end

function name_change:postinit()
  if df.viewscreen_layer_choose_language_namest:is_instance(n) then
      local newn = n.name
    end
  return newn
end

if dfhack.gui.getCurViewscreen().parent == df.viewscreen_itemst then
 local trg = dfhack.gui.getCurViewscreen().parent.item.general_refs[0].artifact_id
 local fact = df.artifact_record.find(trg)
 local oldn = fact.name
elseif dfhack.gui.getCurViewscreen().parent == df.viewscreen_dungeon_monsterstatusst then
 local trg = dfhack.gui.getCurViewscreen().parent.unit
 local oldn = trg.name
return oldn
end

function name_change:onInput(keys)
 if keys.SELECT then
  newn = oldn
 elseif keys.LEAVESCREEN then
  if newn ~= oldn then
     newn = oldn
     self:dismiss()
     choices:dismiss()
    end 
  end
end
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 02, 2015, 04:14:38 am
Code: [Select]
FamilyNode=defclass(FamilyNode)

FamilyNode.ATTRS {
    histfig_id = DEFAULT_NIL,
    mother = DEFAULT_NIL,
    father = DEFAULT_NIL,
    spouse = DEFAULT_NIL,
    children = {}
}

function FamilyNode:clean()
    local remove_table={}
    for k,v in pairs(self.children) do
        if v.mother~=self and v.father~=self then
            remove_table[k]=true
        end
    end
    for k,v in pairs(remove_table) do
        self.children[k]=nil
    end
    self.children_nodes=nil
end

function FamilyNode:getChildrenNum()
    local size=0
    for k,v in pairs(self.children) do
        size=size+1
    end
    return size
end

function FamilyNode:isVoid()
    return (not self.mother and not self.father and self:getChildrenNum()==0)
end

FamilyTree=defclass(FamilyTree)

FamilyTree.ATTRS {
    histfig_lookup={}
}

function FamilyTree:insertNode(node)
    if self:histfigLookup(node.histfig_id) then
        return self:histfigLookup(node.histfig_id)
    else
        self.histfig_lookup[node.histfig_id]=node
        return node
    end
end

function FamilyTree:mergeFamily(other_tree)
    for k,v in pairs(other_tree.histfig_lookup) do
        self.histfig_lookup[k]=self.histfig_lookup[k] or v
    end
    other_tree=self
end

function FamilyTree:histfigLookup(histfig_id)
    self.histfig_lookup=self.histfig_lookup or {}
    return self.histfig_lookup[histfig_id]
end

function FamilyTree:getSize()
    local size=0
    for k,v in pairs(self.histfig_lookup) do
        size=size+1
    end
    return size
end

function FamilyTree:clean()
    for k,v in pairs(self.histfig_lookup) do
        v:clean()
        if v.mother and not self:histfigLookup(v.mother.histfig_id) then
            self:insertNode(v.mother)
        end
        if v.father and not self:histfigLookup(v.father.histfig_id) then
            self:insertNode(v.father)
        end
        for _,child in pairs(v.children) do
            if not self:histfigLookup(child.histfig_id) then
                self:insertNode(child)
            end
        end
        if v:isVoid() then
            self.histfig_lookup[k]=nil
        end
    end
end

function FamilyTree:giveFamilyName()
    local father,mother=self:findProgenitor()
    local father_fig,mother_fig=df.historical_figure.find(father.histfig_id),df.historical_figure.find(mother.histfig_id)
    local name_words={father_fig.name.words[0],mother_fig.name.words[1]}
    local name_parts_of_speech={father_fig.name.parts_of_speech[0],mother_fig.name.parts_of_speech[1]}
    for k,v in pairs(self.histfig_lookup) do
        local fig=df.historical_figure.find(v.histfig_id)
        fig.name.words[1]=name_words[2]
        fig.name.parts_of_speech[1]=name_parts_of_speech[2]
    end
end

function FamilyTree:findProgenitor()
    local father,mother
    for k,v in pairs(self.histfig_lookup) do --actually just returns after first one, heh
        father=v.father or v
        mother=v.mother or v
        while father.father do
            father=father.father or father
        end
        while mother.mother do
            mother=mother.mother or mother
        end
        return father,mother
    end
end

function getLeadingZeroes(num,numDigits)
    local zeroes=numDigits-math.floor(math.log(num)/math.log(10))-1
    local str=''
    for i=1,zeroes do
        str=str..'0'
    end
    return str..num
end

function getMonthDate(num)
    return num~=-1 and getLeadingZeroes(math.ceil(num/33600),2)..getLeadingZeroes(math.ceil((num%33600)/1200),2) or '0000'
end

function FamilyTree:exportToFamilyScript()
    local file=""
    local counter=1
    for k,v in pairs(self.histfig_lookup) do
        print('Exporting member #'..counter..'/'..self:getSize()..', hist fig number #'..k)
        local fig=df.historical_figure.find(v.histfig_id)
        file=file..'i'..v.histfig_id..' g'..(fig.sex==0 and 'f' or 'm')
        file=file..' p'..dfhack.TranslateName(fig.name)
        file=file..' b'..getLeadingZeroes(fig.born_year,4)..getMonthDate(fig.born_seconds)
        if fig.died_year~=-1 then
            file=file..' z1 d'..getLeadingZeroes(fig.died_year,4)..getMonthDate(fig.died_seconds)
        end
        if v.mother then
            file=file..' m'..v.mother.histfig_id
        end
        if v.father then
            file=file..' f'..v.father.histfig_id
        end
        if v.spouse then
            file=file..' s'..v.spouse.histfig_id
        end
        file=file..NEWLINE
        counter=counter+1
    end
    local f=assert(io.open('family_'..self:findProgenitor().histfig_id..'.family',"w"))
    f:write(file)
    f:close()
end

Families=defclass(Families)

Families.ATTRS {
    families={}
}

function Families:getFamilyFromHistFig(histfig_id)
    self.families=self.families or {}
    self.families_histfig_lookup = self.families_histfig_lookup or {}
    local family=self.families_histfig_lookup[histfig_id]
    if family then return family:histfigLookup(histfig_id),family end
    return nil
end

function Families:insertNode(node,family)
    local existingFamily=self:getFamilyFromHistFig(node.histfig_id)
    if existingFamily then
        return existingFamily:histfigLookup(node.histfig_id)
    else
        local newFamily=family or FamilyTree{}
        if not family then
            newFamily.histfig_lookup={}
            newFamily:insertNode(node)
            self.families_histfig_lookup[node.histfig_id]=newFamily
            table.insert(self.families,newFamily)
        else
            newFamily:insertNode(node)
            self.families_histfig_lookup[node.histfig_id]=newFamily
        end
        return node,newFamily
    end
end

function Families:getFamily(hist_fig_id,family,children_only,parent)
    local hist_fig=df.historical_figure.find(hist_fig_id)
    local oldNode,oldfamily=self:getFamilyFromHistFig(hist_fig_id)
    if oldNode then
        if parent and (not oldNode.mother or not oldNode.father) then
            for _,fig_link in pairs(hist_fig.histfig_links) do
                if fig_link.target_hf==parent.histfig_id then
                    if fig_link._type==df.histfig_hf_link_motherst then
                        oldNode.mother=parent
                    elseif fig_link._type==df.histfig_hf_link_fatherst then
                        oldNode.father=parent
                    end
                end
            end
            family:insertNode(parent)
        end
        return oldNode,oldfamily
    end
    local node,family=self:insertNode(FamilyNode{histfig_id=hist_fig_id},family)
    node.children={}
    if children_only and parent then
        local parent_fig=df.historical_figure.find(parent.histfig_id)
        if parent_fig.sex==0 then
            node.mother=parent
        else
            node.father=parent
        end
        family:insertNode(parent)
    end
    for _,fig_link in pairs(hist_fig.histfig_links) do
        if fig_link._type==df.histfig_hf_link_motherst and not children_only then
            node.mother=self:getFamily(fig_link.target_hf,family,children_only)
        elseif fig_link._type==df.histfig_hf_link_fatherst and not children_only then
            node.father=self:getFamily(fig_link.target_hf,family,children_only)
        elseif fig_link._type==df.histfig_hf_link_childst then
            local childNode=self:getFamily(fig_link.target_hf,family,children_only,node)
            node.children[childNode.histfig_id]=childNode
        elseif fig_link._type==df.histfig_hf_link_spousest then
            node.spouse=self:getFamily(fig_link.target_hf,family,children_only)
        end
    end
    return node
end

function Families:clean()
    local prevAmount=1
    for i=#self.families,1,-1 do
        local size=self.families[i]:getSize()
        if size<2 then table.remove(self.families,i) end
        prevAmount=size
    end
    for k,v in pairs(self.families) do
        v:clean()
    end
end

function Families:sort()
    table.sort(self.families,function(a,b) return a:getSize()>b:getSize() end)
end

function Families:getAllHistFigs(children_only)
    print('Gathering all historical figures...')
    for k,v in pairs(df.global.world.history.figures) do
        if k%100==0 then print('At figure #'..k..'/'..#df.global.world.history.figures) end
        self:getFamily(v.id,nil,children_only)
    end
    self:clean()
    self:clean() --two passes actually does something, weirdly enough
    self:sort()
end

local utils=require('utils')

validArgs = validArgs or utils.invert({
 'all',
 'this',
 'help',
 'heritage',
 'export'
})

local args = utils.processArgs({...}, validArgs)

if args.export then
    if args.all then
        local dlg=require('gui.dialogs')
        dlg.showYesNoPrompt('Family lineage','Really export all families? (May take very long time and may cause game to hang!)',COLOR_WHITE,function()
            local families=Families()
            families:getAllHistFigs()
            for k,v in ipairs(families.families) do
                print('Exporting family of ' .. dfhack.TranslateName(df.historical_figure.find(v:findProgenitor().histfig_id).name) .. '...')
                v:exportToFamilyScript()
            end
        end
        )
    end

    if args.this then
        local families=Families()
        families:getFamily(dfhack.gui.getSelectedUnit().hist_figure_id)
        families:clean()
        families:clean()
        for k,v in ipairs(families.families) do
            print('Exporting family of ' .. dfhack.TranslateName(df.historical_figure.find(v:findProgenitor().histfig_id).name) .. '...')
            v:exportToFamilyScript()
        end
    end
end
if args.heritage then
    if args.all then
        local families=Families()
        families:getAllHistFigs(true)
        families:clean()
        for k,v in ipairs(families.families) do
            local progenitor1,progenitor2=v:findProgenitor()
            print('Naming family of ' .. dfhack.TranslateName(df.historical_figure.find(progenitor1.histfig_id).name) .. ' and ' .. dfhack.TranslateName(df.historical_figure.find(progenitor2.histfig_id).name)..'...')
            v:giveFamilyName()
        end
    end
    if args.this then
        local families=Families()
        families:getFamily(dfhack.gui.getSelectedUnit().hist_figure_id)
        families:clean()
        families:clean()
        for k,v in ipairs(families.families) do
            local progenitor1,progenitor2=v:findProgenitor()
            print('Naming family of ' .. dfhack.TranslateName(df.historical_figure.find(progenitor1.histfig_id).name) .. ' and ' .. dfhack.TranslateName(df.historical_figure.find(progenitor2.histfig_id).name)..'...')
            v:giveFamilyName()
        end
    end
end

if args.help then
 print([[scripts/family.lua
arguments
    -help
        print this help message
    -export
        exports specified families to FamilyScript file
    -heritage
        gives family name to specified families
    -all
        specifies all the world's families (may crash game)
    -this
        specifies selected unit's family
]])
 return
end

Here's a script that exports a FamilyScript file from either a given unit's genealogy or every genealogy in the world. Arguments are there so it can also be used as a script_environment library (for heritage 2.0 or somesuch)

Example of parsed output (on http://www.familyecho.com/):

(https://imgur.com/xVKVmCj.png)

EDIT: fixed to make significantly less sexist/homophobic/speciesist (I.E i'm not assuming that mother is female and father is male; other situations are technically possible)

EDIT 2: Old insertion algorithm was O(n), since it required iterating through all existing families, making process of scraping all hist figs O(n^2). Now insertion is O(1), at least given that Lua table access is O(1) (which is true, AFAIK), which makes scraping process significantly faster (hilariously so).

EDIT 3: Added -heritage, reorganized args
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 02, 2015, 06:35:34 am
Well that's pretty damn cool.

Code: [Select]
if args.help then
 print([[scripts/modtools/syndrome-trigger.lua
arguments
at the end should be familynode or whatever shouldn't it?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 02, 2015, 01:10:35 pm
aha yeah it should be

i've been calling it "family.lua" and I guess that's appropriate considering that it's primarily a library
Title: Re: DFHack 0.40.24-r3
Post by: falcn on June 02, 2015, 01:44:49 pm
I have a feature request.
Could you please make digv and digexp support priority?

Currently they have no priority, overriding all manual mining designations.
Title: Re: DFHack 0.40.24-r3
Post by: Eldin00 on June 02, 2015, 02:09:40 pm
I think digv is mostly obsolete with the automining features added at the same time as the priorities (there's still a use case for digv x). But I second that adding a priority to digl and digexp would be useful.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 02, 2015, 02:35:58 pm
https://github.com/DFHack/dfhack/issues/481
It's a known issue that's been around since the job priority changes, but fixing it would require some changes to DFHack's map caching system that nobody's done yet.
Title: Re: DFHack 0.40.24-r3
Post by: fbo on June 03, 2015, 04:00:57 am
Something completely different: Is there a way to read out how many wood/craft/gem/... jobs have been done already (aka when will the fortress become a metropolis)?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 03, 2015, 04:57:38 am
df.global.job_next_id?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 03, 2015, 05:09:40 am
no
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 03, 2015, 05:22:46 am
Oh yeah that one will include cleaning and stuff huh.
Title: Re: DFHack 0.40.24-r3
Post by: Quietust on June 03, 2015, 06:42:56 am
Something completely different: Is there a way to read out how many wood/craft/gem/... jobs have been done already (aka when will the fortress become a metropolis)?
There is a way, but it's very much non-trivial - all of the information is present in [df.global.]ui.tasks.recent_jobs, but you'll need to parse that information out on your own. Exact details on how the game itself does this are not available at the moment, but I can locate it (later) without too much difficulty.
Title: Re: DFHack 0.40.24-r3
Post by: Antsan on June 04, 2015, 07:14:26 am
I think digv is mostly obsolete with the automining features added at the same time as the priorities (there's still a use case for digv x). But I second that adding a priority to digl and digexp would be useful.
digv is superior to automining in one respect: It let's me check whether the command would dig into any tiles I want to keep and then unmark those. It's not nice when my dwarves punch holes into the dining halls.
I already asked this once (and I don't remember why it was denied): It would be very useful if the commands for digging had an option to ignore anything smoothed.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 04, 2015, 07:52:13 am
Are you referring to DF designations or DFHack commands? Suggestions regarding both of these typically aren't "denied", but they do tend to get buried - it world be best to make suggestions for DFHack features in the DFHack issue tracker.
Title: Re: DFHack 0.40.24-r3
Post by: Antsan on June 04, 2015, 09:32:39 am
I'm referring to the DFHack commands. I'll write a ticket.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 04, 2015, 12:28:14 pm
I already asked this once (and I don't remember why it was denied): It would be very useful if the commands for digging had an option to ignore anything smoothed.

That's doable. A ticket is a good way to make sure it doesn't get forgotten.
Title: Re: DFHack 0.40.24-r3
Post by: Antsan on June 05, 2015, 10:18:25 am
It's now in the issue tracker. I hope what I wrote is sufficient.
Title: Re: DFHack 0.40.24-r3
Post by: Bien on June 05, 2015, 03:26:04 pm
Would it be possible to create a flag in Autolabor to set a certain type of labor as 'dedicated'? Like say, set "autolabor HAUL_STONE 2 4 d", where D disables all other labors in the dwarves it selects, leaving them as only stone haulers?

A generalized "HAUL" labor would also be useful, and would act as a macro that sets all of the Hauling labors to the set values.

I'd make this but sadly I have zero programming skill.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 06, 2015, 06:22:47 am
Ok then, I'm tired as hell but with a little more work this will be functioning properly, my brain just funked out on how to make it select the right function for the target type.
Code: (names.lua) [Select]
function factname()
 --if dfhack.gui.getCurViewscreen().parent == df.viewscreen_itemst then
  newn = dfhack.gui.getCurViewscreen().name
fact = dfhack.gui.getCurViewscreen().parent.item.general_refs[0].artifact_id
trg = df.artifact_record.find(fact)
local oldn = trg.name

oldn.first_name = newn.first_name
oldn.words[0] = newn.words[0]
oldn.words[1] = newn.words[1]
oldn.words[2] = newn.words[2]
oldn.words[3] = newn.words[3]
oldn.words[4] = newn.words[4]
oldn.words[5] = newn.words[5]
oldn.words[6] = newn.words[6]
oldn.parts_of_speech[0] = newn.parts_of_speech[0]
oldn.parts_of_speech[1] = newn.parts_of_speech[1]
oldn.parts_of_speech[2] = newn.parts_of_speech[2]
oldn.parts_of_speech[3] = newn.parts_of_speech[3]
oldn.parts_of_speech[4] = newn.parts_of_speech[4]
oldn.parts_of_speech[5] = newn.parts_of_speech[5]
oldn.parts_of_speech[6] = newn.parts_of_speech[6]
oldn.language = newn.language
oldn.has_name = newn.has_name
end

function unitname()
 --if dfhack.gui.getCurViewscreen().parent == df.viewscreen_dungeon_monsterstatusst then
  newn = dfhack.gui.getCurViewscreen().name
oldn = dfhack.gui.getCurViewscree().parent.unit.name
 
  oldn.first_name = newn.first_name
  oldn.words[0] = newn.words[0]
  oldn.words[1] = newn.words[1]
  oldn.words[2] = newn.words[2]
  oldn.words[3] = newn.words[3]
  oldn.words[4] = newn.words[4]
  oldn.words[5] = newn.words[5]
  oldn.words[6] = newn.words[6]
  oldn.parts_of_speech[0] = newn.parts_of_speech[0]
  oldn.parts_of_speech[1] = newn.parts_of_speech[1]
  oldn.parts_of_speech[2] = newn.parts_of_speech[2]
  oldn.parts_of_speech[3] = newn.parts_of_speech[3]
  oldn.parts_of_speech[4] = newn.parts_of_speech[4]
  oldn.parts_of_speech[5] = newn.parts_of_speech[5]
  oldn.parts_of_speech[6] = newn.parts_of_speech[6]
  oldn.language = newn.language
  oldn.has_name = newn.has_name
end

if df.viewscreen_layer_choose_language_namest:is_instance(dfhack.gui.getCurViewscreen()) then
 factname()
 elseif not df.viewscreen_layer_choose_language_namest:is_instance(dfhack.gui.getCurViewscreen()) then
 choices = df.new(df.viewscreen_setupadventurest) ; choices.subscreen = 3 ; gui = require 'gui' ; gui.simulateInput(choices, 'A_RANDOM_NAME') ; gui.simulateInput(choices, 'A_CUST_NAME')
end
At the moment it's set to artifacts as you can see, I intend to have it grab a string sent to it for the first name, and I gotta figure out how to make it apply the change before you exit properly but right now you just run it once and it pulls up the choices, then you run it again and it commits the change.

Again, mostly just a proof of concept but hey, it works and I'll figure out what all is wrong and a better way to do it when I get up. Like, I know there is a "for k,v in ipairs(oldn) do" method to get around typing out the words[0] through [6] stuff but it was annoying me so I just threw it in manually to make sure it worked so I could try to get the targeting stuff in.

Oh, I'm not sure if it would be cleaner to have a second script that just pulls up the choices screen and then run that from dfhack.script_environment(choices) or whatnot, from what I gather it should properly dismiss the extra screen, if there is a way to have it effectively do that inside the one script awesome, but yeah, functioning name changing with the translated names/random generator access, though only first+lastname atm, dunno how to make it choose longer... gotta experiment with pulling up the fortress name generator screen perhaps.
Title: Re: DFHack 0.40.24-r3
Post by: captinjoehenry on June 07, 2015, 12:14:37 pm
So to start off what are the DFhack commands to get a full set of armor (chainmail shirt, breastplate, greaves, high boots, helm, gauntlets and shield).  I ask because I cannot figure out how what to start the creatitem command.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 07, 2015, 12:32:21 pm
Does http://dwarffortresswiki.org/index.php/Utility:DFHack/createitem help?
Title: Re: DFHack 0.40.24-r3
Post by: captinjoehenry on June 07, 2015, 12:45:48 pm
Does http://dwarffortresswiki.org/index.php/Utility:DFHack/createitem help?

No it only shows how to make gauntlets and I cannot figure out the first part of the creatitem command so I have tried ARMOR:???  TORSO:??? UPPER_BODY:?? And a couple other for the breastplate and none of them have worked.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on June 07, 2015, 12:50:48 pm
Use gui/hack-wish, it's easier
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on June 07, 2015, 12:52:55 pm
Armor is the right item token. Are you getting the actual item's name right? Like ARMOR:ITEM_ARMOR_BREASTPLATE BRONZE ?
Title: Re: DFHack 0.40.24-r3
Post by: captinjoehenry on June 07, 2015, 12:56:32 pm
Use gui/hack-wish, it's easier

Can you post a link to this?

@scamtank
Do for all of the armor like chain shirts, high boots and grieves I would use ARMOR right?
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 07, 2015, 01:23:28 pm
https://github.com/DFHack/dfhack/blob/master/scripts/gui/hack-wish.lua
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on June 07, 2015, 01:24:38 pm
No. You'd use the right item token, like HELM, SHOES and PANTS.
Title: Re: DFHack 0.40.24-r3
Post by: captinjoehenry on June 07, 2015, 01:32:51 pm
No. You'd use the right item token, like HELM, SHOES and PANTS.

Ok so I would use PANTS for greaves, HELM for the helm, SHOES for the high boots, ARMOR for the chainmail and breastplate and sheilds, GLOVE for the gauntlet right?
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on June 07, 2015, 01:45:00 pm
Well, there's still SHIELD. But that's the gist of it, yeah. Look up "Item tokens" on the wiki to see why.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 07, 2015, 02:01:43 pm
Use gui/hack-wish, it's easier

Can you post a link to this?

It's part of DFHack.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 07, 2015, 03:16:10 pm
Well, there's still SHIELD. But that's the gist of it, yeah. Look up "Item tokens" on the wiki to see why.
I'd like to point out that this is mentioned on the createitem page on the wiki.

+1 for gui/hack-wish, though - you only need to run "gui/hack-wish" with a unit selected (or it might be bound to a key as well).
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 07, 2015, 07:29:52 pm
I really should have named it something better.

...Actually, not too late, is it? gui/create-item to parallel gui/liquids might be nice.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 07, 2015, 10:47:12 pm
Isn't there already a gui/create-item or was that in one of the other repositories I sifted through while figuring out how to artifake stuff?
Title: Re: DFHack 0.40.24-r3
Post by: Bien on June 08, 2015, 12:58:10 am
Another suggestion:
A build up of the current DF hack Construction menu addon to support the construction of 'polygonal' walls and fortifications, as well as roads.

A player would select points and DFHack automatically creates construction orders to connect them.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 08, 2015, 03:49:51 pm
Is there a way to run a script anytime a unit enters the map? (Any unit, via birth, invasion, wandering, migrants, etc...) I know I could run through all the units every so often, but was hoping for something less intensive.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 08, 2015, 04:26:47 pm
Yeah, I made that a while ago. The gain in performance isn't nearly worth the unreliability. Running through all the units every so often works fine.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 08, 2015, 05:22:44 pm
Ah right, I do seem to recall you posting something about it a while back. Good to know that the performance gain isn't really that great. How often do you think I should check units?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 08, 2015, 05:28:19 pm
It would be a lot faster to check on the C++ side, actually (maybe with eventful?).

Another suggestion:
A build up of the current DF hack Construction menu addon to support the construction of 'polygonal' walls and fortifications, as well as roads.

A player would select points and DFHack automatically creates construction orders to connect them.
Roads would be slightly trickier if you want to use materials effectively, since they'd have to be built to cover groups of tiles, but it shouldn't be too hard to do with constructions (although it could be difficult to use DF's material-selection interface).
Title: Re: DFHack 0.40.24-r3
Post by: Bien on June 08, 2015, 08:07:32 pm
It would be a lot faster to check on the C++ side, actually (maybe with eventful?).

Another suggestion:
A build up of the current DF hack Construction menu addon to support the construction of 'polygonal' walls and fortifications, as well as roads.

A player would select points and DFHack automatically creates construction orders to connect them.
Roads would be slightly trickier if you want to use materials effectively, since they'd have to be built to cover groups of tiles, but it shouldn't be too hard to do with constructions (although it could be difficult to use DF's material-selection interface).

Roads could perhaps be split into sections, then like:

[ooooooooooo]
                  [oooo]
                        [oooo]
                              [oooooooooooooooo]
Where:


After selecting the points, the DFhack would lay down roads of the selected width to connect the points, then ask the player to select the materials for the first section, then the second, then the third. It would essentially act as a macro for {b}-{o}/{O} and I assume would be a bit more complicated code-wise.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 08, 2015, 10:57:10 pm
OH CRAP I DIDN'T MAKE THIS PUBLIC

Code: [Select]
Button=defclass(Button,widgets.Widget)

Button.ATTRS={
    on_click = DEFAULT_NIL,
    graphic = DEFAULT_NIL, --refers to the name of a tilepage
    label = DEFAULT_NIL
}

function Button:preUpdateLayout()
    self.frame=self.frame or {}
    self.frame.w=self.page.page_dim_x
    self.frame.h=self.page.page_dim_y
end

function Button:onRenderBody(dc)
    for k,v in ipairs(self.page.texpos) do
        dc:seek(k%self.frame.w,math.floor(k/self.frame.w)):tile(32,v)
    end
end

function Button:onInput(keys)
    if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then
        self.on_click()
    end
end

function Button:init(args)
    for k,v in ipairs(df.global.texture.page) do
        if v.token==self.graphic then self.page=v break end
    end
end

This is a button that uses an arbitrary graphics image as its display (with GRAPHICS:ON, otherwise will display ☺) that does some arbitrary thing when clicked. Example:
Code: [Select]
        Button{
            graphic='MINE',
            frame={t=0,l=0},
            on_click=function()
                self:sendInputToParent('D_DESIGNATE')
                self:sendInputToParent('DESIGNATE_DIG')
            end,
            label='Mining',
            view_id='mining_button'
        }

graphic='MINE' refers to [TILE_PAGE:MINE] in raw/graphics; it will load this tile page if possible (at least one creature must use part of this tile page for the tile page to load; I use GRIFFON or one of the other fanciful creatures). How large the button will be depends on PAGE_DIM (4:4 will make a 4x4 button). TILE_DIM and PAGE_DIM rules are same as creature graphics.

frame, view_id are as in normal widgets.

label is a thing that I added so that a highlighted button can have text describing what it is, such as in the renderSubviews(dc) method of my specialized button screen:

Code: [Select]
        local highlighted=false
        for _,child in ipairs(self.subviews) do
            if child:getMousePos() then self.subviews.highlight_label:setText(child.label) highlighted=true end
            if child.visible then
                child:render(dc)
            end
        end
        if not highlighted then self.subviews.highlight_label:setText('Highlight a button!') end
    end

Where highlight_label is a widgets.Label.

on_click is the function that fires when the button is clicked. Here, it opens the designations menu with the "mine" designation (assuming this button is on the main dwarf mode screen, which I recommend not doing for issues with OPTIONS and autosaves)
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 09, 2015, 11:25:38 pm
Questions regarding add-syndrome and syndromes in general

1. I'm not sure add-syndrome is working correctly. Using the below syndrome, I don't see any affect. The syndrome is added, but nothing else happens. No bleeding, no necrosis, no blisters. Am I doing something wrong? Or am I misunderstanding what add-syndrome is for?
Code: [Select]
[SYNDROME]
        [SYN_NAME:bad]
        [CE_NECROSIS:SEV:5000:PROB:100:START:1:END:300]
        [CE_BLISTERS:SEV:5000:PROB:100:START:1:END:300]
        [CE_BLEEDING:SEV:5000:PROB:100:START:1:END:300]

2. Do we understand what happens when a syndrome is added to a unit through an interaction? What I mean is, is it possible to do all of the syndrome stuff, without the actual syndrome. For example, with the above syndrome, what if I just wanted to add the necrosis and such without a syndrome? I assume lowering the blood count of the creature is what bleeding does?

The reason I ask is because I think it would be very fun to have an interaction whose outcome is dependent on the users WILLPOWER or something. This can already be done with my wrapper script, but if I want varying degrees of severity I would need to create many different versions of the syndrome, and then do a check, if WILLPOWER > 500 do this, if WILLPOWER > 1000 do this. Whereas, if we could apply the affects outside of a syndrome, I could change those numbers directly.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 10, 2015, 12:05:05 am
Sounds like something from sparking would help since the powerlevel checks are based on willpower among other things.

*lights the putnam signal, it begins screaming, I put it back out again and wonder if that's normal*
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 10, 2015, 12:57:00 am
2. Yes. A "unit syndrome" is added to the unit at that point. Said "unit syndrome" has a number that links to a syndrome ID, which is a proper raws syndrome. You cannot add creature effects without a syndrome due to the nature of syndromes. Bleeding actually creates a proper wound AFAIK.

I got around the "do things based on attributes without many syndromes" thing by manually programming what I wanted it to do without syndromes.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 10, 2015, 01:03:06 am
It's entirely possible only transformation syndromes work with the current add-syndrome stuff.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 10, 2015, 12:42:44 pm
2. Yes. A "unit syndrome" is added to the unit at that point. Said "unit syndrome" has a number that links to a syndrome ID, which is a proper raws syndrome. You cannot add creature effects without a syndrome due to the nature of syndromes. Bleeding actually creates a proper wound AFAIK.

I got around the "do things based on attributes without many syndromes" thing by manually programming what I wanted it to do without syndromes.

Might I inquire how and what you manually programmed? Which of your mods would have examples? That sounds like the route I should try and take.

It's entirely possible only transformation syndromes work with the current add-syndrome stuff.

I know name changes work as well. But adding things like CE_* doesn't seem to have any affect. At least I haven't gotten it to work.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 10, 2015, 03:22:33 pm
Sparking has stuff like that in its init.d/sparking.lua file. It's put together in a fairly formulaic manner (since it's a lookup table of syndrome names I used to replace syndrome-trigger, which I found to be unreliable).
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 10, 2015, 04:58:08 pm
Oi, that's a lot of information to take in. Lots of stuff that looks very useful to me, but alas, still not quite what I was looking for. I think I will just need to look into making wounds on targets. I know I have been able to alter already existing wounds, doing things like adding pain and bleeding and such, also changing things like bruises to burns. Does anyone know if there has been any research done on adding wounds to perfectly healthy units? If not, that is where I am going to invest some time. Hopefully make a script that can do it.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 10, 2015, 05:02:44 pm
If you can figure that out, I'd be very thankful, heh (as comments in the code there suggest).

Adding wounds shouldn't be difficult, just sorta... tedious to figure out. May be crashy at first.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 10, 2015, 06:31:27 pm
Adding wounds doesn't seem like it will be the problem. Figuring out acceptable numbers on the other hand... I just added a wound to the upper body of a dwarf with a bleeding of 20. He lost almost half of his blood just from that wound.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 10, 2015, 08:32:14 pm
Hmmmm, I bet artifake could be translated to that since it's very similar actually.

Wounds have a reference to a part, the part state, the actual wound, wound flags, and syndromes resulting from the wound like pain/numbness/loss of limb/sight/breathing/layers. Then there is a final check for the status2 limb stand/grasp tables I think.

Someone did some research on this a while back but I forget if it was in here or another thread.

Hah, YOU did the research:
http://www.bay12forums.com/smf/index.php?topic=139553.msg6076700#msg6076700
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 10, 2015, 11:31:03 pm
Yes, I had done research previously about how to add wounds, so I have that mostly working. Now I am starting to research the numbers and their affect on the unit. Mayhaps I should also talk to Urist Da Vinci, I seem to remember him doing some research on wounds and how they accumulate.
Title: Re: DFHack 0.40.24-r3
Post by: captinjoehenry on June 11, 2015, 07:50:27 pm
how do i go about spawning a dragon heart or dragon bones with dfhack?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 11, 2015, 10:11:54 pm
You can't just spawn the body parts, if it was from wanderlust then the best you could do would be createitem PLANT BALM_MIGHT (assuming that's what you wanted heart for) and createitem SOME:ITEM_SOME_TOKEN DRAGON:BONE, like createitem WEAPON:ITEM_WEAPON_HAMMER_WAR DRAGON:BONE, and artifake uses the same sceme with the arguments added, artifake -item WEAPON:ITEM_WEAPON_HAMMER_WAR -material DRAGON:BONE -name "The Glorious Buttscratcher of Ham" would make an artifact dragon bone war hammer with that name... that reminds me I gotta incorporate the names script into there properly, been busy and tired so I haven't poked at it much yet.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 12, 2015, 01:42:39 am
Well, I've written a script to successfully add wounds to specified body parts and their layers. Now I just need to work on figuring out the numbers. So far it seems to be working just fine. Copying numbers from other wounds gives the exact same outcome. And you can even get messages like "His eyes are burnt". This is the code so far, but note that it doesn't have any of the number stuff in it. I am still doing that by hand until I figure out a convenient way to do it.

Code: [Select]
local utils = require 'utils'

function checkbodycategory(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.category == x and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodytoken(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.token == x and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodyflag(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.flags[x] and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodylayer(unit,parts,layers)
 local a = 1
 local array = {}
 for i,x in pairs(parts) do
  local part = unit.body.body_plan.body_parts[x]
  for j,y in pairs(layers) do
   for k,z in pairs(part.layers) do
    if z.layer_name == y or y == 'ALL' then
array[a] = {x,k,z.layer_id}
a = a+1
end
   end
  end
 end
 return array
end

function addwound(unit,array)
 local body = unit.body
 local wound = df.unit_wound:new()
 wound.id = body.wound_next_id
 body.wound_next_id = body.wound_next_id + 1
 for i,x in pairs(array) do
  part = df.unit_wound.T_parts:new()
  part.global_layer_idx = x[3]
  part.layer_idx = x[2]
  part.body_part_id = x[1]
  wound.parts:insert('#',part)
 end
 body.wounds:insert('#',wound)
end

validArgs = validArgs or utils.invert({
 'help',
 'category',
 'token',
 'flag',
 'all',
 'layer',
 'unit',
})
local args = utils.processArgs({...}, validArgs)

if args.help then -- Help declaration
 print([[wound-add.lua
  Assign a wound to a specific body part and layer of a unit
  arguments:
   -help
     print this help message
   -unit id
     REQUIRED
     id of the target unit
   -all                       \
     target all body parts    |
   -category TYPE             |
     examples:                |
      TENTACLE                |
      HOOF_REAR               |
      HEAD                    |
   -token TYPE                | Must have at least one of these
     examples:                |
      UB                      |
      LB                      |
      REYE                    |
   -flag FLAG                 |
     examples:                |
      SIGHT                   |
      LIMB                    |
      SMALL                   /
   -layer TYPE
     examples:
      SKIN
  FAT
  MUSCLE
  ALL
  examples:
   unit/wound-add -unit \\UNIT_ID -all -layer SKIN
   unit/wound-add -unit \\UNIT_ID -token UB -layer ALL
 ]])
 return
end

if args.unit and tonumber(args.unit) then -- Check for unit declaration !REQUIRED
 unit = df.unit.find(tonumber(args.unit))
else
 print('No unit selected')
 return
end

dur = tonumber(args.dur) or 0 -- Check if there is a duration (default 0)

parts = {}
recall = ''
tokens = args.all or args.category or args.token or args.flag
layers = args.layer or ''
if type(layers) == 'string' then layers = {layers} end
if type(tokens) == 'string' then tokens = {tokens} end
if args.all then -- Check for the all body parts flag. !!RUN EFFECT!!
 body = unit.body.body_plan.body_parts
 for k,v in ipairs(body) do
  parts[k] = k
 end
 recall = 'all'
elseif args.category then -- Check for category body parts. !!RUN CHECKBODYCATEGORY!!. !!RUN EFFECT!!
 parts = checkbodycategory(unit,tokens)
 recall = 'category'
elseif args.token then -- Check for token body parts. !!RUN CHECKBODYTOKEN!!. !!RUN EFFECT!!
 parts = checkbodytoken(unit,tokens)
 recall = 'token'
elseif args.flag then -- Check for flag body parts. !!RUN CHECKBODYFLAG!!. !!RUN EFFECT!!
 parts = checkbodyflag(unit,tokens)
 recall = 'flag'
end

array = checkbodylayer(unit,parts,layers)
if #array >= 1 then
 addwound(unit,array)
end
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 12, 2015, 03:13:21 am
Cool stuff.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 12, 2015, 03:21:15 am
...Does it just not doing anything with the wound, or am I misunderstanding something?
Title: Re: DFHack 0.40.24-r3
Post by: Libash_Thunderhead on June 12, 2015, 03:24:18 am
Does dfhack.burrows.findByName still work?
I tried "Burrow 1" and "burrow 1", but both of them returned nil.
[edit*]
Well, I rename the burrow and it worked...
Title: Re: DFHack 0.40.24-r3
Post by: Bien on June 12, 2015, 09:17:18 am
Some more script/plugin suggestions:
- A stack merger for Fort and Adventure mode
- An inventory organizer
- Some way to arrange attacks in adventure mode by ease/strength of hit
- A larger/alternate GUI for conversations
Title: Re: DFHack 0.40.24-r3
Post by: FukkenSaved on June 12, 2015, 12:56:16 pm
Would it be possible to create a flag in Autolabor to set a certain type of labor as 'dedicated'? Like say, set "autolabor HAUL_STONE 2 4 d", where D disables all other labors in the dwarves it selects, leaving them as only stone haulers?

A generalized "HAUL" labor would also be useful, and would act as a macro that sets all of the Hauling labors to the set values.

I'd make this but sadly I have zero programming skill.

I don't know why anyone would use autolabor anymore as it does not assign skills optimally and anyone who ever had diplomat responsibility has their labors auto-stripped, including former mayors and expedition leaders. If you have to use autolabor, then your only option there would be to assign them the stone hauling labor only in something like Therapist then put them in a burrow so autolabor will ignore their labor assignments.
But autohauler is designed so you get a lot more control. All you'd have to do then is set the dwarf's stone hauling labor as the only one active then set a labor with the forbid flag so hauling assignments are not changed, by default Alchemist is one. For either program though you'll have a problem with hauling jobs accumulating, so make sure that at least 5% of non-military are idlers.
Title: Re: DFHack 0.40.24-r3
Post by: FukkenSaved on June 12, 2015, 12:59:53 pm
I need to WinMerge what I've changed so far but the big thing is that it assigns hauling to sleeping dwarves and others that can't feasibly do anything so that it tricks DF into assigning more hauling jobs, expect a pull request soon
Title: Re: DFHack 0.40.24-r3
Post by: Rose on June 12, 2015, 01:02:54 pm
How often is DFHack updated? Like if I update a plugin, would it be more reasonable to provide a download of just the plugin, or hope that a new DFhack release comes out before the plugin is needed?
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 12, 2015, 01:11:41 pm
...Does it just not doing anything with the wound, or am I misunderstanding something?

Yeah, that version just adds the wound to the correct body part and layer depending on the inputs you give it. I was just using it as a proof of concept. The version I am playing with now has options for all of the various numbers (bleeding, pain, nausea, dizziness, paralysis, numbness, swelling, impaired, contact_area, surface_area, and strain) along with options for various flags, and if you want it to be a bruise/burn/frostbite/blister/necrosis. I will upload a full version with all the bells and whistles when I get everything working well. I still have a few more ideas to add to it, like the ability to add wounds that simulate getting a body part chopped off.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 12, 2015, 02:23:27 pm
Does dfhack.burrows.findByName still work?
I tried "Burrow 1" and "burrow 1", but both of them returned nil.
[edit*]
Well, I rename the burrow and it worked...
It's possible that burrows have empty names by default and the names DF generates (e.g. "Burrow 1") aren't easily available to DFHack, although I haven't checked.
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on June 12, 2015, 02:58:21 pm
How often is DFHack updated? Like if I update a plugin, would it be more reasonable to provide a download of just the plugin, or hope that a new DFhack release comes out before the plugin is needed?

I don't think that even the current version cares what the plugins themselves say anymore. (https://github.com/DFHack/dfhack/commit/0f77a1a578943ff131766d72d3d1607d3997ded9) Did I interpret that right?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 12, 2015, 03:28:13 pm
Nope - that change only affects compiling plugins. Essentially, instead of each plugin needing to be recompiled when the DFHack version is changed, a separate static library containing only the DFHack version is compiled and linked to (or embedded in, since it's a static library) the core DFHack library and all plugins.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 13, 2015, 12:57:30 am
How often is DFHack updated? Like if I update a plugin, would it be more reasonable to provide a download of just the plugin, or hope that a new DFhack release comes out before the plugin is needed?

It usually doesn't update all that often. It's been a while though so maybe we're due.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 13, 2015, 01:21:03 am
...Does it just not doing anything with the wound, or am I misunderstanding something?

Yeah, that version just adds the wound to the correct body part and layer depending on the inputs you give it. I was just using it as a proof of concept. The version I am playing with now has options for all of the various numbers (bleeding, pain, nausea, dizziness, paralysis, numbness, swelling, impaired, contact_area, surface_area, and strain) along with options for various flags, and if you want it to be a bruise/burn/frostbite/blister/necrosis. I will upload a full version with all the bells and whistles when I get everything working well. I still have a few more ideas to add to it, like the ability to add wounds that simulate getting a body part chopped off.
Oh god I just realized this is like the basis for making eye lasers of limbsplosion (via eventful trickery or something similar), targeted flesh searing, plus custom scarification, isn't it?
Title: Re: DFHack 0.40.24-r3
Post by: Rose on June 13, 2015, 01:36:59 am
In that case, I'll try to get as many changes to RemoteFortressReader as I can before then.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 13, 2015, 03:50:47 am
Oh god I just realized this is like the basis for making eye lasers of limbsplosion (via eventful trickery or something similar), targeted flesh searing, plus custom scarification, isn't it?

Sure. You could even do crazier things like a sword that transfers wounds from the wielder to the target as long as they're the same race.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 13, 2015, 06:40:13 am
Oh dear, that's kinda amazing.

In semi-amazing news, I've almost got names.lua fully working:
Spoiler: old ver (click to show/hide)
Still, you can target an artifact and names -item will give it the name shown on the selection screen when it first loads up (hmmm, I need to reverse that so it shows the current name there... ) and hitting it again after playing with the options will apply that name. Adding the -first flag lets you set a first name, names -unit lets you rename units as well.

I'm pretty sure things like renaming sites and forts and such will also be possible with appropriate flags, and later I'm going to damn well clean up the language_words[0] ~[6] crap, just easier to debug it when it is laid out like that.

Ok it's almost there, I gotta walk the dog and then I'm gonna work out what's happening.

Right now if you use "names -item -first Buttscratcher" and pass it those args it will load up the prompt and then rename the displayed first name in the selection screen, running names -item after that will then apply it correctly. :D
Code: (names.lua) [Select]
local dlg=require 'gui.dialogs'
local utils = require 'utils'

validArgs = validArgs or utils.invert({
 'help',
 'item',
 'unit',
 'first'
})

local args = utils.processArgs({...}, validArgs)

if args.help then
 print(
[[names.lua
arguments:
    -help
        print this help message
    -item
if currently targeting an item
    -unit
if currently targeting a unit
    -first
if a first name is desired
]])
 return
end

if not df.viewscreen_layer_choose_language_namest:is_instance(dfhack.gui.getCurViewscreen()) then
choices = df.new(df.viewscreen_setupadventurest) ; choices.subscreen = 3 ; gui = require 'gui' ; gui.simulateInput(choices, 'A_RANDOM_NAME') ; gui.simulateInput(choices, 'A_CUST_NAME')
end

if args.item then
fact = dfhack.gui.getCurViewscreen().parent.item.general_refs[0].artifact_id
trg = df.artifact_record.find(fact)
end

if args.unit then
trg = dfhack.gui.getCurViewscreen().parent.unit
end

if args.first then do
  trg.name.first_name = args.first
end

function newName()
  newn = dfhack.gui.getCurViewscreen().name
oldn = trg.name
  oldn.words[0] = newn.words[0]
  oldn.words[1] = newn.words[1]
  oldn.words[2] = newn.words[2]
  oldn.words[3] = newn.words[3]
  oldn.words[4] = newn.words[4]
  oldn.words[5] = newn.words[5]
  oldn.words[6] = newn.words[6]
  oldn.parts_of_speech[0] = newn.parts_of_speech[0]
  oldn.parts_of_speech[1] = newn.parts_of_speech[1]
  oldn.parts_of_speech[2] = newn.parts_of_speech[2]
  oldn.parts_of_speech[3] = newn.parts_of_speech[3]
  oldn.parts_of_speech[4] = newn.parts_of_speech[4]
  oldn.parts_of_speech[5] = newn.parts_of_speech[5]
  oldn.parts_of_speech[6] = newn.parts_of_speech[6]
  oldn.language = newn.language
  oldn.has_name = newn.has_name
 end
end
newName()

function firstName()
  newn.first_name = args.first
end

dlg.showInputPrompt(
  'Rename Target',
  'Enter a new name for the target:', COLOR_GREEN,
  newn.first_name,
  curry(firstName, first)
)
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 13, 2015, 07:22:22 pm
How would I make it do the curry(newName, args.etc) when you select a new entry from the name choosing screen? Isn't that where the function screen:oninput(keys) stuff goes or is there a slicker trick I haven't found?
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 13, 2015, 07:58:04 pm
So here is the script to add a wound. It has all the values, flags, and other options I could think of. It works fairly well but there is still a decent amount of work that should be done (and will be done when I have time) to fix certain weird things. For example, you can sever someones right upper arm but they will still have their right lower arm and right hand. These wounds also ignore any type of armor and such. The numbers are all directly what get put into the wound.

Code: [Select]
local utils = require 'utils'

function checkbodycategory(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.category == x and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodytoken(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.token == x and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodyflag(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.flags[x] and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodylayer(unit,parts,layers)
 local a = 1
 local array = {}
 for i,x in pairs(parts) do
  local part = unit.body.body_plan.body_parts[x]
  for j,y in pairs(layers) do
   for k,z in pairs(part.layers) do
    if z.layer_name == y or y == 'ALL' then
array[a] = {x,k,z.layer_id}
a = a+1
end
   end
  end
 end
 return array
end

function addwound(unit,array,numbers,effect,flags,attacker,args)
 local body = unit.body
 local wound = df.unit_wound:new()
 wound.id = body.wound_next_id
 body.wound_next_id = body.wound_next_id + 1
 if attacker and tonumber(attacker) then wound.attacker_unit_id = tonumber(attacker) end
 if args.severed then -- For applying wounds that remove body parts (doesn't produce severed body part)
  wound.flags.severed_part = true
  for i,x in pairs(array) do
   part = df.unit_wound.T_parts:new()
   part.global_layer_idx = x[3]
   part.layer_idx = x[2]
   part.body_part_id = x[1]
   for j,y in pairs(numbers) do
    if y and tonumber(y) then part[j] = tonumber(y) end
   end
   part.contact_area = 1
   part.surface_perc = 0
   part.strain = 0
   part.cur_penetration_perc = 0
   part.max_penetration_perc = 0 
   wound.parts:insert('#',part)
   body.components.body_part_status[x[1]].missing = true
   body.components.body_part_status[x[1]].muscle_damage = true
   body.components.body_part_status[x[1]].muscle_loss = true
   body.components.body_part_status[x[1]].bone_damage = true
   body.components.body_part_status[x[1]].bone_loss = true
   body.components.body_part_status[x[1]].skin_damage = true
   body.components.body_part_status[x[1]].severed_or_jammed = true
   body.components.layer_status[x[3]].gone = true
   body.components.layer_cut_fraction[x[3]] = 10000
   body.components.layer_dent_fraction[x[3]] = 10000
  end
 elseif args.mortal then -- For applying wounds that kill unit (not really useful, mortal wounds are all so different)
  wound.flags.mortal_wound = true
  body.blood_count = 0
 else -- For applying all other types of wounds
  for i,x in pairs(array) do
   part = df.unit_wound.T_parts:new()
   part.global_layer_idx = x[3]
   part.layer_idx = x[2]
   part.body_part_id = x[1]
   for j,y in pairs(numbers) do
    if y and tonumber(y) then part[j] = tonumber(y) end
   end
   if effect then
    part.effect_type:insert('#',tonumber(df.wound_effect_type[effect[1]]))
    part.effect_perc1:insert('#',tonumber(effect[2]))
    part.effect_perc2:insert('#',tonumber(effect[3]))
   end
   if args.surface_perc >= 100 then part.flags2.entire_surface = true end
   for j,y in pairs(flags) do
    part.flags1[y] = true
   end
   wound.parts:insert('#',part)
   if part.strain >= 50000 then
    body.components.layer_dent_fraction[x[3]] = body.components.layer_dent_fraction[x[3]] + part.aurface_perc*part.cur_penetration_perc
body.components.layer_cut_fraction[x[3]] = body.components.layer_cut_fraction[x[3]] + part.aurface_perc*part.cur_penetration_per
   elseif part.strain > 0 then
    body.components.layer_cut_fraction[x[3]] = body.components.layer_cut_fraction[x[3]] + part.aurface_perc*part.cur_penetration_perc
   elseif part.strain == 0 and effect then
    body.components.layer_effect_fraction[x[3]] = body.components.layer_effect_fraction[x[3]] + part.aurface_perc*part.effect_perc1[0]
   end
   if part.strain >= 50000 and part.cur_penetration_per >= 100 then
    body.components.layer_wound_area[x[3]] = body.components.layer_wound_area[x[3]] + part.contact_area
   end
   end
  end
  body.wounds:insert('#',wound)
 end
end

validArgs = validArgs or utils.invert({
 'help',
 'category',
 'token',
 'flag',
 'all',
 'layer',
 'unit',
 'bleeding',
 'pain',
 'nausea',
 'dizziness',
 'paralysis',
 'numbness',
 'swelling',
 'impaired',
 'strain',
 'contact_area',
 'surface_perc',
 'penetration',
 'effect',
 'attacker',
 'flags',
 'mortal',
 'severed',
 'infection',
})
local args = utils.processArgs({...}, validArgs)

if args.help then -- Help declaration
 print([[wound-add.lua
  Assign a wound to a specific body part and layer of a unit
  arguments:
   -help
     print this help message
   -unit id
     REQUIRED
     id of the target unit
   -attacker id
   -all                       \
     target all body parts    |
   -category TYPE             |
     examples:                |
      TENTACLE                |
      HOOF_REAR               |
      HEAD                    |
   -token TYPE                | Must have at least one of these
     examples:                |
      UB                      |
      LB                      |
      REYE                    |
   -flag FLAG                 |
     examples:                |
      SIGHT                   |
      LIMB                    |
      SMALL                   /
   -layer TYPE
     examples:
      SKIN
  FAT
  MUSCLE
  ALL
   -bleeding #
    set bleeding amount for all layers
   -pain #
    set pain amount for all layers
   -nausea #
    set nausea amount for all layers
   -dizziness #
    set dizziness amount for all layers
   -paralysis #
    set paralysis amount for all layers
   -numbness #
    set numbness amount for all layers
   -swelling #
    set swelling amount for all layers
   -impaired #
    set impaired amount for all layers
   -strain #
    set strain level for all layers
   -contact_area #
    set contact area of wound for all layers
   -surface_perc #
    set surface area affected percentage for all layers
   -penetration #
    set penetration depth percentage for all layers
   -effect [ type # # ]
    set what type of wound it is, numbers are percentages, unknown their exact affect
valid types
Bruise
Burn
Frostbite
Melting
Boiling
Freezing
Condensation
Necrosis
Blister
   -flags [ flags ]
    set which flags are toggled for the wound
valid flags
cut
smashed
scar_cut
scar_smashed
tendon_bruised
tendon_strained
tendon_torn
ligament_bruised
ligament_sprained
ligament_torn
motor_nerve_severed
sensory_nerve_severed
edged_damage
smashed_apart
major_artery
guts_spilled
edged_shake1
scar_edged_shake1
edged_shake2
broken
scar_broken
gouged
blunt_shake1
scar_blunt_shake1
blunt_shake2
joint_bend1
scar_joint_bend1
joint_bend2
compound_fracture
overlapping_fracture
artery
   -mortal
    sets the wound as a mortal wound (kills the unit by lack of blood)
   -severed
    sets the body part as severed and removes it (severed body part is not created)
  examples:
   unit/wound-add -unit \\UNIT_ID -all -layer SKIN -pain 20 -surface_perc 100 -effect [ Burn 100 100 ]
   unit/wound-add -unit \\UNIT_ID -token UB -layer ALL -bleeding 10 -penetration 100 -contact_area 25 -surface_perc 30 -flags [ cut edged_damage ]
 ]])
 return
end

if args.unit and tonumber(args.unit) then -- Check for unit declaration !REQUIRED
 unit = df.unit.find(tonumber(args.unit))
else
 print('No unit selected')
 return
end

dur = tonumber(args.dur) or 0 -- Check if there is a duration (default 0)

parts = {}
recall = ''
tokens = args.all or args.category or args.token or args.flag
layers = args.layer or ''
if type(layers) == 'string' then layers = {layers} end
if type(tokens) == 'string' then tokens = {tokens} end
if args.all then -- Check for the all body parts flag. !!RUN EFFECT!!
 body = unit.body.body_plan.body_parts
 for k,v in ipairs(body) do
  parts[k] = k
 end
 recall = 'all'
elseif args.category then -- Check for category body parts. !!RUN CHECKBODYCATEGORY!!. !!RUN EFFECT!!
 parts = checkbodycategory(unit,tokens)
 recall = 'category'
elseif args.token then -- Check for token body parts. !!RUN CHECKBODYTOKEN!!. !!RUN EFFECT!!
 parts = checkbodytoken(unit,tokens)
 recall = 'token'
elseif args.flag then -- Check for flag body parts. !!RUN CHECKBODYFLAG!!. !!RUN EFFECT!!
 parts = checkbodyflag(unit,tokens)
 recall = 'flag'
end

local numbers = {}
numbers.bleeding = args.bleeding
numbers.pain = args.pain
numbers.nausea = args.nausea
numbers.dizziness = args.dizziness
numbers.paralysis = args.paralysis
numbers.numbness = args.numbness
numbers.swelling = args.swelling
numbers.impaired = args.impaired
numbers.strain = args.strain
numbers.contact_area = args.contact_area
numbers.surface_perc = args.surface_perc
numbers.cur_penetration_perc = args.penetration
numbers.max_penetration_perc = args.penetration

if args.severed then layers = {'ALL'} end
parts_and_layers = checkbodylayer(unit,parts,layers)

if #parts_and_layers >= 1 then
 addwound(unit,parts_and_layers,numbers,args.effect,args.flags,args.attacker,args)
end

An option would be to create a higher level script and add Urist Da Vinci's work (http://www.bay12forums.com/smf/index.php?topic=142372.0 (http://www.bay12forums.com/smf/index.php?topic=142372.0)) into it and then call the above script to add wounds. You could then say something like
Code: [Select]
attack -defender id -attacker -id -target RUA -weapon EQUIPPEDAnd the correct numbers for the wound would get calculated and applied to the defender.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 13, 2015, 08:03:29 pm
Is there a way to make it check for the linked parts? Through the connects links or something?
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 13, 2015, 08:24:31 pm
Yeah, the check for connected body parts shouldn't be too hard. Just ran out of time today.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 13, 2015, 08:39:21 pm
Oh I feel ya, I got stuck on the names thing for a while until I bumped into the little prompt trick posted in the gladiator challenge thread.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 13, 2015, 08:42:34 pm
Very cool!
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 13, 2015, 09:04:45 pm
I actually did have a chance to fix the severed issue. This will now properly sever everything connected to a severed body part.

Code: [Select]
local utils = require 'utils'

function checkconnectedparts(unit,parts)
 for i,x in pairs(parts) do
  for j,y in pairs(unit.body.body_plan.body_parts) do
   if y.con_part_id == x then
    table.insert(parts,j)
   end
  end
 end
 return parts
end
function checkbodycategory(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.category == x and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodytoken(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.token == x and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodyflag(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.flags[x] and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodylayer(unit,parts,layers)
 local a = 1
 local array = {}
 for i,x in pairs(parts) do
  local part = unit.body.body_plan.body_parts[x]
  for j,y in pairs(layers) do
   for k,z in pairs(part.layers) do
    if z.layer_name == y or y == 'ALL' then
array[a] = {x,k,z.layer_id}
a = a+1
end
   end
  end
 end
 return array
end

function addwound(unit,array,numbers,effect,flags,attacker,args)
 local body = unit.body
 local wound = df.unit_wound:new()
 wound.id = body.wound_next_id
 body.wound_next_id = body.wound_next_id + 1
 if attacker and tonumber(attacker) then wound.attacker_unit_id = tonumber(attacker) end
 if args.severed then -- For applying wounds that remove body parts (doesn't produce severed body part)
  wound.flags.severed_part = true
  for i,x in pairs(array) do
   part = df.unit_wound.T_parts:new()
   part.global_layer_idx = x[3]
   part.layer_idx = x[2]
   part.body_part_id = x[1]
   for j,y in pairs(numbers) do
    if y and tonumber(y) then part[j] = tonumber(y) end
   end
   part.contact_area = 1
   part.surface_perc = 0
   part.strain = 0
   part.cur_penetration_perc = 0
   part.max_penetration_perc = 0 
   wound.parts:insert('#',part)
   body.components.body_part_status[x[1]].missing = true
   body.components.body_part_status[x[1]].muscle_damage = true
   body.components.body_part_status[x[1]].muscle_loss = true
   body.components.body_part_status[x[1]].bone_damage = true
   body.components.body_part_status[x[1]].bone_loss = true
   body.components.body_part_status[x[1]].skin_damage = true
   body.components.body_part_status[x[1]].severed_or_jammed = true
   body.components.layer_status[x[3]].gone = true
   body.components.layer_cut_fraction[x[3]] = 10000
   body.components.layer_dent_fraction[x[3]] = 10000
  end
 elseif args.mortal then -- For applying wounds that kill unit (not really useful, mortal wounds are all so different)
  wound.flags.mortal_wound = true
  body.blood_count = 0
 else -- For applying all other types of wounds
  for i,x in pairs(array) do
   part = df.unit_wound.T_parts:new()
   part.global_layer_idx = x[3]
   part.layer_idx = x[2]
   part.body_part_id = x[1]
   for j,y in pairs(numbers) do
    if y and tonumber(y) then part[j] = tonumber(y) end
   end
   if effect then
    part.effect_type:insert('#',tonumber(df.wound_effect_type[effect[1]]))
    part.effect_perc1:insert('#',tonumber(effect[2]))
    part.effect_perc2:insert('#',tonumber(effect[3]))
   end
   if args.surface_perc >= 100 then part.flags2.entire_surface = true end
   for j,y in pairs(flags) do
    part.flags1[y] = true
   end
   wound.parts:insert('#',part)
   if part.strain >= 50000 then
    body.components.layer_dent_fraction[x[3]] = body.components.layer_dent_fraction[x[3]] + part.aurface_perc*part.cur_penetration_perc
body.components.layer_cut_fraction[x[3]] = body.components.layer_cut_fraction[x[3]] + part.aurface_perc*part.cur_penetration_per
   elseif part.strain > 0 then
    body.components.layer_cut_fraction[x[3]] = body.components.layer_cut_fraction[x[3]] + part.aurface_perc*part.cur_penetration_perc
   elseif part.strain == 0 and effect then
    body.components.layer_effect_fraction[x[3]] = body.components.layer_effect_fraction[x[3]] + part.aurface_perc*part.effect_perc1[0]
   end
   if part.strain >= 50000 and part.cur_penetration_per >= 100 then
    body.components.layer_wound_area[x[3]] = body.components.layer_wound_area[x[3]] + part.contact_area
   end
  end
  body.wounds:insert('#',wound)
 end
end

validArgs = validArgs or utils.invert({
 'help',
 'category',
 'token',
 'flag',
 'all',
 'layer',
 'unit',
 'bleeding',
 'pain',
 'nausea',
 'dizziness',
 'paralysis',
 'numbness',
 'swelling',
 'impaired',
 'strain',
 'contact_area',
 'surface_perc',
 'penetration',
 'effect',
 'attacker',
 'flags',
 'mortal',
 'severed',
 'infection',
})
local args = utils.processArgs({...}, validArgs)

if args.help then -- Help declaration
 print([[wound-add.lua
  Assign a wound to a specific body part and layer of a unit
  arguments:
   -help
     print this help message
   -unit id
     REQUIRED
     id of the target unit
   -attacker id
   -all                       \
     target all body parts    |
   -category TYPE             |
     examples:                |
      TENTACLE                |
      HOOF_REAR               |
      HEAD                    |
   -token TYPE                | Must have at least one of these
     examples:                |
      UB                      |
      LB                      |
      REYE                    |
   -flag FLAG                 |
     examples:                |
      SIGHT                   |
      LIMB                    |
      SMALL                   /
   -layer TYPE
     examples:
      SKIN
  FAT
  MUSCLE
  ALL
   -bleeding #
    set bleeding amount for all layers
   -pain #
    set pain amount for all layers
   -nausea #
    set nausea amount for all layers
   -dizziness #
    set dizziness amount for all layers
   -paralysis #
    set paralysis amount for all layers
   -numbness #
    set numbness amount for all layers
   -swelling #
    set swelling amount for all layers
   -impaired #
    set impaired amount for all layers
   -strain #
    set strain level for all layers
   -contact_area #
    set contact area of wound for all layers
   -surface_perc #
    set surface area affected percentage for all layers
   -penetration #
    set penetration depth percentage for all layers
   -effect [ type # # ]
    set what type of wound it is, numbers are percentages, unknown their exact affect
valid types
Bruise
Burn
Frostbite
Melting
Boiling
Freezing
Condensation
Necrosis
Blister
   -flags [ flags ]
    set which flags are toggled for the wound
valid flags
cut
smashed
scar_cut
scar_smashed
tendon_bruised
tendon_strained
tendon_torn
ligament_bruised
ligament_sprained
ligament_torn
motor_nerve_severed
sensory_nerve_severed
edged_damage
smashed_apart
major_artery
guts_spilled
edged_shake1
scar_edged_shake1
edged_shake2
broken
scar_broken
gouged
blunt_shake1
scar_blunt_shake1
blunt_shake2
joint_bend1
scar_joint_bend1
joint_bend2
compound_fracture
overlapping_fracture
artery
   -mortal
    sets the wound as a mortal wound (kills the unit by lack of blood)
   -severed
    sets the body part as severed and removes it (severed body part is not created)
  examples:
   unit/wound-add -unit \\UNIT_ID -all -layer SKIN -pain 20 -surface_perc 100 -effect [ Burn 100 100 ]
   unit/wound-add -unit \\UNIT_ID -token UB -layer ALL -bleeding 10 -penetration 100 -contact_area 25 -surface_perc 30 -flags [ cut edged_damage ]
 ]])
 return
end

if args.unit and tonumber(args.unit) then -- Check for unit declaration !REQUIRED
 unit = df.unit.find(tonumber(args.unit))
else
 print('No unit selected')
 return
end

dur = tonumber(args.dur) or 0 -- Check if there is a duration (default 0)

parts = {}
recall = ''
tokens = args.all or args.category or args.token or args.flag
layers = args.layer or ''
if type(layers) == 'string' then layers = {layers} end
if type(tokens) == 'string' then tokens = {tokens} end
if args.all then -- Check for the all body parts flag. !!RUN EFFECT!!
 body = unit.body.body_plan.body_parts
 for k,v in ipairs(body) do
  parts[k] = k
 end
 recall = 'all'
elseif args.category then -- Check for category body parts. !!RUN CHECKBODYCATEGORY!!. !!RUN EFFECT!!
 parts = checkbodycategory(unit,tokens)
 recall = 'category'
elseif args.token then -- Check for token body parts. !!RUN CHECKBODYTOKEN!!. !!RUN EFFECT!!
 parts = checkbodytoken(unit,tokens)
 recall = 'token'
elseif args.flag then -- Check for flag body parts. !!RUN CHECKBODYFLAG!!. !!RUN EFFECT!!
 parts = checkbodyflag(unit,tokens)
 recall = 'flag'
end

local numbers = {}
numbers.bleeding = args.bleeding
numbers.pain = args.pain
numbers.nausea = args.nausea
numbers.dizziness = args.dizziness
numbers.paralysis = args.paralysis
numbers.numbness = args.numbness
numbers.swelling = args.swelling
numbers.impaired = args.impaired
numbers.strain = args.strain
numbers.contact_area = args.contact_area
numbers.surface_perc = args.surface_perc
numbers.cur_penetration_perc = args.penetration
numbers.max_penetration_perc = args.penetration

if args.severed then parts = checkconnectedparts(unit,parts) end
if args.severed then layers = {'ALL'} end
parts_and_layers = checkbodylayer(unit,parts,layers)

if #parts_and_layers >= 1 then
 addwound(unit,parts_and_layers,numbers,args.effect,args.flags,args.attacker,args)
end
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 13, 2015, 09:40:21 pm
Nice, I got names working well enough to put it up, I still have to learn a bit more about the input events I think as right now you have to run it again with the screen open to finalize the changes.

Did artifake -item WEAPON:ITEM_WEAPON_AXE_BATTLE -material ADAMANTINE twice, once for me, once for a dorflet:
Spoiler (click to show/hide)
Pulled up said dorflet I'm rescuing, did names -first Bob:
Spoiler (click to show/hide)
Selected the axe I spawned under him, did names -item -first "Bob's axe":
Spoiler (click to show/hide)
Selected my axe, did names -item -first "My axe":
Spoiler (click to show/hide)
Selected a war hammer I had made earlier, did names -first, changed the name and ran names -item -first before closing the name choice screen:
Spoiler (click to show/hide)
Aight, it works now and by hitting random a few times it gives access to all the languages. https://github.com/maxthyme/dfstuff/blob/master/names.lua

I knew I was missing something with artifake and I just found it!
Code: (artifake.lua) [Select]
local utils = require 'utils'

validArgs = validArgs or utils.invert({
 'help',
 'material',
 'item',
 'name',
 'r',
 'l'
})

local args = utils.processArgs({...}, validArgs)

if args.help then
 print(
[[artifake.lua
arguments:
    -help
        print this help message
    -material matstring
        specify the material of the item to be created
        examples:
            INORGANIC:IRON
            CREATURE_MAT:DWARF:BRAIN
            PLANT_MAT:MUSHROOM_HELMET_PLUMP:DRINK
    -item itemstring
        specify the itemdef of the item to be created
        examples:
            WEAPON:ITEM_WEAPON_PICK
    -name namestring
    specify a first name if desired
    -r
for right handed gloves
    -l
for left handed gloves
]])
 return
end

if dfhack.gui.getSelectedUnit(true) then
 args.creator = dfhack.gui.getSelectedUnit()
 else args.creator = df.global.world.units.active[0]
end
if not args.item then
 error 'Invalid item.'
end
local itemType = dfhack.items.findType(args.item)
if itemType == -1 then
 error 'Invalid item.'
end
local itemSubtype = dfhack.items.findSubtype(args.item)

args.material = dfhack.matinfo.find(args.material)
if not args.material then
 error 'Invalid material.'
end


local item = dfhack.items.createItem(itemType, itemSubtype, args.material['type'], args.material.index, args.creator)

 local base=df.item.find(df.global.item_next_id-1)
 df.global.world.artifacts.all:new()
 df.global.world.artifacts.all:insert('#',{new=df.artifact_record})
local facts = df.global.world.artifacts.all
 for _,k in ipairs(facts) do
  if k.id==0 then
   local fake=k
   fake.id=df.global.artifact_next_id
   fake.item = {new=base}
fake.item.flags.artifact = true
fake.item.flags.artifact_mood = true
fake.item.id = base.id
fake.item.general_refs:insert('#',{new =  df.general_ref_is_artifactst})
fake.item.general_refs[0].artifact_id = fake.id
fake.item.spec_heat = base.spec_heat
fake.item.ignite_point = base.ignite_point
fake.item.heatdam_point = base.heatdam_point
fake.item.colddam_point = base.colddam_point
fake.item.boiling_point = base.boiling_point
fake.item.fixed_temp = base.fixed_temp
fake.item.weight = base.weight
fake.item.weight_fraction = base.weight_fraction
fake.item.improvements:insert('#',{new = df.itemimprovement_spikesst,mat_type=25,mat_index=474,quality=0,skill_rating=15})
fake.item.improvements:insert('#',{new = df.itemimprovement_spikesst,mat_type=25,mat_index=493,quality=0,skill_rating=15})
fake.item.improvements:insert('#',{new = df.itemimprovement_art_imagest,mat_type=22,mat_index=474,quality=5,skill_rating=15})
fake.item.improvements:insert('#',{new = df.itemimprovement_art_imagest,mat_type=42,mat_index=480,quality=5,skill_rating=15})
fake.item.improvements:insert('#',{new = df.itemimprovement_art_imagest,mat_type=22,mat_index=497,quality=5,skill_rating=15})
   fake.anon_1 = -1000000
   fake.anon_2 = -1000000
   fake.anon_3 = -1000000
     base.flags.artifact = true
     base.flags.artifact_mood = true
     base.general_refs = fake.item.general_refs
     base.improvements = fake.item.improvements
     fake.item:setQuality(5)
     base:setQuality(5)
     if fake.item == 'WEAPON' then item:setSharpness(1,0) end
     if base == 'WEAPON' then item:setSharpness(1,0) end
     df.global.artifact_next_id=df.global.artifact_next_id+1
 df.global.world.history.events:new()
 df.global.world.history.events:insert('#',{new=df.history_event_artifact_createdst,
year = df.global.cur_year,
seconds = df.global.cur_year_tick_advmode,
id = df.global.hist_event_next_id,
artifact_id = fake.id,
unit_id = args.creator.id,
hfid = args.creator.hist_figure_id,
}
)
   df.global.hist_event_next_id = df.global.hist_event_next_id+1
if args.r then
base.handedness[0] = true
fake.item.handedness[0] = true
end
if args.l then
base.handedness[1] = true
fake.item.handedness[1] = true
end
 if args.name then do
  fake.name.first_name = args.name
  fake.name.language = 0
  fake.name.has_name = true
         end
      end
   end
end
I remembered I never put in the -r and -l args for gauntlet handedness as well as fixing them so they properly show up in legends mode:
Spoiler (click to show/hide)
Ok, unless I find a new trick to get names to activate on exit it looks like it's easiest to just call it to get the screen and call it again to set the current name to your target, works for me, unless anyone knows a better way to have it like apply the function on exiting the df.viewscreen_layer_name_choosest screen?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 14, 2015, 09:25:38 am
O.o

I just realized you could make a flaming weapon which can add burns and burning type wounds to targeted areas with some hackery, but I can't remember if the on_fire tag is under wounds or not...
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on June 14, 2015, 09:33:10 am
Try items. It looks like ON_FIRE is more of a property that 's attached to body components. The burns that it makes are totally wounds.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 14, 2015, 09:46:05 am
Hmmm, see now I'm wondering because I know there is a fires entry I poked at and I'm not sure if it counts the fires on your person as the ones under there... still, flaming swords!
Title: Re: DFHack 0.40.24-r3
Post by: telarin on June 15, 2015, 08:34:07 am
It seems like with the 0.40 version of Dwarf Fortress, DFHack Workflow is having difficulty regulation production of quarry leaves:

1) Added a process plants to bag job to a farmers workshop
2) Used item-material to set the input to Quarry Bushes
3) When using the UI to add a new constraint, workflow sees rock nuts as a product, but not quarry leaves.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 15, 2015, 08:43:11 am
Sounds like https://github.com/DFHack/dfhack/issues/524
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 15, 2015, 09:48:01 am
O.o

I just realized you could make a flaming weapon which can add burns and burning type wounds to targeted areas with some hackery, but I can't remember if the on_fire tag is under wounds or not...

To set a certain body part on fire unit.body.components.on_fire = true

There is also body part temperatures which is in unit.status2.body_part_temperature.whole = #

You can look at my script unit/body-change.lua. It was originally designed to have a lot of options, but right now all it can do is set a body part on fire or change it's temperature. For example
Code: [Select]
unit/body-change -unit id -flag GRASP -fireWill turn a units hands on fire.

EDIT: I could wrap it into wound-add, but you can also just use multi-cmd to trigger both.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 15, 2015, 09:51:43 am
Yeah, shame it couldn't be cleanly rolled into wounds-add, but still burns and exploded limbs and such are great!

Wow, that uh... sounds odd.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on June 15, 2015, 02:14:19 pm
I'll just leave this here (mostly for expwnent)

http://docs.travis-ci.com/user/deployment/releases/
http://www.appveyor.com/docs/deployment/github

Yes that means that you can configure free online service to build dfhack for you
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 15, 2015, 02:41:13 pm
I'm pretty sure it already has travis? At least, it tells me it's testing a build with that every time I make a pull request.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 15, 2015, 02:44:47 pm
It only runs some tests; actually building DFHack would take much longer than 20-30 seconds.

The main concern when this was mentioned before is setting up the build environment - it would be hard to find a free solution that offers CMake, perl/LibXML/LibXSLT, gcc45/MSVC 2010, etc.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on June 15, 2015, 11:28:17 pm
It only runs some tests; actually building DFHack would take much longer than 20-30 seconds.

The main concern when this was mentioned before is setting up the build environment - it would be hard to find a free solution that offers CMake, perl/LibXML/LibXSLT, gcc45/MSVC 2010, etc.
appveyor supports msvc 2010 and perl
pretty sure travis supports gcc 4.5 (and many others)
ALL support CMake. The rest could be packed into zips and uploaded somwhere (for appveyor) or checked out from nuget or apt-get from repositories.
Title: Re: DFHack 0.40.24-r3
Post by: ElenaRoan on June 17, 2015, 07:44:11 am
OK my search ability is failing me. Where can I find support for the burrow DFHack plugin? Auto-grow appears to have stopped working with it.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 17, 2015, 11:39:22 am
This thread or the DFHack issue tracker are the best places to ask - separate threads for plugins included in DFHack aren't very common (Falconne's plugins and stockflow are the only ones I can remember that do have separate threads).

Anyway, that issue has already been reported: https://github.com/DFHack/dfhack/issues/601
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 17, 2015, 04:16:45 pm
Is there a dfhack function or script to determine if a body part is protected by worn armor/clothing (and which armor/clothing)? I know I can check the inventory and see which body part is covered, but that doesn't include the upstep/ubstep/lbstep. I am sure I could write something that does this, but was just wondering if there is something already written.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 17, 2015, 07:32:13 pm
Not that I know of.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 17, 2015, 10:00:54 pm
In that case, would anyone be willing to educate me on what exactly the ub/up/lbstep values do? I know that, for example, a chest piece with a ubstep of 0 will only protect the upper body, and a chest piece with a ubstep of 1 will protect the upper body and upper arms. Is it just simply, you take the body part that the piece of armor is attached to, and then, for each increase in ubstep you move out one connected body part? So for a creature with just one part arms, their whole arm would be protected by a ubstep of 1, but a dwarf would need a ubstep of 2?
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on June 17, 2015, 11:12:24 pm
Yeah, that's it. UPSTEP starts from the hand and goes up towards the torso. LBSTEP starts from the lower body and stretches down the legs.

All extensions stop before the next non-limb bit. Robe hems can't cover the feet, long pervy velvet gloves can't stretch past the shoulder and sleeves always cut off at the wrist. I'm sure you know their effects on layer volume already.
Title: Re: DFHack 0.40.24-r3
Post by: ElenaRoan on June 18, 2015, 02:11:41 am
Thanks Lethosor, I'll keep an eye on that thread.

I really need to pull my thumb out and learn some lua *chuckle*
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 18, 2015, 02:09:43 pm
I am sure there is probably a better way to check for armor covering, but this function works just fine according to the rules on the wiki which may be outdated. Note that it doesn't suffer from the bug listed in the wiki. As input it requires the unit (not the unit_id), the bp_id you are checking to see if it is covered, and the inventory item you are checking. Putting it in a loop such as will run through an entire units inventory and tell you all of the items that cover that body part.

Code: [Select]
for i,x in pairs(defender.inventory) do
  if x.mode == 2 then
   if checkcoverage(defender,target_part_id,x) then

Here is the actual function
Code: [Select]
function checkcoverage(unit,bp_id,inventory_item)
 covers = false
 item = inventory_item.item
 itype = df.item_type[item:getType()]
 base_bp_id = inventory_item.body_part_id
 if base_bp_id == bp_id then
  covers = true
  return covers
 end
 step = 0
 connect = {base_bp_id}
 if itype == 'ARMOR' then
  ubstep = item.subtype.ubstep
  while step < ubstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.LOWERBODY and not x.flags.HEAD and not x.flags.GRASP then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
  step = 0
  for i,x in pairs(unit.body.body_plan.body_parts) do
   if x.flags.LOWERBODY then
    base_bp_id = i
    break
   end
  end
  if base_bp_id == bp_id then
   covers = true
   return covers
  end
  connect = {base_bp_id}
  lbstep = item.subtype.lbstep
  while step < lbstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.UPPERBODY and not x.flags.STANCE then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
 elseif itype == 'HELM' then
  return covers
 elseif itype == 'GLOVES' then
  upstep = item.subtype.upstep
  while step < upstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.UPPERBODY and not x.flags.LOWERBODY then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
 elseif itype == 'SHOES' then
  upstep = item.subtype.upstep
  while step < upstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.UPPERBODY and not x.flags.LOWERBODY then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
 elseif itype == 'PANTS' then
  lbstep = item.subtype.lbstep
  while step < lbstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.UPPERBODY and not x.flags.STANCE then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
 end
 return covers
end
Title: Re: DFHack 0.34.11 r5
Post by: JayThePro on June 18, 2015, 05:56:05 pm
Did anything happen to "adv-bodyswap"
Can't seem to preform it at it's current v40.24.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 18, 2015, 10:01:47 pm
In that case, would anyone be willing to educate me on what exactly the ub/up/lbstep values do? I know that, for example, a chest piece with a ubstep of 0 will only protect the upper body, and a chest piece with a ubstep of 1 will protect the upper body and upper arms. Is it just simply, you take the body part that the piece of armor is attached to, and then, for each increase in ubstep you move out one connected body part? So for a creature with just one part arms, their whole arm would be protected by a ubstep of 1, but a dwarf would need a ubstep of 2?

Raw modders would know better. You could ask around there.
Title: Re: DFHack 0.34.11 r5
Post by: Rumrusher on June 19, 2015, 08:47:20 am
Did anything happen to "adv-bodyswap"
Can't seem to preform it at it's current v40.24.
have you tried out Dfusion's Body swap script that should still work. Adv-Bodyswap was someone else attempt at that code with mix results.
Title: Re: DFHack 0.40.24-r3
Post by: Lightningy on June 19, 2015, 11:20:42 am


where do i get Add-splatter and details of how to use it? i found the actual code in the github site and i have no idea how to use it.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 19, 2015, 11:40:53 am
It's a plugin that's compiled and included with DFHack by default.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on June 19, 2015, 12:31:30 pm
This question seems more appropriate here.

Code: [Select]
df.global.world.history.events:new()
 df.global.world.history.events:insert('#',{new=df.history_event_hf_attacked_sitest,
year = whenever,
seconds = whatever,
id = df.global.hist_event_next_id,
site = you get the idea,
hfid = beast.id,
}
)
   df.global.hist_event_next_id = df.global.hist_event_next_id+1

does this actually do anything

I'm trying to make a creature that won't spawn naturally show up during worldgen, as if these historical sites were doing the same kinds of things that a player fort could do to get them to show up.  (They show up when a boil-away stone is mined, but that's not important for this discussion).

If I spawn a nemesis and figure out how to place it at a historical site during worldgen, will adding a "rampage" event at that time cause the creature to actually cause problems at that site?  Or maybe I'm overthinking this, and placing a hostile nemesis onsite will cause a rampage all by itself?

Ideally, I'd like there to be some mention of these beasts in Legends (and artworks) including the Knights In Shining Armor who've slain them.  It bothers me right that they appear in a game-y fashion right now that can only occur in a player fort.

Eventually, I'd like to do away with the boil-away stone entirely, and just make a tiny chance of spawning a critter whenever mining a layer stone.
Title: Re: DFHack 0.40.24-r3
Post by: Lightningy on June 19, 2015, 12:33:31 pm
thx i should have checked
Title: Re: DFHack 0.34.11 r5
Post by: JayThePro on June 19, 2015, 06:47:10 pm
Did anything happen to "adv-bodyswap"
Can't seem to preform it at it's current v40.24.
have you tried out Dfusion's Body swap script that should still work. Adv-Bodyswap was someone else attempt at that code with mix results.
Er my bad, where would I get the script?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 20, 2015, 01:14:54 am
This question seems more appropriate here.

Spoiler (click to show/hide)

I'm trying to make a creature that won't spawn naturally show up during worldgen, as if these historical sites were doing the same kinds of things that a player fort could do to get them to show up.  (They show up when a boil-away stone is mined, but that's not important for this discussion).

If I spawn a nemesis and figure out how to place it at a historical site during worldgen, will adding a "rampage" event at that time cause the creature to actually cause problems at that site?  Or maybe I'm overthinking this, and placing a hostile nemesis onsite will cause a rampage all by itself?

Ideally, I'd like there to be some mention of these beasts in Legends (and artworks) including the Knights In Shining Armor who've slain them.  It bothers me right that they appear in a game-y fashion right now that can only occur in a player fort.

Eventually, I'd like to do away with the boil-away stone entirely, and just make a tiny chance of spawning a critter whenever mining a layer stone.
I slapped in the same basic layout for artifakes and it made them show up in legends properly. As long as those links are intact it should show up right. If you want to double check pull up the location with gui/gm-editor df.global.world.history.events dot whatever entry you're targeting and make sure you didn't miss a field in the entries.

Oh and I do mean literally slapped in, I just put that in before the last two sections where it handles the left/right and name arguments, at the end of the item/artifact definition sections and it worked as expected. I checked on the "attacked_sitest" format and it has the hfid and site and stuff fields which you'd need to have defined elsewhere but once those are set up and you link them properly it should insert an appropriate reference into legends as expected.
Title: Re: DFHack 0.40.24-r3
Post by: Showbiz on June 20, 2015, 06:08:14 am
My adventurer is startet in a sealed Fort again. Is there a way to teleport my adventurer up to the surface?
Title: Re: DFHack 0.40.24-r3
Post by: Arx on June 20, 2015, 12:57:18 pm
I think the teleport command should do that, but I can't remember if it still needs to be be spoonfed information in this DFHack release.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 20, 2015, 05:11:46 pm
Also the option of reveal > find area with link to exit > head over there and advfort dig your way out. Traveling might give you access to a road and if you then travel back to the spot with the stairs you can exit.
Title: Re: DFHack 0.40.24-r3
Post by: Dwarfy the Dwarf Dwarf on June 21, 2015, 03:02:50 am
How can I use dfhack to change attributes or attribute caps for my adventurer?
Title: Re: DFHack 0.40.24-r3
Post by: Lightningy on June 21, 2015, 04:15:14 am
http://dwarffortresswiki.org/index.php/User:Vjek

You can use the elevate mental and the elevate physical scrips. copy paste into a txt file and rename them into x.lua (x being what ever you want). the when in game type x into dfhack and it will raise them to their max vanilla values.

I am not entirely sure but i think you can get them a lot high but i have no idea how.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 21, 2015, 04:45:14 am
Easier than that, save these pages as the appropriate .lua in hack/scripts.

https://dl.dropboxusercontent.com/u/1339319/df_scripts/40.08/elevate_physical.lua
https://dl.dropboxusercontent.com/u/1339319/df_scripts/40.08/elevate_mental.lua

Quote from: vjek
elevate_mental

This script will adjust all the mental attributes of a single dwarf from whatever they currently are to the value 2600. While 2600 is not the maximum, it's very high, and you'll find this is high enough for most common activities. To adjust this value, pass the new value to the script as an argument. For example: 'elevate_mental 2700' This script can also be used to LOWER all the mental attributes of a particular dwarf. Use 'elevate_mental 200' for example. Yes, I know, it's not really "elevating" if you're lowering a value, but meh, the name is the name, change it if you want.

elevate_physical

This script will adjust all the physical attributes of a single dwarf from whatever they currently are to the value 2600. This value can also be changed by passing an argument to the script such as 'elevate_physical 3000' to adjust them all to 3000 instead of 2600. As with the elevate_mental script, this script can also be used to LOWER all the physical attributes of a particular dwarf. . I have had the need to do this, for example, with pesky nobles who insist on beating the hell out of their fellow dwarves. Not so easy to beat someone with a strength of 10, now is it?! Hee hee.
Title: Re: DFHack 0.40.24-r3
Post by: Dwarfy the Dwarf Dwarf on June 21, 2015, 05:45:52 am
How would I change the max value of my attributes? Do I have to edit the raw objects file for an entire race or can I do it through dfhack? Also, is it possible to just increase my attribute past the max value with the .lua files given above?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 21, 2015, 05:49:04 am
unit.body.physical_attrs

unit.status.current_soul.mental_attrs

use gui/gm-editor to access your unit to find those

that's pretty much it
Title: Re: DFHack 0.40.24-r3
Post by: Dwarfy the Dwarf Dwarf on June 21, 2015, 06:58:53 am
unit.body.physical_attrs

unit.status.current_soul.mental_attrs

use gui/gm-editor to access your unit to find those

that's pretty much it

Uhh...Duhhh...I don't comply. I'm a blockhead when comes to pretty much anything related to codes or computers unless a very specific step-to-step guide was given. So...care to explain again in simple english?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 21, 2015, 07:08:48 am
Run gui/gm-editor with a unit selected, then navigate to those fields (e.g. status > current_soul > mental_attrs or body > physical_attrs - you can press "s" to search for these). I'm not sure what's contained there - if gm-editor displays skill names, finding the ones you're interested in should be simple enough, but it's possible that it doesn't (in which case you'd need to figure out the skill ID's that you're interested in manually, or set all of them to large values).

Edit: did you try the scripts Max linked to above? Those worked in 0.40.08, and I don't remember the structures they use changing since then, so they would probably work.
Title: Re: DFHack 0.40.24-r3
Post by: Lightningy on June 21, 2015, 08:33:34 am
Easier than that, save these pages as the appropriate .lua in hack/scripts.

https://dl.dropboxusercontent.com/u/1339319/df_scripts/40.08/elevate_physical.lua
https://dl.dropboxusercontent.com/u/1339319/df_scripts/40.08/elevate_mental.lua

Quote from: vjek
elevate_mental

This script will adjust all the mental attributes of a single dwarf from whatever they currently are to the value 2600. While 2600 is not the maximum, it's very high, and you'll find this is high enough for most common activities. To adjust this value, pass the new value to the script as an argument. For example: 'elevate_mental 2700' This script can also be used to LOWER all the mental attributes of a particular dwarf. Use 'elevate_mental 200' for example. Yes, I know, it's not really "elevating" if you're lowering a value, but meh, the name is the name, change it if you want.

elevate_physical

This script will adjust all the physical attributes of a single dwarf from whatever they currently are to the value 2600. This value can also be changed by passing an argument to the script such as 'elevate_physical 3000' to adjust them all to 3000 instead of 2600. As with the elevate_mental script, this script can also be used to LOWER all the physical attributes of a particular dwarf. . I have had the need to do this, for example, with pesky nobles who insist on beating the hell out of their fellow dwarves. Not so easy to beat someone with a strength of 10, now is it?! Hee hee.

You literally just told him to do the same thing as i told him

(http://i723.photobucket.com/albums/ww235/Femi_Boss_Mark/DF%20tomfoolery_zpsiionn5gj.png)
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 21, 2015, 10:20:10 am
Saving the files directly isn't quite the same as copying them into a text file and renaming them.
Title: Re: DFHack 0.40.24-r3
Post by: Showbiz on June 21, 2015, 02:13:02 pm
I think the teleport command should do that, but I can't remember if it still needs to be be spoonfed information in this DFHack release.

Also the option of reveal > find area with link to exit > head over there and advfort dig your way out. Traveling might give you access to a road and if you then travel back to the spot with the stairs you can exit.
Thanks a lot!
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 21, 2015, 04:14:35 pm
If you look at the JOB_COMPLETED event then you can probably get rid of the boil-away stone and just count dig completed jobs and check the tile for the appropriate type of rock and then trigger the thing that spawns them or increases their population somehow.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on June 21, 2015, 09:58:36 pm
If you look at the JOB_COMPLETED event then you can probably get rid of the boil-away stone and just count dig completed jobs and check the tile for the appropriate type of rock and then trigger the thing that spawns them or increases their population somehow.
That's a good idea. Is it possible to see what the mined-out tile was?  Everything leaves a layer stone floor now, so that's an unreliable indicator of the original tile.  The boil-away stones currently occur in one-tile clusters inside layer stones and specific gem clusters.  I'd prefer to limit spawning to those areas because having the creatures are based on the layer stones, and it'd seem odd for one to spawn inside a microcline cluster.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 21, 2015, 11:44:23 pm
There's definitely a way but I forget what it is. Try looking at the tileprobe plugin. Or maybe it's just called probe? I forget.
Title: Re: DFHack 0.40.24-r3
Post by: Prismatic on June 22, 2015, 03:48:27 am
Could anyone kindly explain to me how to insert new values to int32_t vectors in gm-editor?
(For instance, if I wanted to add a value for style_strength of a certain written_content).
Title: Re: DFHack 0.40.24-r3
Post by: Rose on June 22, 2015, 08:26:54 am
does the df::global::world.buildings.all vector contain every building ever made, including removed ones?

I'm trying to decide how I will send over constructed buildings to Armok vision. I don't want to send more than I need to, but besides searching through all buildings and picking the ones that are inside a specific map block, I'm not sure how that could be done.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 22, 2015, 08:41:05 am
Could anyone kindly explain to me how to insert new values to int32_t vectors in gm-editor?
(For instance, if I wanted to add a value for style_strength of a certain written_content).
It doesn't look like it's possible at the moment, but you can use "vector:insert('#', number)" in the lua interpreter.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 22, 2015, 08:52:16 am
does the df::global::world.buildings.all vector contain every building ever made, including removed ones?

I'm trying to decide how I will send over constructed buildings to Armok vision. I don't want to send more than I need to, but besides searching through all buildings and picking the ones that are inside a specific map block, I'm not sure how that could be done.

I'm 90% sure that it does not.
Title: Re: DFHack 0.40.24-r3
Post by: Rose on June 22, 2015, 09:07:02 am
I just checked, and no, it only contains actually existing and/or planned buildings.

So now it becomes a question of it it's fine to just send over the entire list, or if I would need to filter it so it only includes the map blocks I'm currently looking at.
Title: Re: DFHack 0.40.24-r3
Post by: Prismatic on June 22, 2015, 03:03:06 pm
Could anyone kindly explain to me how to insert new values to int32_t vectors in gm-editor?
(For instance, if I wanted to add a value for style_strength of a certain written_content).
It doesn't look like it's possible at the moment, but you can use "vector:insert('#', number)" in the lua interpreter.

Excuse my ignorance (I have practically no experience using lua), but could you please elaborate on that? Entering "vector:insert('#', 0)" in the lua interpreter on the dfhack console yielded the following error message:
Spoiler (click to show/hide)
I'm most definitely just omitting something obvious. Should the vector be specified? If so, could you explain how?
Thanks for the help!
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 22, 2015, 03:04:31 pm
"vector" refers to the actual vector you're looking at, yeah. You specify it the same way you navigate to it in gm-editor.

(unit->body.blood_max in gm-editor becomes unit.body.blood_max in lua, for example)
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on June 22, 2015, 04:39:26 pm
There's definitely a way but I forget what it is. Try looking at the tileprobe plugin. Or maybe it's just called probe? I forget.
The probe command lists three different materials for a tile: layer, base and static.  If and only if the tile is part of a vein, it will also have a vein material.

The layer material doesn't change, and neither does the vein if it's present.  The base and static materials switch from the vein material to the layer material when a tile is mined.  So in pseudo-code:

if layer_stone is spawnable then
    if vein is null OR vein is spawnable then
        spawn-creature-script //layer_stone //location //miner
    end
end


First, will Lua properly short-circuit an OR if the first condition is true?  If I have to capture errors then I'll just find an uglier way to order the tests.

Second, is there a quick way to check if a material matches one of 24 arbitrary materials?  Since this will be an eventful call-back, I'll have a chance to pre-populate a persistent list with numeric ids if that will make a difference in performance.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 22, 2015, 04:47:06 pm
It will properly end a conditional if a pre-OR is true or if a pre-AND is false, yeah. I personally use the idiom "if unit.status.current_soul and (something else)" for checking if a unit has a soul (undead do not) a lot.
Title: Re: DFHack 0.40.24-r3
Post by: kane_t on June 23, 2015, 09:54:02 am
Does anybody know if there's a way to make dfhack.items.remove() in the Lua API work properly for items in containers?

I'm trying to remove items from the game entirely (as part of a script to merge stacks (http://www.bay12forums.com/smf/index.php?topic=151394.0)) and calls to dfhack.items.remove() don't seem to do anything to items stored in a container.  Same deal with items.moveToGround().  If items.remove() won't work, is there any way to get an item out of a container so it can be removed?

Alternatively, does anybody know if the equivalent C++ function on the plugin side works?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 23, 2015, 10:06:43 am
It looks like you'd have to remove them from their containers somehow (the same applies to items in workshops and projectiles, among other things). Most of those Lua functions are direct wrappers around the corresponding C++ functions, so there shouldn't be any difference between them.
Title: Re: DFHack 0.40.24-r3
Post by: kane_t on June 23, 2015, 10:31:39 am
It looks like you'd have to remove them from their containers somehow (the same applies to items in workshops and projectiles, among other things). Most of those Lua functions are direct wrappers around the corresponding C++ functions, so there shouldn't be any difference between them.

Yeah, it appears that, if I remove the general_ref from the container's general_refs vector (by erasing it by index), that removes it from the container.  What worries me is that, even after then calling dfhack.items.remove() on the item, quitting the Lua interpreter, and unpausing the game for a little while, I can still reopen the interpreter and find the item by its id through df.item.find().  That makes me think that it isn't actually being completely removed, and is going to end up causing a memory leak.

The other thing I'm wondering about is how the game will handle it if that item is tasked.  Will dfhack correctly cancel all jobs using the item when calling dfhack.items.remove()?  Or am I going to wind up with a null reference error later on?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 23, 2015, 11:59:47 am
What's the return value of remove()? The item should have a corresponding general_ref, and not removing both could cause issues. I think there's also a specific_ref or general_ref for tasked items, which remove() should refuse to touch.
Title: Re: DFHack 0.40.24-r3
Post by: Prismatic on June 23, 2015, 01:53:51 pm
"vector" refers to the actual vector you're looking at, yeah. You specify it the same way you navigate to it in gm-editor.

(unit->body.blood_max in gm-editor becomes unit.body.blood_max in lua, for example)
Thank you Putnam, that was precisely what I needed to know!
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on June 23, 2015, 01:57:53 pm
Second, is there a quick way to check if a material matches one of 24 arbitrary materials?  Since this will be an eventful call-back, I'll have a chance to pre-populate a persistent list with numeric ids if that will make a difference in performance.
Does anyone have a lead on this, either from a Lua angle or a regular expression angle?  Otherwise it turns into looping string match tests, which I imagine would be relatively slow.  There are 49 tests in a worst case scenario, so it might not be too bad.  Would still like a more elegant solution, though.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 23, 2015, 02:04:16 pm
Second, is there a quick way to check if a material matches one of 24 arbitrary materials?  Since this will be an eventful call-back, I'll have a chance to pre-populate a persistent list with numeric ids if that will make a difference in performance.
Does anyone have a lead on this, either from a Lua angle or a regular expression angle?  Otherwise it turns into looping string match tests, which I imagine would be relatively slow.  There are 49 tests in a worst case scenario, so it might not be too bad.  Would still like a more elegant solution, though.

Make a persistent table with the id of each of the materials. Then just use
Code: [Select]
if persistTable.GlobalTable.DirstMatTable[mat.id] then something like that should work
Title: Re: DFHack 0.40.24-r3
Post by: kane_t on June 23, 2015, 03:18:58 pm
What's the return value of remove()? The item should have a corresponding general_ref, and not removing both could cause issues. I think there's also a specific_ref or general_ref for tasked items, which remove() should refuse to touch.

Good call, I checked the return value (the fact that it returns a value wasn't documented in the Lua API, so I didn't bother to check before) and it was returning false.  A bit of experimentation and looking through the source on github revealed that it wasn't able to remove the item because it was held by a Viewscreen, because I was keeping the barrel inventory open.  If the function is called after closing the barrel's inventory, the item is removed successfully.

It's the items::detachItem() function which checks to see if an item is visible in a viewscreen, by the way, which is also called for lots of similar functions, like putOnGround() and moveToContainer().  Quite inconvenient.

So now my problem is figuring out a way to either remove things while viewscreens are open (which I guess would require manually detaching the item from the viewscreen, which could only be done in a plugin, and might cause other problems I can't predict) or delaying removal until the inventory is closed (which would require continuous polling, and might still require doing it in a plugin to be able to detect whether an inventory window is open).  Or changing my script to only work on containers, instead of the specific items within them, so the user doesn't need to manually select the item.

Alternatively, I might just be able to fool items::remove() by manually removing the in_inventory flag and adding the removed flag after removing the item from the container.

Incidentally, item::remove() also fails if the item is tasked in any way (by having any specific_ref), so that answers that question.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 23, 2015, 04:17:46 pm
Removing items while they're displayed in a DF viewscreen probably isn't safe. If you're making a UI to stack items, you could probably implement a simplified list in lua, but it would have the disadvantage of not having the options of the native viewscreen (I'm not sure how necessary you consider that).
Anyway, you ought to be able to remove an item from a viewscreen listing multiple items from lua, as well as the corresponding refs, but I'm not sure how safe that is.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 23, 2015, 05:32:09 pm
Does anyone know where the [MATERIAL_FORCE_MULTIPLIER] information is stored? I have found the corresponding syndrome based material force change, but can't seem to find where the creature/caste information is kept. I have looked all over the individual unit and the raws.creatures.all[unit.race], and I keep coming up empty handed.
Title: Re: DFHack 0.40.24-r3
Post by: kane_t on June 23, 2015, 06:13:15 pm
Removing items while they're displayed in a DF viewscreen probably isn't safe. If you're making a UI to stack items, you could probably implement a simplified list in lua, but it would have the disadvantage of not having the options of the native viewscreen (I'm not sure how necessary you consider that).
Anyway, you ought to be able to remove an item from a viewscreen listing multiple items from lua, as well as the corresponding refs, but I'm not sure how safe that is.

Yeah, it's possible, and I wrote a script that does it.  It didn't crash immediately, or after running the game for half a minute, and the item does disappear from df.item.find(), so it's probably safe.  It depends on how DF does its memory management internally.  If, internally, it uses reference-counted smart pointers, then as long as it doesn't do anything obscene with them it should be fine.

It doesn't update the inventory screen to show removals in real time, though, which makes it less useful as something to release to the public.  I'll probably just write something ugly that solves the minor inconvenience I had and keep it to myself.  (You know, two scripts, one to mark items for merging while you're in the inventory screen, storing their IDs in a persist table, the second to actually carry out the merges after exiting the inventory screen.)

I suppose I could still write a plugin that automatically merges stacks as items are added to containers (and containers to stockpiles), but I don't know how many people would care to have a utility like that.  Personally, I really think it should just be something DF does automatically.  It's kind of absurd the way the game handles stacks of items, really.  A cook grabs a stack of 30 eggs and a stack of one quarry bush leaf and figures that's a reasonable pairing?  And that takes the same amount of time to cook as four stacks of 30 eggs, or two stacks of one strawberry?  Instead of picking up stacks from containers, dwarves should make stacks in their hands by taking items, and try to hit a target stack size.  So, when a cook decides to add eggs as the next ingredient to a meal, they should try to collect (say) six eggs from the available stocks, even if that requires splitting and merging available item stacks.  Same deal with crossbow bolts.  Dwarves should just fill their quiver from the available stocks.

It's a minor gripe, I know, like the fact that you can't select material types for most jobs (though there is a script for that), but it's one of those little things that just sticks in my craw for some reason.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on June 23, 2015, 06:59:25 pm
If, internally, it uses reference-counted smart pointers, then as long as it doesn't do anything obscene with them it should be fine.

No, it doesn't. However I don't see what's the problem to remove item from the viewscreen first.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 23, 2015, 07:05:27 pm
Right, although you'd also have to remove the corresponding general_refs and specific_refs before the item can be deleted with Items::remove().
Title: Re: DFHack 0.40.24-r3
Post by: roguester on June 23, 2015, 07:43:23 pm
Hi, I'm getting a crash whenever I use 'zone set'. 'zone zinfo' gives correct-looking information including the zone id. 'zone assign etc' doesn't crash, but of course doesn't work because the zone is not set. This happens on all the zones I have tried on my current map.

I am using DF v0.40.24, DFHack  release 0.40.24-r3-Windows

Running on Windows 8

Wondering whether this is a known issue or whether someone knows what might be wrong.

It is possible I am doing something wrong but I don't think so. I hit 'i', select the zone, then type on the console 'zone set' and I get a crash.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 23, 2015, 07:47:32 pm
It crashes for me if the cursor is in use but a zone isn't selected, which should definitely be fixed. Are you sure you're selecting a zone? (It might require the 'q' cursor to work properly.)
Title: Re: DFHack 0.40.24-r3
Post by: roguester on June 23, 2015, 07:52:09 pm
Yes, I had a zone selected. I tried just now with 'q' and same thing.

One thing that might help: When it crashes it prints out in the console 'Target building type: cage'. However if I try to do it on a cage I get: 'No pen/pasture or pit under cursor'
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 23, 2015, 08:09:53 pm
Yeah, that's one of several crash issues (I'm surprised it went unnoticed for so long). In that case the logic is reversed - if there's no cage selected, the plugin should check other building types, but it doesn't and then tries to work with a null pointer (by printing the building's ID - without that, it's possible that the crash wouldn't occur and you'd only end up with no zone selected, as before). There were also issues with cage and chain checks crashing if a building wasn't selected at all.
Edit: Should be fixed now.
Title: Re: DFHack 0.40.24-r3
Post by: kane_t on June 24, 2015, 09:37:53 am
I changed my mind and ended up writing the scripts anyway.  Here they are, if anyone wants to use them: combine_drinks (https://github.com/kane-t/dfhack_scripts/blob/master/combine_drinks.lua) and combine_plants (https://github.com/kane-t/dfhack_scripts/blob/master/combine_plants.lua).

For combine_plants, you can select either a stockpile (with q) or a container (with k).  In either case, the script will recurse into nested containers to find stacks to merge.  For combine_drinks, you have to select a stockpile.  Both scripts allow a -max param to set the desired stack size, with _plants defaulting to 12 and _drinks defaulting to 30.

As promised, they're ugly and poorly-optimised, but they do check for and ignore items that are currently tasked.  Importantly, they don't currently test to see if a viewscreen is open, so if you're selecting the item from an inventory screen it'll stupidly move items but be unable to remove empty stacks.  (For safety, I made it set the stack size of stacks to be removed to 1, but it's still undesirable.)

If anybody wants to copy the code and use it for merging, say, ammunition stacks, feel free.  Or I'll probably do it in the future when that starts annoying me.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on June 24, 2015, 05:08:06 pm
Is there a script to get rid of burned trees by any chance?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 25, 2015, 11:54:10 am
Not that I know of, trees are a pain to get rid of with hackery, they like to respawn inside solid tiletypes/liquids created walls.

In other news, for a first run activated on hotkey version this is remarkably fun:
Code: (artibash.lua) [Select]
local unit = df.global.world.units.active[0]
local attks = unit.actions
for k,v in ipairs(attks) do
if attks[k].type==1 and attks[k].data.attack.attack_item_id then
local item = df.item.find(attks[k].data.attack.attack_item_id)
if item.flags.artifact == true then
item.subtype.attacks[0].velocity_mult = 2700000
attks[k].data.attack.unk_30=99999999
end
end
end

I was trying to use Putnam's sparking trick of having it check for artifact weapon swings and then running the velocity booster and ended up stripping it back until it worked first (rather than trying to build it up and get it working) so I could at least test and make sure it was doing the right stuff. Basically you line up a multi-attack and before you advance time a step run the script (or use the hotkey) and pchew! Away the poor bastard you're hitting goes.

Similar effect to using launch to fling them except it's the actual hyper-accelerated weapon impact doing the work and thus getting the credit.

Before:
@>ë
After:
@ ~≈~≈≈~²~≈e ²
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 25, 2015, 12:11:37 pm
Hmm, that makes me think of something. I have been trying to figure out adding more custom attacks using scripts to add the wounds that would be caused by an attack with the item/body part made of a certain material. Would it be at all possible to just queue an actual attack, in game, and then let the game mechanics handle the wound calculation?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 25, 2015, 12:21:40 pm
Uhhhh...

unit.actions:new()
unit.actions:insert('#',
                    type = 1,
                    id = y,
                    data = faked_attack,
                    )
unit.next_action_id = y+1

Set up the relevant fields for faked_attack and it should process it next tick I think?

I originally tried to get vertical leaps by messing with that before I bumped into propel/molested it into launch. I was able to take a readied jump and edit it and I recall directly gm-editor faking a jump with various effects but never getting the desired vertical leap in a satisfying manner.

I wonder if it wouldn't be easier to just fake a projectile for the attack?
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 25, 2015, 12:25:45 pm
Uhhhh...

unit.actions:new()
unit.actions:insert('#',
                    type = 1,
                    id = y,
                    data = faked_attack,
                    )
unit.next_action_id = y+1

Set up the relevant fields for faked_attack and it should process it next tick I think?

I will look into this, but I was just looking through the various fields that we can edit and unfortunately it seems like we can only specify an item id, body part id, and velocity. I was hoping to be able to simulate attacks made with body part X but with a different material (like steel punches). So unless one of those various unk parameters handles material and such I don't think it will be as useful as I hoped.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 25, 2015, 12:30:17 pm
Hmmm, well, not sure if it would be easier to set up a faked item or try the projectile thing. Need to ask Putnam if he knows what any of those unk values do, who would have guessed that unk_30 was freaking attack velocity?
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 25, 2015, 12:50:42 pm
Yeah, from the few tests I did it doesn't seem like any of the other unk values have anything to do with material or the like (which why would they since that information is stored in the attack_item_id and body_part_id. What I really need to do is find a way to get into what the actual attack action does (i.e. calculate momentum, shear costs, blah, blah, blah, calculate wound), but from my cursory check it doesn't look like we have a way to manipulate that.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 25, 2015, 01:45:07 pm
Announcement: if possible, please submit structure/memory research in the issues tracker for df-structures. Direct Link (https://github.com/DFHack/df-structures/issues/)
Title: Re: DFHack 0.40.24-r3
Post by: mifki on June 25, 2015, 08:33:42 pm
Announcement: if possible, please submit structure/memory research in the issues tracker for df-structures. Direct Link (https://github.com/DFHack/df-structures/issues/)

Done. Would like some feedback https://github.com/DFHack/df-structures/issues/45
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 26, 2015, 12:31:13 am
Does that include stuff like being able to put a name/function on an unk_ entry?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 26, 2015, 06:37:13 am
Yes, although a pull request would be even better.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 26, 2015, 01:04:30 pm
Yeah, from the few tests I did it doesn't seem like any of the other unk values have anything to do with material or the like (which why would they since that information is stored in the attack_item_id and body_part_id. What I really need to do is find a way to get into what the actual attack action does (i.e. calculate momentum, shear costs, blah, blah, blah, calculate wound), but from my cursory check it doesn't look like we have a way to manipulate that.

Well, I do have an idea for a workaround now, but it might be pretty messy and have unforeseen consequences. Basically it is split into two parts, item attacks and body part attacks.


Now as far as I can see this should work fine, allowing for highly customisable attacks and such. The only downside is that for that one tick (or however long it needs to remain for the attack to be applied) all items/creatures of that type will have the change. Thoughts?

I really wish you could change an individual creatures material!
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on June 26, 2015, 02:37:51 pm
Second, is there a quick way to check if a material matches one of 24 arbitrary materials?  Since this will be an eventful call-back, I'll have a chance to pre-populate a persistent list with numeric ids if that will make a difference in performance.
Does anyone have a lead on this, either from a Lua angle or a regular expression angle?  Otherwise it turns into looping string match tests, which I imagine would be relatively slow.  There are 49 tests in a worst case scenario, so it might not be too bad.  Would still like a more elegant solution, though.

Make a persistent table with the id of each of the materials. Then just use
Code: [Select]
if persistTable.GlobalTable.DirstMatTable[mat.id] then something like that should work
So it turns out that getting the layer and vein materials for a tile is non-trivial, but Milo wrote a Lua plugin to extract it.  But I'd also like to check if the just-mined-out tile has a boulder in it or not.  Spawning an "awakened stone" creature or a rough "hidden gem" will have a low probability per tile, so I might as well avoid the 1-in-4 tiles that mine out a boulder anyway.

Is there a straightforward check for an object at a given set of XYZ coordinates?  Since this will be checked the tick a tile was mined out, the only possible outcomes are empty and boulder.  Carved stairs, etc. are terrain features so they shouldn't interfere with the check.

If I get this to work, I won't need to have different versions of the inorganic file for different graphics packs.  The next step would be to find a tile that's universally applicable as a plant, and then there'd be no need to adjust for graphics packs at all.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 26, 2015, 03:07:34 pm
Second, is there a quick way to check if a material matches one of 24 arbitrary materials?  Since this will be an eventful call-back, I'll have a chance to pre-populate a persistent list with numeric ids if that will make a difference in performance.
Does anyone have a lead on this, either from a Lua angle or a regular expression angle?  Otherwise it turns into looping string match tests, which I imagine would be relatively slow.  There are 49 tests in a worst case scenario, so it might not be too bad.  Would still like a more elegant solution, though.

Make a persistent table with the id of each of the materials. Then just use
Code: [Select]
if persistTable.GlobalTable.DirstMatTable[mat.id] then something like that should work
So it turns out that getting the layer and vein materials for a tile is non-trivial, but Milo wrote a Lua plugin to extract it.  But I'd also like to check if the just-mined-out tile has a boulder in it or not.  Spawning an "awakened stone" creature or a rough "hidden gem" will have a low probability per tile, so I might as well avoid the 1-in-4 tiles that mine out a boulder anyway.

Is there a straightforward check for an object at a given set of XYZ coordinates?  Since this will be checked the tick a tile was mined out, the only possible outcomes are empty and boulder.  Carved stairs, etc. are terrain features so they shouldn't interfere with the check.

If I get this to work, I won't need to have different versions of the inorganic file for different graphics packs.  The next step would be to find a tile that's universally applicable as a plant, and then there'd be no need to adjust for graphics packs at all.

Something like
Code: [Select]
if dhack.maps.getTileBlock(pos).occupancy[pos.x%16][pos.y%16].item thenwill tell you if the particular position has an item in it.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on June 26, 2015, 03:21:25 pm
Something like
Code: [Select]
if dhack.maps.getTileBlock(pos).occupancy[pos.x%16][pos.y%16].item thenwill tell you if the particular position has an item in it.
Thanks, this improved way of hiding things in the rock is coming along nicely.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 26, 2015, 04:46:01 pm
Hmmm, well, not sure if it would be easier to set up a faked item or try the projectile thing. Need to ask Putnam if he knows what any of those unk values do, who would have guessed that unk_30 was freaking attack velocity?

It seems that unk_3c is accuracy, or in some way related to the chance to hit. At 100 all of my custom attacks hit, at 0 all of my custom attacks missed.

Yeah, from the few tests I did it doesn't seem like any of the other unk values have anything to do with material or the like (which why would they since that information is stored in the attack_item_id and body_part_id. What I really need to do is find a way to get into what the actual attack action does (i.e. calculate momentum, shear costs, blah, blah, blah, calculate wound), but from my cursory check it doesn't look like we have a way to manipulate that.

Well, I do have an idea for a workaround now, but it might be pretty messy and have unforeseen consequences. Basically it is split into two parts, item attacks and body part attacks.

  • Item Attacks
    • Create appropriate item of desired material (or use equipped item)
    • Add an attack to the item raw with the desired contact/penetration/name/velocity
    • Add the attack action with all necessary inputs
    • Wait one tick for attack to be applied
    • Remove attack from item raw
    • Remove item (if not using an equipped item)
  • Body Part Attacks
    • Pick body part
    • Change the creature raw to use the desired material
    • Add attack to the creature raw with the desired contact/penetration/name/velocity
    • Add the attack action with all necessary inputs
    • Wait one tick for the attack to be applied
    • Remove attack from the creature raw
    • Revert material of creature raw

Now as far as I can see this should work fine, allowing for highly customisable attacks and such. The only downside is that for that one tick (or however long it needs to remain for the attack to be applied) all items/creatures of that type will have the change. Thoughts?

I really wish you could change an individual creatures material!

Well, I got it working for mostly for both items and body parts. Still not sure what some of the values do, but they don't seem to affect the outcome. It is interesting to note you can queue up as many attacks as you want and it will execute them all at once. I punched a goblin 100 times in the chest using very low velocity punches and watched the wounds accumulate (then once with a super velocity and watched him fly away). But be careful, each of those actions adds a bit of exhaustion. After punching 100 times my dwarf passed out from over exertion. I then changed the dwarf bone to slade and punched a bronze colossus 100 times smashing him into pieces (without the change to slade the attacks all bounced off).

Interestingly, shooting a crossbow doesn't seem to generate an action. And all attack actions assume you are adjacent to the enemy, so you can't use fake long range attacks without teleporting your attacker to the defender and then executing the attack or simply using the projectile script.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 26, 2015, 06:24:05 pm
Oh jesus, I'm kinda turned on thinking about what Putnam and Rumrusher will end up doing when they get their hands on that.

Holy fuckbats, you just confirmed the old "artifact weapons are more accurate" thing.

Steel artifake battle axe regular swings at easy/can't land squarely targets tends to give a value of around 271 at legendary+10 skill/fighter skill. Regular steel masterwork battle axe tends to range around 105~160 in similar conditions.

Precise attacks bumped it up to 330 something, multiple ATTACKS reduce the accuracy of the first attack pretty significantly, the others have less consistent and less noticeable reductions.

Now the interesting thing: attacking and dodging has no accuracy penalty, so, yeah, ku-fuckin-dos to you Roses and to Putnam as well, it's very nice knowing where those damn values sit for sure.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 27, 2015, 11:37:29 am
Awesome! Scriptable attacks are a great tool. I'm slightly concerned what would happen if the game saves during the one tick where things are weird but as long as that doesn't happen it should work fine.
Title: Re: DFHack 0.40.24-r3
Post by: elcr on June 27, 2015, 02:00:39 pm
Does anyone have a Linux build of DFHack 0.34.11-r5 lying around they could share? I can only find 0.34.11-r3 builds here (http://dethware.org/dfhack/download/), and only source packages are available on the GitHub releases page. (https://github.com/DFHack/dfhack/releases/tag/0.34.11-r5)
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on June 27, 2015, 02:07:22 pm
Releases made before we started uploading builds to GitHub are all on DFFD.
Edit:
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 27, 2015, 06:23:00 pm
Awesome! Scriptable attacks are a great tool. I'm slightly concerned what would happen if the game saves during the one tick where things are weird but as long as that doesn't happen it should work fine.

Now heres a question. What if I force a block action during a fight? Will it successfully block an attack?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 27, 2015, 07:08:45 pm
Don't see why not.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on June 27, 2015, 07:31:48 pm
I have no idea. I think at this point you and Urist_Davinci know the most about it.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 27, 2015, 07:45:54 pm
Weirdly enough, a block has accuracy and such under the attack entry but they don't seem to do anything from what I can tell. Can a block miss?
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on June 27, 2015, 08:04:54 pm
Does the shield's BLOCKCHANCE have an effect on it?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 27, 2015, 08:20:14 pm
Weirdly enough, a block has accuracy and such under the attack entry but they don't seem to do anything from what I can tell. Can a block miss?

the action data structures are a union, which means that it is a single chunk of memory that represents data for the action, of which only one sub whosit will be used.

the proper C++ documentation for unions should explain better.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 27, 2015, 09:56:15 pm
No, that makes sense.

Incidentally I tried poking in the dfhack irc about the angavrilov df.structures gui program but ya'll/them folks is dead or something.
Title: Re: DFHack 0.40.24-r3
Post by: elcr on June 28, 2015, 01:14:45 am
Releases made before we started uploading builds to GitHub are all on DFFD.
Edit:
  • GCC 4.9 build (http://dffd.bay12games.com/file.php?id=8681)
  • GCC 4.8 build (http://dffd.bay12games.com/file.php?id=8693)
Thank you.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on June 28, 2015, 09:11:30 pm
so finally got my hands on max's artifact crit weapon item and it seems this script can work with any attack or well
Code: [Select]
attks[k].data.attack.unk_30=99999999 I pancaked a guy with a single punch with this.
also you could set up a redirect target if you set the attack to mutli-hit then aim away from the target you wanted to hit.
don't know if this allows for say long range gut punches, but you could load up several high damaging attacks on a target then set each of those attacks to hit surrounding people with out having to look at them and pick a body part. got an idea of seeing it if's possible to hit 3 people with one punch attack.

this being said we gone far past OP and now just working on styling on units.
it's possible to say redirect an attack on you to hit someone else and cause infighting to kick off.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 28, 2015, 10:10:46 pm
Yeah, velocities much past 10000 are basically just over the top and dumb, thus my using them in Sparking.

Max got the unk_30 as velocity from Sparking IIRC
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 28, 2015, 10:41:26 pm
Yup, I was trying to make it work like you did except just for a few attack types like artifact weapons or whatnot. I'm still not good at getting eventful stuff working right so I just set up a direct use version to test with, which is surprisingly fun still.

Also submitted the changes to label them in df-structures and credited you and roses for working out the unk_30 and unk_3c effects.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 28, 2015, 10:52:01 pm
Note that the 999...99 value there isn't the max at all, I just went with it because it was faster than tracking how many 0's I had. Didn't you work out that the maximum attack velocity has like a jillion digits?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 28, 2015, 10:57:40 pm
Nono, the max is probably ~231 or ~232. The Sparking changes were because for some reason I didn't think that the persist numbers would work like Lua numbers. They do. My max ki value is ~21024 (to be more precise, ~2210), but I have it set up for unk_30 not to go more than 2,000,000,000. Lua numbers go up to 2^1024 because they're all double precision floats IIRC.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 28, 2015, 11:14:03 pm
Yeesh, and yeah past the 2.7 million point I recall unk_30 rolling over into negatives.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on June 29, 2015, 02:09:58 am
I just love the idea of redirecting attacks and the possible chance to not only avoid an attack but to launch said attack back at the opponent 20 times stronger.
(http://www.truimagz.com/host/fortcrush2/de/stop-hitting-your-self.png)
so yeah it's possible to set the attacking id to the same unit leading to self harm.
haven't seen what happens if you get a unit to charge after someone 3 tiles away, do they instantly warp over to there position or just fall over?
thought with dfhacking it's possible to launch.lua a man then while airborne punch him repeatedly.
to test this I guess someone needs to throw a unit at another unit then dfhack an attack action on the 'ball unit' with the 'batter unit'
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on June 29, 2015, 02:13:12 am
I posted that in ~august last year IIRC, me cutting my own head off with a sword

good fun
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on June 29, 2015, 05:30:17 am
I posted that in ~august last year IIRC, me cutting my own head off with a sword

good fun
So now we can mod in the astoundingly unsuccessful entrepreneur Cut Me Own Throat Dibbler.

More seriously, this sounds like it can simulate the martial artist who takes on several red shirts melee combatants as well as the wall-of-steel who deflects a silly number of incoming arrows with a weapon.  Good work!
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 29, 2015, 08:42:46 am
I just love the idea of redirecting attacks and the possible chance to not only avoid an attack but to launch said attack back at the opponent 20 times stronger.
(http://www.truimagz.com/host/fortcrush2/de/stop-hitting-your-self.png)
so yeah it's possible to set the attacking id to the same unit leading to self harm.
haven't seen what happens if you get a unit to charge after someone 3 tiles away, do they instantly warp over to there position or just fall over?
thought with dfhacking it's possible to launch.lua a man then while airborne punch him repeatedly.
to test this I guess someone needs to throw a unit at another unit then dfhack an attack action on the 'ball unit' with the 'batter unit'

When I was experimenting with attacks, they only applied to units directly next to the attacking unit. Even if I had it all set up correctly to attack a unit multiple tiles away, the game would just say "TARGET has moved away" or something like that. But you could combine the script with the teleport script and then be able to launch distant attacks.

EDIT: Interestingly enough this is only for body part attacks. It makes no check for where an item is when you attack. I had an elf in arena mode carrying a short sword on the right side of the map, and on the left side of the map I had a dwarf attack a goblin with that short sword. Note that this means an item just needs to be created, not carried in any way, to attack with. The combat report said "Dwarf 1 slashes Goblin 1 with her iron short sword"
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 29, 2015, 08:38:10 pm
I'm thinking someone could go about checking how many tiles away a target is and then say, limiting the ranges at which an effect applies, cross check it by weapon type, and probably produce a rather functional approximation of longer and shorter ranged melee weapons.

Pikes and whips reaching across two squares, great swords, poleaxes, mauls, spears, and such reaching across one square, and other weapons having the normal requirement of being directly adjacent to your target.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 29, 2015, 09:54:02 pm
Well further testing shows that it doesn't matter where the weapon is located on the map, but the attacking unit must be adjacent to the targeted unit for an attack to be applied. Now I am still working on how to apply wounds regardless of attack (using Urist Da Vinci's formulas), and indeed I have a working script for that, but it doesn't handle things like breaking a bone through a body part and into another body part, or any other fancy wound mechanics.

I wonder... I suppose I could make a copy of both attacker and defender off screen and next to each other, generate the attack, and then copy the wound from the simulated target to the real target. That would keep all the wound calculation on the same, in-game system, but allow for complex attacks. Of course it would also involve creating copies of attacker and defender for each such attack, and that might lead to it's own issues, not to mention erroneous reports/announcements. It's odd to me that firing/throwing an item has no associated action. I suppose once an item is turned into a projectile it is no longer a part of the action system and no behaves independently.

But I think, with the combined functionality of adding attacks to units, and simulating attacks using mathematical formulas, I should be able to come up with a decent, all around attacking system. Just have to test things out and see what the game thinks.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 30, 2015, 12:35:52 am
Oh yeah, forgot that requirement of an adjacent target... could you initialize the attack targeting yourself and then change it to the appropriate target?

God I can see some funny side effects of that.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 30, 2015, 12:34:48 pm
Oh yeah, forgot that requirement of an adjacent target... could you initialize the attack targeting yourself and then change it to the appropriate target?

God I can see some funny side effects of that.

Alas, that won't help. There is some sort of check in the actual mechanics of the attack that looks to see if the target has moved away (most likely to handle dodging properly). If we were able to hack into the attack code itself (not just the action but the full on number crunching code) we could apply long range attacks. But I'm not sure how feasible that is, and it is definitely beyond my capabilities. If one of the DFHack gods would like to look into it though it could be amazing.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on June 30, 2015, 05:42:49 pm
Spoiler (click to show/hide)

Edit: nevermind, just a field is missing in the class.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 30, 2015, 07:14:32 pm
Oh yeah, forgot that requirement of an adjacent target... could you initialize the attack targeting yourself and then change it to the appropriate target?

God I can see some funny side effects of that.

Alas, that won't help. There is some sort of check in the actual mechanics of the attack that looks to see if the target has moved away (most likely to handle dodging properly). If we were able to hack into the attack code itself (not just the action but the full on number crunching code) we could apply long range attacks. But I'm not sure how feasible that is, and it is definitely beyond my capabilities. If one of the DFHack gods would like to look into it though it could be amazing.
Wait wait wait, I'm going to poke at a couple of things later, but I was reminded of something while I was falling asleep.

So rumrusher made it so launch uses the hunt target to fling other units, the neat thing there is even if that target is nowhere near you, until you do an action that sets a hunt target you can keep tossing them around like a ragdoll, right?

Gonna have to mess around and see if you can set a hunt target and use that to bootstrap it back into an action target.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 30, 2015, 09:38:48 pm
Hmmm, no luck, was able to aim the targets just fine but still get the moved out of range problem.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on June 30, 2015, 10:02:32 pm
Hmmm, no luck, was able to aim the targets just fine but still get the moved out of range problem.

Yeah, I tried a couple different ways to try and work around the range issue, but I think it is just a fundamental part of the attack, to account for things like dodging or long build up attacks against extremely fast units. DFHack trickery will be required to circumvent this check.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 30, 2015, 10:09:41 pm
Yeah, though I realized I also misinterpreted what was said about the position of the weapon not mattering, I read it as hitting the elf with the sword, not the elf having the sword and using it from a distance to hit something beside you with it.

Is there a way to make a dummy target/attacker instead of having to copy them entirely?
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on June 30, 2015, 10:48:13 pm
uhh spawnunit a creature then delete said creature after testing works?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on June 30, 2015, 11:55:20 pm
I was trying to find where the actual "targetable for attacks" entry is but haven't had any luck yet, I figured maybe it would be possible to pull up a bare minimum which would allow an attack to be aimed without having to fully create a creature.
Title: Re: DFHack 0.40.24-r3
Post by: Iban on July 01, 2015, 11:37:21 am
How do I use Tiletypes to remove any floor and make it Open Space? I'm trying to clear tiles under bridges. I swear to god yo used to be able to channel under a closed bridge, but no more.
Title: Re: DFHack 0.40.24-r3
Post by: kane_t on July 01, 2015, 02:36:59 pm
I guess this is the thread for research?  If so, I think I found something that doesn't seem to be mentioned anywhere else.  Is the connection between the Recuperation attribute and dwarf obesity widely known?

I was trying to figure out why most of my starting dwarves had gotten severely obese by a couple years into the game, and had assumed it had something to do with all the lavish meals I was feeding them, so I looked around to see if there was any information on how weight gain works in Dwarf Fortress, and couldn't find anything.

I did a bit of research myself with dfhack, and found that the answer is that most of my starting dwarves have poor Recuperation.  While mining on a full stomach, a particular dwarf with 800 Recuperation will actually gain around 300 stored_fat every 150 ticks; the exact same dwarf with their Recuperation changed to 2200 will lose 1000 stored_fat every 150 ticks.  I strongly suspect that Recuperation determines a Dwarf's target stored_fat, and their weight loss/gain is modified to keep them near that target value.

A dwarf's job doesn't seem to impact this at all.  Miners who work flat out for years will still be fat if they have low Recuperation, while completely sedentary nobles will still be thin if they have high Recuperation.  And the game doesn't seem to differentiate types of food, either.

In case anyone finds it useful for testing, here's the script I used to monitor changes to dwarves' weight:
Code: [Select]
local utils = require 'utils'

validArgs = validArgs or utils.invert({ 'unit' })
local args = utils.processArgs({...}, validArgs)

local unit = nil

if args.unit and tonumber(args.unit) then
unit = df.unit.find(tonumber(args.unit))
else
print('No unit selected')
return
end

if unit == nil then print('Bad unit ID') return end

lastWeights = lastWeights or {}
local previousWeight = lastWeights[tonumber(args.unit)] or nil
local currentWeight = unit.counters2.stored_fat
lastWeights[tonumber(args.unit)] = currentWeight

local output = dfhack.TranslateName(dfhack.units.getVisibleName(unit)) .. ': weight=' .. currentWeight
if previousWeight ~= nil then output = output .. ' (' .. (currentWeight - previousWeight) .. ')' end
output = output .. ' job='
if unit.job.current_job == nil then
output = output .. 'No Job'
else
output = output .. dfhack.job.getName(unit.job.current_job)
end

output = output .. ' content=' .. unit.counters2.stomach_content .. ' food=' .. unit.counters2.stomach_food

print(output)

Takes a unit ID and prints their weight, stomach_content, and stomach_food, as well as the weight change since the script was last called for that unit.  Works well with the repeat script set to a tick interval.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on July 01, 2015, 06:40:17 pm
Well that's a fascinating discovery belarded with hanging sacks of neat.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on July 01, 2015, 07:17:05 pm
...So recuperation is somewhat of a metabolism stat? Huh.
Title: Re: DFHack 0.40.24-r3
Post by: kane_t on July 01, 2015, 07:48:15 pm
...So recuperation is somewhat of a metabolism stat? Huh.

It would appear so!  I had to put my current fort on hold for a few days, but when I get back to it on the weekend I'm going to set each of my starting dwarves to a different Recuperation value, and see if after a few months the stored_fat values they've settled on form a nice line.  That should either verify or disprove my theory that Recuperation is the main thing that determines a dwarf's weight.

Oddly enough, I also checked Immoderation, to see if it was related, but there's no correlation in my fort between Immoderation and fatness.  Either that personality trait doesn't currently influence dwarves to gluttony, or the effect of Recuperation dominates the effect of overeating.  For the record, from what I can tell every meal and drink adds ~50,000 to a dwarf's stomach_contents, and that seems to always reduce by 750 per 150 ticks (5 per tick).
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on July 01, 2015, 09:27:14 pm
wait is it possible to dfhack 2 civs into a war?
Title: Re: DFHack 0.40.24-r3
Post by: someone12345 on July 03, 2015, 02:19:04 am
How do you work at a building with advfort? I have made a workshop, but do not know how to perform reactions in it.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on July 03, 2015, 04:08:02 am
Hit tab?
Title: Re: DFHack 0.40.24-r3
Post by: someone12345 on July 03, 2015, 04:35:34 am
It does nothing except cause Site:Ilolum to show up in the top left corner, below the line discussing the job (R CarveFortification T).
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on July 03, 2015, 09:42:13 am
When you stand in the workshop it doesn't add Tab to open workshop window to the right of the job selection (R stuff T) line?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on July 03, 2015, 09:58:22 am
It does nothing except cause Site:Ilolum to show up in the top left corner, below the line discussing the job (R CarveFortification T).
Are you using TwbT?
Title: Re: DFHack 0.40.24-r3
Post by: someone12345 on July 04, 2015, 01:50:03 am
Yes, I am using TWBT. I know that causes a black screen, but advfort still works, as I was able to dig and build the workshop.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on July 04, 2015, 07:53:43 am
 that would explain it as Advfort boots up a menu which might break TWBT transparency settings, guessing from your scenario.
though on the subject of Advfort how far are we with jobs that we can tell a unit in adventurer mode to repeatly do a job forever?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on July 04, 2015, 05:01:22 pm
I can't help but picture some horrific adventurer-children child labor camp involving cats and bone extraction.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on July 05, 2015, 08:58:19 pm
Just had a chuckle at one of the snippets in the script I'm forging at the moment.  The Rube-Goldbergness of it is positively Dwarven.

df.global.world.raws.inorganics[dfhack.matinfo.find(hiddenGem_list[GetLayerMat(pos)]).index].material.state_name.Solid

It's really that complicated to get the name of a mineral?  This game has a Mandelbrot fractal quality to it, that it feel Dwarven at any scale from overview to microscopic.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on July 05, 2015, 10:16:02 pm
Just had a chuckle at one of the snippets in the script I'm forging at the moment.  The Rube-Goldbergness of it is positively Dwarven.

df.global.world.raws.inorganics[dfhack.matinfo.find(hiddenGem_list[GetLayerMat(pos)]).index].material.state_name.Solid

It's really that complicated to get the name of a mineral?  This game has a Mandelbrot fractal quality to it, that it feel Dwarven at any scale from overview to microscopic.

Pretty sure just dfhack.matinfo.find(hiddenGem_list[GetLayerMat(pos)]).material.state_name.Solid would work
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on July 06, 2015, 04:38:23 am
I guess this is the thread for research?  If so, I think I found something that doesn't seem to be mentioned anywhere else.  Is the connection between the Recuperation attribute and dwarf obesity widely known?

I was trying to figure out why most of my starting dwarves had gotten severely obese by a couple years into the game, and had assumed it had something to do with all the lavish meals I was feeding them, so I looked around to see if there was any information on how weight gain works in Dwarf Fortress, and couldn't find anything.

I did a bit of research myself with dfhack, and found that the answer is that most of my starting dwarves have poor Recuperation.  While mining on a full stomach, a particular dwarf with 800 Recuperation will actually gain around 300 stored_fat every 150 ticks; the exact same dwarf with their Recuperation changed to 2200 will lose 1000 stored_fat every 150 ticks.  I strongly suspect that Recuperation determines a Dwarf's target stored_fat, and their weight loss/gain is modified to keep them near that target value.

A dwarf's job doesn't seem to impact this at all.  Miners who work flat out for years will still be fat if they have low Recuperation, while completely sedentary nobles will still be thin if they have high Recuperation.  And the game doesn't seem to differentiate types of food, either.

In case anyone finds it useful for testing, here's the script I used to monitor changes to dwarves' weight:
Code: [Select]
local utils = require 'utils'

validArgs = validArgs or utils.invert({ 'unit' })
local args = utils.processArgs({...}, validArgs)

local unit = nil

if args.unit and tonumber(args.unit) then
unit = df.unit.find(tonumber(args.unit))
else
print('No unit selected')
return
end

if unit == nil then print('Bad unit ID') return end

lastWeights = lastWeights or {}
local previousWeight = lastWeights[tonumber(args.unit)] or nil
local currentWeight = unit.counters2.stored_fat
lastWeights[tonumber(args.unit)] = currentWeight

local output = dfhack.TranslateName(dfhack.units.getVisibleName(unit)) .. ': weight=' .. currentWeight
if previousWeight ~= nil then output = output .. ' (' .. (currentWeight - previousWeight) .. ')' end
output = output .. ' job='
if unit.job.current_job == nil then
output = output .. 'No Job'
else
output = output .. dfhack.job.getName(unit.job.current_job)
end

output = output .. ' content=' .. unit.counters2.stomach_content .. ' food=' .. unit.counters2.stomach_food

print(output)

Takes a unit ID and prints their weight, stomach_content, and stomach_food, as well as the weight change since the script was last called for that unit.  Works well with the repeat script set to a tick interval.

Very interesting! Thank you.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on July 06, 2015, 11:17:23 am
Pretty sure just dfhack.matinfo.find(hiddenGem_list[GetLayerMat(pos)]).material.state_name.Solid would work
I was pretty sure there was a more efficient way to summon the name, but what you saw reflected the path I followed to find it.  And it has twice as many dots as your way ;)
Title: Re: DFHack 0.40.24-r3
Post by: ChairmanPoo on July 07, 2015, 12:13:43 pm
How do you install this thing again?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on July 07, 2015, 12:41:50 pm
First post:
How to install DFHack:
  • First, get the archive meant for your system. Extract the contents into your DF folder.
  • On Windows, you're ready to use DFHack. An extra command line window should appear when you run DF.
  • On Linux, use the 'dfhack' script from a terminal to run DF with DFHack. If you have stonesense problems, you might have to get your own allegro 5 libraries and delete the ones in stonesense/deplibs.
(The "Linux" instructions apply to OS X too.)
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on July 12, 2015, 05:41:31 pm
Where can I trigger rage in gm-editor?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on July 12, 2015, 06:56:09 pm
Where can I trigger rage in gm-editor?
It depends on your tolerance for meat-and-potatoes interfaces.  I get most enraged when dealing with the bits about materials...

Oh you meant for an in-game creature?  I'd like to know the answer to that, too.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on July 12, 2015, 07:46:20 pm
Yeah, in-game. I want to see if an angry GCS will web when a calm one will not.
Title: Re: DFHack 0.40.24-r3
Post by: Atomic Chicken on July 13, 2015, 05:35:36 am
Where can I trigger rage in gm-editor?
Select the unit, open gm-editor, select "counters".
Set "soldier_mood" to 1 (Enraged)
Now enter a value for "soldier_mood_countdown" to determine how long the rage will last (each figure is equal to one tick, if I remember correctly).
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on July 13, 2015, 07:32:15 am
thanks
Title: Re: DFHack 0.40.24-r3
Post by: tahu16 on July 13, 2015, 09:44:34 am
Hello! I'm not sure that this is the right place to report this bug, but still, here is my problem:
Any time when I'm using one of the "rendermax" commands, the game instantly crashes in fortress mode, right after I press ENTER in the DFHack window(or after I enter in the fortress mode). I'm not using any mods. Do I have any hope to use this command?

https://github.com/DFHack/dfhack#rendermax (https://github.com/DFHack/dfhack#rendermax)

Title: Re: DFHack 0.40.24-r3
Post by: lethosor on July 13, 2015, 10:13:45 am
Are you using TwbT?
Title: Re: DFHack 0.40.24-r3
Post by: tahu16 on July 13, 2015, 11:32:30 am
I forgot to say: I use 40_24 Starter Pack r13 whit Phoebus tileset.
Yes: I'm using TwbT.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on July 13, 2015, 11:48:03 am
TwbT breaks rendermax, unfortunately (and several other plugins as well).
Title: Re: DFHack 0.40.24-r3
Post by: tahu16 on July 13, 2015, 11:54:24 am
I replaced [PRINT_MODE:TwbT] whit [PRINT_MODE:STANDARD] just as you said in the original thread of the mod. Now it works.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on July 24, 2015, 05:52:38 am
hmm is it possible to say send an attack to a spawn unit for the purpose of copying that attack and sending that unit to attack to a far away opponent by teleporting it?
if you need to be adjacent to the opponent you want to mega punch then it should be possible to send a dummy unit to do the blow for you then delete the unit after the assault. 
Title: Re: DFHack 0.40.24-r3
Post by: Roses on July 24, 2015, 06:03:17 am
hmm is it possible to say send an attack to a spawn unit for the purpose of copying that attack and sending that unit to attack to a far away opponent by teleporting it?
if you need to be adjacent to the opponent you want to mega punch then it should be possible to send a dummy unit to do the blow for you then delete the unit after the assault.

That is basically what I was thinking. Although my idea was to make two dummy units off screen one attacker and one defender, then stimulate the attack and move the wound to the real target. Although it might be better to just teleport the units together attack then teleport back. But yes, you can force an attack action with specified values. I even wrote a script for it, but it's not publish worthy yet
Title: Re: DFHack 0.40.24-r3
Post by: Spleenling on July 24, 2015, 10:40:54 pm
Is there a way to make DF Hack kill a specific entity? I have an annoying glitched out werewolf that won't leave but don't want to kill every werewolf in existence.

Note: I am using Masterwork V6.2.7
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on July 24, 2015, 10:42:12 pm
exterminate him
Title: Re: DFHack 0.40.24-r3
Post by: RailroadRider on July 25, 2015, 03:24:46 am
Is there a way I can give a unit a syndrome from the console?
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on July 25, 2015, 03:54:38 am
modtools/add-syndrome
Title: Re: DFHack 0.40.24-r3
Post by: Meph on July 25, 2015, 09:05:53 am
Create plants seems to work and I can plant saplings, but trying to grow them just makes them turn into dead saplings.

Is there any way with dfhack to plant actual trees, aka plants that block vision/paths? I'm thinking about naturally grown walls for elves.

EDIT: Unrelated: HFS-Pit seems broken.

[DFHack]# hfs-pit 1 0 0
...\Dwarf Fortress\hack\scripts/hfs-pit.lua:23: Cannot read field world.T_cur_savegame.map_features: not found.
stack traceback:
        [C]: in function '__index'
        ...\Dwarf Fortress\hack\scripts/hfs-pit.lua:23: in mainchunk
        (...tail calls...)
Title: Re: DFHack 0.40.24-r3
Post by: Schilcote on July 28, 2015, 02:08:28 pm
Sorry if this is discussed earlier, I only looked back three pages.

I have a fort that crashes on load (the black screen right after the loading progress bars disappear and right before the game proper begins) with DFhack enabled - but loads perfectly fine without DFHack. I'm toggling DFHack on and off through the PyLNP launcher. I've tried menu-saving and loading (I use quicksave a lot, since the game crashes a lot) and that doesn't help. I do have TWBT turned on. Maybe that's the reason? I have workflow turned off, since I've heard that has issues. What logs and such do you need to diagnose this?

This self-extracting save archive (http://dffd.bay12games.com/file.php?id=11015) should contain the issue (this save is from a succession game).
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on July 28, 2015, 03:27:23 pm
I'd try disabling TwbT first. If that doesn't work, try running "unload all" before loading the world, which should unload all plugins.
Title: Re: DFHack 0.40.24-r3
Post by: Teneb on July 28, 2015, 03:50:58 pm
I am probably just missing something, but in the 0.34.x DFHack versions, there was, unless I am very mistaken, a script to assign specific pets to specific entities (it was used by Masterwork, I think). Does it still exist in any form (and, if so, what is the current name)?
Title: Re: DFHack 0.40.24-r3
Post by: Boltgun on July 29, 2015, 03:40:27 am
I am probably just missing something, but in the 0.34.x DFHack versions, there was, unless I am very mistaken, a script to assign specific pets to specific entities (it was used by Masterwork, I think). Does it still exist in any form (and, if so, what is the current name)?

Yes, pick your choice among the Add*ToCiv :
https://github.com/Devduweb/DF-succubus/tree/master/succubus-prod/raw/scripts

Example of use in an onLoad.init. (https://github.com/Devduweb/DF-succubus/blob/master/succubus-prod/raw/onLoad.init#L23)
Title: Re: DFHack 0.40.24-r3
Post by: catvanbrian on July 29, 2015, 11:09:12 am
how do I spawn a titan or anything that is a creature with spawn-unit because it did not work (I Put in spawn-unit UNICORN last time I did it). also can you give me an example of how to spawn a titan as well please
Title: Re: DFHack 0.40.24-r3
Post by: Teneb on July 29, 2015, 11:32:56 am
I am probably just missing something, but in the 0.34.x DFHack versions, there was, unless I am very mistaken, a script to assign specific pets to specific entities (it was used by Masterwork, I think). Does it still exist in any form (and, if so, what is the current name)?

Yes, pick your choice among the Add*ToCiv :
https://github.com/Devduweb/DF-succubus/tree/master/succubus-prod/raw/scripts

Example of use in an onLoad.init. (https://github.com/Devduweb/DF-succubus/blob/master/succubus-prod/raw/onLoad.init#L23)
Many thanks. I'll probably be back with more questions later since I still don't know much about integrating DFHack into mods.
Title: Re: DFHack 0.40.24-r3
Post by: GrizzlyAdamz on July 31, 2015, 08:33:21 am
Hey, is there a 'Current version scripts list' floating around anywhere?

Looking for something that would let me switch between units in adv mode & change race and/or skills & attributes.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on July 31, 2015, 08:36:18 am
Warmist is working on a unit editor that I believe supports skills and attributes (or will in the future).
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on July 31, 2015, 08:44:46 am
A less human-hostile frontend, in any case. Pretty much most of everything or thereabouts are accessible through lua or gui/gm-editor as is, it's just a bitch to alter anything by hand.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on July 31, 2015, 08:59:12 am
Are there any plans for a new DFHack release soon?  It's already the longest changelog in years, and there's a lot of stuff in there I'd like to be the default before Meph reboots Masterwork in a month or so.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on July 31, 2015, 09:44:14 am
There's a rough list here (https://github.com/DFHack/dfhack/milestones/0.40.24-r4) of things I'd like to see finished, and expwnent wants to finish his create-unit script. I'm not aware of any changes that would affect MDF, though, so Meph ought to be able to update MDF's version of DFHack without too much trouble if it's necessary. I'm a bit hesitant to base DFHack releases around the development cycle of one mod.

Also, changelog length isn't a great metric because we only recently started listing all changes and bugfixes (well, "recent" being at some point in the 0.40 series, so 0.40.24-r3/r4 are probably the largest releases since then).
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on July 31, 2015, 10:16:38 am
There's a rough list here (https://github.com/DFHack/dfhack/milestones/0.40.24-r4) of things I'd like to see finished, and expwnent wants to finish his create-unit script. I'm not aware of any changes that would affect MDF, though, so Meph ought to be able to update MDF's version of DFHack without too much trouble if it's necessary. I'm a bit hesitant to base DFHack releases around the development cycle of one mod.

Also, changelog length isn't a great metric because we only recently started listing all changes and bugfixes (well, "recent" being at some point in the 0.40 series, so 0.40.24-r3/r4 are probably the largest releases since then).

Fair enough.  I only mentioned MW because I've dealt with more version-based issues than I want to before, even if it's just working out what the interface on something should look like.  For my own sake, there's some stuff I won't have to maintain or document anymore (currently manually pulled from the develop branch).  The other metrics I checked were the master - develop diff, which seems pretty significant, and closed issues and pulls.

I do think a release soon would be good though, and there can always be another when the next round of work is done...
Title: Re: DFHack 0.40.24-r3
Post by: GrizzlyAdamz on August 01, 2015, 12:36:02 pm
Hey guys, I don't suppose anyone's made a 'fog of war' mod for fortress mode?

Coming here from the archaeology thread, (again), figured FoW would make fortress-mode expeditions more immersive, (and all-around better than adv-mode expeditions).

btw thanks letho & scam.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on August 03, 2015, 07:03:25 am
Did you know it's possible to do

Code: [Select]
w=dfhack.gui.getCurViewscreen() ; w.child=df.viewscreen_legendsst:new() ; dfhack.gui.getCurViewscreen().parent=w

and get a fully functional Legends screen? There was couple question about how to get more info about outer world recently. The only thing you can't use ESC to close the screen, instead, use

Code: [Select]
dfhack.gui.getCurViewscreen().breakdown_level=2

Someone needs to make a convenient script, if there's no already.

Can somebody do this?  I can even use exportlegends.lua as usual!  It's amazing  :D
Title: Re: DFHack 0.40.24-r3
Post by: Roses on August 04, 2015, 05:27:55 pm
Question about lua programming.

So I know you can create functions like normal where you have a fixed number of variables and variable positions
Code: [Select]
function func(arg1,arg2,arg3)
 blah
end

func(X,Y,Z)

And you can create functions that use keyword like arguments
Code: [Select]
function func(options)
 name = options.name or 'this is a name'
 blah = options.blah or 'this is blah'
end

func{name='foo',blah='bar'}

But can you create functions that combine these two? For instance, could I do
Code: [Select]
function func(arg1,arg2,arg3,options)
 blah
 name = options.name
end

func(X,Y,Z,{name = 'name'})

Basically I am wondering if you can simulate functions with keyword arguments like in Python (and other programming languages)
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on August 04, 2015, 05:58:57 pm
Lua's keyword-like function parameters are not given any special privileges like in, say, Python. They are nothing more than tables. The function{foo=bar} syntax is just syntactic sugar for function({foo=bar}).
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 04, 2015, 07:02:50 pm
That last example you gave is valid, by the way.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on August 09, 2015, 04:07:37 pm
I asked in the general modding thread and got no reply, so I'm guessing this is a DFHack thing or impossible.  Can a creature (or creature class) be made especially vulnerable to a specific weapon?  In this case I'm working on a stone megabeast, and for flavor reasons I'd like them to take extra damage from picks.

If it works out nicely I might back-port it into The Earth Strikes Back as well.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on August 09, 2015, 04:17:55 pm
no

it should be possible to do it with DFHack... but it would probably be using the onAction event so that the velocity can be increased on that particular enemy
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on August 09, 2015, 07:25:39 pm
I figured it would be something like that.  Might do it anyway if there's a simple way to reference the creature class of the target, plus either filter events on the weapon type or reference that during the attack.  Shouldn't be too bad a hit on FPS.

For a completely unrelated feature, is there a way to wink an item out of existence?  My vision for the megabeast is to "animate" nearby boulders, which really means destroying the boulder and spawning a creature in the same tile.  The creature then has a corpse item of that kind of boulder to keep everything logical.
Title: Re: DFHack 0.40.24-r3
Post by: Atomic Chicken on August 14, 2015, 08:20:13 am
Just thought I'd point out the significance of a few minor unlabelled things I noticed whilst using gm-editor:

unit.flags3
Spoiler (click to show/hide)

df.global.ui_advmode
Spoiler (click to show/hide)

unit.inventory[y]
Spoiler (click to show/hide)

df.world.nemesis.all[y].figure.info.relationships.anon_1[z]
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 14, 2015, 08:27:22 am
Thanks! That sort of thing is good to mention here (https://github.com/DFHack/df-structures/issues) as well, but I'll get those added.
Title: Re: DFHack 0.40.24-r3
Post by: Severedicks on August 14, 2015, 09:37:34 am
Getting an error at compile time on remotefortressreader.cpp:
Spoiler (click to show/hide)
despite having updated RemoteFortressReader.proto, did I miss anything?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 14, 2015, 09:43:42 am
library/xml on the develop branch isn't pointing to the latest df-structures commit with those enum names added.

Edit: it's up-to-date now.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on August 14, 2015, 09:54:07 am
Is there a way to delete thoughts via gm-editor? Bastiongate has a bunch of dwarves with bugged vengeful thoughts that might cause disaster.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 14, 2015, 09:56:29 am
Alt+d should work. You can press ? for a (hopefully) full list of keybindings.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on August 14, 2015, 11:00:59 am
Thanks. You're a lifesaver. My dwarves were starting to tantrum. It's one thing to lose a beloved fort, but it's another to lose said fort to a stupid bug.
Title: Re: DFHack 0.40.24-r3
Post by: Rose on August 14, 2015, 11:14:28 am
Does anybody know what the biome numbers mean in world_region_details? Or at least how to get the biome info in general?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on August 14, 2015, 02:53:07 pm
Thanks. You're a lifesaver. My dwarves were starting to tantrum. It's one thing to lose a beloved fort, but it's another to lose said fort to a stupid bug.

thoughts AFAIK don't cause stress after they're initially created, so I don't think deleting the thought will help; what you want to do is edit stress directly.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on August 14, 2015, 05:10:21 pm
For a completely unrelated feature, is there a way to wink an item out of existence?  My vision for the megabeast is to "animate" nearby boulders, which really means destroying the boulder and spawning a creature in the same tile.  The creature then has a corpse item of that kind of boulder to keep everything logical.

If you look at the autodump plugin you should be able to figure it out. There's a flag you have to set but I forget which one. Hopefully you won't mind waiting one frame for it to disappear.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 14, 2015, 05:19:21 pm
Code: [Select]
            itm->flags.bits.garbage_collect = true;
Title: Re: DFHack 0.40.24-r3
Post by: Scoops Novel on August 15, 2015, 06:52:45 am
How can i make a program read the games output through DFhack?
Title: Re: DFHack 0.40.24-r3
Post by: Rose on August 15, 2015, 07:00:00 am
Which output?
Title: Re: DFHack 0.40.24-r3
Post by: Scoops Novel on August 15, 2015, 07:12:04 am
the descriptions.
Title: Re: DFHack 0.40.24-r3
Post by: Rose on August 15, 2015, 08:07:23 am
There's a script called forum-dwarves that outputs the descriptions to a text file with bbcode for colors.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 15, 2015, 08:20:40 am
The "markdown" script would probably also work, and I'm working on another script that'll support more formats.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on August 15, 2015, 10:56:48 am
For a completely unrelated feature, is there a way to wink an item out of existence?  My vision for the megabeast is to "animate" nearby boulders, which really means destroying the boulder and spawning a creature in the same tile.  The creature then has a corpse item of that kind of boulder to keep everything logical.

If you look at the autodump plugin you should be able to figure it out. There's a flag you have to set but I forget which one. Hopefully you won't mind waiting one frame for it to disappear.

Code: [Select]
            itm->flags.bits.garbage_collect = true;

Thanks!
Title: Re: DFHack 0.40.24-r3
Post by: Dozebôm Lolumzalìs on August 15, 2015, 02:07:53 pm
I wasn't sure where to post this, so I'll do it here as well as on Putnam's thing.  Yes, I am a complete newb.

Whenever I force a siege with modtools/force -CivAttack -EVIL, it says this:

...1.03_\DWARFF~1\Dwarf Fortress 0.40.24\hack\lua\utils.lua:595: error: invalid
arg: 1: CivAttack
stack traceback:
        [C]: in function 'error'
        ...1.03_\DWARFF~1\Dwarf Fortress 0.40.24\hack\lua\utils.lua:595: in func
tion 'processArgs'
        ...1\Dwarf Fortress 0.40.24/hack/scripts/modtools/force.lua:25: in funct
ion 'f'
        ....03_\DWARFF~1\Dwarf Fortress 0.40.24\hack\lua\dfhack.lua:461: in func
tion <....03_\DWARFF~1\Dwarf Fortress 0.40.24\hack\lua\dfhack.lua:425>
        (...tail calls...)
Title: Re: DFHack 0.40.24-r3
Post by: fricy on August 15, 2015, 02:27:11 pm
Whenever I force a siege with modtools/force -CivAttack -EVIL, it says this:
...1.03_\DWARFF~1\Dwarf Fortress 0.40.24\hack\lua\utils.lua:595: error: invalid
Forcing a siege doesn't work in DF 40.01+, because army movements were changed by Toady, and nobody nows how to spawn an invading army (yet).
You can beta-test the create-unit script (http://www.bay12forums.com/smf/index.php?topic=152119.0) for the same(ish) feature.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on August 15, 2015, 08:29:18 pm
Putnam and I have had very limited success with hijacking existing armies and teleporting them to your fort. It's still really fiddly and not easily scripted though.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on August 15, 2015, 08:32:30 pm
Ludicrously fiddly. Last I tried it, I moved every army in the world to my fort and didn't get an invasion.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 15, 2015, 08:43:56 pm
Meaning in or next to your fort?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on August 15, 2015, 09:10:30 pm
Next to moving into.
Title: Re: DFHack 0.40.24-r3
Post by: Scoops Novel on August 16, 2015, 01:05:48 am
I'll also need to read the combat log.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on August 16, 2015, 01:25:49 am
Ludicrously fiddly. Last I tried it, I moved every army in the world to my fort and didn't get an invasion.
Yeah, it's really freaking tricky, I know I got one to work, as did Putnam, but there is still something missing about the way an army determines if it is invading or not which still needs to be found.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on August 16, 2015, 11:33:50 am
Ludicrously fiddly. Last I tried it, I moved every army in the world to my fort and didn't get an invasion.
Yeah, it's really freaking tricky, I know I got one to work, as did Putnam, but there is still something missing about the way an army determines if it is invading or not which still needs to be found.
Toady mentioned that armies actively avoid a player's embark site unless invading.  For one thing, the time-dilation of fort mode would slow down an army that's just passing through.  And for another, it'd absolutely destroy the game's FPS.  So even if an army is told its next step is an embark tile, there's probably a check to see if they're invading or not.

There are some who can peer at disassemblies and intuit what the program is doing.  I am not one of those people :)
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on August 16, 2015, 01:35:48 pm
Ludicrously fiddly. Last I tried it, I moved every army in the world to my fort and didn't get an invasion.
Yeah, it's really freaking tricky, I know I got one to work, as did Putnam, but there is still something missing about the way an army determines if it is invading or not which still needs to be found.
For one thing, the time-dilation of fort mode would slow down an army that's just passing through.

Nah, I checked, they move an army tile (1/3 of an embark tile) about every 10-50 ticks, ridiculously quickly.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 16, 2015, 03:21:58 pm
Right, but an army passing through your fort would move much slower.
Title: Re: DFHack 0.40.24-r3
Post by: Nopenope on August 16, 2015, 03:56:56 pm
Rendermax won't work with the Linux version of dfhack, even without TWBT, even using the freshly compiled build. When typing "rendermax light" the prompt hangs and I have to kill DF manually. Does anyone have the same issue?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 16, 2015, 05:40:22 pm
It's worked fine for me. I really can't understand why the prompt would hang when running that command, since it does so little. Does DF still respond? What happens if you run "lua ~df.global.enabler.renderer"?
Title: Re: DFHack 0.40.24-r3
Post by: Atomic Chicken on August 18, 2015, 04:30:41 am
How do I designate a specific tile for mining, given its x,y,z coordinates? (for a script I'm working on)
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 18, 2015, 05:35:18 am
Take a look at dfhack.maps.getTileBlock(x, y, z).designation[x%16][y%16]
Title: Re: DFHack 0.40.24-r3
Post by: Atomic Chicken on August 18, 2015, 08:55:43 am
Take a look at dfhack.maps.getTileBlock(x, y, z).designation[x%16][y%16]
That worked great, thanks!
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on August 18, 2015, 10:10:28 am
Take a look at dfhack.maps.getTileBlock(x, y, z).designation[x%16][y%16]

or
local designation,occupancy = dfhack.maps.getTileFlags(coords)
and just change what you want, it works because it returns a reference to the tile flags.
Title: Re: DFHack 0.40.24-r3
Post by: Nopenope on August 18, 2015, 11:16:10 am
It's worked fine for me. I really can't understand why the prompt would hang when running that command, since it does so little. Does DF still respond? What happens if you run "lua ~df.global.enabler.renderer"?

DF still responds, only DFHack hangs. Here's the output from the lua command:
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: Marza on August 18, 2015, 06:03:53 pm
Hey all, I'm trying to write a script that would force all underground tree variants to start growing as discovering three cavern layers is not a guarantee to obtaining all the underground tree types. I'm not a very script savvy person, so I looked around and tried to copy and adapt this (http://www.bay12forums.com/smf/index.php?topic=135258.msg4894288#msg4894288) code for starting Nethercap growth:

Code: [Select]
feat = df.global.world.cur_savegame.map_features[2]
num = #feat.feature.population
feat.feature.population:insert('#', { new = df.world_population, type = df.world_population_type.Tree, plant = dfhack.matinfo.find('PLANT:NETHER_CAP').index });
for i,j in pairs(df.global.world.populations) do if (j.population.cave_id == feat.layer and j.population.population_idx == num - 1) then df.global.world.populations:insert('#', { new = df.local_population, type = df.world_population_type.Tree, plant = dfhack.matinfo.find('PLANT:NETHER_CAP').index, population = {region_x = j.population.region_x, region_y = j.population.region_y, population_idx = num, cave_id = feat.layer, depth = feat.start_depth, unk_28 = -1 } } ) end end

However running that particular script returns the following error from DFHack:

Cannot read field world.T_cur_savegame.map_features: not found.
stack traceback:
[C]: in function '_index'
TreeScript.lua:1: in main chunk
[C]: in function 'safecall'
...DF/hack/scripts/lua.lua:11: in function 'f'
...DF\hack\lua\dfhack.lua:461: in function <...DF\hack\lua\dfhack.lua:425>
(...tail calls...)

It's all greek to me, but I guess DFHack doesn't like this script written from over a year and a half ago. Anyone point me in the right direction?
Title: Re: DFHack 0.40.24-r3
Post by: Atomic Chicken on August 19, 2015, 07:38:43 am
Spoiler (click to show/hide)
Didn't know this either, thanks!

Spoiler (click to show/hide)
At first glance,
Code: [Select]
feat = df.global.world.cur_savegame.map_features[2] is outdated and needs to be changed to
Code: [Select]
feat = df.global.world.features.map_features[2]
That should at least get rid of the error.
Title: Re: DFHack 0.40.24-r3
Post by: Marza on August 19, 2015, 03:55:22 pm
That fixed it, thanks!
Title: Getting started.
Post by: Morcaster on August 19, 2015, 10:10:09 pm
I'm looking forward to creating a GUI like dwarf therapist, where should I get started?
Title: Re: Getting started.
Post by: smakemupagus on August 19, 2015, 11:54:00 pm
I'm looking forward to creating a GUI like dwarf therapist, where should I get started?

Study Dwarf Therapist's code and learn how it works, then join the project or begin your own.
Title: Re: Getting started.
Post by: Warmist on August 20, 2015, 12:03:26 am
I'm looking forward to creating a GUI like dwarf therapist, where should I get started?

Study Dwarf Therapist's code and learn how it works, then join the project or begin your own.
Note- there is also dwarf manipulator in dfhack. Two versions even (one C++ and other lua). You can study them too.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on August 20, 2015, 11:51:25 am
By any chance, is there a script or function to fill in all of the ancillary values when you change a creature's size?  Something to keep the surface area, blood volume, etc. in sync.  Or is there a size adjustment function buried in DF itself that causes all of these to recalculate?
Title: Re: DFHack 0.40.24-r3
Post by: Geltor on August 20, 2015, 12:57:31 pm
is it possible to hack a plugin where dfhack handles adventure mode's drinking and eating needs without any player intervention? all the player has to do is supply them of course
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on August 21, 2015, 09:47:38 pm
If someone makes it and doesn't name it lifesupport I will KILL.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on August 21, 2015, 09:48:42 pm
By any chance, is there a script or function to fill in all of the ancillary values when you change a creature's size?  Something to keep the surface area, blood volume, etc. in sync.  Or is there a size adjustment function buried in DF itself that causes all of these to recalculate?
Uhhhh.

I know the body part modifiers under appearance do a lot of that stuff smoothly.
Title: Re: DFHack 0.40.24-r3
Post by: Atomic Chicken on August 22, 2015, 05:08:44 am
Was there a reliable way to obtain the x,y,z coordinates of the target LOCATION of an interaction (considering that you are not targeting a unit)?
Title: Re: DFHack 0.40.24-r3
Post by: Roses on August 24, 2015, 10:54:57 am
Anyone know what happens when you try and use the function dfhack.items.createItem() without a creator? Can't run DF right now so can't check myself. If it crashes, is there anyway to make it so that it doesn't crash?
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on August 24, 2015, 10:58:01 am
Anyone know what happens when you try and use the function dfhack.items.createItem() without a creator? Can't run DF right now so can't check myself. If it crashes, is there anyway to make it so that it doesn't crash?
Either it crashes or it does not work at all (i.e. emits an error message).
This is because it uses df own functions (namely reaction products IIRC) and it needs unit for it to work. You can make your own createItem for subset of items (e.g. I did one for heart tearing out script, just because these reactions do not support body parts). For a general use case it would be lot's of work...
Title: Re: DFHack 0.40.24-r3
Post by: Roses on August 24, 2015, 11:02:31 am
Anyone know what happens when you try and use the function dfhack.items.createItem() without a creator? Can't run DF right now so can't check myself. If it crashes, is there anyway to make it so that it doesn't crash?
Either it crashes or it does not work at all (i.e. emits an error message).
This is because it uses df own functions (namely reaction products IIRC) and it needs unit for it to work. You can make your own createItem for subset of items (e.g. I did one for heart tearing out script, just because these reactions do not support body parts). For a general use case it would be lot's of work...

Good to know. I suppose it would be possible to select a random creator and then set the created_by flag (or whatever it is called) to -1. I actually don't think it is a big deal as I will almost always have a creator, was just wondering what would happen if I didn't.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on August 24, 2015, 11:06:36 am
Anyone know what happens when you try and use the function dfhack.items.createItem() without a creator? Can't run DF right now so can't check myself. If it crashes, is there anyway to make it so that it doesn't crash?
Either it crashes or it does not work at all (i.e. emits an error message).
This is because it uses df own functions (namely reaction products IIRC) and it needs unit for it to work. You can make your own createItem for subset of items (e.g. I did one for heart tearing out script, just because these reactions do not support body parts). For a general use case it would be lot's of work...

Good to know. I suppose it would be possible to select a random creator and then set the created_by flag (or whatever it is called) to -1. I actually don't think it is a big deal as I will almost always have a creator, was just wondering what would happen if I didn't.
Are you limited to the IDs of creatures actively on the map?  Deities have historical figure IDs ;)
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on August 24, 2015, 11:58:39 am
The created_by id can be -1. It's -1 for all items that are pre-history. Df says it's "by unknown author".
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 24, 2015, 01:38:18 pm
Anyone know what happens when you try and use the function dfhack.items.createItem() without a creator? Can't run DF right now so can't check myself. If it crashes, is there anyway to make it so that it doesn't crash?
Currently, passing a nil unit will crash, but that's fixed in the next release.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on August 24, 2015, 09:14:03 pm
Anyone know what happens when you try and use the function dfhack.items.createItem() without a creator? Can't run DF right now so can't check myself. If it crashes, is there anyway to make it so that it doesn't crash?
Currently, passing a nil unit will crash, but that's fixed in the next release.

In the current version you can still just pick anybody as the fake creator then go into the item and delete the creator by setting the id to -1.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on August 24, 2015, 09:23:35 pm
Exactly (actually, that fix only addresses the crash - passing a null unit from now on will produce an error instead). I think df.global.world.units.all[0] should work as a creator, although replacing "all" with "active" could avoid issues that I'm not aware of with dead/off-map units.

Edit: Creating a fake unit with df.unit:new() and setting its position to arbitrary coordinates appears to work. I don't know if any information about the creator is tracked by DF or not, though. Using an off-map unit will not work, however, as DFHack makes sure units' positions are valid, so you'd need to use world.units.active[0] otherwise (and make sure its position is valid).
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on August 25, 2015, 02:53:52 am
Hmmm, just make sure it doesn't cross into adventurer mode, no clue what it would do with one active, hopefully it would just assign it as the creator though.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on August 31, 2015, 07:13:49 am
Hey all, I'm trying to get spawned creatures to do something other than wander, and the logical thing seemed to be to induce them to attack the dwarf that triggered the spawn (unless mod logic says the creature should be friendly, of course).

I tried populating

critter.opponent.unit_id=15250
critter.opponent.unit_pos={118,67,178}
critter.anon_1=300


based on what I've seen hunters and prey do.  The id and position are for the miner.  But the creature still wanders off and the anon_1 was 265 the next time I checked.  It stayed at 300 for hunters and prey.  It's apparently a count-down for how long a unit stays interested in its opponent, and there must be some other attributes I'm missing to start a fight.

Has anyone scienced this out?
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on August 31, 2015, 07:58:21 am
Hey all, I'm trying to get spawned creatures to do something other than wander, and the logical thing seemed to be to induce them to attack the dwarf that triggered the spawn (unless mod logic says the creature should be friendly, of course).

I tried populating

critter.opponent.unit_id=15250
critter.opponent.unit_pos={118,67,178}
critter.anon_1=300


based on what I've seen hunters and prey do.  The id and position are for the miner.  But the creature still wanders off and the anon_1 was 265 the next time I checked.  It stayed at 300 for hunters and prey.  It's apparently a count-down for how long a unit stays interested in its opponent, and there must be some other attributes I'm missing to start a fight.

Has anyone scienced this out?
Well obvious out of the way first: have you set civ_id to -1? If so then maybe adding an attack action? Also setting the berserk mood (or that other that badgers use?) should also work.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on August 31, 2015, 08:29:24 am
Well obvious out of the way first: have you set civ_id to -1? If so then maybe adding an attack action? Also setting the berserk mood (or that other that badgers use?) should also work.
Yes, its was civ -1.  Hunter's prey that fought back didn't have an invader ID, so that can't be necessary to fight.  Hunters and prey also maintain mood -1, but it's worth checking for berserk or something.  (Edit: Some prey don't fight back and their opponent remains -1, so I know I don't need to fiddle with the triggering dwarf's mind.)

I don't know how to set an attack action, but I supposed I could watch some fights in the arena then verify with hunting.  A direct attack action ought to work: if the mod triggers the spawn then the triggering dwarf and the spawned creature will be 0 or 1 tiles apart.  The player could play with the command line and spawn a creature half a map away from the triggering dwarf, but that won't crash the game or anything.

"Missed him by that much."
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on August 31, 2015, 10:00:33 am
Well obvious out of the way first: have you set civ_id to -1? If so then maybe adding an attack action? Also setting the berserk mood (or that other that badgers use?) should also work.
Yes, its was civ -1.  Hunter's prey that fought back didn't have an invader ID, so that can't be necessary to fight.  Hunters and prey also maintain mood -1, but it's worth checking for berserk or something.  (Edit: Some prey don't fight back and their opponent remains -1, so I know I don't need to fiddle with the triggering dwarf's mind.)

I don't know how to set an attack action, but I supposed I could watch some fights in the arena then verify with hunting.  A direct attack action ought to work: if the mod triggers the spawn then the triggering dwarf and the spawned creature will be 0 or 1 tiles apart.  The player could play with the command line and spawn a creature half a map away from the triggering dwarf, but that won't crash the game or anything.

"Missed him by that much."
The thing about hunting is that it's a job. All the "ai" depends on creature having hunting job and then it depends on ammo/weapon. Also one of main things is that jobs for non dwarves that are your civ might work and might not.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on August 31, 2015, 11:02:02 am
Well obvious out of the way first: have you set civ_id to -1? If so then maybe adding an attack action? Also setting the berserk mood (or that other that badgers use?) should also work.
Yes, its was civ -1.  Hunter's prey that fought back didn't have an invader ID, so that can't be necessary to fight.  Hunters and prey also maintain mood -1, but it's worth checking for berserk or something.  (Edit: Some prey don't fight back and their opponent remains -1, so I know I don't need to fiddle with the triggering dwarf's mind.)

I don't know how to set an attack action, but I supposed I could watch some fights in the arena then verify with hunting.  A direct attack action ought to work: if the mod triggers the spawn then the triggering dwarf and the spawned creature will be 0 or 1 tiles apart.  The player could play with the command line and spawn a creature half a map away from the triggering dwarf, but that won't crash the game or anything.

"Missed him by that much."

I actually have a script I am working on to add attacks. Here is the rough version

Code: (unit/attack-add.lua) [Select]
function checkbodytoken(unit,token)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(token) do
  local a = 1
  for j,y in ipairs(body) do
   if y.token == x and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts[1]
end

validArgs = validArgs or utils.invert({
 'help',
 'defender',
 'attacker',
 'target',
 'weapon',
 'velocity',
})
local args = utils.processArgs({...}, validArgs)

if args.defender and tonumber(args.defender) then -- Check for defender declaration !REQUIRED
 defender = df.unit.find(tonumber(args.defender))
else
 print('No defender selected')
 return
end
if args.attacker and tonumber(args.attacker) then -- Check for attacker declaration !REQUIRED
 attacker = df.unit.find(tonumber(args.attacker))
else
 print('No attacker selected')
 return
end
j = 0
while j < 1 do
action = df.unit_action:new()
action.id = attacker.next_action_id
attacker.next_action_id = attacker.next_action_id + 1

action.type = 1
attack = action.data.attack
attack.target_unit_id = defender.id
attack.attack_item_id = -1
attack.target_body_part_id = checkbodytoken(defender,{args.target})
attack.attack_body_part_id = checkbodytoken(attacker,{args.weapon})
attack.unk_30 = tonumber(args.velocity)
attack.attack_id = 0
attack.flags = 0

attack.unk_28 = 100
attack.unk_2c = 100
attack.unk_38 = 100
attack.unk_3c = 100
attack.timer1 = 1
attack.timer2 = 1
for i,x in pairs(attack.unk_4) do
 attack.unk_4[i] = 0
end
attack.unk_4.wrestle_type = -1
attacker.actions:insert('#',action)
j = j + 1
end

It's still extremely rough, but it should work. Just use this syntax

Code: [Select]
unit/attack-add -target UNIT_ID -attacker UNIT_ID -target BODY_TOKEN -weapon BODY_TOKEN -velocity X
Note I haven't fully tested this yet, but in arena mode I was able to add attacks just fine.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on August 31, 2015, 12:05:13 pm
Thanks Warmist and Roses.  I'll let you know how things work when I get a chance to test it.
Title: Re: DFHack 0.40.24-r3
Post by: Duul on September 01, 2015, 03:37:23 am
I'm having a bit of trouble with the add-syndrome script in modtools. I'll admit I'm a beginner at using dfhack in this way, so if I wanted to add a syndrome to turn my adventurer into a mist thrall/husk, how would I go about doing that?

I don't really care if you just tell me how to do it or give me a direct command to put into the console but I would really appreciate some help on this one.
Title: Re: DFHack 0.40.24-r3
Post by: Blind Wolf on September 01, 2015, 06:04:52 am
In Adventure mode, is there any way to add an artifact from worldgen directly into my inventory or locate the item in a site?

Alternatively, is there an easier way to add secrets to a slab than by changing the topic with gm-editor? The game is heavily modded and I've had some interesting results from testing every single value one at a time, but now that I'm in the 50's it's lost its charm.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 01, 2015, 07:54:22 pm
Hello anon >.> and you can artifake one into existence. https://github.com/maxthyme/dfstuff/blob/master/artifake.lua
Title: Re: DFHack 0.40.24-r3
Post by: Blind Wolf on September 01, 2015, 08:04:23 pm
Hello anon >.> and you can artifake one into existence. https://github.com/maxthyme/dfstuff/blob/master/artifake.lua
I've been fiddling with that for a little while, and I can easily get an artifact slab, but how can I set it to function as a secret/necromancy slab?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 01, 2015, 09:55:45 pm
Oh, well I went and checked, this is just using a regular createitem slab btw.

Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 02, 2015, 08:07:24 am
I'm having a bit of trouble with the add-syndrome script in modtools. I'll admit I'm a beginner at using dfhack in this way, so if I wanted to add a syndrome to turn my adventurer into a mist thrall/husk, how would I go about doing that?

I don't really care if you just tell me how to do it or give me a direct command to put into the console but I would really appreciate some help on this one.

Unfortunately, you can only deal with syndromes that have names using add-syndrome. Autogenerated ones like vampirism and husks don't have names.
Title: Re: DFHack 0.40.24-r3
Post by: Atomic Chicken on September 02, 2015, 03:45:42 pm
I need some help with reaction-product-trigger. I've written this script, taxidermy.lua, which is meant to be used in a reaction which takes a corpse or vermin remains and produces a statue or figurine. The script targets the corpse reagent, obtain histfig or race,caste ids from it, and then alters the statue so that the statue appears to correspond to the corpse (i.e. corpse of a cat -> statue of a cat). As it is, the script works as intended, as long as the only reagent used is the corpse. I was wondering if it is possible to use reaction-product-trigger in this way when multiple reagents are present, and if so what alterations need to be done to my own script to ensure proper functioning.

The script so far:

Code: [Select]
-- taxidermy.lua
-- by Atomic Chicken

local utils = require 'utils'

validArgs = validArgs or utils.invert({
 'corpse_id',
 'statue_id',
 'record_name',
 'help'
})
local args = utils.processArgs({...}, validArgs)

if args.help then
 print([[ taxidermy.lua
 This script is designed to work with a reaction that takes a corpse and produces one statue of any material.

 arguments:
 
 -corpse_id
The item id of the corpse you wish to "stuff".
If used in conjunction with reaction-product-trigger, this takes \\INPUT_ITEMS

 -statue_id
The item id of the statue produced in the reaction.
If used in conjunction with reaction-product-trigger, this takes \\OUTPUT_ITEMS

 -record_name
If this optional argument is included, the script will check whether the corpse was from a named historical figure,
and if so describes the statues as being "of [creature's name]" rather than "of [creature's race]".

  To use:
 
 Create a file called "onLoad.init" in Dwarf Fortress/raw if one does not already exist.
 Enter the following:
  modtools/reaction-product-trigger -reactionName YOUR_REACTION -command [ taxidermy -corpse_id \\INPUT_ITEMS -statue_id \\OUTPUT_ITEMS -record_name ]
 Replace "YOUR_REACTION" with whatever your reaction is called.
 ]])
 return
end

if not args.corpse_id then
error 'ERROR: Corpse id not specified.'
end

if not args.statue_id then
error 'ERROR: Statue id not specified.'
end

corpse = df.item.find(tonumber(args.corpse_id))
statue = df.item.find(tonumber(args.statue_id))

if corpse ~= nil and statue ~= nil then

if args.record_name
and corpse:getType() ~= df.item_type.REMAINS
and corpse.hist_figure_id ~= -1 then
unit_id = corpse.unit_id
unit = df.unit.find(unit_id)
if unit.name.has_name == true then
target_desc_name = dfhack.TranslateName(dfhack.units.getVisibleName(unit))

dfhack.timeout(1,'ticks',function()
statue.description = ''..target_desc_name..''

for _,artchunk in ipairs(df.global.world.art_image_chunks) do
if artchunk.id == statue.image.id then

statue_image = artchunk.images[statue.image.subid]
end
end

while #statue_image.elements > 0 do
statue_image.elements:erase(#statue_image.elements-1)
end

while #statue_image.properties > 0 do
statue_image.properties:erase(#statue_image.properties-1)
end

newart=df.art_image_element_creaturest:new()
statue_image.elements:insert("#",newart)

statue_image.elements[0].histfig = corpse.hist_figure_id

statue_image.mat_type = -1
statue_image.mat_index = -1
end)
end

else

raceindex = corpse.race
casteindex = corpse.caste
target_desc = df.global.world.raws.creatures.all[raceindex].caste[casteindex].caste_name[0]

dfhack.timeout(1,'ticks',function()
statue.description = 'a '..target_desc..''

for _,artchunk in ipairs(df.global.world.art_image_chunks) do
if artchunk.id == statue.image.id then
statue_image = artchunk.images[statue.image.subid]
end
end

while #statue_image.elements > 0 do
statue_image.elements:erase(#statue_image.elements-1)
end

while #statue_image.properties > 0 do
statue_image.properties:erase(#statue_image.properties-1)
end

newart=df.art_image_element_creaturest:new()
statue_image.elements:insert("#",newart)

statue_image.elements[0].race = raceindex
statue_image.elements[0].caste = casteindex
statue_image.elements[0].count = 1

statue_image.mat_type = -1
statue_image.mat_index = -1

end)
end
end

In onLoad.init:
Code: [Select]
modtools/reaction-product-trigger -reactionName TAXIDERMY -command [ taxidermy -corpse_id \\INPUT_ITEMS -statue_id \\OUTPUT_ITEMS -record_name ]
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 02, 2015, 07:12:10 pm
The simplest way to do it is to have a helper script extract the first reagent and product.

Code: [Select]
modtools/reaction-product-trigger -reactionName TAXIDERMY -command [ taxidermy-helper -inputs [ \\INPUT_ITEMS ] -outputs [ \\OUTPUT_ITEMS ] -record_name ]

(note the extra brackets)

Code: [Select]
--taxidermy-helper.lua
local utils = require 'utils'

validArgs = utils.invert({
 'inputs',
 'outputs',
 'record_name'
})
local args = utils.processArgs({...}, validArgs)

--put error checking here

local commandstr = 'taxidermy -corpse_id ' .. args.inputs[1] .. ' -statue_id ' .. args.outputs[1]
if args.record_name then
  commandstr = commandstr .. ' -record_name'
end
dfhack.run_command(commandstr)

Title: Re: DFHack 0.40.24-r3
Post by: mifki on September 03, 2015, 05:59:59 am
Is -r4 planned? Need to find time to submit a bunch of df structures patches before that.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on September 03, 2015, 06:55:41 am
Is -r4 planned? Need to find time to submit a bunch of df structures patches before that.

I would also like to know, since I'm thinking of adding Vjek's scripts.
Title: Re: DFHack 0.40.24-r3
Post by: Atomic Chicken on September 03, 2015, 07:33:25 am
Spoiler (click to show/hide)
Thanks!
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 03, 2015, 08:08:40 am
I would like to do one more release before the next DF release, yes.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 03, 2015, 08:09:06 am
Spoiler (click to show/hide)
Thanks!

Sure. Glad to see modtools stuff getting used.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 03, 2015, 03:23:24 pm
Roses, the add_attack script seems to work in fort mode.  I stripped out the error-checking because it's used internally, but the guts function as intended.

Even the dwarf who was the victim of the first induced attack seemed exited to see things working so well!

(http://i8.photobucket.com/albums/a28/8gon/Exhilarated.png)

Sometimes, these guys bother me.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 03, 2015, 04:42:25 pm
Is there anywhere else in a creature besides the main screen and the soul that gender/caste is stored?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on September 03, 2015, 04:49:37 pm
hist fig
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 03, 2015, 04:54:29 pm
What menu is that under? I can't find it. Is it 'hist_figure_id'?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on September 03, 2015, 05:07:52 pm
df.historical_figure.find(hist_fig_id) will get you the hist fig given the hist_fig_id (which for a unit will be unit.hist_fig_id)
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 03, 2015, 05:59:49 pm
Am I supposed to type that into the lua in DFhack? When I do it, it just gives me a bunch of errors. For hist fig id 2082, what would be the correct prompt?

Sorry for the bother, I never knew doing a simple gender-swap would be so hard.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on September 03, 2015, 06:40:29 pm
it might not be historical_figure, that one always trips me up

also, "bunch of errors" is very non-specific
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 03, 2015, 06:59:34 pm
Wait, I don't need to find what the hist fig id is, I already know it. Can I do it through gm-editor? I know my way around that, at least.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 03, 2015, 07:10:52 pm
df.historical_figure.find(2082) works for me - it returns the historical figure with ID 2082. "gui/gm-editor df.historical_figure.find(2082)" should open it in gm-editor.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 03, 2015, 07:26:10 pm
Two things: One, I was opening it in lua when I should have done it in the regular screen, and two I shouldn't change the caste, only the gender. Thanks! We'll see if it's a functional female soon.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 03, 2015, 07:52:38 pm
I would usually do gui/gm-editor df.historical_figure.find(2082) myself if I didn't just poke around through df.global with gm-editor to find it.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 03, 2015, 11:30:13 pm
FYI, the add-attack script doesn't start a fight as far as the attacker is concerned.  The defender might, if they aren't knocked out.  This means after a one-shot knockout the attacker just wanders off.  I'll try using that anon_1 counter to encourage them to gnaw on the victim's helm for a while.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 04, 2015, 02:11:52 am
I think Rumrusher did something that got fights started, or was it Roses?
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on September 04, 2015, 04:51:36 pm
oh yeah what I did to get fights to start in the old versions was getting both attacker and defender to target each other.
which usually cause them to continue on now that they took some damage.
usually when you set it to 1 person there's a chance the character cancels the attack because why provoke an attack on someone you know isn't aiming to hurt you.
but getting this to work for companions or optimize it for say adventure mode tomfoolery was a pain.
Code: [Select]
Target={}
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

if unit==nil then
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 v== nil then
error("Invalid creature")
end
--entry=dfhack.lineedit()
targ=getCreatureAtPos(getxyz())

v.opponent.unit_id=targ.id
v.opponent.unit_pos.x=getxyz()
v.opponent.unit_pos.y=getxyz()
v.opponent.unit_pos.z=getxyz()
targ.job.hunt_target=v
end
end
end

this was kinda the jist of it but the bottom part is the stuff you want to poke around the opponent unit_position and unit_id get both of those working and you got a fight.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 04, 2015, 05:28:56 pm
Thanks, I'll let you know what happens when I get a chance to test it.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on September 05, 2015, 07:22:47 pm
there another case where all this does is cause the person to run to the spot where that unit was but not start the fight.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 06, 2015, 02:10:52 pm
Where is the egg-laying counter in gm-editor?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 06, 2015, 02:28:05 pm
I don't see anything with a relevant name in df-structures, so it's possible that it's not identified yet.
(By the way, the names you see in gm-editor are used everywhere in DFHack - they're not specific to gm-editor.)
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 06, 2015, 03:26:48 pm
I asked to save myself some poking around. I actually did find it, under 'status.misc_traits' inside the creature. It's actually one of several possible counters listed there.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 06, 2015, 03:42:27 pm
Ah, one with an ID of EggSpent? I must have only been searching for "egg", then (case-sensitive).
Note that a unit_misc_trait with that ID won't exist for all creatures, although it should exist for all egg-laying (and mature?) creatures.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 06, 2015, 07:47:43 pm
Yeah, I might have to mod in eggs for male rocs, since what I've been trying to do is make two male rocs have children. This is way more complicated than I thought.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 06, 2015, 09:44:17 pm
Yeah, I might have to mod in eggs for male rocs, since what I've been trying to do is make two male rocs have children. This is way more complicated than I thought.
Tell that to the Rocs.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on September 07, 2015, 07:01:36 am
Can't make egglayers pregnant? No proper birth given?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 07, 2015, 08:02:53 am
DF doesn't have much in the way of sex-specific roles, but what it has is hard-coded.  Females give birth and carry babies; males fertilize.  Creatures that can marry will only mate with their spouse.

That said, not sure what would happen if you set the pregnancy timer on a male.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on September 07, 2015, 09:06:38 am
DF doesn't have much in the way of sex-specific roles, but what it has is hard-coded.  Females give birth and carry babies; males fertilize.  Creatures that can marry will only mate with their spouse.

That said, not sure what would happen if you set the pregnancy timer on a male.
tested it nothing happens.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 07, 2015, 09:28:06 am
I changed one's gender first, but I can't change its caste. Every time I do it transforms back into a male.

The roc is indeed pregnant, it just won't lay eggs. I think I need to do some quick modding.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 07, 2015, 09:48:15 am
Try using modtools/transform-unit to change its caste to that of the opposite sex.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on September 07, 2015, 10:04:06 am
Is that a thing? Let me check if I have it.

You're a bit late, though. I modded male rocs to lay eggs and there we go.

(http://i.imgur.com/GFeKMEm.png)
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on September 08, 2015, 10:34:35 am
oh  I know why you need to dive into another section of the unit data, some how the unit.caste is just the current caste state, and because how were-creatures work the game needs a check to see what was the original race/caste which allows for the switch back and changes any oddities with not being the right caste.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 08, 2015, 03:12:30 pm
I did get a crash but I think it was because I had spent like an hour and a half or so doing this and had set most of a forest retreat on fire at that point... but normally it doesn't have those sort of problems.

Really simple really obvious little toy but dammit it is fun.

Code: (firestarter.lua) [Select]
tinder=dfhack.gui.getCurViewscreen().item
tinder.flags.on_fire=true

>.> I totally have it hotkeyed, and I'm resisting the urge to expand it to things that I know I can do like, set everything in an inventory on fire, and I'm pretty sure with a bit of fiddling you could set creatures on fire, but I like the straightforward "I want this item to be on fire now" nature of it.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on September 08, 2015, 03:31:38 pm

>.> I totally have it hotkeyed, and I'm resisting the urge to expand it to things that I know I can do like, set everything in an inventory on fire, and I'm pretty sure with a bit of fiddling you could set creatures on fire, but I like the straightforward "I want this item to be on fire now" nature of it.

Code: [Select]
unit/body-change -unit \\UNIT_ID -token UB -temperature fire^ Sets the upper body of a creature on fire (from my scripts)
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 08, 2015, 04:21:03 pm
Well, adding an opponent.anon_1 counter to Roses' add_attack doesn't seem to change anything.  Hard to tell exactly because I keep getting either one-shot knock-out or the bite deflects off of the miner's hood  :o

The miner does not retaliate if a single shot deflects harmlessly.  Definitely missing an essential element of starting a fight.
Title: Re: DFHack 0.40.24-r3
Post by: neilthrun on September 08, 2015, 04:59:31 pm
Hey dfhackers. Is it possible to use DF hack to adjust the the wind strength on a map? My current fortress has zero wind and I stupidly built a tower and a dozen windmills on top of it. I'd like to solve this problem some how.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on September 08, 2015, 05:21:50 pm
Well, adding an opponent.anon_1 counter to Roses' add_attack doesn't seem to change anything.  Hard to tell exactly because I keep getting either one-shot knock-out or the bite deflects off of the miner's hood  :o

The miner does not retaliate if a single shot deflects harmlessly.  Definitely missing an essential element of starting a fight.

I wonder if you could add an attack to both units with a hit chance of ~0, then when they both miss will they still want to fight?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 08, 2015, 08:47:01 pm

>.> I totally have it hotkeyed, and I'm resisting the urge to expand it to things that I know I can do like, set everything in an inventory on fire, and I'm pretty sure with a bit of fiddling you could set creatures on fire, but I like the straightforward "I want this item to be on fire now" nature of it.

Code: [Select]
unit/body-change -unit \\UNIT_ID -token UB -temperature fire^ Sets the upper body of a creature on fire (from my scripts)
Nice, I was sitting in a forest retreat and all the sleeping elves were boring so I pulled up the loincloth of one and flipped the on_fire flag manually then giggled forever at them setting the tree on fire.

They did it so much faster than going around igniting branches one at a time and I realized there wasn't a script to say "this item should be on fire" and now there is. I'll probably add in an inventory flag to set all the items on a unit on fire, and see if I can get a -here for everything in a square working.

Edit: Oh god...
Spoiler (click to show/hide)
>.>
Code: (firestarter.lua) [Select]
local tinder
    if dfhack.gui.getCurFocus() == 'item' then
        tinder=dfhack.gui.getCurViewscreen().item
tinder.flags.on_fire=true
    elseif dfhack.gui.getSelectedUnit(true) then
        tinder=dfhack.gui.getSelectedUnit(true).inventory
for k,v in ipairs(tinder) do
tinder[k].item.flags.on_fire=true
end
     elseif df.global.ui_advmode.menu==1 then
local curpos=df.global.cursor
df.global.world.fires:insert('#',{new=df.fire})
local hot = df.global.world.fires
for _,k in ipairs(hot) do
  if k.temperature==0 then
   local spot = k
k.pos.x=curpos.x
k.pos.y=curpos.y
k.pos.z=curpos.z
k.timer=1000
k.temperature=60000
end
end
end
Item by item, or entire inventory at once! Weeee!

Oh dear, now you can set an item on fire by viewing it, an inventory on fire by viewing a unit, or a location on fire by putting the cursor there.
______________________________________________
Oh, and thanks again for doing the work to make propel, I love being able to launch myself around like a ninja so much.

As for the fight bit, change the target? Try to have it knock out a tooth, or strike the upper body or something?

Hmmm, initiating a grapple tends to reliably start at least a brawl when can then escalate easily enough.

I'm still playing with it a bit, though I'm wondering now if you could make it pull up the body part/attack part/confirm menu because I envy my npc companions for being able to wail on people I've knocked into the air.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on September 09, 2015, 07:47:50 pm
Do we know where the adventurer's location while traveling is stored?
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on September 10, 2015, 12:17:33 am
Do we know where the adventurer's location while traveling is stored?
Yes. It forms an army. It has first flag equal to true.  pull request about all that stuff (https://github.com/DFHack/df-structures/pull/56).
Not sure where it holds the coordinates before traveling... Maybe in map?
Title: Re: DFHack 0.40.24-r3
Post by: mifki on September 10, 2015, 12:28:13 am
Do we know where the adventurer's location while traveling is stored?
Yes. It forms an army. It has first flag equal to true.  pull request about all that stuff (https://github.com/DFHack/df-structures/pull/56).
Not sure where it holds the coordinates before traveling... Maybe in map?

Oh I found it looks for something in the armies vector and gave up. Thanks.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 10, 2015, 02:42:14 am
Under df.global.world.world_data, adv_region_x, adv_region_y, adv_emb_x, and adv_emb_y are at least part of it.

The values respectively while fresh out of travel mode:
adv_region_x 63
adv_region_y 27
adv_emb_x 8
adv_emb_y 13

Enter travel mode, move around, the values stay the same while I'm traveling.
Teleport my army from 3043 by 1667 to 304 by 1667, the values stay the same.

Exit travel mode at 304 by 1667 and I get:
adv_region_x 6
adv_region_y 27
adv_emb_x 4
adv_emb_y 13

I moved 4 squares west in travel mode, so thats adv_emb_x 8 -> 4
I teleported from 3043 to 304, so that's adv_region_x 63 -> 6
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on September 10, 2015, 03:03:26 am
Under df.global.world.world_data, adv_region_x, adv_region_y, adv_emb_x, and adv_emb_y are at least part of it.

The values respectively while fresh out of travel mode:
adv_region_x 63
adv_region_y 27
adv_emb_x 8
adv_emb_y 13

Enter travel mode, move around, the values stay the same while I'm traveling.
Teleport my army from 3043 by 1667 to 304 by 1667, the values stay the same.

Exit travel mode at 304 by 1667 and I get:
adv_region_x 6
adv_region_y 27
adv_emb_x 4
adv_emb_y 13

I moved 4 squares west in travel mode, so thats adv_emb_x 8 -> 4
I teleported from 3043 to 304, so that's adv_region_x 63 -> 6

More interesting question: now that we can create armies (with your chosen races and their counts) is it possible (by setting position or armies path) force it to appear in fort mode and/or in your adventure map?

This would allow for all sorts of !!fun!! scenarios.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 10, 2015, 04:55:04 am
Putnam and I poked at that a bit, and we had varying degrees of success, but nothing consistent.

I did learn one interesting trick though: nameless historical figures in an army are just designated by a race and a count. I've brought armies to my position which started as 2 gobs and loaded in as 30 or something.

Need a script that goes in and checks what the races are, it would be nice if we could cross check that against their goals. I've noticed various armies which run patrol loops even though they aren't guards. Yetis do this a lot, bandits tend to do it unless there are nearby hillocks/hamlets, I've noticed vampires doing it as well.

I don't know how well it would work if you just told the game "there are now 30 goblins from x civ at my fort who want to attack me because I'm from y civ" as I recall the tent of 2 goblins I ported over to me just ended up with a pile of them sleeping eternally stacked like cordwood.

I recall that the one siege I was actually able to force was one of the hostile gob civs and I grabbed that army by checking the pos_x and pos_y for the right area of the map before zooping them next to my fort. They started attacking decently enough, but when I went out with an adventurer and came back they were acting like they lived there but were hostile to me as an adventurer, not a member of the ruby hammers or whatever.

Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on September 10, 2015, 05:29:37 am
Putnam and I poked at that a bit, and we had varying degrees of success, but nothing consistent.

I did learn one interesting trick though: nameless historical figures in an army are just designated by a race and a count. I've brought armies to my position which started as 2 gobs and loaded in as 30 or something.

There is two arrays in army: one is historical figures the other is non-historical. I added the fields i guessed (and then checked by spawning armies in advmode). But i did not have any success in "calling-in" army in fort mode.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on September 10, 2015, 10:38:57 am
hmm would dabble more into this but I still haven't gotten a good UI working for the fast travel warp to marker fixed(waypoint is fixed but portal isn't).
another question is with the wait command can you send personal armies to do base of operations in areas?
like park a bunch of peasants at a ruin/lair and tell them to settle there?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 10, 2015, 12:07:49 pm
So, this works to get a newly spawned creature in a fighting mood, but it's heavier-handed than I would like.

Code: [Select]
...

function add_attack(attacker_id,defender_id,target,weapon)
attacker = df.unit.find(attacker_id)
defender = df.unit.find(defender_id)
j = 0
while j < 1 do -- Not sure why this "loop" is here???
action = df.unit_action:new()
action.id = attacker.next_action_id
attacker.next_action_id = attacker.next_action_id + 1

action.type = 1
attack = action.data.attack
attack.target_unit_id = defender_id
attack.attack_item_id = -1
attack.target_body_part_id = tonumber(target)
attack.attack_body_part_id = tonumber(weapon)
attack.unk_30 = 1
attack.attack_id = 0
attack.flags = 0
attack.unk_28 = 100
attack.unk_2c = 100
attack.unk_38 = 100
attack.unk_3c = 100
attack.timer1 = 1
attack.timer2 = 1
for i,x in pairs(attack.unk_4) do
attack.unk_4[i] = 0
end
attack.unk_4.wrestle_type = -1
attacker.actions:insert('#',action)
j = j + 1
end
end

...

wyrm = df.unit.find(wyrm_id)
miner = df.unit.find(args.miner)
wyrm.opponent.unit_id = args.miner      -- who it's supposed to attack
wyrm.opponent.unit_pos.x = miner.pos.x  -- where the target is
wyrm.opponent.unit_pos.y = miner.pos.y
wyrm.opponent.unit_pos.z = miner.pos.z
wyrm.opponent.anon_1 = 300              -- how long to stay in combat mode?
wyrm.mood = 7                           -- go berserk, the only reliable way to force more than a single attack
add_attack(wyrm_id,args.miner,3,12)     -- targets head, but seems to ignore instructions to attack with its tail

...

I dialed up the chance of spawning one and got it to appear at a fresh embark.  It took six of the Starting Seven about two weeks to kill the thing (the hunter was off doing his own thing), which seems about the balance I was looking for: dangerous to a lone miner but not fort-killing.  I'd rather not make it berserk, though, just so that withdrawal is an option where it can prowl the old mine tunnels and grow to full size.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on September 10, 2015, 12:19:25 pm
Looking over the code, what is the bit about it's tail?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 10, 2015, 12:24:41 pm
Looking over the code, what is the bit about it's tail?
My understanding of add_attack was that you provided the target bodypart and the bodypart to be used for the attack.  Maybe I just misread that completely?  The thing's tail is body part index 12.

In any event, what is the normal value for attack velocity?  Is it 1, 100, 1000?  Having it really dialed down for an initial ambush is fine if the fight continues, but I'm curious what is considered a "normal" attack.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on September 10, 2015, 12:36:47 pm
Looking over the code, what is the bit about it's tail?
My understanding of add_attack was that you provided the target bodypart and the bodypart to be used for the attack.  Maybe I just misread that completely?  The thing's tail is body part index 12.

In any event, what is the normal value for attack velocity?  Is it 1, 100, 1000?  Having it really dialed down for an initial ambush is fine if the fight continues, but I'm curious what is considered a "normal" attack.

No, you are correct, it's odd that it isn't using the tails attack (does the creature have [ATTACK:SLAP:BODYPART:BY_CATEGORY:TAIL]?)

As for velocity, another script I am working on (which simulates inflicting wounds without the attack) uses these formulae for velocity (which were taken from a thread by Urist DaVinci)
Code: [Select]
function momentumitem(unit,velocity,item,material)
 weight = math.floor(item.size*material.solid_density/100000)
 weight_fraction = item.size*material.solid_density*10 - weight*1000000
 effweight=unit.body.size_info.size_cur/100+weight*100+weight_fraction/10000
 actweight=weight*1000+weight_fraction/1000
 vel=unit.body.size_info.size_base * dfhack.units.getPhysicalAttrValue(unit,0) * velocity/1000/effweight/1000
 mom=vel*actweight/1000+1
 return mom
end
function momentumbodypart(unit,velocity,bp,material)
 partsize = math.floor(unit.body.size_info.size_cur * bp.relsize / unit.body.body_plan.total_relsize)
 partweight = math.floor(partsize * material.solid_density / 100)
 vel = 100 * dfhack.units.getPhysicalAttrValue(unit,0) / 1000 * velocity / 1000
 mom = vel * partweight / 1000 + 1
 return mom
end

Typically I was seeing values in the 10-100 range. But it can vary a lot.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 10, 2015, 01:17:25 pm
Yes it has a tail slap, but it is secondary priority.  Maybe that's the problem?

Another creature has claws, but I couldn't figure out how to specify all of them.  I just went with its right front hand (glossed as a "claw"), but that guy defaults to its primary bite attack as well.

It works fine for the mod it's in... I just want these guys to pop up and fight rather than wander off... but in a perfect world I would convince them they are in a normal fight rather than driving them berserk.

In case this helps:
Spoiler: Creature (click to show/hide)

This script is called by the mod when a miner strikes "Living Stone."  Whether the creature is an Awakened Stone or a Wyrm, and whether it is friendly or hostile, is decided by mod logic outside this script as passed through command line arguments.
A "hostile" creature is induced to attack immediately.  A "friendly" Awakened Stone is tame; a "friendly" Wyrm is simply a wild animal.
Spoiler: "Wake" script (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: Roses on September 10, 2015, 01:28:53 pm
Oh, it's because attack.attack_id = 0. Use 2 for the tail attack and 1 for the claw attack (that should work I think)

Edit: The tail attack might be more like 5 if it can claw attack with all four claws
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 10, 2015, 01:40:49 pm
Oh, it's because attack.attack_id = 0. Use 2 for the tail attack and 1 for the claw attack (that should work I think)

Edit: The tail attack might be more like 5 if it can claw attack with all four claws
Oh!  That makes sense.  Thanks!
Title: Re: DFHack 0.40.24-r3
Post by: Roses on September 10, 2015, 02:14:27 pm
Oh, it's because attack.attack_id = 0. Use 2 for the tail attack and 1 for the claw attack (that should work I think)

Edit: The tail attack might be more like 5 if it can claw attack with all four claws
Oh!  That makes sense.  Thanks!

Yeah, the code I provided earlier wasn't the most up to date version, in the new version I actually check which attack number to use for the corresponding body part. It's interesting that the attack_id over rules the attack_body_part_id. I wonder if you mix match if it uses the material and such of the body part but the penetration/contact etc... of the attack. Will have to do some more testing.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 10, 2015, 02:18:52 pm
Oh, it's because attack.attack_id = 0. Use 2 for the tail attack and 1 for the claw attack (that should work I think)

Edit: The tail attack might be more like 5 if it can claw attack with all four claws
Oh!  That makes sense.  Thanks!

Yeah, the code I provided earlier wasn't the most up to date version, in the new version I actually check which attack number to use for the corresponding body part. It's interesting that the attack_id over rules the attack_body_part_id. I wonder if you mix match if it uses the material and such of the body part but the penetration/contact etc... of the attack. Will have to do some more testing.
Yeah, maybe it was biting... with its tail.

In a game where you can swing a sword at a specific tooth, it may not be that far-fetched :)
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 10, 2015, 03:09:50 pm
Yeah, maybe it was biting... with its tail.

I love when this sort of thing happens. Now I want to see somebody bite someone's pancreas with their brain.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 10, 2015, 05:13:47 pm
Yeah, maybe it was biting... with its tail.

I love when this sort of thing happens. Now I want to see somebody bite someone's pancreas with their brain.
(http://i.imgur.com/GMz2c2u.png)

'Hey, want a turtle?'
"How kind, thanks!"
'Whoa, why are you trying to hit me?'
*turtlegrab*

hmm would dabble more into this but I still haven't gotten a good UI working for the fast travel warp to marker fixed(waypoint is fixed but portal isn't).
another question is with the wait command can you send personal armies to do base of operations in areas?
like park a bunch of peasants at a ruin/lair and tell them to settle there?
Hmmm, could you drop into wait/sleep mode for a tic and pull up the warp then?

When I'm in a mountainous area or dark fortress I'll wait for 2 or 4 hours and hit my gm-editor hotkey which opens my army pos_x and pos_y up. I've gotten pretty good at just dropping myself in a spot with that now.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on September 10, 2015, 05:17:30 pm
Yeah, maybe it was biting... with its tail.

I love when this sort of thing happens. Now I want to see somebody bite someone's pancreas with their brain.
I want to see someone attacking their own heart with brain (or reverse) :D
Title: Re: DFHack 0.40.24-r3
Post by: Roses on September 10, 2015, 05:32:17 pm
Yeah, maybe it was biting... with its tail.

I love when this sort of thing happens. Now I want to see somebody bite someone's pancreas with their brain.
I want to see someone attacking their own heart with brain (or reverse) :D

Actually, that is something I haven't tried... What if the defending unit is the attacking unit?
Title: Re: DFHack 0.40.24-r3
Post by: mifki on September 10, 2015, 05:36:21 pm
Yeah, maybe it was biting... with its tail.

I love when this sort of thing happens. Now I want to see somebody bite someone's pancreas with their brain.
I want to see someone attacking their own heart with brain (or reverse) :D

Actually, that is something I haven't tried... What if the defending unit is the attacking unit?

Oh well, I have to ask, is there a way to make dorfs get happy thoughts from pain then?
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 10, 2015, 06:06:49 pm
Yeah, maybe it was biting... with its tail.

I love when this sort of thing happens. Now I want to see somebody bite someone's pancreas with their brain.
I want to see someone attacking their own heart with brain (or reverse) :D

Actually, that is something I haven't tried... What if the defending unit is the attacking unit?
Spoiler (click to show/hide)

Oh well, I have to ask, is there a way to make dorfs get happy thoughts from pain then?
...ok, look, I made a fort with civilians in squads so I could assign leather armor and get rid of clothing nonsense... I didn't need THIS added to the image dammit.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on September 11, 2015, 06:13:43 am
Yeah, maybe it was biting... with its tail.

I love when this sort of thing happens. Now I want to see somebody bite someone's pancreas with their brain.
I want to see someone attacking their own heart with brain (or reverse) :D

Actually, that is something I haven't tried... What if the defending unit is the attacking unit?

i have an image of me decapitating myself somewhere, but i think i've lost it
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on September 11, 2015, 06:17:55 am
Hmmm, could you drop into wait/sleep mode for a tic and pull up the warp then?

When I'm in a mountainous area or dark fortress I'll wait for 2 or 4 hours and hit my gm-editor hotkey which opens my army pos_x and pos_y up. I've gotten pretty good at just dropping myself in a spot with that now.
yes usually before the travel mode got swap for army mode, the script is coded to delay warp if you're not in the right menu allowing for sleeping or waiting to pull you out.
also the portal menu pauses the game to allow you to set your destination.  there's something really screwy with advfort now since it crashing my game when I try to swap around jobs(it's stuck on construct fortifications). It really sticking a thorn in my set up science base for researching armies when I can't even dig out a hole and stick dudes in it.
Title: Re: DFHack 0.40.24-r3
Post by: Jazzeraint on September 13, 2015, 12:22:06 am
My apologies if this is a stupid question, but how do I find a list of 'df.world.items.other' types? e.g. Fish, Egg, Plant, etc.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on September 13, 2015, 03:10:15 am
printall(df.global.world.items.other)
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 13, 2015, 10:07:23 am
You can also use "~df.global.world.items.other" as a shortcut in the lua interpreter.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 13, 2015, 10:15:54 am
Or just

Code: [Select]
:lua printall(df.global.world.items.other)

directly from the console.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 13, 2015, 10:27:40 am
Another thing - if you want a list of all types and their numerical equivalents, use "@df.items_other_id" or "printall_ipairs(df.items_other_id)". You can use either the numbers or names as indices into world.items.other, and convert between them by indexing df.items_other_id (e.g. "df.items_other_id[1]" is "ANY_ARTIFACT" and "df.items_other_id.ANY_ARTIFACT" is 1).
Title: Re: DFHack 0.40.24-r3
Post by: Rose on September 13, 2015, 10:45:46 am
How can I reliably tell whether a player should be seeing the embark map, the world map, or neither?

Simply checking the existence of the data gives false positives while saving and loading.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 13, 2015, 11:01:20 am
Wouldn't df.global.gview have something you can count on?
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on September 13, 2015, 12:43:11 pm
so on the poking around with armies anyone figure out what causes armies to poop tents? maybe it's possible to toggle that on so when ever you step out of fast travel you start in one?
Title: Re: DFHack 0.40.24-r3
Post by: Jazzeraint on September 13, 2015, 01:43:06 pm
printall(df.global.world.items.other)

Thank you

Or just

Code: [Select]
:lua printall(df.global.world.items.other)

directly from the console.

Thank you

You can also use "~df.global.world.items.other" as a shortcut in the lua interpreter.
Another thing - if you want a list of all types and their numerical equivalents, use "@df.items_other_id" or "printall_ipairs(df.items_other_id)". You can use either the numbers or names as indices into world.items.other, and convert between them by indexing df.items_other_id (e.g. "df.items_other_id[1]" is "ANY_ARTIFACT" and "df.items_other_id.ANY_ARTIFACT" is 1).

And thank you!
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on September 13, 2015, 01:51:29 pm
How can I reliably tell whether a player should be seeing the embark map, the world map, or neither?

Simply checking the existence of the data gives false positives while saving and loading.
Check ui state i guess.
I only had problem with word maps zoom level, never found out when it's zoomed in (when you are near towns) when i wanted to do a map overlay.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on September 14, 2015, 12:35:19 am
so ui_advmode.anon_49 is the timer for wait sleep so the player could set it to go beyond that and wait out world generation in game.
though I would avoid this as you might starve your character unless they don't need to sleep or eat.
also avoid clicking in the screen or the game would correct any change you have made.
(http://www.truimagz.com/host/fortcrush2/de/enternal-slumber.png)
looks like this doesn't really effects the game more so alters the ui.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 14, 2015, 04:11:10 am
That is interesting but it doesn't work as far I've been able to see.
Title: Re: DFHack 0.40.24-r3
Post by: qorthos on September 14, 2015, 09:02:28 pm
Has anyone created a script/method to spawn magma from a reaction ala the Magma Shrine from v0.34 Masterwork?

I totally want to steal that.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 14, 2015, 09:07:18 pm
I seem to remember there's a way of doing it even without DFHack but I don't remember how.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on September 15, 2015, 12:25:07 am
I seem to remember there's a way of doing it even without DFHack but I don't remember how.
Pretty sure there is a way to add "magma" item but not "magma" square.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 15, 2015, 12:40:55 am
Yeah, similarly if you deconstruct a rock block wall with advfort it turns into a magma.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 15, 2015, 01:17:18 am
Has anyone created a script/method to spawn magma from a reaction ala the Magma Shrine from v0.34 Masterwork?

I have not tested this at all, but this should work with a small amount of fiddling:

Code: [Select]
--in dfhack.init
modtools/reaction-trigger -reactionName nameOfReactionThatMakesMagmaGoesHere -command [ liquidMaker -location [ \\LOCATION ] -type Magma -amount 7 -offset [ 0 0 \-1 ] ]

Code: [Select]
--in hack/scripts/liquidMaker.lua

utils = require 'utils'
validArgs = validArgs or utils.invert({
  'help',
  'location',
  'type',
  'amount',
  'offset'
})

local args = utils.processArgs({...}, validArgs)

if args.help then
  print([[scripts/makeLiquids.lua
    -help
        print this help message
    -location [ x y z ]
        specify the target location coordinates
    -offset [ x y z ]
        add this vector to location in order to get the real target location
        this argument is optional
    -amount n
        specify the desired depth of the liquid
    -liquidType liquidType
        specify whether you want magma or water
        liquidType should be Water or Magma
]])
  return
end

local pos = {}
pos.x = tonumber(args.location[1])
pos.y = tonumber(args.location[2])
pos.z = tonumber(args.location[3])

if args.offset then
  pos.x = pos.x + tonumber(args.offset[1])
  pos.y = pos.y + tonumber(args.offset[2])
  pos.z = pos.z + tonumber(args.offset[3])
end

local tileBlock = dfhack.maps.ensureTileBlock(pos.x, pos.y, pos.z)
tileBlock.flags.update_temperature = true
tileBlock.flags.update_liquid = true
local xOffset = pos.x - 16*floor(pos.x / 16)
local yOffset = pos.y - 16*floor(pos.y / 16)

tileBlock.designation[xOffset][yOffset].flow_size = tonumber(args.amount)
tileBlock.designation[xOffset][yOffset].liquid_type = df.tile_liquid[args.liquidType]

Title: Re: DFHack 0.40.24-r3
Post by: Putnam on September 15, 2015, 02:00:37 am
IIRC 1000 magma (any liquid rock I think or maybe just obsidian and any similar modded rocks) in a minecart makes a magma tile

or some arbitrary amount like that
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 15, 2015, 02:14:08 am
Hmmm, when you fill a minecart in adventurer mode up it holds like 833 of a liquid and it usually takes a couple full carts to get a 7/7 tile as I recall.
Title: Re: DFHack 0.40.24-r3
Post by: qorthos on September 15, 2015, 08:27:23 am
Has anyone created a script/method to spawn magma from a reaction ala the Magma Shrine from v0.34 Masterwork?

I have not tested this at all, but this should work with a small amount of fiddling:

Code: [Select]
--in dfhack.init
modtools/reaction-trigger -reactionName nameOfReactionThatMakesMagmaGoesHere -command [ liquidMaker -location [ \\LOCATION ] -type Magma -amount 7 -offset [ 0 0 \-1 ] ]

Code: [Select]
--in hack/scripts/liquidMaker.lua

utils = require 'utils'
validArgs = validArgs or utils.invert({
  'help',
  'location',
  'type',
  'amount',
  'offset'
})

local args = utils.processArgs({...}, validArgs)

if args.help then
  print([[scripts/makeLiquids.lua
    -help
        print this help message
    -location [ x y z ]
        specify the target location coordinates
    -offset [ x y z ]
        add this vector to location in order to get the real target location
        this argument is optional
    -amount n
        specify the desired depth of the liquid
    -liquidType liquidType
        specify whether you want magma or water
        liquidType should be Water or Magma
]])
  return
end

local pos = {}
pos.x = tonumber(args.location[1])
pos.y = tonumber(args.location[2])
pos.z = tonumber(args.location[3])

if args.offset then
  pos.x = pos.x + tonumber(args.offset[1])
  pos.y = pos.y + tonumber(args.offset[2])
  pos.z = pos.z + tonumber(args.offset[3])
end

local tileBlock = dfhack.maps.ensureTileBlock(pos.x, pos.y, pos.z)
tileBlock.flags.update_temperature = true
tileBlock.flags.update_liquid = true
local xOffset = pos.x - 16*floor(pos.x / 16)
local yOffset = pos.y - 16*floor(pos.y / 16)

tileBlock.designation[xOffset][yOffset].flow_size = tonumber(args.amount)
tileBlock.designation[xOffset][yOffset].liquid_type = df.tile_liquid[args.liquidType]


Gonna test this out tonight.  Thanks expwnent  :D
Title: Re: DFHack 0.40.24-r3
Post by: qorthos on September 15, 2015, 10:23:47 pm
Got it runs.  Small typo had to fixed.  floor needs to become math.floor

Code: [Select]
local xOffset = pos.x - 16*math.floor(pos.x / 16)
local yOffset = pos.y - 16*math.floor(pos.y / 16)

But then it spawns water, and said water doesn't move.  Scratching my head over that one...
Title: Re: DFHack 0.40.24-r3
Post by: Roses on September 15, 2015, 10:40:32 pm
For just magma, change

tileBlock.designation[xOffset][yOffset].liquid_type = df.tile_liquid[args.liquidType]

to

tileBlock.designation[xOffset][yOffset].liquid_type = true

and add

tileBlock.flags.update_liquid_twice = true

should work.
Title: Re: DFHack 0.40.24-r3
Post by: qorthos on September 15, 2015, 11:05:35 pm
That fixed it.  Finished and working script:

Code: [Select]
utils = require 'utils'
validArgs = validArgs or utils.invert({
  'help',
  'location',
  'type',
  'amount',
  'offset'
})

local args = utils.processArgs({...}, validArgs)

if args.help then
  print([[scripts/liquidMaker.lua
    -help
        print this help message
    -location [ x y z ]
        specify the target location coordinates
    -offset [ x y z ]
        add this vector to location in order to get the real target location
        this argument is optional
    -amount n
        specify the desired depth of the liquid
    -liquidType liquidType
        specify whether you want magma or water
        liquidType should be Water or Magma
]])
  return
end

local pos = {}
pos.x = tonumber(args.location[1])
pos.y = tonumber(args.location[2])
pos.z = tonumber(args.location[3])

if args.offset then
  pos.x = pos.x + tonumber(args.offset[1])
  pos.y = pos.y + tonumber(args.offset[2])
  pos.z = pos.z + tonumber(args.offset[3])
end

local tileBlock = dfhack.maps.ensureTileBlock(pos.x, pos.y, pos.z)
tileBlock.flags.update_temperature = true
tileBlock.flags.update_liquid = true
local xOffset = pos.x - 16*math.floor(pos.x / 16)
local yOffset = pos.y - 16*math.floor(pos.y / 16)

tileBlock.designation[xOffset][yOffset].flow_size = tonumber(args.amount)
tileBlock.designation[xOffset][yOffset].liquid_type = true
tileBlock.flags.update_liquid_twice = true
Title: Re: DFHack 0.40.24-r3
Post by: Abaddon on September 16, 2015, 09:17:20 am
Is there a script which can show me my adventurers stats and stat caps?
Title: Re: DFHack 0.40.24-r3
Post by: qorthos on September 16, 2015, 10:11:19 am
The liquidType is no ignored (now surprise).  Found that out while trying to spawn water.  Gonna have to root around the API docs and see if I can figure it out.  I think LUA is casting 'true' into the liquidType magma enum is.  Lua, y u no strongly typed?   :'(

My first minimod will be an Ice Furnace that takes a block of glacial ice, fuel (mebbe magma) and pipes it to the floor below.




Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 16, 2015, 01:40:36 pm
Ran into a dead-end so far, I was trying to get it where I could add a -all flag and have it show the entire map but so far the only one I can toggle the visibility on is the northwesternmost square because it's 0 by 0 and the structures file defaults to that one in the world_data.region_map stuff I think.

Still works for sites that you can't find anyone to point out, which is super handy in things like a nearly dead world as I was playing in earlier (total remaining pop is like 150 or so I think) because nobody has a clue where anything is anymore.

Code: ("revealsites.lua") [Select]
local hid = df.global.world.world_data.sites
for k, v in ipairs(hid) do
hid[k].flags.Undiscovered=false
hid[k].flags[8]=true
end

Weirdly it doesn't unhide the map block where the lair is (so you're still limited to the locally visible stuff from your travels) but it will unhide all the stuff on visible map blocks for you.

Well, not sure if it's revealing the vaults right, might be another flag in there that needs to be flipped, I just copied the settings from some of the lairs I'd found until it worked as I expected.

Probably try to add toggles so you can have it do lairs, camps, vaults, and everything. Still not sure where to toggle map block visibility is though.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on September 16, 2015, 03:23:24 pm
The liquidType is no ignored (now surprise).  Found that out while trying to spawn water.  Gonna have to root around the API docs and see if I can figure it out.  I think LUA is casting 'true' into the liquidType magma enum is.  Lua, y u no strongly typed?   :'(

My first minimod will be an Ice Furnace that takes a block of glacial ice, fuel (mebbe magma) and pipes it to the floor below.

Change

Code: [Select]
tileBlock.designation[xOffset][yOffset].liquid_type = true
to

Code: [Select]
if df.tile_liquid[args.liquidType] == 0 then
 tileBlock.designation[xOffset][yOffset].liquid_type = false
elseif df.tile_liquid[args.liquidType] == 1 then
 tileBlock.designation[xOffset][yOffset].liquid_type = true
end

Should handle water and magma now
Title: Re: DFHack 0.40.24-r3
Post by: qorthos on September 16, 2015, 05:07:02 pm
My fix was similar. 

Code: [Select]
if args.liquidType == "Magma" then
tileBlock.designation[xOffset][yOffset].liquid_type = 1
else
tileBlock.designation[xOffset][yOffset].liquid_type = 0
end

(also changed type to liquidType in args)

Everything seems to work except I sometimes get a stack of 7/7 water that just hangs out for a little and then later collapses.  A bit odd...

Working on the building now...
Title: Re: DFHack 0.40.24-r3
Post by: Jazzeraint on September 16, 2015, 07:11:23 pm
Would it be possible through DFHack to create a syndrome that infected a Dwarf and made them periodically grow Plump Helmet Men (i.e. spawn a unit) until the Dwarf eventually died? Say, ill for 1 - 4 years, started sprouting PHM that jumped off after the 6 - 12 month mark?

Just an idea. (And if this is the wrong thread to ask this, please let me know~)
Title: Re: DFHack 0.40.24-r3
Post by: Rose on September 16, 2015, 09:47:45 pm
Are you trying to recreate a doctor who episode?
Title: Re: DFHack 0.40.24-r3
Post by: Jazzeraint on September 16, 2015, 09:53:04 pm
Are you trying to recreate a doctor who episode?

Actually no, but I see the resemblance now that you mention it.
I was thinking of how to make raw Plump Helmets less than ideal to eat, and I imagined tumors that burst open and out popped creepy crawlies... and then with the PMH mod already in place, it clicked.
Title: Re: DFHack 0.40.24-r3
Post by: qorthos on September 17, 2015, 11:43:56 am
Water&Magma seems to inconsistently sticking in a 7/7 column.  Sometimes it just takes a few DF days and then it'll fall out, sometimes longer.  Not sure what the deal is.  Should I try setting the flag for liquid updating on adjacent blocks?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 17, 2015, 11:52:28 am
Water&Magma seems to inconsistently sticking in a 7/7 column.  Sometimes it just takes a few DF days and then it'll fall out, sometimes longer.  Not sure what the deal is.  Should I try setting the flag for liquid updating on adjacent blocks?
I know that fluid updates are staggered a bit for FPS concerns, but a few game days seems long.  Hopefully setting the update flag on that and the eight neighboring tiles helps.  There are only seven units of water, so it won't look too strange even if the water stays inside that box for a while.
Title: Re: DFHack 0.40.24-r3
Post by: Jazzeraint on September 17, 2015, 03:21:30 pm
Are there any scripts out there that modify the hunger rates for Dwarves?
If not, could someone direct me toward making one?
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 17, 2015, 08:20:36 pm
Edit: Never mind, the whole problem was due to a stupid typo.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 21, 2015, 09:20:43 am
Are there any scripts out there that modify the hunger rates for Dwarves?
If not, could someone direct me toward making one?

I do not know of any.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 21, 2015, 10:39:40 am
Wait hunger like the counter or hunger like how fast they get hungry, didn't it get discovered that recuperation influences that?

the gui/gm-unit.lua can do the counters as I recall, I've been meaning to add an attribute editor to it since it should be pretty straightforward to just point the same layout as the skill section towards the body.attributes and status.current_soul.mental_attributes instead of status.current_soul.skills with the appropriately renamed sections and value displays swapped in.

Keep thinking about how to translate the list of stuff in appearance.bp_modifiers into a cromulent list for editing and getting distracted from the much easier attributes idea.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on September 21, 2015, 12:15:43 pm
So you guys wanted monsters to attack other people? I finally found how to do it (in my work for arena building).

So there is this thing called "enemy_status_cache". Like name implies it's only used for enemies (or at least my testing showed that). Combined with "unit.enemy.enemy_status_slot" you can figure out what is "relation" between two units. Here's a small script that i used for testing:
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 21, 2015, 12:23:39 pm
Thanks Warmist!  I will test this out when I get a chance (which unfortunately might not be for several days).

Do you need to induce a first blow between the units, or can you specify which one throws the first punch?
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on September 21, 2015, 02:21:59 pm
Thanks Warmist!  I will test this out when I get a chance (which unfortunately might not be for several days).

Do you need to induce a first blow between the units, or can you specify which one throws the first punch?
You can probably set one to be angry at another and the other be friendly (till he gets hit?)
Also found some research on these values: here (https://gist.github.com/warmist/3017dc796a6173c215bb)
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 21, 2015, 03:14:38 pm
Thanks Warmist!  I will test this out when I get a chance (which unfortunately might not be for several days).

Do you need to induce a first blow between the units, or can you specify which one throws the first punch?
You can probably set one to be angry at another and the other be friendly (till he gets hit?)
Also found some research on these values: here (https://gist.github.com/warmist/3017dc796a6173c215bb)
The context would be a newly spawned unit 0 or 1 tiles away from a fort citizen, and the mod logic determines that the newly spawned unit is supposed to be "hostile" but not berserk.
Title: Re: DFHack 0.40.24-r3
Post by: Nazushvel on September 22, 2015, 01:47:16 pm
I've been working on identifying the different variables under bp_modifiers for a utility I'm working on. Is there a place where I can document this in the dfhack or dfstructures repo? Thanks!
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 22, 2015, 02:34:37 pm
Clone a version of df-structures and assign the variable values/names under the unit.appearance entries?

Once you get them worked out or even just worked out as far as you can, submit a pull request, and thank you for working on that too. I've got some idea of them. I know the bottom 20 or so are skin wrinkles, there is a chunk of 5 with the same values for teeth spacing, the hair lengths are a chunk of 2 pairs and 2 more which match the values under tissue_length, and then there are a few more for like nose straightness/size that I don't know as well.
Title: Re: DFHack 0.40.24-r3
Post by: Nazushvel on September 22, 2015, 04:07:50 pm
Gotcha. I am confident I know what all of the bp_modifier values do, as well as the values for tissue styles. I'll try to figure out how to add these values correctly...the XML structure is very confusing to me. I'm completely unfamiliar with C++ and Lisp, and I just dived into Lua for this project.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 22, 2015, 04:26:27 pm
Is there a straightforward way to determine the "type" of an object, for example differentiating between a trap and a workshop?  The type() operator just says "userdata".

It turns out that a building ID can refer to things other than a workshop, and referencing a workshop-only field crashes Lua.  As a stopgap, I filtered on construction_stage 3 and no design quality... but getting the actual object type would be preferable.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 22, 2015, 04:29:48 pm
Try object._type (type() is a function, by the way, which will return "userdata" for anything that isn't a basic Lua type).
What exactly are you doing in Lua that causes a crash? For example, "custom_type" is a field specific to workshops, but "df.building_trapst:new().custom_type" doesn't crash.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 22, 2015, 04:30:08 pm
Dirst: I think that would require run-time type information, which Toady does not have enabled.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 22, 2015, 05:08:56 pm
I had hooked into job completion and checked for job type 68, which is constructing a building.  I was checking the building to see if it was relevant to the mod's logic, but referenced a field (custom_type) that doesn't exist for traps.  I suspect bridges might be a problem too, so the current screen is a new building, construction_stage == 3, and design == nil.  Those should exist for any building... I hope.

Edit: a "capture" or "on error" structure would work, too.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 22, 2015, 05:10:40 pm
Dirst: I think that would require run-time type information, which Toady does not have enabled.
Yeah, that's exactly what I wanted.  Can't have everything I suppose.

Thanks for the help guys!
Title: Re: DFHack 0.40.24-r3
Post by: mifki on September 22, 2015, 05:54:07 pm
Dirst: I think that would require run-time type information, which Toady does not have enabled.
Yeah, that's exactly what I wanted.  Can't have everything I suppose.

Thanks for the help guys!

Don't know why expwnent said that, since game types are known to us. You can use df.is_instance(df.building_workshopst,your_building).
(your_building._type == df.building_workshopst) will work too in your case, but is_instance handles subclasses as well.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on September 22, 2015, 05:59:53 pm
For anyone interested:  I'm working on a pull request to clean up the documentation, and generally make it possible to check whether something is actually documented as it should be.

This is obviously a work in progress, but I'd love any feedback you have at the pull (https://github.com/DFHack/dfhack/pull/693) or here.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 22, 2015, 06:20:27 pm
Dirst: I think that would require run-time type information, which Toady does not have enabled.
Yeah, that's exactly what I wanted.  Can't have everything I suppose.

Thanks for the help guys!

Don't know why expwnent said that, since game types are known to us. You can use df.is_instance(df.building_workshopst,your_building).
(your_building._type == df.building_workshopst) will work too in your case, but is_instance handles subclasses as well.
Yeah, that's what I was referring to with

Try object._type
(This uses dfhack-implemented structure identities, which are similar to vtables for identification purposes, so RTTI isn't required.)
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on September 22, 2015, 07:10:02 pm
I'm grateful this community is so full of helpful code wizards!

I knew there was a right way to do the check.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 22, 2015, 08:18:46 pm
Gotcha. I am confident I know what all of the bp_modifier values do, as well as the values for tissue styles. I'll try to figure out how to add these values correctly...the XML structure is very confusing to me. I'm completely unfamiliar with C++ and Lisp, and I just dived into Lua for this project.
Man, it's all pretty raw in there still huh.

Code: [Select]
<stl-vector name='bp_modifiers' type-name='int32_t'
                        index-refers-to='$$._global.caste.ref-target.bp_appearance.modifier_idx[$].refers-to'/>
If I'm not mistaken that can have the relevant type-name replaced with a list pulled from somewhere, hmmm, we need to take into account other species though.

The parts names are the relevant body parts and layers right? Bah, that's frustrating sounding right off the bat, because we can't just have it be skull_height, skull_width, nose_straightness, ear_height, eye_protrusion, teeth_spacing0, teeth_spacing1, and so forth can we?
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on September 22, 2015, 08:29:49 pm
For anyone interested:  I'm working on a pull request to clean up the documentation, and generally make it possible to check whether something is actually documented as it should be.

This is obviously a work in progress, but I'd love any feedback you have at the pull (https://github.com/DFHack/dfhack/pull/693) or here.

You can now download the pretty, comprehensive html docs on DFFD (http://dffd.bay12games.com/file.php?id=11152), for those interested.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on September 22, 2015, 08:45:19 pm
For anyone interested:  I'm working on a pull request to clean up the documentation, and generally make it possible to check whether something is actually documented as it should be.

This is obviously a work in progress, but I'd love any feedback you have at the pull (https://github.com/DFHack/dfhack/pull/693) or here.

You can now download the pretty, comprehensive html docs on DFFD (http://dffd.bay12games.com/file.php?id=11152), for those interested.

I usually hate auto-generated docs but this is pretty good.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on September 23, 2015, 12:23:32 am
For anyone interested:  I'm working on a pull request to clean up the documentation, and generally make it possible to check whether something is actually documented as it should be.

This is obviously a work in progress, but I'd love any feedback you have at the pull (https://github.com/DFHack/dfhack/pull/693) or here.

You can now download the pretty, comprehensive html docs on DFFD (http://dffd.bay12games.com/file.php?id=11152), for those interested.

I usually hate auto-generated docs but this is pretty good.

I don't like auto-gen docs too. The idea of readme.rst and "lua api.rst" was that it would be readable both in html and txt format. Currently that is not exactly the case (because imho they are too big).

We'll see how it goes i guess...

Dirst: I think that would require run-time type information, which Toady does not have enabled.
Yeah, that's exactly what I wanted.  Can't have everything I suppose.

Thanks for the help guys!

Don't know why expwnent said that, since game types are known to us. You can use df.is_instance(df.building_workshopst,your_building).
(your_building._type == df.building_workshopst) will work too in your case, but is_instance handles subclasses as well.

Imho better way to check this is "building:type()==df.building_type.WORKSHOP (or was it workshop)". Though is_instance is more general this one is (for me at least) more readable. Also there is "subtype" and "custom_type" for more control (e.g. on all traps or just the boulder trap).

Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on September 23, 2015, 01:45:52 am
For anyone interested:  I'm working on a pull request to clean up the documentation, and generally make it possible to check whether something is actually documented as it should be.

This is obviously a work in progress, but I'd love any feedback you have at the pull (https://github.com/DFHack/dfhack/pull/693) or here.

You can now download the pretty, comprehensive html docs on DFFD (http://dffd.bay12games.com/file.php?id=11152), for those interested.
I usually hate auto-generated docs but this is pretty good.
I don't like auto-gen docs too. The idea of readme.rst and "lua api.rst" was that it would be readable both in html and txt format. Currently that is not exactly the case (because imho they are too big).

We'll see how it goes i guess...

Ah - worth noting then that these are not autogenerated docs - just a more coherent system for building the .rst files into html (or pdf, or...).  Nicer style, but the big benefit is that everything can be linked and searchable from the single index file.  Easier building and integration means it's easier to break down the docs into manageable chunks, which should help.

You can find all the .rst files in the new /docs/ directory.  I agree that Readme.rst was too big; I broke it up into a file each for base, plugins, and scripts.  Still huge though   :-\

Spoiler: Far future (click to show/hide)
Title: Re: DFHack 0.40.24-r3
Post by: Nazushvel on September 23, 2015, 10:16:02 am
Code: [Select]
<stl-vector name='bp_modifiers' type-name='int32_t'
                        index-refers-to='$$._global.caste.ref-target.bp_appearance.modifier_idx[$].refers-to'/>
If I'm not mistaken that can have the relevant type-name replaced with a list pulled from somewhere, hmmm, we need to take into account other species though.

The parts names are the relevant body parts and layers right? Bah, that's frustrating sounding right off the bat, because we can't just have it be skull_height, skull_width, nose_straightness, ear_height, eye_protrusion, teeth_spacing0, teeth_spacing1, and so forth can we?

Yeah, I figured that out yesterday after poring over the xml and looking for similar instances that link enum-lists to integer tables.

Unfortunately the different species pose a significant problem. Each index in bp_modifiers means something different depending on the unit species...and even within a species: males have about 20-30 extra variables relating to facial hair that get dumped into the middle of the table.

I'm not sure how the bp_modifier values are getting associated to specific body parts depending on the species. That must be in there somewhere, I would think.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on September 23, 2015, 10:48:36 am
Oh, that points to a part from the creature_raws.xml I think.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 23, 2015, 11:01:12 am
What I was saying is that in the general case it is not possible. If there's a vector<void*> in df-structures there's no automatic way of determining the type. The reason we can do it for buildings is because of the building::getType() method (or whatever it's called) and because we've already mapped the enum it returns.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on September 23, 2015, 04:40:22 pm
What I was saying is that in the general case it is not possible. If there's a vector<void*> in df-structures there's no automatic way of determining the type. The reason we can do it for buildings is because of the building::getType() method (or whatever it's called) and because we've already mapped the enum it returns.

Type is determined (for buildings as well) by matching vtable address to known addresses. If it's still void* in df-structures, then likely it's an unknown type indeed, but for known types we can determine what void* is.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 23, 2015, 04:41:50 pm
I believe that's only if it has virtual functions.
Title: Re: DFHack 0.40.24-r3
Post by: milo christiansen on September 23, 2015, 04:49:13 pm
For anyone interested:  I'm working on a pull request to clean up the documentation, and generally make it possible to check whether something is actually documented as it should be.

This is obviously a work in progress, but I'd love any feedback you have at the pull (https://github.com/DFHack/dfhack/pull/693) or here.

I use autogen docs every day, and these aren't half bad... Better than the hard to use PITA that is available now. (+1 from me)
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on September 24, 2015, 05:55:41 am
Yay, that got merged!  My new pull (https://github.com/DFHack/dfhack/pull/697) adds some nice stuff like internal hyperlinks, automatically pulling in the docs for third-party scripts (it they're there at build time), and so on.  I'm hoping this will get some of you excited enough to go improve it further...  :P
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on September 25, 2015, 12:43:21 pm
Update on the next release: effectively negative progress because there's more stuff to do. The documentation is overhauled in terms of formatting and presentation but the content is about the same. I'd like to go over the documentation and add stuff and organize a bit more. I'd also like to go through the big pile of third party scripts we're adding and decide what needs to go in and what would be too cluttered and fix indentation and try and extract out common functionality, etc, etc. I'm working on it a little each day but it will take longer than I expected.

I do still intend to do DFHack 0.40.24-r4 before the next DF release.

It would go a lot quicker if I just took all the 3rd party scripts and stuffed them in but that would clutter the scripts folder a lot and when I do eventually go in and standardize everything it would break backwards compatibility. I'm willing to break it if there's a good reason for the long-term health of the project but I try not to.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on September 25, 2015, 05:47:28 pm
expwnent, reminding about my small PR to df-structures.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on September 25, 2015, 08:12:10 pm
Update on the next release: effectively negative progress because there's more stuff to do. The documentation is overhauled in terms of formatting and presentation but the content is about the same. I'd like to go over the documentation and add stuff and organize a bit more. I'd also like to go through the big pile of third party scripts we're adding and decide what needs to go in and what would be too cluttered and fix indentation and try and extract out common functionality, etc, etc. I'm working on it a little each day but it will take longer than I expected.

I do still intend to do DFHack 0.40.24-r4 before the next DF release.

It would go a lot quicker if I just took all the 3rd party scripts and stuffed them in but that would clutter the scripts folder a lot and when I do eventually go in and standardize everything it would break backwards compatibility. I'm willing to break it if there's a good reason for the long-term health of the project but I try not to.

Could we maybe do a quick r4 release before going down the rabbit hole on scripts and documentation?  Specifically, a release based off the current develop branch (with docs pull), but not including any of the other work you're going through.

I've been one of the people pushing on both those fronts, and I think it's important stuff to do.  However we're already sitting on the biggest changelog ever (http://peridexiserrant.neocities.org/html/docs/Changelog.html), and I think adding in all the scripts work and further changes would make it too big.

r4 would be a huge release but more or less standard, while r5 could overhaul the scripts and properly structure the documentation etc.  This also provides clarity for users and modders, makes it much easier for modders or pack maintainers to communicate with newbs about required versions (and I have to do a lot of that), and gives us a clear baseline to assess the proposed r5 changes against.
Title: Re: DFHack 0.40.24-r3
Post by: mifki on September 27, 2015, 05:19:28 pm
we're already sitting on the biggest changelog ever (http://peridexiserrant.neocities.org/html/docs/Changelog.html)

Have you noticed that it's impossible to read because text doesn't wrap inside grey areas?
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on September 27, 2015, 08:02:17 pm
we're already sitting on the biggest changelog ever (http://peridexiserrant.neocities.org/html/docs/Changelog.html)

Have you noticed that it's impossible to read because text doesn't wrap inside grey areas?

Yes, using literal blocks is certainly less than ideal.  In desktop browsers it's usually OK, though you still need to scroll horizontally.  Mobile is awfully narrow.

Note however that this is just a placeholder; after the next release (when merge conflicts are less of an issue) I'll format it to use subheadings and the field list syntax.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 27, 2015, 09:32:27 pm
I've been thinking of reformatting NEWS as a bulleted list (as it was in 0.34.11), by the way. I could start the headings with "#" or something else to make inclusion in documentation easier, or you could replace first-level bullets (or lack of bullets) with appropriate heading characters.

(Also, I know there are a lot of changes in r4, but it also has one of the best-documented changelogs, so changelog length isn't a perfect metric.)

Edit: Oh, you've already reformatted NEWS as a RST file. It's worth keeping in mind that NEWS is generally used verbatim for release notes on GitHub, so it would be nice to keep the syntax Markdown-compatible if possible. Headings underlined with "===" and "---" seem to work, for example, as do hyphen-bulleted lists.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on September 27, 2015, 11:56:19 pm
I'm aware that changelog length isn't a great metric, but it's easy to check.  The other comparison would be to 0.34.11-r4, which could have been smoother.  This one is coming along nicely now though.

After experimenting with a couple of different formatting options, it turns out that my favourite is entirely in the overlap between .rst and markdown.  In short:  headings underlined with ----, * bullet lists for all sections, and items related to a particular tool start "toolname:".  Looks good in rst, markdown, and raw text; and easy to write.  I'll go through the rest of the file later and make a pull request.
Title: Re: DFHack 0.40.24-r3
Post by: DeDeRon on September 28, 2015, 06:24:36 am
i just pulled the last changes and when running cmake i was greeted with a bunch of error messages.

running "git submodules --init" fixed most of them (maybe this should ne noted in the docs, "git submodules update" did not work.).

no i'm stuck with

-- Could NOT find Sphinx (missing:  SPHINX_EXECUTABLE)
CMake Error at CMakeLists.txt:205 (message):
  Sphinx not found but BUILD_DOCS enabled

google revealed that sphinx is a documentation tool. can we have this build target disabled by default? it introduces another dependency.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 28, 2015, 11:25:06 am
That's what the BUILD_DOCS option is for - if you disable it, you don't need to have sphinx installed. If it's disabled by default, there's a risk of including no documentation or inaccurate documentation in releases.

I thought the submodule message referred to "git submodule update --init", which does work, but I'll fix it if not.

Title: Re: DFHack 0.40.24-r3
Post by: DeDeRon on September 28, 2015, 01:33:35 pm
That's what the BUILD_DOCS option is for - if you disable it, you don't need to have sphinx installed. If it's disabled by default, there's a risk of including no documentation or inaccurate documentation in releases.

I thought the submodule message referred to "git submodule update --init", which does work, but I'll fix it if not.

indeed, the i just checked the doc, but to me it seemed that  "git submodule update --init" referred to the first checkout only. my knowledge about git is very limited.

and cmake -DBUILD_DOCS=no did the trick. thx

now make install fails:

"CMake Error at cmake_install.cmake:43 (FILE):
  file INSTALL cannot copy file
  "/home/schlichti/build/dfhack/dfhack-config/default/default/default/default/default/default/default/default/default/default/d
efault/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/
default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default
/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/defaul
t/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/defau
lt/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/defa
ult/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/def
ault/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/de
fault/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/d
efault/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/
default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default
/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/defaul
t/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/defau
lt/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/defa
ult/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/def
ault/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/de
fault/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/d
efault/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/
default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default
/default/default/default/default/default/default/default/default/default/default/default/default/default/default/default/defaul
t/default/default/default/default/defau" etc..

this msg appears many times.

i guess i wait till things are fleshed out.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 28, 2015, 03:12:39 pm
What are the contents of your dfhack-config directory (in the source tree, not your DF folder)?
Title: Re: DFHack 0.40.24-r3
Post by: DeDeRon on September 28, 2015, 03:20:21 pm
What are the contents of your dfhack-config directory (in the source tree, not your DF folder)?

schlichti@fiete:~/build/dfhack/dfhack-config $ ls -l
total 12
drwxr-xr-x 3 schlichti schlichti 4096 Sep 28 20:31 default
-rw-r--r-- 1 schlichti schlichti  514 Sep  5 18:55 dfstatus.lua
-rw-r--r-- 1 schlichti schlichti  221 Jun 22 18:39 dwarfmonitor.json

and after cd to ./default guess what:

schlichti@fiete:~/build/dfhack/dfhack-config/default $ ls -l
total 12
drwxr-xr-x 3 schlichti schlichti 4096 Sep 28 20:31 default
-rw-r--r-- 1 schlichti schlichti  514 Sep  5 18:55 dfstatus.lua
-rw-r--r-- 1 schlichti schlichti  221 Jun 22 18:39 dwarfmonitor.json

watching the output of find . tells me that this recursion goes very deep.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on September 28, 2015, 04:09:39 pm
That's strange - the 'default' directory shouldn't exist at all (https://github.com/DFHack/dfhack/tree/develop/dfhack-config) in your source tree. Can you check `git status` and make sure you haven't added it somehow (and make sure you're using the latest commit of the develop branch)?
At any rate, you ought to be able to remove it safely if there's nothing important in it.
Title: Re: DFHack 0.40.24-r3
Post by: DeDeRon on September 29, 2015, 02:38:07 am
That's strange - the 'default' directory shouldn't exist at all (https://github.com/DFHack/dfhack/tree/develop/dfhack-config) in your source tree. Can you check `git status` and make sure you haven't added it somehow (and make sure you're using the latest commit of the develop branch)?
At any rate, you ought to be able to remove it safely if there's nothing important in it.

build and install do work now. i have no idea where the default dirs came from. thx for the help.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on October 01, 2015, 05:26:03 pm
So while playing around in game testing my scripts and I came across an interesting flag in flows. Namely

Code: [Select]
expanding = true
Now this may have been common knowledge, but I had no idea you could keep a flow from spreading... That means you can target the exact locations you want the flow to appear and only put it in those locations. Want your caster to put a line of dragonfire, easy. Want a spider to spit a cone of webs, done. Want a perfect circle of smoke, alright!

I will be incorporating this into my scripts.

EDIT: It may also be possible to stop the spread of fires when using fire based spells by removing and burnable things from a tile, and then placing the fire with expanding = false so that the local tile doesn't start a fire.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on October 02, 2015, 08:43:10 am
I didn't know that either. Interesting.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on October 02, 2015, 02:48:51 pm
That is, man, I can think of a lot of effects that enables, cool shit!
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on October 05, 2015, 03:25:21 pm
Are we still troubleshooting problems with spawn-unit, or has all the effort moved over to create-unit?

One of my players posted a save (http://dffd.bay12games.com/file.php?id=11188) that has two spawned creatures go nuts shortly after the save is loaded.  Specifically they start to hunt a nearby friendly creature.

This happens the moment an unrelated script throws an error.  The next version of the mod fixes the script that throws the error, but in the spirit of root cause analysis, I'd like to figure out why red text in the console seems to spook spawned creatures.

For anyone who wants to take a look, watch the two "war awakened stones" until a floor-building job is completed.  The !!SCIENCE!! here is those creatures, like I said I already know how to fix the script error.
Title: Re: DFHack 0.40.24-r3
Post by: Boltgun on October 07, 2015, 03:48:39 am
When we tracked down the issue, it was narrowed it into a bunch of anon flags inside unit.enemy, or the values inside the unit.animal.population.

The fix is there (https://github.com/Devduweb/DF-succubus/blob/master/succubus-prod/raw/scripts/spawn.lua#L480) but create unit will work better anyway.
Title: Re: DFHack 0.40.24-r3
Post by: Tilogour on October 10, 2015, 06:45:41 am
I just download DFHack (default settings), started a game, enter Legend mode, and tried to export all and I see this.
Spoiler (click to show/hide)
How could I fix this?
I'm totally newbie with this utility.
BTW: Save is here (http://dffd.bay12games.com/file.php?id=11198) if you need this.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on October 10, 2015, 07:04:42 am
What version of DFHack are you using?
Title: Re: DFHack 0.40.24-r3
Post by: Tilogour on October 10, 2015, 07:05:27 am
I have newest version -> DFHack 0.40.24-r3 (or maybe it's not newest... I don't know)
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on October 10, 2015, 03:08:59 pm
Are we still troubleshooting problems with spawn-unit, or has all the effort moved over to create-unit?

create-unit works differently enough that it's unlikely to have the same bugs, and I never worked much on spawn-unit. The people who did are busy, I think.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on October 10, 2015, 07:07:32 pm
Are we still troubleshooting problems with spawn-unit, or has all the effort moved over to create-unit?

create-unit works differently enough that it's unlikely to have the same bugs, and I never worked much on spawn-unit. The people who did are busy, I think.
As long as the new script accepts age 0 (which is an adult) then I can just start using that one.  Thanks for all of your work on this.
Title: Re: DFHack 0.40.24-r3
Post by: Mason11987 on October 11, 2015, 05:13:55 am
I just download DFHack (default settings), started a game, enter Legend mode, and tried to export all and I see this.
Spoiler (click to show/hide)
How could I fix this?
I'm totally newbie with this utility.
BTW: Save is here (http://dffd.bay12games.com/file.php?id=11198) if you need this.

The export_legends.lua code I wrote broke with a DFHack update.

You can fix it by finding that line (#400, or Ctrl-F for "assumed_identities") and replace with the following:

Code: [Select]
local thisIdentity = df.global.world.identities.all[v]

That should work.
Title: Re: DFHack 0.40.24-r3
Post by: Tilogour on October 11, 2015, 10:28:12 am
I tried to do that but It doesn't work.
Maybe because I'm a newbie. Could you send fixed export_legends.lua to github?
(after you check it first)
I found line #400 with notepad++, but I see this http://imgur.com/5N15Cjm
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on October 11, 2015, 11:04:26 am
Try https://github.com/DFHack/dfhack/blob/develop/scripts/exportlegends.lua
Title: Re: DFHack 0.40.24-r3
Post by: Tilogour on October 11, 2015, 12:39:58 pm
Try https://github.com/DFHack/dfhack/blob/develop/scripts/exportlegends.lua
http://i.imgur.com/U7kzA2j.jpg?1
Title: Re: DFHack 0.40.24-r3
Post by: Mason11987 on October 12, 2015, 04:21:31 am
Try https://github.com/DFHack/dfhack/blob/develop/scripts/exportlegends.lua
http://i.imgur.com/U7kzA2j.jpg?1

Try this version: https://github.com/Mason11987/dfhack/blob/patch-1/scripts/exportlegends.lua
Title: Re: DFHack 0.40.24-r3
Post by: Tilogour on October 12, 2015, 04:49:10 am
It's working now!
Thank you very much!
Title: Re: DFHack 0.40.24-r3
Post by: Rose on October 12, 2015, 12:35:28 pm
Is it theoretically possible to allow building constructed walls from any item?
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on October 12, 2015, 12:41:11 pm
I think so.
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on October 12, 2015, 06:35:51 pm
Is it theoretically possible to allow building constructed walls from any item?
With advfort you probably can. I know I removed the "hard surfaces only" restriction so I could engrave the walls I built the faces of armok with.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on October 14, 2015, 10:38:21 pm
Update on the next release: effectively negative progress because there's more stuff to do. The documentation is overhauled in terms of formatting and presentation but the content is about the same. I'd like to go over the documentation and add stuff and organize a bit more. I'd also like to go through the big pile of third party scripts we're adding and decide what needs to go in and what would be too cluttered and fix indentation and try and extract out common functionality, etc, etc. I'm working on it a little each day but it will take longer than I expected.

I do still intend to do DFHack 0.40.24-r4 before the next DF release.

It would go a lot quicker if I just took all the 3rd party scripts and stuffed them in but that would clutter the scripts folder a lot and when I do eventually go in and standardize everything it would break backwards compatibility. I'm willing to break it if there's a good reason for the long-term health of the project but I try not to.

It's been a while, any further news or time estimates?

I ask because I expect a DF release in the first week of November, and 34.11-r5 proved the value of a recent DFHack release going in to the update work.  This doesn't leave much time for third-party updates (eg TwbT, some utilities) to update either.
Title: Re: DFHack 0.40.24-r3
Post by: Rumrusher on October 15, 2015, 02:27:47 am
have a question is it possible to toggle the Army tent mechanic on the adventurer's army?
Title: Re: DFHack 0.40.24-r3
Post by: LastGreen on October 17, 2015, 04:25:18 pm
"How to install DFHack:
•First, get the archive meant for your system. Extract the contents into your DF folder.
•On Windows, you're ready to use DFHack. An extra command line window should appear when you run DF."

So I haven't played in awhile and I'm trying to install DFHack but.. I cant figure it out. what archive am I suppose to find? and do I need another program in order to read the file? I downloaded the windows version but its just a single unreadable file. so I'm alittle confused. I tried downloading the lazy newb pack and simply taking the pre installed DF hack from there but that didn't work either.

Edit: nvm I figured out which file I missed in the Lazynewbpack.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on October 17, 2015, 04:50:02 pm
The DFHack archives are available here (https://github.com/DFHack/dfhack/releases/tag/0.40.24-r3) (the "Download link" under "DFHack 0.40.24-r3" in the first post). You'll need 7-zip to decompress the Windows archive, from which you need the "hack" folder. On Windows you'll also need SDL.dll, SDLreal.dll, libruby.dll, lua.dll, and protobuf-lite.dll, but installing all of the files is best.
Title: Re: DFHack 0.40.24-r3
Post by: Eric Blank on October 17, 2015, 07:14:30 pm
Quick question: wondering if there's still a utility included that can reverse madness in dwarves.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on October 17, 2015, 07:33:37 pm
Gm-editor can do it, but the interface is a bit complex.
Title: Re: DFHack 0.40.24-r3
Post by: Atomic Chicken on October 18, 2015, 03:26:35 pm
Quick question: wondering if there's still a utility included that can reverse madness in dwarves.
Gm-editor can do it, but the interface is a bit complex.
Select the unit, enter "gui/gm-editor" in the console, select "mood" and change the value to -1.
Title: Re: DFHack 0.40.24-r3
Post by: Immortal-D on October 20, 2015, 03:24:36 pm
Edit 3: I for sure have it solved now, should anyone else encounter this.

Edit 2: After reinstalling to deal with a graphics issue, the problem is back :(  Ctrl-s allows me to set a limit directly, without any menu.  Alt-w simply doesn't work, even though it is the default hotkey in the init.

Edit: Got it sorted out :)  I didn't realize how dependent on Workflow I have become until I didn't have it.

Hey peeps, quick question.  Using the latest version, the ingame GUI for Workflow Manager is invisible.  I can see the background change when I select it with a job, and can enter a contraint.  However, material options, that nifty graph, etc. have all vanished.  Any info is appreciated :)

Additionally, the console returns 'Toggled display of water/magma depth'.
Title: Re: DFHack 0.40.24-r3
Post by: Eric Blank on October 22, 2015, 10:50:42 am
Quick question: wondering if there's still a utility included that can reverse madness in dwarves.
Gm-editor can do it, but the interface is a bit complex.
Select the unit, enter "gui/gm-editor" in the console, select "mood" and change the value to -1.

Thanks! I'll give that a shot. Unfortunately the guy died anyway, but at least he got a really spiffy tomb.
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on October 26, 2015, 05:13:45 am
Is there a simple way to set up a callback for 1 tick later?  Creatures spawned with the create-unit script don't seem to have a valid enemy.enemy_status_slot right away, but they do if I pause the game after they spawned.

Still fiddling while ways to set the flags correct from the start, but a callback would also work.  In principle, more than one creature can appear in the same tick, so the callback would need an arbitrary identifier like Eventful has.

Edit: Well, I managed to set the enemy_status as the creature was spawned, and it still shows up on the unit list as "friendly".  Will have to do this some other way.
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on October 26, 2015, 11:11:49 am
dfhack.timeout(1,'ticks',callback)

if you need function arguments in the callback, you can use an anonymous function:

dfhack.timeout(1,'ticks',function() foo(bar,baz) end)
Title: Re: DFHack 0.40.24-r3
Post by: Dirst on October 26, 2015, 11:26:03 am
dfhack.timeout(1,'ticks',callback)

if you need function arguments in the callback, you can use an anonymous function:

dfhack.timeout(1,'ticks',function() foo(bar,baz) end)
Great to know.  Problem is that the fix I was trying to apply doesn't fix the problem :(
Title: Re: DFHack 0.40.24-r3
Post by: Boltgun on October 27, 2015, 10:32:22 am
Hello,
Did anyone managed to add interactions with add-syndrome?

I tried adding a syndrome through a script (https://github.com/Devduweb/DF-succubus/blob/master/succubus-prod/raw/scripts/succubus/power-learning.lua#L71) and I can confirm that it worked with show-unit-syndromes.

But once in combat the unit never use the interaction. It's the most obvious with the firey one (https://github.com/Devduweb/DF-succubus/blob/master/succubus-prod/raw/objects/interaction_succubus.txt#L155). If I switch into arena mode and assume control, I can throw fireball but the AI never tries.

I remember we had the same problem in 0.34 no and we fixed that by setting additional timers?

Second problem, LUA_HOOK reactions seems to fire twice.

Thanks
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on November 02, 2015, 06:21:14 am
Proposal:  make DFHack scripts a seperate repo
(see it on github here (https://github.com/DFHack/dfhack/issues/723))

For script developers, the current system is awkward enough to use that most simply don't. Many maintain git repos for their scripts with no shared history, and more still don't use git at all.

I think it self-evident that script authors working on a fork would be better than our new submodule system, and that encouraging more people to use git for DFHack scripts would be a good thing. I further assume that we would like to know about as much of the script development being done as possible, and prefer to have the option of adopting that work into the standard distribution.

So the proposal is actually pretty simple:
What are the advantages for users (ie script authors)?
Advantages for DFHack core developers?
Thoughts? I know this is a big step, but the DFHack project is getting big enough that it's hard to manage and this seems like a natural and helpful split to make.
Title: Re: DFHack 0.40.24-r3
Post by: Warmist on November 02, 2015, 06:52:11 am
<...>
each author forks the repo, and works in /devel/$name/
<...>

I'm for it but can't seem to understand why this is needed? Imho it would be more sense to fork and work in same location as the script is intended to be (bonus points to improve other $name scripts :) ). Also history would be better as having file in same place lets you track changes more easily (e.g. tried figuring out something about tweak but because it was split into files and moved around it was a chore).
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on November 02, 2015, 08:06:01 am
Right, if you're working directly towards publication the expected file location is the right place to start. I would hope that this becomes more common.

For longer term stuff or experiments though, such as most of the new sibmodules, the devel subdirectory is an alternative to entirely separate repos.  And appropriate use of "git mv" preserves the history of a file even when it's path changes, though splitting and combining files still confuses it.
Title: Re: DFHack 0.40.24-r3
Post by: Gorobay on November 02, 2015, 05:58:02 pm
I don’t think git mv (https://git.wiki.kernel.org/index.php/GitFaq#Why_does_Git_not_.22track.22_renames.3F) means what you think it means.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on November 02, 2015, 06:01:31 pm
"Appropriate" in this case means you commit between moving and editing the file, so it can be tracked.  There's plenty of magic left for me in git, but I do get the basics  ;)
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on November 02, 2015, 06:25:53 pm
Without additional options, there's no difference between "git mv a b" and "mv a b; git add a b". Also, GitHub does not follow renames in its web interface (see https://github.com/DFHack/dfhack/commits/develop/plugins/title-version.cpp for an example), and doesn't deal with them in PRs very well either.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on November 05, 2015, 03:05:44 pm
So modtools/add-syndrome, for lack of a better term, needs some work, I'm just not exactly sure what. First off most syndromes are added correctly, you can give a unit an interaction that it will use correctly, change display name/tile, change attributes, and basically anything that is considered a "Special Effect" on http://dwarffortresswiki.org/index.php/DF2014:Syndrome (http://dwarffortresswiki.org/index.php/DF2014:Syndrome). But any of the base effects will have do nothing. My brief bit of science that I did found the following.

When applying a syndrome via interaction (which is what I figure we should model add-syndrome after, instead of adding a syndrome via attack). There are several additional components that are not correctly set.

1. None of the target_ vectors are populated in the symptoms list.
2. This leads to no wound being generated.
3. If the target_vectors are artificially populated a wound is automatically created, but it's parts vector is empty
4. Filling in the parts vector seems to correctly "apply" the syndrome. Unfortunately using this method means that out of everything in;
Code: [Select]
[CE_NECROSIS:SEV:100:PROB:100:RESISTABLE:BP:BY_TYPE:THOUGHT:ALL:BP:BY_TYPE:NERVOUS:ALL:START:30:PEAK:60:END:1200]the only thing we can really do is apply necrosis to the correct body parts for the correct times. As you have to populate all the values, and there is no easy way to handle SEV or RESISTABLE.
5. Unfortunatelyx2 in 3 of my 5 tests the game crashed. This may be because I was creating entries by copying another units. I am unsure

I am hoping that someone more knowledgeable about the workings of things can come up with a way to add damaging syndromes via add-syndrome. Otherwise I will move back to just adding wounds directly (this suffers from the same Unfortunately as number 4)
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on November 05, 2015, 11:22:23 pm
Update on the next release: effectively negative progress because there's more stuff to do. The documentation is overhauled in terms of formatting and presentation but the content is about the same. I'd like to go over the documentation and add stuff and organize a bit more. I'd also like to go through the big pile of third party scripts we're adding and decide what needs to go in and what would be too cluttered and fix indentation and try and extract out common functionality, etc, etc. I'm working on it a little each day but it will take longer than I expected.

I do still intend to do DFHack 0.40.24-r4 before the next DF release.

It would go a lot quicker if I just took all the 3rd party scripts and stuffed them in but that would clutter the scripts folder a lot and when I do eventually go in and standardize everything it would break backwards compatibility. I'm willing to break it if there's a good reason for the long-term health of the project but I try not to.

Just another ping - is there an ETA for the DFhack release, given that the DF release is expected very soon?

The documentation is I think basically done; https://dfhack.readthedocs.org works and pull #732 deals with all the remaining issues I could see.

Of the third-party scripts, Roses' and dscorbett's are disabled for this release, Lethosor's are IMO fine, and the others are one or two small scripts.  Standardizing and extracting common functionality is great, but at this point the real risk to compatibility is going so long without a release that everything changes!

For modders and users alike, it will be much easier to make the transition across DF versions if there has been a recent DFHack release - otherwise we have to cope with all the feature changes at the same time as the DF changes.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on November 06, 2015, 12:23:13 am
I'm working on cleaning things up for one soon (I was hoping to do it today, but there are a couple more pull requests to get to).

I can't say I understand the argument for releasing before the next DF release, although I certainly want to - there's nothing preventing us from making a DFHack release before adding support for the new DF version after it's released. I also don't know how much modders will gain from having a DFHack release before the new DF release, given that many remain with the older DF version for a while.
Title: Re: DFHack 0.40.24-r3
Post by: Jay on November 06, 2015, 12:46:22 am
I still don't plug the DF release before December, personally.

You're trying to keep backwards compatibility, so I don't really see the ground that the argument is trying to stand on.
If you had rewritten core parts of the application and broken existing scripts, sure, but...
The benefit isn't there to rush it, as far as I can see.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on November 06, 2015, 01:31:29 am
I'm working on cleaning things up for one soon (I was hoping to do it today, but there are a couple more pull requests to get to).
  • I can't say I understand the argument for releasing before the next DF release, although I certainly want to.
  • There's nothing preventing us from making a DFHack release before adding support for the new DF version after it's released.
  • I also don't know how much modders will gain from having a DFHack release before the new DF release, given that many remain with the older DF version for a while.
Awesome, that's sooner than I was expecting (and sorry for continuing to add more pulls!).

Given (2), the only reason for (1) is just that people are going to be more excited about migrating if it's unambiguously the newest and best thing around.  There is a potential trade-off between releasing features and updating for a new version, even if the reality is that it doesn't make much difference.

I'd like as much as possible of the long tail in (3) to be on DFHack r4 as possible, to maximise the ease of updates when they finally come due, and as above I think an earlier release would help with this.
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on November 06, 2015, 04:25:54 pm
Some gm-editor questions:
1. Where are entity loyalties stored for a creature? Exact location please, I couldn't find it from someone else's instructions.
2. Where is state of matter stored in an object?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on November 06, 2015, 05:05:26 pm
I'd like to point out that nothing in gm-editor is specific to gm-editor - it's just a more friendly interface that shows exactly the same layout of structures that other tools use.
If by "state of matter" you mean solid/liquid/gas, those might be determined by checking the object's temperature against the states stored in its raws. (It's hard for me to check exact layouts at the moment, but I'll check soon.)
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on November 06, 2015, 05:18:48 pm
Objects do not have a state of matter, states of matters are object. Most objects are solid, anything in a powder is POWDER_MISC, liquids are LIQUID_MISC or DRINK, globs/pastes/pressed things are GLOB and gasses AFAIK don't have an item at all.
Title: Re: DFHack 0.40.24-r3
Post by: expwnent on November 06, 2015, 05:33:00 pm
So modtools/add-syndrome, for lack of a better term, needs some work, I'm just not exactly sure what. First off most syndromes are added correctly, you can give a unit an interaction that it will use correctly, change display name/tile, change attributes, and basically anything that is considered a "Special Effect" on http://dwarffortresswiki.org/index.php/DF2014:Syndrome (http://dwarffortresswiki.org/index.php/DF2014:Syndrome). But any of the base effects will have do nothing. My brief bit of science that I did found the following.

When applying a syndrome via interaction (which is what I figure we should model add-syndrome after, instead of adding a syndrome via attack). There are several additional components that are not correctly set.

1. None of the target_ vectors are populated in the symptoms list.
2. This leads to no wound being generated.
3. If the target_vectors are artificially populated a wound is automatically created, but it's parts vector is empty
4. Filling in the parts vector seems to correctly "apply" the syndrome. Unfortunately using this method means that out of everything in;
Code: [Select]
[CE_NECROSIS:SEV:100:PROB:100:RESISTABLE:BP:BY_TYPE:THOUGHT:ALL:BP:BY_TYPE:NERVOUS:ALL:START:30:PEAK:60:END:1200]the only thing we can really do is apply necrosis to the correct body parts for the correct times. As you have to populate all the values, and there is no easy way to handle SEV or RESISTABLE.
5. Unfortunatelyx2 in 3 of my 5 tests the game crashed. This may be because I was creating entries by copying another units. I am unsure

I am hoping that someone more knowledgeable about the workings of things can come up with a way to add damaging syndromes via add-syndrome. Otherwise I will move back to just adding wounds directly (this suffers from the same Unfortunately as number 4)

Posting to remind myself later.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on November 06, 2015, 05:39:13 pm
Yeah, solid items disintegrate when they start boiling (you can modify item->temperature to cause that), although they leave behind flow_info objects (e.g. "boiling bronze") which are accessible with gm-editor.
I'm not sure what exactly you mean by "entity loyalties", but here's a way you can access the entities a citizen belongs to:
* Run "gui/gm-editor" with the unit selected
* Run ":gui/gm-editor df.historical_figure.find(<value of unit->hist_figure_id>)"
* Locate the entity_id value in each entry in entity_links of the type "histfig_entity_link_memberst" (e.g. entity_links->0->entity_id, entity_links->1->id, etc.)
* Run ":gui/gm-editor df.historical_entity.find(<entity ID>)" for each
Title: Re: DFHack 0.40.24-r3
Post by: Max™ on November 06, 2015, 06:42:01 pm
Wait do the colons make it search the current target with gm-editor?
Title: Re: DFHack 0.40.24-r3
Post by: Putnam on November 06, 2015, 06:43:12 pm
No.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on November 06, 2015, 06:55:10 pm
Colons cause DFHack to treat everything after the command name as the first argument to the command. For example, ":devel/print-args a b" prints "a b", and "devel/print-args a b" prints "a" and "b" on separate lines. This is useful when passing lua snippets to commands, since it avoids issues if whitespace is accidentally added (the whitespace is passed through as part of the first argument).
Title: Re: DFHack 0.40.24-r3
Post by: scamtank on November 07, 2015, 05:46:55 am
I'm trying to do a thing, but I'm terrible and I can't figure out what's wrong.

What I want to make happen is that nobody trades with clay anymore, elves in particular. UristdaVinci's blood-del script already crawls entity resource lists and purges all mentions of blood and other useless extracts, so I thought I'd repurpose that, but it seems I can't just make the script look in "misc_mat.clay" instead of "misc_mat.extracts" instead.

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.misc_mat.clay.mat_index do
  v=my_entity.resources.misc_mat.clay.mat_type[k]
  sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.clay.mat_index[k])
  if (sText==nil) then
   my_entity.resources.misc_mat.clay.mat_type:erase(k)
   my_entity.resources.misc_mat.clay.mat_index:erase(k)
   k=k-1
  else
   if(sText.material.id=="CLAY") then
    my_entity.resources.misc_mat.clay.mat_type:erase(k)
    my_entity.resources.misc_mat.clay.mat_index:erase(k)
    k=k-1
   end
   if(sText.material.id=="SANDY_CLAY") then
    my_entity.resources.misc_mat.clay.mat_type:erase(k)
    my_entity.resources.misc_mat.clay.mat_index:erase(k)
    k=k-1
   end
   if(sText.material.id=="SILTY_CLAY") then
    my_entity.resources.misc_mat.clay.mat_type:erase(k)
    my_entity.resources.misc_mat.clay.mat_index:erase(k)
    k=k-1
   end
   if(sText.material.id=="CLAY_LOAM") then
    my_entity.resources.misc_mat.clay.mat_type:erase(k)
    my_entity.resources.misc_mat.clay.mat_index:erase(k)
    k=k-1
   end

  end
  k=k+1
 end
end


This was my crude attempt. What do?
Title: Re: DFHack 0.40.24-r3
Post by: TheFlame52 on November 07, 2015, 10:43:59 am
Okay, so the first part is useful, I'm in the creature's historical_figure entry.

But
uh
There aren't any entries under histfig_entity_link. Is this my problem? The creature is a tamed roc, by the way.

So what I really want to know, I guess, is there a way to make tamed megabeasts (and their children) loyal to my fortress?
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on November 07, 2015, 05:56:26 pm
I'm not very familiar with civ loyalties. What I suggested just lists the civs that a unit belongs to, which probably doesn't include animals.

PSA: I'm working on a release, so let me know of any last-minute changes (preferably not large ones)! There's a sort of checklist here (https://github.com/DFHack/dfhack/issues/737) (in no set order) if anyone's curious.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on November 07, 2015, 06:12:14 pm
Turns out that read the docs wrongly sets readme.md as the root instead of docs/index.rst - try adding the file to the ignore list in conf.py, and specifying the file extensions as a one-element list instead of a string.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on November 07, 2015, 06:50:27 pm
https://dfhack.readthedocs.org/en/latest/ is returning a 404 error now.

Edit: http://dfhack.readthedocs.org/en/latest/docs/ works. Is is possible to get rid of the docs/ subfolder? (It doesn't exist in an offline DFHack installation.)
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on November 07, 2015, 07:26:12 pm
Seems that https://github.com/DFHack/dfhack/commit/5826b49d09f12ebc16cc6937234b1e56aa39a559 is the culprit, thanks to readthedocs ignoring the relevant config :(

And a release package should include that; the whole docs folder is moved over.  readthedocs.org should be hosting the subtree from "~/docs/html/..." See https://github.com/DFHack/dfhack/blob/develop/CMakeLists.txt#L244
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on November 07, 2015, 08:12:17 pm
Looks like it's working now.
Title: Re: DFHack 0.40.24-r3
Post by: PeridexisErrant on November 07, 2015, 08:28:01 pm
Yay!  Just a not to anyone interested:  the canonical url is https://dfhack.readthedocs.org (https://dfhack.readthedocs.org), which redirects to the correct version - and soon that will be "stable" (master) rather than "latest" (develop).  We'll also have any notable older versions tagged, for historical builds.
Title: Re: DFHack 0.40.24-r3
Post by: Rose on November 08, 2015, 12:32:02 am
Is there an easy way to detect whether a unit is hostile, neutral, or a member of your fort?
Title: Re: DFHack 0.40.24-r3
Post by: mifki on November 08, 2015, 04:36:22 pm
Is there an easy way to detect whether a unit is hostile, neutral, or a member of your fort?

There's some code in https://github.com/DFHack/dfhack/blob/master/plugins/ruby/unit.rb to categorise units, but it's quite complicated, you need to check that all the conditions are up to date.
Title: Re: DFHack 0.40.24-r3
Post by: lethosor on November 08, 2015, 06:48:02 pm
r4 is up! (https://github.com/DFHack/dfhack/releases/tag/0.40.24-r4)
Title: Re: DFHack 0.40.24-r4
Post by: Max™ on November 08, 2015, 08:16:54 pm
r4 is up! (https://github.com/DFHack/dfhack/releases/tag/0.40.24-r4)
Need to rename the thread don't we!

:O

I went to copy over my scripts and add in my personal use changes to gm-editor and launch/names are already in there. *squee*
Title: Re: DFHack 0.40.24-r4
Post by: expwnent on November 08, 2015, 08:52:27 pm
Front post updated. Special thanks to Lethosor for putting together this release which is what I'm theoretically supposed to do!
Title: Re: DFHack 0.40.24-r4
Post by: Dirst on November 08, 2015, 09:13:30 pm
Always awesome when the thread title changes!  Thanks for all the wizardry you guys cram into these releases!
Title: Re: DFHack 0.40.24-r4
Post by: PeridexisErrant on November 08, 2015, 09:19:26 pm
Front post updated. Special thanks to Lethosor for putting together this release which is what I'm theoretically supposed to do!
You also need to change the "compile" and "contributors" links, since those filenames changed ;-)

And maybe someone could download the old binaries from dethware and DFFD, and upload them on the Github releases?

I went to copy over my scripts and add in my personal use changes to gm-editor and launch/names are already in there. *squee*
Always awesome when the thread title changes!  Thanks for all the wizardry you guys cram into these releases!
I too love updates, as much for all the fixed bugs as the new features  :D

Maybe an actual release schedule would help this happen more regularly?  Something like "release at the start of each month" shouldn't be too tricky, given all the build infrastructure and testing  :P
Title: Re: DFHack 0.40.24-r4
Post by: Putnam on November 09, 2015, 11:55:56 pm
...probably should've mentioned before release that the header files are completely unnecessary and mostly just make the file take twice as long to unzip

EDIT: this seems to have broken compatibility with script_environment

that's, uh, very bad for me, like, "utter catastrophe none of my mods work at all" bad

EDIT 2: To be exact, I have no goddamn idea how it works now. I script_environment a script and only get a dfhack_flags table and a moduleMode bool instead of the normal global variables. Trying reqscript gets me an error about not being usable as a module. How do i make something usable as a module?
Title: Re: DFHack 0.40.24-r4
Post by: Warmist on November 10, 2015, 04:14:47 am
Actually i never figured out the new script modules and trying to avoid them :D (though haven't had any time to do df-related stuff lately)
Normal modules look simple and nice (as in local local _ENV = mkmodule(plugin_path) and then return _ENV)
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 10, 2015, 06:55:26 am
script_environment worked the last time I checked. For reqscript to work, you need a "--@ module = true" comment somewhere in the file, although script_environment shouldn't care about that.

The header files are there because ragundo forgot to turn off the option that installs them, but they should only take up a couple megabytes.
Title: Re: DFHack 0.40.24-r4
Post by: Putnam on November 10, 2015, 10:43:03 am
script_environment worked the last time I checked.

Yeah, but... it doesn't. r3 works fine, r4 doesn't.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 10, 2015, 11:03:40 am
I'm not able to test it at the moment, but does it work if you run the scripts you're importing in the console first?
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 10, 2015, 04:12:36 pm
I can't seem to reproduce the issue in r4:
Code: [Select]
[lua]# ~dfhack.script_environment('devel/lua-example')
Arguments:
Command called 1 times.
table: 0x11dcb2f0
dfhack_flags            = table: 0x11ce1ed0
moduleMode              = true
run_count              = 1
[lua]# ~dfhack.script_environment('devel/lua-example')
table: 0x11dcb2f0
dfhack_flags            = table: 0x11ce1ed0
moduleMode              = true
run_count              = 1
("run_count" is a global variable in that script, and it seems to be exported correctly.)
Other scripts work as well, regardless of whether they're run as commands first or not. Can you run "type (scriptname)" and make sure it returns the correct script type and path?
Title: Re: DFHack 0.40.24-r4
Post by: Micro102 on November 10, 2015, 07:51:13 pm
Does anyone know how to use dfhack to get rid of an unkillable animated remain? I've got a head rolling around my fortress and it won't die. I've also encountered undead hair before but didn't have dfhack to deal with it.

I know I can spawn magma but I am afraid of setting all the dwarves currently attacking it on fire, or it getting set on fire and then running around lighting everything on fire. Is there not a simple kill or teleport command?
Title: Re: DFHack 0.40.24-r4
Post by: Putnam on November 10, 2015, 07:52:58 pm
Huh, that seemed to be a weird temporary thing. Kinda worrisome.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 10, 2015, 07:53:25 pm
Does anyone know how to use dfhack to get rid of an unkillable animated remain? I've got a head rolling around my fortress and it won't die. I've also encountered undead hair before but didn't have dfhack to deal with it.

I know I can spawn magma but I am afraid of setting all the dwarves currently attacking it on fire, or it getting set on fire and then running around lighting everything on fire. Is there not a simple kill or teleport command?
"exterminate it" should work.
Title: Re: DFHack 0.40.24-r4
Post by: Micro102 on November 10, 2015, 08:02:25 pm
Does anyone know how to use dfhack to get rid of an unkillable animated remain? I've got a head rolling around my fortress and it won't die. I've also encountered undead hair before but didn't have dfhack to deal with it.

I know I can spawn magma but I am afraid of setting all the dwarves currently attacking it on fire, or it getting set on fire and then running around lighting everything on fire. Is there not a simple kill or teleport command?
"exterminate it" should work.
Ah thank you. Unfortunately if any undead are on the map it this will kill all of them, but it's worth it.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 10, 2015, 08:09:48 pm
If you run "exterminate it" with a unit selected, it should only kill that unit (and running "exterminate it" without a unit selected shouldn't do anything). Did you run "exterminate undead", or is there an issue with that script?
Title: Re: DFHack 0.40.24-r4
Post by: Max™ on November 11, 2015, 12:13:00 am
Having just used it to get rid of some annoying wombat chunks that were keeping eagles from spawning in Cathelms I can confirm that exterminate undead works fine.
Title: Re: DFHack 0.40.24-r4
Post by: Micro102 on November 11, 2015, 09:18:44 am
If you run "exterminate it" with a unit selected, it should only kill that unit (and running "exterminate it" without a unit selected shouldn't do anything). Did you run "exterminate undead", or is there an issue with that script?

I just typed "exterminate" but that wasnt enouh so it gave me a list of what to type and one of the commands was undead, so I thought that was my only option. What do you mean by selecting a unit? Hovering over it with the "v" button?
Title: Re: DFHack 0.40.24-r4
Post by: expwnent on November 11, 2015, 03:22:56 pm
Yes, that will do.
Title: Re: DFHack 0.40.24-r4
Post by: mifki on November 11, 2015, 09:26:49 pm
Guys, how are you building it on OS X? This is embarrassing but after some point (I think Xcode update to 7) I can't get it to build/work on both 10.10 and 10.11. When building with GCC 4.5, protoc crashes, when building with later version of GCC, dfhack builds but df crashes because of some symbols can't be found in the damn libstdc++.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 11, 2015, 09:36:28 pm
I'm using GCC 4.5 on 10.9 - I know there's a patch needed to compile it on 10.10 (which Homebrew and Macports use), but I'm not sure about 10.11. Danaris has gotten it to work on 10.10, at least. I don't think Xcode should make a difference.
If you use a newer GCC version, you have to have a corresponding 32-bit libstdc++ in the DF/libs folder (which makes distributing code compiled with newer GCC versions harder, and requires actually building GCC from source and specifying -mmacosx-version-min=10.6 for it to be portable).
Title: Re: DFHack 0.40.24-r4
Post by: mifki on November 11, 2015, 11:56:22 pm
I'm using GCC 4.5 on 10.9 - I know there's a patch needed to compile it on 10.10 (which Homebrew and Macports use), but I'm not sure about 10.11. Danaris has gotten it to work on 10.10, at least. I don't think Xcode should make a difference.
If you use a newer GCC version, you have to have a corresponding 32-bit libstdc++ in the DF/libs folder (which makes distributing code compiled with newer GCC versions harder, and requires actually building GCC from source and specifying -mmacosx-version-min=10.6 for it to be portable).

Apparently Xcode 7 has switched from GNU assembler to LLVM-based one, and GCC uses the system assembler. This breaks compilation with GCC 4.9 (there should be a patch, probably it's not in Homebrew yet). It's strange if this also makes protoc compiled with GCC 4.5 to crash, but I'm pretty sure that I was building it fine on 10.10 and it got problems after updating Xcode.
Title: Re: DFHack 0.40.24-r4
Post by: Max™ on November 12, 2015, 04:36:31 am
Hmmm, from looking at the search.cpp, am I mistaken in thinking that just adding in the necessary require and pointers and such for ui_adv_mode.look and ui_adv_mode.get with the same filtering type as the fortress mode lookaround search uses could work?
Title: Re: DFHack 0.40.24-r4
Post by: Abadrausar on November 12, 2015, 01:41:49 pm
Can DFhack be converted to a Lua VM for DF modding and debuging?

This would enable us to use some of the open source Lua IDEs that support lua debugging...

The next version of Rubble will use Lua for scripting, ...
Nice move Milo, Rubble DF modding framework could  then reuse the Lua knowledge of the dfhack team and the Dwarf fortress modding community.

... I discovered that the Lua VM I was using was riddled with bugs...
Oh, and did I mention that the main reason I chose the VM I did is because the other one has no documentation whatsoever? ...
If you are evaluating lua VMs as candidates for Rubble scripting and your evaluation is not closed,  you could have a look to refactored Metalua 0.72 http://lua-users.org/lists/lua-l/2014-01/msg00636.html (http://lua-users.org/lists/lua-l/2014-01/msg00636.html)

Metalua http://metalua.luaforge.net/ (http://metalua.luaforge.net/) is used as a Lua code analysis tool in projects like LuaDevelopmentTools https://eclipse.org/ldt/ (https://eclipse.org/ldt/) (the Eclipse-based Lua IDE, so good community support and maybe even some docs...), LuaDocumentor (an LDoc-like tool which retrieves information missing from comments through code analysis), LuaInspect (back-end for SciTE and ZeroBrane) , etc.

If you dont like metalua VM you can also choose another from the list supported by open source ZeroBrane Studio Lua IDE http://studio.zerobrane.com/ (http://studio.zerobrane.com/) supports debugging with an ever increasing number of different Lua VMs as for LÖVE, Moai, Gideros, Marmalade Quick, Corona, and Cocos2d-x. It also supports general Lua debugging for Wireshark, GSL-shell, Adobe Lightroom, OpenResty, Lapis, Moonscript, home automation, and more.

DFhack is almost a Lua VM or not too far of becoming one. Adding support for debugging dfhack lua scripting to one of the lua IDEs cited could reduce the entry barrier. Adding this support in zerobrane is ,maybe, easier as this IDE is developped 100% in Lua.
Title: Re: DFHack 0.40.24-r4
Post by: Warmist on November 12, 2015, 02:39:31 pm
Can DFhack be converted to a Lua VM for DF modding and debuging?

This would enable us to use some of the open source Lua IDEs that support lua debugging...

Zerobrane has a way to debug lua in process. This is done by using socket and a special debug lib. This might work and i encouraged people to look into it. However my hackish socket lib might not be up to the task but again: please do look into it imho it would be nice to have breakpoints.
Title: Re: DFHack 0.40.24-r4
Post by: Kars on November 13, 2015, 02:15:22 pm
Whenever I try to use Exterminate I get the following error:

(http://i.imgur.com/bK8sI8Z.png)

How can I fix this?
Title: Re: DFHack 0.40.24-r4
Post by: DeDeRon on November 13, 2015, 03:18:33 pm
error while trying to compile git tip:

[ 63%] Building CXX object plugins/CMakeFiles/RemoteFortressReader.dir/remotefortressreader.cpp.o
/home/schlichti/build/dfhack/plugins/remotefortressreader.cpp: In function ‘void CopyBuilding(int, RemoteFortressReader::BuildingInstance*)’:
/home/schlichti/build/dfhack/plugins/remotefortressreader.cpp:450:25: error: ‘struct df::building_windmillst’ has no member named ‘orient_x’
             if (actual->orient_x < 0)
                         ^
/home/schlichti/build/dfhack/plugins/remotefortressreader.cpp:452:30: error: ‘struct df::building_windmillst’ has no member named ‘orient_x’
             else if (actual->orient_x > 0)
                              ^
/home/schlichti/build/dfhack/plugins/remotefortressreader.cpp:454:30: error: ‘struct df::building_windmillst’ has no member named ‘orient_y’
             else if (actual->orient_y < 0)
                              ^
/home/schlichti/build/dfhack/plugins/remotefortressreader.cpp:456:30: error: ‘struct df::building_windmillst’ has no member named ‘orient_y’
             else if (actual->orient_y > 0)
                              ^
make[2]: *** [plugins/CMakeFiles/RemoteFortressReader.dir/remotefortressreader.cpp.o] Error 1
make[1]: *** [plugins/CMakeFiles/RemoteFortressReader.dir/all] Error 2
make: *** [all] Error 2
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 13, 2015, 04:28:45 pm
Did you update submodules ("git submodule update")?

Whenever I try to use Exterminate I get the following error:

(http://i.imgur.com/bK8sI8Z.png)

How can I fix this?
What DFHack version are you using? If you upgraded, did you make sure to replace the entire hack folder (rather than just overwriting its contents)?
Title: Re: DFHack 0.40.24-r4
Post by: Micro102 on November 14, 2015, 04:13:27 am
I've been watching quill18 playing dwarf fortress, and noticed that he is somehow setting certain items to be maintained. For example, he selects iron bars and enters "10-20" and he said that the game will automatically queue up production if the quantity get's too low. Now I couldn't find any way to do this on vanilla DF so I assume since he was using DFHack, someone here could tell me how I can do this. If this is not DFHack, sorry, any tips on how I could do this would be welcome.
Title: Re: DFHack 0.40.24-r4
Post by: PeridexisErrant on November 14, 2015, 05:00:14 am
https://dfhack.readthedocs.org/en/stable/docs/Plugins.html#workflow
Title: Re: DFHack 0.40.24-r4
Post by: DeDeRon on November 14, 2015, 11:35:46 am
Did you update submodules ("git submodule update")?
of course not. so never mind, this update fixed the issue. thx for the reply. seems i will never get into git.
Title: Re: DFHack 0.40.24-r4
Post by: LeoCean on November 14, 2015, 02:15:16 pm
I've been watching quill18 playing dwarf fortress, and noticed that he is somehow setting certain items to be maintained. For example, he selects iron bars and enters "10-20" and he said that the game will automatically queue up production if the quantity get's too low. Now I couldn't find any way to do this on vanilla DF so I assume since he was using DFHack, someone here could tell me how I can do this. If this is not DFHack, sorry, any tips on how I could do this would be welcome.

Alt + w is the workflow hotkey for dfhack. You could try out the Starter pack (http://www.bay12forums.com/smf/index.php?topic=126076.0) which has dfhack preinstalled and tilesets to choose from. Or you can still use default dwarf fortress graphics.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 14, 2015, 02:28:13 pm
http://lazynewbpack.com/ is a better link (since there are other packs), and workflow is independent of graphics.

Another note: the workflow plugin needs to be enabled to use it. I think the gui/workflow script (which is triggered by Alt+W with the default dfhack.init) will prompt you to do this automatically, but you can add the line "enable workflow" to dfhack.init to enable the plugin when starting DF.
Title: Re: DFHack 0.40.24-r4
Post by: Micro102 on November 15, 2015, 09:28:22 pm
Hmmm, I typed in "enable workflow" into the console screen for DFHack, it said "Enabling the plugin. Protecting 20 jobs." but nothing happens when I press Alt-w.

It looks like I could do all of this from the console screen, but I'd really prefer to use the same window's I'm seeing in youtube videos.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 15, 2015, 09:32:37 pm
Are you pressing alt+w with a job selected in a workshop?
Title: Re: DFHack 0.40.24-r4
Post by: LeoCean on November 16, 2015, 03:08:03 pm
Yeah you have to say, set a chair to be built then put it on repeat then click alt+w and that workflow screen will popup. If you type in how to use workflow for dfhack in google you should find something. https://www.youtube.com/watch?v=rL6nyeBwpGo that for example.
Title: Re: DFHack 0.40.24-r4
Post by: Jay on November 17, 2015, 03:04:25 pm
It's worth mentioning that if you have a malformed dfhack.init, you might not have the keybindings. It'd be wise to check that.
Also, the keybind is only set up to work at the status (z) screen and in the job (q)ueue, when you have a job highlighted.
Title: Re: DFHack 0.40.24-r4
Post by: feelotraveller on November 18, 2015, 11:27:22 pm
hope this is the right place to report.  very minor issue.

view-item-info fails with hemp press cake (and presumably with all press cake?)

(http://i1122.photobucket.com/albums/l531/feelotraveller/press_zpst1ptisvw.jpg)

Have a nice day!
Title: Re: DFHack 0.40.24-r4
Post by: Roses on November 20, 2015, 04:51:31 pm
I'm wondering if anyone has experience with overwriting default viewscreens that would be willing to help me with a project. I would like to change the default description checks of items and units. I know how to make my own viewscreens, but i can't seem to get them to replace the default ones. I looked through some examples but they were all for things like workshops menus and such.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 20, 2015, 05:03:37 pm
What I usually do is check for viewscreen changes and display a new viewscreen over the previous one when appropriate (see gui/load-screen for an example). You should be able to call "self._native.parent:render()" in render()/onRenderBody() to render the parent screen.
Title: Re: DFHack 0.40.24-r4
Post by: Putnam on November 20, 2015, 06:52:15 pm
Yeah, see dwarf_scouter or something along those lines in Sparking for an example.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 20, 2015, 07:21:49 pm
Yep: https://github.com/Putnam3145/SPARKING-Dwarf-Fortress-DBZ-mod/blob/master/raw/scripts/dragonball/dwarf_scouter.lua
(The TransparencyViewscreen class just provides a common onInput() method.)
Title: Re: DFHack 0.40.24-r4
Post by: Micro102 on November 22, 2015, 03:57:05 am
Can DFHack be used to undo convictions? I accidentally convicted my best miner :(
Title: Re: DFHack 0.40.24-r4
Post by: Max™ on November 22, 2015, 05:00:28 am
Might have to dig around in gui/gm-editor df.global.ui I think to find it, plus the references that links to in df.global.world in whichever entries that I am not sure of off the top of my head.
Title: Re: DFHack 0.40.24-r4
Post by: Micro102 on November 22, 2015, 05:02:00 am
Might have to dig around in gui/gm-editor df.global.ui I think to find it, plus the references that links to in df.global.world in whichever entries that I am not sure of off the top of my head.

No idea what you just said. Is there a guide to all of this?
Title: Re: DFHack 0.40.24-r4
Post by: Max™ on November 22, 2015, 11:15:43 am
Not really besides going to github and reading through the df-structures.xml file?

It's not a stable thing, since you'd have to go in and manually edit historical events and try to track down all the links to them, tightrope in high winds with no safety net at all.
Title: Re: DFHack 0.40.24-r4
Post by: Putnam on November 22, 2015, 04:40:33 pm
There's a point where you probably want to make a script for it.

That is the exact point.

My process for writing scripts is basically that; go into the lua interface (or gm-editor, if you prefer), go through each step of the process to do what you want and write that step down. If it works, you basically already have a script.
Title: Re: DFHack 0.40.24-r4
Post by: Dirst on November 23, 2015, 08:03:32 am
There's a point where you probably want to make a script for it.

That is the exact point.

My process for writing scripts is basically that; go into the lua interface (or gm-editor, if you prefer), go through each step of the process to do what you want and write that step down. If it works, you basically already have a script.
And if it doesn't, you have yet another way to instantly induce a crash or corrupt a save :)
Title: Re: DFHack 0.40.24-r4
Post by: Max™ on November 23, 2015, 04:37:25 pm
Corrupting a save with a script is pretty hard to do accidentally, and I play around with shit like moving sites, renaming them, altering historical relationships, or flat out inserting artifact creation events/references.

I've successfully changed the parental links for the kid of an adventurer I got pregnant with dfusion, adding the father back in and having them respond properly, and be recorded correctly in all game screens. Totally renamed forts so all references to it point to the right position, actually moved sites around cleanly.

As long as you don't deliberately remove anything without clearing the pointers to it or try specifically to screw up a save, I don't see how you would corrupt one just writing a lua script.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 23, 2015, 04:47:44 pm
How commonly-used is dfusion, by the way? There's a discussion about removing it on Github, but I'm not sure how much would need to be converted to scripts.
Title: Re: DFHack 0.40.24-r4
Post by: Putnam on November 23, 2015, 04:54:42 pm
I use it for Fortbent (transformation into different creatures that ought still be citizens is an important part of the mod) and nothing else. This will be obsolete as of the next version of DF, which would probably be the best time to replace it; AFAIK, all the non-friendship functionality is easily replacable.
Title: Re: DFHack 0.40.24-r4
Post by: TheFlame52 on November 23, 2015, 05:00:41 pm
How commonly-used is dfusion, by the way? There's a discussion about removing it on Github, but I'm not sure how much would need to be converted to scripts.
I use it for easier body-swapping/reincarnation, plus its heal command can bring things back to life where full-heal can't. Impregnate is useful too.
Title: Re: DFHack 0.40.24-r4
Post by: Putnam on November 23, 2015, 05:05:40 pm
How commonly-used is dfusion, by the way? There's a discussion about removing it on Github, but I'm not sure how much would need to be converted to scripts.
plus its heal command can bring things back to life where full-heal can't. Impregnate is useful too.

1. What situations would that be?
2. Yeah, that's easily replacable. I've already made a pregnancy script, in fact.
Title: Re: DFHack 0.40.24-r4
Post by: TheFlame52 on November 23, 2015, 05:14:30 pm
Both have their advantages. Full-heal can heal better, but dfusion can restore you to life in adventure mode. Try it.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 23, 2015, 05:29:41 pm
I don't see anything from looking at the source that should prevent full-heal from working in adventure mode. Is it just impossible to select yourself after you die in adventure mode?
Title: Re: DFHack 0.40.24-r4
Post by: TheFlame52 on November 23, 2015, 05:41:06 pm
No, it just doesn't bring you back to life. Dfusion does. What dfusion doesn't do is heal you properly. It's a bit broken.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 23, 2015, 06:08:15 pm
Try replacing this section in full-heal.lua (starting at line 134 in 0.40.24-r4):
Code: [Select]
    for i=0,#v-1,1 do
        v[i].on_fire = false
        v[i].missing = false
        v[i].organ_loss = false
        v[i].organ_damage = false
        v[i].muscle_loss = false
        v[i].muscle_damage = false
        v[i].bone_loss = false
        v[i].bone_damage = false
        v[i].skin_damage = false
        v[i].motor_nerve_severed = false
        v[i].sensory_nerve_severed = false
    end
with this:
Code: [Select]
    for i=0,#v-1,1 do
        v[i].whole = 0
    end
Title: Re: DFHack 0.40.24-r4
Post by: Putnam on November 23, 2015, 06:47:53 pm
No, it just doesn't bring you back to life. Dfusion does. What dfusion doesn't do is heal you properly. It's a bit broken.

Have you tried using -r? It works perfectly for me.
Title: Re: DFHack 0.40.24-r4
Post by: TheFlame52 on November 23, 2015, 06:57:09 pm
Oh what? There are more options? Okay then, I didn't know.
Title: Re: DFHack 0.40.24-r4
Post by: Max™ on November 24, 2015, 01:47:08 am
Main thing I do with dfusion is change adventurer, which can also be moved to a new script. The sites thing is handy but I like the claim a site reaction hook one more, and though that hooks into dfusion it can also be moved out of it.
Title: Re: DFHack 0.40.24-r4
Post by: Warmist on November 24, 2015, 06:13:53 am
Main thing I do with dfusion is change adventurer, which can also be moved to a new script. The sites thing is handy but I like the claim a site reaction hook one more, and though that hooks into dfusion it can also be moved out of it.
It does?... oh i forgot :P
Title: Re: DFHack 0.40.24-r4
Post by: Rumrusher on November 24, 2015, 03:47:20 pm
oh yeah you could also spawn any kind of site as well so if you want you could plop down a hamlet near a ocean and safely fast travel cross with no fuss.
then there's the friendship script and the turn a type of animal sentient scripts which I would poke around for simple V,k in pairs do functions.
for learning how to script stuff poking around in dfusion scripts are neat.

Title: Re: DFHack 0.40.24-r4
Post by: Guava sprinkles on November 26, 2015, 12:20:38 am
Is stonesense displaying correctly for everyone? I've been having some display issues, specifically with creature sprites, and was wondering if anyone else is experiencing this.
Title: Re: DFHack 0.40.24-r4
Post by: lethosor on November 27, 2015, 08:39:43 pm
r5 is up! https://github.com/DFHack/dfhack/releases/tag/0.40.24-r5
This fixes issues in the workflow and confirm plugins, among other things. Documentation is distributed separately.

Edit (23 Oct 2016): fixed link
Title: Re: DFHack 0.40.24-r4
Post by: Rose on November 27, 2015, 11:19:01 pm
Is stonesense displaying correctly for everyone? I've been having some display issues, specifically with creature sprites, and was wondering if anyone else is experiencing this.
What kind of issues are these?
Title: Re: DFHack 0.40.24-r5
Post by: Sutremaine on November 28, 2015, 09:49:29 pm
Can anyone help with this script?

Spoiler (click to show/hide)

It's supposed to return the heights of every dwarf in the fortress. The (partial) error message it gives is: "Cannot read field unit.appearance_modifier_type: not found." I don't know what it wants between the v and the appearance_modifier_type.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on November 28, 2015, 10:47:39 pm
The unit class has no appearance_modifier_type. Where do you get that from?
Title: Re: DFHack 0.40.24-r5
Post by: Guava sprinkles on November 28, 2015, 11:37:16 pm
Well to be specific, human hair doesn't show on either gender, clothing doesn't show right on female humans. (The entire sprite is their skin color) Elves seem to be fine except clothing on the female ones. The dwarves' hair color and skin color don't show. (I checked, and their description did say that the hair and skin color were different than what was shown) The goblins all have the exact same sprite.
Also the character's job doesn't seem to impact their sprite.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on November 28, 2015, 11:45:46 pm
Could you give a screenshot?
And are you using mods?
Title: Re: DFHack 0.40.24-r5
Post by: Guava sprinkles on November 28, 2015, 11:57:25 pm
Images here: http://imgur.com/a/S15Cz

As for mods, I used to have the calfdir's dwarves, but that was on a different version, I've updated since then.
Idk if it counts but i'm using lazynewbpack as well.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on November 29, 2015, 12:07:00 am
Okay, could you turn on debug mode in the stonesense init.txt, and show what it says when there's one of the units selected?

Also try in an actual fort,rather than the arena, since arena dwarves are naked peasants by default.
Title: Re: DFHack 0.40.24-r5
Post by: Guava sprinkles on November 29, 2015, 12:26:47 am
Debug images: http://imgur.com/a/6TGMD

Outside of arena classes show fine. Unfortunately I don't have any saves with goblins involved atm.
Title: Re: DFHack 0.40.24-r5
Post by: Sutremaine on November 29, 2015, 08:34:05 am
The unit class has no appearance_modifier_type. Where do you get that from?
I found it here (https://github.com/DFHack/df-structures/blob/master/df.creature-raws.xml).
Title: Re: DFHack 0.40.24-r5
Post by: Rose on November 29, 2015, 12:54:06 pm
First you need to look in df.global.world.raws.creatures.all[465].caste[0].body_appearance_modifiers and find the one of type HEIGHT, where 456 is the default creature type of dwarfs, and 0 is male. Replace with the creature type and caste id of the unit in question.

Then you look at v.appearance.body_modifiers
  • [/tt], where x is the index you got in the previous step, and you will get a percentage number of the height compared to the average dwarf.

Title: Re: DFHack 0.40.24-r5
Post by: lethosor on November 29, 2015, 01:03:21 pm
The place where you should use appearance_modifier_type is to convert between HEIGHT and 0 (i.e. you should compare the type to df.appearance_modifier_type.HEIGHT, not 0, in case the raw numbers change in the future):
Code: [Select]
[lua]# ~df.appearance_modifier_type.HEIGHT
0
[lua]# ~df.appearance_modifier_type[0]
HEIGHT
Title: Re: DFHack 0.40.24-r5
Post by: Sutremaine on November 29, 2015, 06:46:53 pm
First you need to look in df.global.world.raws.creatures.all[465].caste[0].body_appearance_modifiers and find the one of type HEIGHT, where 456 is the default creature type of dwarfs, and 0 is male. Replace with the creature type and caste id of the unit in question.
printall(df.global.world.raws.creatures.all[467].caste[0]) gives me a bunch of information on dwarves. (I added two new creatures to make 'plain' leather and 'prepared' meat, intestines, liver, etc., and they went at the beginning of the creature file list.)
printall(df.global.world.raws.creatures.all[467].caste[0].body_appearance_modifiers) gives me nothing at all, though on most other creatures it gives me a 0 1 2 list with memory addresses. 468 (humans) and 469 (elves) give me a 0 1 list, presumably because they don't have a LENGTH modifier.

Since it's messing up on reporting the body modifiers, I should say that I want the raw information because I messed up my dwarves. I was inputting some extreme values to see if there'd be any changes to a running fortress, and I accidentally put five values in instead of seven.

I have an older save on that fortress, and it gives the correct 0 1 list.

I don't know what to do with that yet... I'll have to get back to you.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on November 29, 2015, 08:19:23 pm
Here's something you can try:

Select a dwarf with v, then type in gui/gm-editor I'm the console. That will allow you to look at all the info for that dwarf.
Title: Re: DFHack 0.40.24-r5
Post by: Sutremaine on November 30, 2015, 05:02:42 pm
Okay, I figured out the problem with the non-display of the modifiers. I left the raws as they were when I broke them, with five values. Putting the full seven in made them show up again.

On all the dwarves in the broken fortress, the body modifiers are set to 0 and the size modifier is set to 1. I selected the former largest and smallest dwarves (plus a couple of others) and changed the three modifiers, but it only had an effect on the smallest. I have a hunch why, but I'd need to go edit some more dwarves.
Title: Re: DFHack 0.40.24-r5
Post by: DrunkGamer on December 01, 2015, 03:19:41 pm
Requesting programming magic to make DFHack compatible with the new version of DF.

It can't be that hard... Right?

Right?
Title: Re: DFHack 0.40.24-r5
Post by: breadman on December 01, 2015, 03:36:18 pm
Requesting programming magic to make DFHack compatible with the new version of DF.

It can't be that hard... Right?

Right?

In all of programming magic, there are few arts deeper or darker.  Fortunately, the best practitioners have been making it simpler, and #dfhack is aware of the new release.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on December 01, 2015, 03:53:44 pm
We're working on it but we're running out of people asking us to hurry up. ;)
Title: Re: DFHack 0.40.24-r5
Post by: DrunkGamer on December 01, 2015, 04:03:13 pm
Requesting programming magic to make DFHack compatible with the new version of DF.

It can't be that hard... Right?

Right?

In all of programming magic, there are few arts deeper or darker.  Fortunately, the best practitioners have been making it simpler, and #dfhack is aware of the new release.

We're working on it but we're running out of people asking us to hurry up. ;)

Go DFHack team Go!
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 01, 2015, 04:18:54 pm
Requesting programming magic to make DFHack compatible with the new version of DF.

It can't be that hard... Right?

Right?
There's not a lot of new code needed to update to a new version, aside from changes needed to fix things that depend on changed structures. The most work involves figuring out the layouts of changed structures, and maybe new ones too.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 02, 2015, 12:30:56 pm
We're working on it but we're running out of people asking us to hurry up. ;)
Hurry up!

(And you guys are invaluable assets to the DF community.)
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on December 02, 2015, 04:22:14 pm
I miss reveal and exterminate so badly :'(
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 02, 2015, 05:03:19 pm
all i miss is, uh

...

actually i mostly want to make a rollercoaster tycoon-esque "most common thoughts, distractions" GUI
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on December 03, 2015, 02:13:32 pm
all i miss is, uh

...

actually i mostly want to make a rollercoaster tycoon-esque "most common thoughts, distractions" GUI
I almost got around to it...
The idea was a board that would collect most common thoughts around that area. However the problem is that there was HUGE number of different thoughts that need to be turned into coherent sentences.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 03, 2015, 02:15:04 pm
Current version makes it easier with the maslow stuff.
Title: Re: DFHack 0.40.24-r5
Post by: Kiloku on December 04, 2015, 08:03:54 am
If you guys live-streamed yourselves working on the new version, I'd totally watch and cheer.
Title: Re: DFHack 0.40.24-r5
Post by: Apostolos on December 04, 2015, 12:33:44 pm
Need some help here.. I am pulling my hair out trying to figure out just the basic stuff on this.  I wanted to try and learn a little bit about DFHack as I have heard lots of people mention it.  My questions have a lot of explanations from my point of view.  I am begging whoever manages stuff to please take the time and go over what I am going to say so you 'see it through my eyes' so to speak.

After looking at the documentation inside DFHack itself with the ? command I kinda had some vague ideas but I absolutely suck at just reading documentation and actually understanding anything. I have to see it to 'get it'.  So.. I did a google search for dfhack tutorial.  Here is the video I first looked at https://www.youtube.com/watch?v=zZrVbwm4YLA

I realize that changes take place and that the version he documented in his video is not the same as what exists now.  I went to GitHub to look at the commands like he is talking about but the web page does not look like what is in his video.  The biggest problem I have is that the GitHub page the wiki points to is one of the most non-beginner-userfriendly pieces of documentation I have ever seen.

In the video, there on the front page at the 3:45 mark is a big "Commands" section.  I cannot find that anywhere (after looking literally for 3 hours).  At the bottom of the page currently it says ..and I quote
"The full documentation is available online here, from the README.html page in the DFHack distribution, or as raw text in the ./docs folder. If you're an end-user, modder, or interested in contributing to DFHack - go read those docs."

I clicked on the link but I do not see any "ReadMe" link or the word "Distribution" in any link either.  I also do not see anything saying /docs in the linked page.  However I do see docs folder on the github page which shows an images and styles folders which again confuses the hell out of me as nothing there has anythnig remotely resembling actual documentation of anything.

Can someone for the love of GOD point me in the right direction?  Also.. can someone clean up the github page to be more user friendly and more concise and clear as to where the bloody hell to go to learn about stuff?
Title: Re: DFHack 0.40.24-r5
Post by: breadman on December 04, 2015, 01:22:11 pm
I realize that changes take place and that the version he documented in his video is not the same as what exists now.  I went to GitHub to look at the commands like he is talking about but the web page does not look like what is in his video.  The biggest problem I have is that the GitHub page the wiki points to is one of the most non-beginner-userfriendly pieces of documentation I have ever seen.
Yes, the documentation has been undergoing a massive revamp.  It was hoped that the new version would be friendlier, but it seems that it can still be improved.

Quote
In the video, there on the front page at the 3:45 mark is a big "Commands" section.  I cannot find that anywhere (after looking literally for 3 hours).  At the bottom of the page currently it says ..and I quote
"The full documentation is available online here, from the README.html page in the DFHack distribution, or as raw text in the ./docs folder. If you're an end-user, modder, or interested in contributing to DFHack - go read those docs."

I clicked on the link but I do not see any "ReadMe" link or the word "Distribution" in any link either.  I also do not see anything saying /docs in the linked page.  However I do see docs folder on the github page which shows an images and styles folders which again confuses the hell out of me as nothing there has anythnig remotely resembling actual documentation of anything.
Two issues here.  First, the "Commands" section has been rearranged into the new "User Manual" section in the online documentation (https://dfhack.readthedocs.org/en/stable/#user-manual).  The "DFHack Core", "DFHack Plugins", and "DFHack Scripts" pages each list their set of the commands.  It got a bit too unwieldy as a single page, but the new structure is neither searchable nor intuitive unless you already know the distinction.

Second, the part you quote can be misinterpreted.  It intends to list three different places to find the documentation; however, the second only applies to a released distribution, and even then only to releases that include built documentation.  The third also applies mostly to releases, but since you looked at the /docs folder on GitHub, you must have seen the list of .rst files, which are the "raw text" documentation described in the quote.  If, instead of interpreting the three items as separate, you interpret the second as modifying the first, then yes, you'll have trouble finding README.html after following the link.

Quote
Can someone for the love of GOD point me in the right direction?  Also.. can someone clean up the github page to be more user friendly and more concise and clear as to where the bloody hell to go to learn about stuff?
I've changed the link on the dwarffortresswiki page to go directly to the online documentation (https://dfhack.readthedocs.org/en/stable/#user-manual).  Any suggestions on how to be clearer in the GitHub Readme?  Would bullet points help?

Part of the issue may be that DFHack isn't meant to be something you just try.  It's a tool for accomplishing something in particular.  What were you hoping for?
Title: Re: DFHack 0.40.24-r5
Post by: Apostolos on December 04, 2015, 02:28:37 pm
Ya I actually think just one large page you could do a search on would be a lot easier, but that is purely personal preference as others may like it sectioned off.  I thought I would try and get back into the game a little since its been over a year since I played at all.  I was also a little interested in learning how to manipulate the map some to customize my embark location. Instead of creating 30+ worlds or more and then searching for a specific set of circumstances in a 4x4 area I was hoping dfhack would allow me to build an embark location.  Example: having 4 regions, each being a different type of surrounding so as to increase the number of possible fauna you could encounter and at the same time making sure there was a minimum amount of X and Y resources.  Getting lucky on a world creation for something so specific is hard as hell to get right so thought dfhack could help.  I just got frustrated as hell just trying to find any kind of tutorial or anything noob friendly at all.

Also.. as to .rst files.. I have no idea what those are, would not have known what I was looking at it if it was waving at me.  I just clicked on that folder and said "thats not anything that looks at all what I am looking for" when it opened up and promptly closed it heh
Title: Re: DFHack 0.40.24-r5
Post by: DrunkGamer on December 04, 2015, 02:30:26 pm
Any ETA on the dfhack release? It's a pain to build gigantic things without fastdwarf or cleaning out all the blood without clean all
Title: Re: DFHack 0.40.24-r5
Post by: Geltor on December 04, 2015, 04:10:53 pm
Any ETA on the dfhack release? It's a pain to build gigantic things without fastdwarf or cleaning out all the blood without clean all
first world problems... i cant even manage dwarves without dfhack
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 04, 2015, 04:30:38 pm
Ya I actually think just one large page you could do a search on would be a lot easier, but that is purely personal preference as others may like it sectioned off.  I thought I would try and get back into the game a little since its been over a year since I played at all.  I was also a little interested in learning how to manipulate the map some to customize my embark location. Instead of creating 30+ worlds or more and then searching for a specific set of circumstances in a 4x4 area I was hoping dfhack would allow me to build an embark location.  Example: having 4 regions, each being a different type of surrounding so as to increase the number of possible fauna you could encounter and at the same time making sure there was a minimum amount of X and Y resources.  Getting lucky on a world creation for something so specific is hard as hell to get right so thought dfhack could help.  I just got frustrated as hell just trying to find any kind of tutorial or anything noob friendly at all.

Also.. as to .rst files.. I have no idea what those are, would not have known what I was looking at it if it was waving at me.  I just clicked on that folder and said "thats not anything that looks at all what I am looking for" when it opened up and promptly closed it heh

There's a search box on https://dfhack.readthedocs.org/en/stable/, although it's admittedly not as useful for browsing. The main reason for the plugin/script distinction is that script documentation is automatically generated, so it would be hard to insert it in appropriate locations in existing files. It's also nice to clearly distinguish between plugins and scripts, although it's possible to do that in the documentation itself (without necessarily separating the two).
Title: Re: DFHack 0.40.24-r5
Post by: dmselena on December 04, 2015, 05:10:29 pm
Any ETA on the dfhack release? It's a pain to build gigantic things without fastdwarf or cleaning out all the blood without clean all
first world problems... i cant even manage dwarves without dfhack

HEY, the struggle is REAL, man. This game is just way too much !!Fun!! without DFHack.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on December 04, 2015, 05:20:57 pm
+1

That and ALL my mods use DFHack extensively, oh well I need a break anyway...

EDIT: Oh, by the way, what version of Lua does DFHack use? Is it 5.2 or 5.3?
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 04, 2015, 05:51:25 pm
No integers in DFHack lua, so not 5.3. table.unpack is the function you use to unpack tables, so I'm pretty sure 5.2.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on December 04, 2015, 05:56:42 pm
OK, thanks.

I am thinking about writing my own Lua for use in Rubble (because I can't find a good Go Lua VM that isn't old or very buggy) and I got curious which version DFHack used.
Title: Re: DFHack 0.40.24-r5
Post by: Gorobay on December 04, 2015, 08:55:44 pm
I’m having some trouble with persistent storage in 0.40.24-r5. Here is what I am doing:

Title: Re: DFHack 0.40.24-r5
Post by: Rallor on December 05, 2015, 06:33:28 am
Could someone recommend me a library I could use to display image files in a dfhack plugin?
The images would use transparency and would be layered on top of each other.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 05, 2015, 12:29:00 pm
Could someone recommend me a library I could use to display image files in a dfhack plugin?
The images would use transparency and would be layered on top of each other.

Code: [Select]
local widgets=require('gui.widgets')

local gui=require('gui')

local Button=defclass(Button,widgets.Widget)

Button.ATTRS={
    on_click = DEFAULT_NIL,
    graphic = DEFAULT_NIL, --refers to the name of a tilepage
    label = DEFAULT_NIL
}

function Button:preUpdateLayout()
    self.frame=self.frame or {}
    if not self.page then self.frame.w=0 self.frame.h=0 return end
    self.frame.w=self.page.page_dim_x
    self.frame.h=self.page.page_dim_y
end

function Button:onRenderBody(dc)
    if not self.page then return end
    for k,v in ipairs(self.page.texpos) do
        dc:seek(k%self.frame.w,math.floor(k/self.frame.w)):tile(32,v)
    end
end

function Button:onInput(keys)
    if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then
        self.on_click()
    end
end

function Button:init(args)
    if not self.graphic then return end
    for k,v in ipairs(df.global.texture.page) do
        if v.token==self.graphic then self.page=v return end
    end
    error('No tilepage found: '..self.graphic)
end

this is a GUI widget that displays a full graphics image using Dwarf Fortress's native graphics capabilities, with optional on_click function to be called when image is clicked on

I use it in the SCP mod for various things

you have to actually load the graphics files in-game, which looks like this:

Code: [Select]
[TILE_PAGE:LEGENDS_BOOK]
[FILE:scp/menu/white-book.png]
[TILE_DIM:16:16]
[PAGE_DIM:4:4]
 
[TILE_PAGE:BANKNOTE]
[FILE:scp/menu/banknote.png]
[TILE_DIM:16:16]
[PAGE_DIM:4:4]

[TILE_PAGE:SCP_LOGO]
[FILE:scp/menu/scp-logo.png]
[TILE_DIM:16:16]
[PAGE_DIM:8:8]
   
[TILE_PAGE:SCP_173]
    [FILE:scp/SCPs/scp-173.png]
    [TILE_DIM:16:16]
    [PAGE_DIM:16:13]

[TILE_PAGE:DESCRIPTION_LOGO]
    [FILE:scp/menu/tied-scroll.png]
    [TILE_DIM:16:16]
    [PAGE_DIM:8:8]
   
[TILE_PAGE:OFFER_TO_CONTAIN_LOGO]
    [FILE:scp/menu/exit-door.png]
    [TILE_DIM:16:16]
    [PAGE_DIM:8:8]
   
[TILE_PAGE:SCP_S]
    [FILE:scp/SCPs/nothin to see here, insect.png]
    [TILE_DIM:16:16]
    [PAGE_DIM:16:16]
 
[CREATURE_GRAPHICS:GRAPHICS_CREATURE_SCP]
 [DEFAULT:LEGENDS_BOOK:0:0:ADD_COLOR:DEFAULT]
 [STANDARD:SCP_LOGO:0:0:ADD_COLOR:DEFAULT]
 [MINER:BANKNOTE:0:0:ADD_COLOR:DEFAULT]
 [WOODWORKER:SCP_173:0:0:ADD_COLOR:DEFAULT]
 [BOWYER:DESCRIPTION_LOGO:0:0:ADD_COLOR:DEFAULT]
 [WOODCUTTER:OFFER_TO_CONTAIN_LOGO:0:0:ADD_COLOR:DEFAULT]
 [STONEWORKER:SCP_S:0:0:ADD_COLOR:DEFAULT]

GRAPHICS_CREATURE_SCP is a barebones [DOES_NOT_EXIST] creature; you must load the tilepage on a valid creature in order to have the tilepage load into the game
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 05, 2015, 12:34:42 pm
That really only supports one image in a given location, though. It would be possible to use SDL_Image to draw to the screen in non-OpenGL print modes, but I'm not sure how it would work with OpenGL.
Title: Re: DFHack 0.40.24-r5
Post by: Rallor on December 05, 2015, 02:57:12 pm
I didn't actually intend for it to display within the game window.
I had something like stonesense in mind, in which it opens a separate window to display its graphics.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on December 05, 2015, 03:16:54 pm
I didn't actually intend for it to display within the game window.
I had something like stonesense in mind, in which it opens a separate window to display its graphics.
Depends on what you want.
Stonesense moved away from this model because it had to use same address space as df. So it's quite limited and might crash for big things (like visualizers). If you want something small it's possible but imho too hacky and not worth the trouble.
Other way is have dfhack talk to your program through a socket. We use protobuf and basically you write stuff you need from dfhack to your program. This way you have way more control and can even program in any language you want.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 05, 2015, 05:11:48 pm
...Which means that if I decide to make a music generator I can make that in whatever language. Huh, that's convenient.
Title: Re: DFHack 0.40.24-r5
Post by: Rallor on December 06, 2015, 06:38:29 am
Other way is have dfhack talk to your program through a socket. We use protobuf and basically you write stuff you need from dfhack to your program. This way you have way more control and can even program in any language you want.

Is dfhack listening for those requests by default or do I need to write a c++ plugin for it?
My goal is to access variables that store a dwarves appearance. One would place the in-game cursor over a unit and have my application display image files based on these values.

Using a lua script I can access the values like this:
Code: [Select]
local unit=dfhack.gui.getSelectedUnit()

print(printall(unit.appearance.tissue_style))
print(printall(unit.appearance.bp_modifiers))
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on December 06, 2015, 06:52:05 am
There's not a lot of new code needed to update to a new version, aside from changes needed to fix things that depend on changed structures. The most work involves figuring out the layouts of changed structures, and maybe new ones too.

How's this work going?  I've looked at the commit logs on df-structures, but all that told me was that I don't understand it enough to help  :-[    Even a confirmed ETA of "no idea" would be nice!

Once structures are updated - but before all the plugin fixes - could someone run the devel/export-dt-ini script?  I've got a number of people asking when it'll be ready  ;)
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on December 06, 2015, 07:38:40 am
Other way is have dfhack talk to your program through a socket. We use protobuf and basically you write stuff you need from dfhack to your program. This way you have way more control and can even program in any language you want.

Is dfhack listening for those requests by default or do I need to write a c++ plugin for it?
My goal is to access variables that store a dwarves appearance. One would place the in-game cursor over a unit and have my application display image files based on these values.

Using a lua script I can access the values like this:
Code: [Select]
local unit=dfhack.gui.getSelectedUnit()

print(printall(unit.appearance.tissue_style))
print(printall(unit.appearance.bp_modifiers))
It's listening by default, but not everything is supported: stuff for visualizers is supported but it might be strange format (e.g. export EVERYTHING!). And it's not writing a full plugin in c++ just some commands you need (e.g. "GetSelectedUnitId" and "GetUnitAppearance").
Also i have not looked at that part very much...
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 06, 2015, 08:11:15 am
There's not a lot of new code needed to update to a new version, aside from changes needed to fix things that depend on changed structures. The most work involves figuring out the layouts of changed structures, and maybe new ones too.

How's this work going?  I've looked at the commit logs on df-structures, but all that told me was that I don't understand it enough to help  :-[    Even a confirmed ETA of "no idea" would be nice!

Once structures are updated - but before all the plugin fixes - could someone run the devel/export-dt-ini script?  I've got a number of people asking when it'll be ready  ;)
Angavrilov said he would work on it today, I think, but there are a lot of structures that still haven't been fixed. That script actually crashes at the moment, which is surprising, but probably related to mismatched layouts (apparently creature raws changed significantly). Plugins are typically fixed as structures are fixed, but it's usually faster than figuring out structures.

Other way is have dfhack talk to your program through a socket. We use protobuf and basically you write stuff you need from dfhack to your program. This way you have way more control and can even program in any language you want.

Is dfhack listening for those requests by default or do I need to write a c++ plugin for it?
My goal is to access variables that store a dwarves appearance. One would place the in-game cursor over a unit and have my application display image files based on these values.

Using a lua script I can access the values like this:
Code: [Select]
local unit=dfhack.gui.getSelectedUnit()

print(printall(unit.appearance.tissue_style))
print(printall(unit.appearance.bp_modifiers))
DFHack has a server built in that listens for protobuf requests, but you have to implement request handlers (the commands warmist mentioned) in plugins. You could alternatively set up your own server, which could be done with lua, but it's probably easier to use the built-in one if you're able to use protobuf.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on December 06, 2015, 08:34:32 am
Yeah, you can look at how the remotefortressreader does things, and implement something similar, either in the same plugin, or as your own.
I think it'd make things easier to have all of that sort of stuff in the same place, but that's up to you.
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on December 06, 2015, 03:03:36 pm
Is there a thread or page somewhere for the new version's progress?


Or will this one metamorphose into it as the time is right?
Title: Re: DFHack 0.40.24-r5
Post by: notfood on December 06, 2015, 03:53:59 pm
df_structures for windows seems almost there for 42.02. Can't really test, I don't use windows.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on December 06, 2015, 03:59:00 pm
df_structures for windows seems almost there for 42.02. Can't really test, I don't use windows.
Globals are there, but the structures are not. So it would appear to work until crash or corruption.
It will be done when all of these:  file on github  (https://github.com/DFHack/df-structures/blob/master/v0.42.02.lst) will be "VERIFIED" IIRC
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on December 06, 2015, 04:15:13 pm
Ah, thanks for clarifying the relevant part of the repo.


At any rate, we are 13/1401. Not so close then.
Title: Re: DFHack 0.40.24-r5
Post by: notfood on December 06, 2015, 04:19:05 pm
Globals are there, but the structures are not. So it would appear to work until crash or corruption.
It will be done when all of these:  file on github  (https://github.com/DFHack/df-structures/blob/master/v0.42.02.lst) will be "VERIFIED" IIRC

Didn't the autotool detect some of those? They just need human verification and correction.

From previous experiences, some tools work. More than often, the simple and useful tools are already working. Though it's like playing with fire, corruption is around the corner. But then, so is life when you live as dangerously.

Query/info tools like prospect tend to work fine.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on December 07, 2015, 10:58:50 am
Yeah, I tried to load up df in evan's debugger and poke around in there for structures, but I had to update my video card recently so I took that opportunity to switch to plasma next from the old kde workbase stuff so I'm unstable as shit and edb just kinda laughs at me until I load a different tty and kill it from there.
Title: Re: DFHack 0.40.24-r3
Post by: Roses on December 07, 2015, 06:33:49 pm
So modtools/add-syndrome, for lack of a better term, needs some work, I'm just not exactly sure what. First off most syndromes are added correctly, you can give a unit an interaction that it will use correctly, change display name/tile, change attributes, and basically anything that is considered a "Special Effect" on http://dwarffortresswiki.org/index.php/DF2014:Syndrome (http://dwarffortresswiki.org/index.php/DF2014:Syndrome). But any of the base effects will have do nothing. My brief bit of science that I did found the following.

When applying a syndrome via interaction (which is what I figure we should model add-syndrome after, instead of adding a syndrome via attack). There are several additional components that are not correctly set.

1. None of the target_ vectors are populated in the symptoms list.
2. This leads to no wound being generated.
3. If the target_vectors are artificially populated a wound is automatically created, but it's parts vector is empty
4. Filling in the parts vector seems to correctly "apply" the syndrome. Unfortunately using this method means that out of everything in;
Code: [Select]
[CE_NECROSIS:SEV:100:PROB:100:RESISTABLE:BP:BY_TYPE:THOUGHT:ALL:BP:BY_TYPE:NERVOUS:ALL:START:30:PEAK:60:END:1200]the only thing we can really do is apply necrosis to the correct body parts for the correct times. As you have to populate all the values, and there is no easy way to handle SEV or RESISTABLE.
5. Unfortunatelyx2 in 3 of my 5 tests the game crashed. This may be because I was creating entries by copying another units. I am unsure

I am hoping that someone more knowledgeable about the workings of things can come up with a way to add damaging syndromes via add-syndrome. Otherwise I will move back to just adding wounds directly (this suffers from the same Unfortunately as number 4)

Posting to remind myself later.

After further testing I have found that some of my assumption are incorrect. It appears all you really need to do is populate the target_ fields in unit.syndromes.active[].symptoms[]. The game will then create a wound, link it to the syndrome, and begin to populate the parts of the wound as necessary (filling in correct values of pain, bleeding, etc...). In my custom version this is easily handled by simply looking up the df.global.world.raws.syndrome.all[].ce[].target with BY_TYPE being mode 0, BY_TOKEN being mode 1, and BY_CATEGORY being mode 2 and then determing the creatures body parts and tissues.

So far I haven't had any crashes with adding syndromes like this, although I still need to test what happens if you artificially remove those same syndromes.
Title: Re: DFHack 0.40.24-r5
Post by: palu on December 07, 2015, 08:38:43 pm
Do you have any recommended resources for learning lua? I have some programming experience, mostly Javascript, with bits of other languages.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 07, 2015, 08:39:30 pm
lua is basically javascript with fewer parentheses, curly brackets and semicolons
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on December 07, 2015, 09:21:52 pm
Do you have any recommended resources for learning lua? I have some programming experience, mostly Javascript, with bits of other languages.

I just started writing DFHack scripts, and it seems to have worked out OK.  There's plenty of work on the issue tracker if you want to try a similar route.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 07, 2015, 09:30:09 pm
yeah, DFHack scripts is how I learned, uh, programming actually, my first one was taking a snippet of Quietust's code and replacing some enums
Title: Re: DFHack 0.40.24-r5
Post by: Rose on December 07, 2015, 11:16:27 pm
I learned programming from Stonesense.
Title: Re: DFHack 0.40.24-r5
Post by: Rallor on December 08, 2015, 05:54:34 am
We use protobuf and basically you write stuff you need from dfhack to your program. This way you have way more control and can even program in any language you want.
Does the latest version of stonesense use protobuf? I'm trying to find a working example and can not get the addressbook one google themselves provide to work.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 08, 2015, 06:46:47 am
No. Armok Vision does (with the remotefortressreader plugin), and a couple other plugins implement simpler RPC/protobuf commands, like rename.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 08, 2015, 07:53:38 am
I learned programming from Stonesense.
I learned programming from a before-school TV series on BASIC.

Get off my lawn :)
Title: Re: DFHack 0.40.24-r5
Post by: Boltgun on December 08, 2015, 10:13:22 am
Do you have any recommended resources for learning lua? I have some programming experience, mostly Javascript, with bits of other languages.

Reading other scripts is a good start to see how LUA works.

What you really need to keep as a bookmark is the Dfhack reference : https://github.com/DFHack/dfhack/blob/master/docs/Lua%20API.rst

Because you have a bundle of functions that will let you manipulate DF without writing hundreds of lines of code and a bunch of C++ type checks that are not inside the base LUA.
Title: Re: DFHack 0.40.24-r5
Post by: vjek on December 08, 2015, 10:53:15 am
... I learned programming from a before-school TV series on BASIC.

Get off my lawn :)
Right there with ya. (https://upload.wikimedia.org/wikipedia/commons/1/14/Sinclair_ZX81_Setup_PhotoManipped.jpg)  ;D  1980, woo hoo!
Title: Re: DFHack 0.40.24-r5
Post by: notfood on December 08, 2015, 01:45:15 pm
prospect and showmood appear functional now.

strangemood works but it causes corruption and strange situations.
Title: Re: DFHack 0.40.24-r5
Post by: dmselena on December 08, 2015, 02:51:59 pm
... I learned programming from a before-school TV series on BASIC.

Get off my lawn :)
Right there with ya. (https://upload.wikimedia.org/wikipedia/commons/1/14/Sinclair_ZX81_Setup_PhotoManipped.jpg)  ;D  1980, woo hoo!

Anyone else remember this? https://www.youtube.com/watch?v=1-Y8-g9ArLw

This kid demoing it made me feel really effing old.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 08, 2015, 04:11:35 pm
... I learned programming from a before-school TV series on BASIC.

Get off my lawn :)
Right there with ya. (https://upload.wikimedia.org/wikipedia/commons/1/14/Sinclair_ZX81_Setup_PhotoManipped.jpg)  ;D  1980, woo hoo!
Started with a VIC-20, which wasn't around yet when I saw the show on TV... I wrote out programs on paper with no way to run them.  But that practice came in handy a few years later when they started putting computers on display at stores... lot's of fun programming them to give advice to customers.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on December 08, 2015, 10:58:33 pm
I learned programming from Stonesense.
I learned programming from a before-school TV series on BASIC.

Get off my lawn :)
If we're going there, I technically learned BASIC from my c64 manual, but I wasn't counting that.
Title: Re: DFHack 0.40.24-r5
Post by: Krutzelpuntz on December 09, 2015, 03:14:33 am
The game has become near unplayable to me without DFHack, especially "anti-micromanaging" commands like workflow are dear to me.

I can't wait for the new version, and I thank everyone who contribute, for making the most awesome game so much better!  :D
Title: Re: DFHack 0.40.24-r5
Post by: Hesperid on December 09, 2015, 06:53:19 am
Totally agreed, I'd like to see all the new stuff that's in, but I just can't play anymore without all the utilities that spare me from using DF menus.

Could devote my time to helping the new release get made, just not sure who organizes the effort.
Title: Re: DFHack 0.40.24-r5
Post by: Krutzelpuntz on December 09, 2015, 08:05:54 am
If you know your way around.. scripting(?), you can create your own content, and ask for a merge with the current code.
https://github.com/DFHack/dfhack
I don't

Oh, did I forget to mention how ridiculously time saving it is to have a search-bar in every menu? :(
Title: Re: DFHack 0.40.24-r5
Post by: Hesperid on December 09, 2015, 08:40:33 am
I've written a few squad and military tools for Dfhack using C++. I meant more like I could help find the symbols with a debugger and stuff, I just have no idea how the workload is divided or who's even doing what currently.

Yeah, the menu searches are absolute bliss.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on December 09, 2015, 09:46:54 am
I've written a few squad and military tools for Dfhack using C++. I meant more like I could help find the symbols with a debugger and stuff, I just have no idea how the workload is divided or who's even doing what currently.

Check out https://github.com/DFHack/df-structures
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on December 09, 2015, 08:21:31 pm
I'm stuck in a goblin dark fortress. Reveal + exterminate troll would have really helped  :'(
Title: Re: DFHack 0.40.24-r5
Post by: nickburns on December 09, 2015, 08:41:29 pm
Probably a silly question...
Has the latest version of DFHack been updated for the latest Dwarf Fortress release?
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on December 09, 2015, 08:43:01 pm
no
Title: Re: DFHack 0.42.02-r1
Post by: Putnam on December 09, 2015, 08:43:53 pm
if it were, the title of the post would be "DFHack 0.42.02-r1"
Title: Re: DFHack 0.40.24-r5
Post by: nickburns on December 09, 2015, 09:02:20 pm
Thats what I figured, but thanks.
Title: Re: DFHack 0.40.24-r5
Post by: blackjack on December 09, 2015, 09:27:07 pm
So today addresses for Linux were updated.
I compiled DFHack on my pc and most of stuff is already working.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on December 09, 2015, 10:13:45 pm
Just because it compiles doesn't mean it works.
Title: Re: DFHack 0.40.24-r5
Post by: notfood on December 10, 2015, 12:34:56 am
Can confirm. A lot of things work. Some tools are prone to corruption. At least manager is functional. I prefer it before Therapist.
Title: Re: DFHack 0.40.24-r5
Post by: Pseudo on December 10, 2015, 08:32:31 am
Ditto, I managed to get prospector up and running. You don't realize how much you rely on things until you have to spend far too much time figuring out how to get them working.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 10, 2015, 11:26:51 am
Just because it compiles doesn't mean it works.
You obviously don't work for a AAA videogame studio.
Title: Re: DFHack 0.40.24-r5
Post by: Nameless Archon on December 10, 2015, 11:47:10 am
Just because it compiles doesn't mean it works.
You obviously don't work for a AAA videogame studio.
...or nearly any software shop with a dedicated QA department and a relentless focus on billable hours.

The number of times I've seen 'baseline product code' that is, prima facie, broken before installation is mind-boggling. (I've seen code I could tell from a cursory reading would never have worked, and I'm hardly an expert programmer!) It turns out that they can use local QA to make up for the costs they don't bill while they're still making the product we're selling, so why use internal product-team QA when we can offload the costs to the customer and get site support devs/QA to clean it up in a Big Damn Hurry at the Last Possible Minute?

/sigh
Title: Re: DFHack 0.40.24-r5
Post by: Ysyua on December 10, 2015, 01:17:10 pm
PTW

I would offer warm-hearted programmer encouragement and advice. But I am not a programmer. Thank you to all who put in the time though!
Title: Re: DFHack 0.40.24-r5
Post by: Nopenope on December 10, 2015, 04:07:45 pm
I can confirm that with the latest xml updates pretty much everything you can expect works on Linux (and by that I mean the UI tools everyone uses like reveal/prospect/workflow/search/etc. still no luck with Rendermax on the other hand). Of course, this is to be taken with the usual grain of salt (i.e. very early experimental build, may crash randomly, may corrupt your saves, your binaries, your hard-drive, your soul, your firstborn, etc.).
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on December 10, 2015, 04:08:53 pm
All right! Now for Windows...
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 10, 2015, 05:00:45 pm
Linux, OS X, and Windows should all be equally supported unless someone hasn't found some offsets on Windows yet (I haven't checked).
Title: Re: DFHack 0.40.24-r5
Post by: Herbalist on December 10, 2015, 06:47:56 pm
Well can somone compile a windows verson and upload it then?
It would be very helpfull even if only prospect and reveal work.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on December 10, 2015, 06:55:51 pm
Those two and gm-editor are the commands I use most of all, so I would be grateful.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 10, 2015, 11:15:31 pm
I should have said "equally broken" instead of "equally supported". Unless there are offsets that haven't been located on Windows, DFHack should have equivalent functionality on the three platforms, but it's still too broken to release.
Title: Re: DFHack 0.40.24-r5
Post by: Rallor on December 11, 2015, 07:19:25 am
No. Armok Vision does (with the remotefortressreader plugin), and a couple other plugins implement simpler RPC/protobuf commands, like rename.
I need to find a client example that interacts with one of the existing dfhack plugins that implement RPC.
I can't understand why rename has RPC implemented. Isn't it just a command you type into dfhack to rename something?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 11, 2015, 08:47:48 am
It is, but you can also call it remotely (although I'm not sure if anything does that).
Title: Re: DFHack 0.40.24-r5
Post by: Tryss on December 11, 2015, 09:41:41 am
About compiling for windows, would it be complicated to allow it to compile with VS 2015 in addition of VS 2010?
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 11, 2015, 10:15:29 am
About compiling for windows, would it be complicated to allow it to compile with VS 2015 in addition of VS 2010?
Unless VS has gotten a lot smarter recently, DFHack needs to be compiled with the same compiler that was used to build the core DF.
Title: Re: DFHack 0.40.24-r5
Post by: Tryss on December 11, 2015, 10:22:20 am
So this answer my question. Thanks ! VS2010, back on disk :D
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 11, 2015, 10:24:33 am
So this answer my question. Thanks ! VS2010, back on disk :D
You'd think there could just be a version flag... but there isn't.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on December 11, 2015, 11:08:50 am
If you have vs 2010 installed, you can just open the generated solution with 2015 and tell it not to convert the project. Then it'll use the 2010 compilers, while you can use the 2015 ide.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 11, 2015, 11:43:19 am
Linux, OS X, and Windows should all be equally supported unless someone hasn't found some offsets on Windows yet (I haven't checked).
So why isn't my favorite system supported?  :'(
(http://i8.photobucket.com/albums/a28/8gon/DigiComp2.jpg)
Title: Re: DFHack 0.40.24-r5
Post by: Tryss on December 11, 2015, 12:39:25 pm
So, everything compile with VC 2010 (except manipulator) but the version of DF is not recognised (yes, I compiled the dev branch)... What should I check ?
Title: Re: DFHack 0.40.24-r5
Post by: notfood on December 11, 2015, 03:56:10 pm
Even after checking dev branch, you must checkout libraries/xml folder to master.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 11, 2015, 04:20:28 pm
Even after checking dev branch, you must checkout libraries/xml folder to master.
Every time I hear how complicated this thing is to build, I think there might be room for a DFhack Therapist ;)
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 11, 2015, 04:23:34 pm
Even after checking dev branch, you must checkout libraries/xml folder to master.

Well, it's usually recommended to run "git submodule update" in the dfhack folder after switching branches unless you're working on structures. They should result in the same thing, unless we forget to update dfhack's library/xml submodule to point to the newest df-structures commit, but if you want to make sure you have the latest structures (potentially useful in a new version), "cd library/xml; git checkout master; git pull" should work, like you suggested.
Title: Re: DFHack 0.40.24-r5
Post by: forsaken1111 on December 11, 2015, 04:43:59 pm
hang on, does someone have a working version for windows?
Title: Re: DFHack 0.40.24-r5
Post by: Tryss on December 11, 2015, 04:49:48 pm
Every time I hear how complicated this thing is to build, I think there might be room for a DFhack Therapist ;)

Not that hard : I managed to compile it without too much trouble. Now I'll see which modules works and which don't  :P

Quote
hang on, does someone have a working version for windows?

I have a "working" version. Should I upload it somewhere ? Not sure if it's a good idea to make this "public". But if I do this, you MUST assume that nothing will work correctly, and that using it will corrupt your saves (and your soul)
Title: Re: DFHack 0.40.24-r5
Post by: Ysyua on December 11, 2015, 04:50:26 pm
hang on, does someone have a working version for windows?

There's an unofficial r0 (https://www.reddit.com/r/dwarffortress/comments/3wa5r6/guess_the_date_for_hack_and_therapist/) that was posted on the subreddit by someone who compiled it from the dev branch. I can't vouch for it or what is working in it. Seems a bit use-at-your-own-peril. I'm staying away from it. Especially considering that there's about to be a release with a laundry list of important fixes.
Title: Re: DFHack 0.40.24-r5
Post by: forsaken1111 on December 11, 2015, 05:18:02 pm
No problem, I'm fine waiting. I just saw the chatter and wasn't sure if someone had built a more stable/official version.
Title: Re: DFHack 0.40.24-r5
Post by: Manzeenan on December 11, 2015, 06:54:38 pm
ptw
Title: Re: DFHack 0.40.24-r5
Post by: Orkel on December 12, 2015, 03:48:36 pm
ptw

pay to win?
Title: Re: DFHack 0.40.24-r5
Post by: Manzeenan on December 12, 2015, 04:40:26 pm
ptw

pay to win?
Pwn the weak
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on December 12, 2015, 04:51:32 pm
ptw

pay to win?

Posting To Watch
Title: Re: DFHack 0.40.24-r5
Post by: Manzeenan on December 12, 2015, 06:24:31 pm
ptw

pay to win?

Posting To Watch
See this guy knows whats up.
Title: Re: DFHack 0.40.24-r5
Post by: Geltor on December 12, 2015, 06:55:42 pm
is there a r0 42.03 version for windows available somewhere? i just cant play without manager
Title: Re: DFHack 0.40.24-r5
Post by: Ysyua on December 12, 2015, 07:23:53 pm
is there a r0 42.03 version for windows available somewhere? i just cant play without manager
Patience. It's ready when it's ready. I want my workflow as much as anyone but I also don't want to chance corrupted saves. Until then, keep an eye on the thread with the rest of us! (:
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on December 12, 2015, 08:09:20 pm
Of course, this is to be taken with the usual grain of salt (i.e. very early experimental build, may crash randomly, may corrupt your saves, your binaries, your hard-drive, your soul, your firstborn, etc.).

DFHack confirmed to be... something? Something bad, like Rumplestiltskin crossed with a demon.
Title: Re: DFHack 0.40.24-r5
Post by: Gorobay on December 12, 2015, 08:19:01 pm
What uses general_ref_languagest (https://github.com/DFHack/df-structures/blob/879108458fd57b9a92276e9f68b1d849ffe179fe/df.refs.xml#L276)?
Title: Re: DFHack 0.40.24-r5
Post by: Nopenope on December 12, 2015, 08:34:27 pm
is there a r0 42.03 version for windows available somewhere? i just cant play without manager

.42.03 was released 5 hours ago. Despite the dfhack team being extremely reactive, you'd have to take timezones into account, at least.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 12, 2015, 11:34:43 pm
I can confirm that with the latest xml updates pretty much everything you can expect works on Linux (and by that I mean the UI tools everyone uses like reveal/prospect/workflow/search/etc. still no luck with Rendermax on the other hand).
I have absolutely no idea what the problem with rendermax is, since it hasn't changed in a way that should affect anything since 0.34. I did try to troubleshoot it at one point, but adding a print statement to the renderer_light constructor (I think) made the problem go away, at which point I more or less gave up. Which renderers does it happen with, exactly? If it only happens with renderers that use lua in some way, it could be a threading issue of sorts, although I haven't looked at it at all in 0.42.

Also, a warning: Quietust just fixed a nasty crash (and possible corruption issue) that mainly affected workflow, but could theoretically affect anything that interacts with jobs, units, buildings, items, projectiles, and historical figures (in other words, a lot of things). I'd advise against trying to play seriously or save (unless you've made backups) with whatever unofficial builds are floating around, unless they're less than 4 hours old.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on December 12, 2015, 11:47:59 pm
A warning: Quietust just fixed a nasty crash (and possible corruption issue) that mainly affected workflow, but could theoretically affect anything that interacts with jobs, units, buildings, items, projectiles, and historical figures (in other words, a lot of things). I'd advise against trying to play seriously or save (unless you've made backups) with whatever unofficial builds are floating around, unless they're less than 4 hours old.

...validating my decision to wait for an official DFHack release, despite going for unofficial or prerelease builds for anything else.
Title: Re: DFHack 0.40.24-r5
Post by: Tryss on December 12, 2015, 11:55:03 pm
Also, a warning: Quietust just fixed a nasty crash (and possible corruption issue) that mainly affected workflow, but could theoretically affect anything that interacts with jobs, units, buildings, items, projectiles, and historical figures (in other words, a lot of things). I'd advise against trying to play seriously or save (unless you've made backups) with whatever unofficial builds are floating around, unless they're less than 4 hours old.

Was this the crash that happenned when you put a job on repeat ? By the way, if you need help to test stuff, I may be able to help
Title: Re: DFHack 0.40.24-r5
Post by: Nopenope on December 13, 2015, 12:56:40 am
I have absolutely no idea what the problem with rendermax is, since it hasn't changed in a way that should affect anything since 0.34. I did try to troubleshoot it at one point, but adding a print statement to the renderer_light constructor (I think) made the problem go away, at which point I more or less gave up. Which renderers does it happen with, exactly? If it only happens with renderers that use lua in some way, it could be a threading issue of sorts, although I haven't looked at it at all in 0.42.
I think it's more specific, as Rendermax has consistently refused to work ever since .34.11 on my Linux machine. I have the same exact problem as described here:

rendermax trippy works.
rendermax light locks the dfhack console, the game keeps running. If I try to exit DwarfFortress, it just locks. It eats 100% CPU as well.

stderr.log shows:
Code: [Select]
Invoking: rendermax light
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 13, 2015, 12:01:12 pm
Also, a warning: Quietust just fixed a nasty crash (and possible corruption issue) that mainly affected workflow, but could theoretically affect anything that interacts with jobs, units, buildings, items, projectiles, and historical figures (in other words, a lot of things). I'd advise against trying to play seriously or save (unless you've made backups) with whatever unofficial builds are floating around, unless they're less than 4 hours old.

Was this the crash that happenned when you put a job on repeat ? By the way, if you need help to test stuff, I may be able to help
Yeah, it happened right after workflow started controlling a job.

I have absolutely no idea what the problem with rendermax is, since it hasn't changed in a way that should affect anything since 0.34. I did try to troubleshoot it at one point, but adding a print statement to the renderer_light constructor (I think) made the problem go away, at which point I more or less gave up. Which renderers does it happen with, exactly? If it only happens with renderers that use lua in some way, it could be a threading issue of sorts, although I haven't looked at it at all in 0.42.
I think it's more specific, as Rendermax has consistently refused to work ever since .34.11 on my Linux machine. I have the same exact problem as described here:

rendermax trippy works.
rendermax light locks the dfhack console, the game keeps running. If I try to exit DwarfFortress, it just locks. It eats 100% CPU as well.

stderr.log shows:
Code: [Select]
Invoking: rendermax light
I don't see how that's more specific. What other renderers work or hang?
Title: Re: DFHack 0.40.24-r5
Post by: Gorobay on December 13, 2015, 04:25:29 pm
In adventurer mode, how can I detect when the set of units changes, e.g. when moving to a different world tile? I am currently monitoring #df.global.world.units.all, but that doesn’t work if the new tile has the same number of units as the old tile.
Title: Re: DFHack 0.40.24-r5
Post by: Nopenope on December 13, 2015, 06:28:38 pm
Quote
I don't see how that's more specific. What other renderers work or hang?
I meant specific as in 'specific to a couple machines like mine', sorry. What do you mean by 'which renderers'? 'Trippy' works and 'light' hangs, for instance.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 13, 2015, 07:44:30 pm
Quote
I don't see how that's more specific. What other renderers work or hang?
I meant specific as in 'specific to a couple machines like mine', sorry. What do you mean by 'which renderers'? 'Trippy' works and 'light' hangs, for instance.
Yes, which other renderers work/don't work?
Title: Re: DFHack 0.40.24-r5
Post by: Rose on December 13, 2015, 07:57:36 pm
In adventurer mode, how can I detect when the set of units changes, e.g. when moving to a different world tile? I am currently monitoring #df.global.world.units.all, but that doesn’t work if the new tile has the same number of units as the old tile.
Monitor the world position of the map.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on December 13, 2015, 08:29:01 pm
Regarding DFHack, we (meaning Quietust and Angavrilov) are sorting out some issues with vtables and structures in .02 first, then moving to .03. Hopefully .03 will be stable enough to release soon after that, but I can't make any guarantees.

Sounds like a great plan to me, especially since Therapist layouts are already available.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on December 14, 2015, 05:50:01 am
For anyone interested, I made a progress bar for df-structures, updating daily @0001UTC and whenever I log on and run the script.  Green=verified, yellow=aligned, red=unchecked.  Currently for 42.02, but I'll try to keep it up to date.  Sized for sigs or whatever, so feel free to use/hotlink.

(http://peridexiserrant.pythonanywhere.com/dfhack-progress.png)
Title: Re: DFHack 0.40.24-r5
Post by: mifki on December 14, 2015, 03:34:22 pm
For anyone interested, I made a progress bar for df-structures, updating daily @0001UTC and whenever I log on and run the script.  Green=verified, yellow=aligned, red=unchecked.  Currently for 42.02, but I'll try to keep it up to date.  Sized for sigs or whatever, so feel free to use/hotlink.

But if I look at 0.40 files, I see a lot of unchecked as well, so I don't understand whether this really means something.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 14, 2015, 03:55:18 pm
Those are just structures that we've verified are the correct size and/or contain the right fields. It's not completely accurate, and it's usually even less accurate for new minor versions without structure changes (since we don't bother re-checking everything).
You can also get the current version from version.lisp, I think.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 16, 2015, 11:39:38 am
Those are just structures that we've verified are the correct size and/or contain the right fields. It's not completely accurate, and it's usually even less accurate for new minor versions without structure changes (since we don't bother re-checking everything).
You can also get the current version from version.lisp, I think.
There's generally no need to double-check everything in a minor release, but is there a way to color it as "previously checked and almost certainly unchanged"?  Gray or something would give the cheering section interested parties a sense of scale.
Title: Re: DFHack 0.40.24-r5
Post by: notfood on December 16, 2015, 05:25:47 pm
sv-esk already got somewhat working 42.03 offsets, compiles with no issues and most stuff works.
Title: Re: DFHack 0.40.24-r5
Post by: forsaken1111 on December 16, 2015, 05:40:22 pm
sv-esk already got somewhat working 42.03 offsets, compiles with no issues and most stuff works.
Thats what was said about the last unofficial build until it was found that there was a potentially save-corrupting bug. I'll wait.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 16, 2015, 05:43:52 pm
There are still several broken things, and there may be issues with those offsets that are causing crashes.
(Also, since the only file DFHack uses that sv-esk touched was symbols.xml, there shouldn't be any recompiling involved, so anything that compiled in .02 should still compile.) I would advise against using it for anything besides testing at the moment.

Those are just structures that we've verified are the correct size and/or contain the right fields. It's not completely accurate, and it's usually even less accurate for new minor versions without structure changes (since we don't bother re-checking everything).
You can also get the current version from version.lisp, I think.
There's generally no need to double-check everything in a minor release, but is there a way to color it as "previously checked and almost certainly unchanged"?  Gray or something would give the cheering section interested parties a sense of scale.
It would be somewhat difficult to determine because structures can also be partially verified, which creates new/different lines in the .lst file (example (https://github.com/DFHack/df-structures/commit/6e2e8731d2c10a4a5394046ae48cc0cd16e9a049#diff-5f44db9d128278c344bac1c8676ab0ceR1113)).
Title: Re: DFHack 0.40.24-r5
Post by: nomad_delta on December 16, 2015, 05:46:06 pm
sv-esk already got somewhat working 42.03 offsets, compiles with no issues and most stuff works.
Thats what was said about the last unofficial build until it was found that there was a potentially save-corrupting bug. I'll wait.

Same, I really miss dfhack (workflow and autobutcher in particular, I really love the the unnecessary micromanagement reduction tools which allow me to spend more time micromanaging the parts I find to be fun and enjoyable rather than constantly monitoring stockpile levels and re-queuing repeating jobs in workshops) but I'll happily keep waiting until the official release is out.  Big <3 to all the wonderful peeps who work on dfhack and all the plugins.  Thanks guys!

--nomad_delta
 
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 16, 2015, 05:53:03 pm
There are still several broken things, and there may be issues with those offsets that are causing crashes.
(Also, since the only file DFHack uses that sv-esk touched was symbols.xml, there shouldn't be any recompiling involved, so anything that compiled in .02 should still compile.) I would advise against using it for anything besides testing at the moment.
And keep a fire extinguisher handy.  Just in case.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on December 16, 2015, 08:52:52 pm
I will add that the fact that it compiles means nothing. Even if the structures are dead wrong it can still compile. It is 100% impossible for the compiler to check whether df-structures is correct or not.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on December 16, 2015, 09:01:21 pm
Maybe we need a test suite then?  Just something automatic that can run and pass/fail would be a nice signal...
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 16, 2015, 09:25:52 pm
The only thing we could really figure out automatically would be if DFHack crashes when doing something, and checking  a significant number of structures in DF with that technique probably wouldn't be possible (and we can already figure out some size changes without running DF, anyway). DFHack generates its own constructors for all DF objects, so even if the layout for something like "itemst" is completely wrong and would crash if you try to interact with items in DF, items that DFHack creates (df.itemst:new() in Lua, for example) would work just fine, since they'd have the layout DFHack expects.
Also, even if we did manage to get a pass/crash check implemented for some structures, that wouldn't tell us if their layouts were correct. For example, if Toady changes unit flags, there isn't a way to verify that DFHack's "scuttle" flag corresponds to DF's without manually checking.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on December 16, 2015, 09:35:32 pm
The only thing we could really figure out automatically would be if DFHack crashes when doing something, and checking  a significant number of structures in DF with that technique probably wouldn't be possible (and we can already figure out some size changes without running DF, anyway). DFHack generates its own constructors for all DF objects, so even if the layout for something like "itemst" is completely wrong and would crash if you try to interact with items in DF, items that DFHack creates (df.itemst:new() in Lua, for example) would work just fine, since they'd have the layout DFHack expects.
Also, even if we did manage to get a pass/crash check implemented for some structures, that wouldn't tell us if their layouts were correct. For example, if Toady changes unit flags, there isn't a way to verify that DFHack's "scuttle" flag corresponds to DF's without manually checking.
I think PE meant something like a long macro that just exercises standard DFHack stuff and tries to do something with it in the game (spawn a cat then exterminate it, add the first clothing item to a uniform, etc.), though I might be wrong.

Such a system would do very basic stuff, leaving the new features for in-depth testing.
Title: Re: DFHack 0.40.24-r5
Post by: notfood on December 17, 2015, 12:10:09 am
Okay, forget I mentioned compiling. It works fine, mostly.
Title: Re: DFHack 0.40.24-r5
Post by: blackjack on December 17, 2015, 01:05:27 pm
Can you guys give me the link to the new symbols file, please?
Thanks
Title: Re: DFHack 0.40.24-r5
Post by: Krutzelpuntz on December 17, 2015, 01:07:34 pm
I'm looking so much forward to the new stable releases, I check in here every day at least once.

I was wondering though, is this the right place to look?
Is this where new updates will be posted? :)
Title: Re: DFHack 0.40.24-r5
Post by: Brody on December 17, 2015, 01:13:29 pm
This will indeed be the place to look.
Title: Re: DFHack 0.40.24-r5
Post by: Nopenope on December 18, 2015, 05:20:09 am
The right place to look is actually the github repo, if you want nightlies that is.

Can you guys give me the link to the new symbols file, please?
Thanks

As far as I know the only update I'm aware of is at svesk's repo:
http://github.com/sv-esk/df-structures/
Didn't test it though, and seeing as the update wasn't performed by the dfhack team itself a whole handful of salt should be taken this time, and even more care should be taken regarding unstability and secondborn corruption.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 18, 2015, 06:46:32 am
There are a couple minor issues with it, and possibly a couple crashes related to it (although it's unclear if those resulted from his offsets or someone else's). We'll probably add offsets in the next day or two, since Quietust just fixed a lot of issues in .02.
Title: Re: DFHack 0.40.24-r5
Post by: Urist McCheeseMaker on December 18, 2015, 06:59:39 am
For anyone interested, I made a progress bar for df-structures, updating daily @0001UTC and whenever I log on and run the script.  Green=verified, yellow=aligned, red=unchecked.  Currently for 42.02, but I'll try to keep it up to date.  Sized for sigs or whatever, so feel free to use/hotlink.

(http://peridexiserrant.pythonanywhere.com/dfhack-progress.png)
Maybe add some markers to it so we can actually see it inching forward day by day? Like, one little line every 10 pixels or so, across the top 1/4th of the height.
Title: Re: DFHack 0.40.24-r5
Post by: Massemassimo on December 18, 2015, 07:55:21 am
(http://i.imgur.com/rgCvNAs.png) would be cool. :>
I would really like to help - is this alot of brainless work anyone with visual studio at hand can do? If so, would it make sense for you guys to make a little tutorial on how to participate?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 18, 2015, 09:20:21 am
It takes more effort than that, but identifying problems usually helpful. Once we have .03 offsets available (they're incomplete right now), you can build DFHack and inspect various things in the lua interpreter or gui/gm-editor and find things that are incorrect or crash.
Also, those numbers are individual structures, not individual files.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on December 18, 2015, 03:21:09 pm
Sadly the necessary skill level for most of the work updating is quite high. Only Quietust and Angavrilov can do the hard stuff.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on December 18, 2015, 03:24:40 pm
I have done some data layout research before (writing a save editor for an old game), but nothing on the scale of DFHack, and nothing with live programs... It is fairly complicated to learn, but once you know how it is mostly just tedious, very tedious.
Title: Re: DFHack 0.40.24-r5
Post by: Roses on December 18, 2015, 03:26:20 pm
Sadly the necessary skill level for most of the work updating is quite high. Only Quietust and Angavrilov can do the hard stuff.

And Armok help us if they ever decide to stop working on it.
Title: Re: DFHack 0.40.24-r5
Post by: Gorobay on December 19, 2015, 11:53:54 pm
I’ve done some research on conversation structures. What is the best way to get it into df-structures? (I don’t want to make a pull request because the structures are more complex than I know how to express in XML.)
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 20, 2015, 07:14:58 am
Open an issue in df-structures, I guess.
Title: Re: DFHack 0.40.24-r5
Post by: scenegg on December 20, 2015, 10:48:31 am
Download link is not working.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 20, 2015, 11:06:11 am
Should be https://github.com/DFHack/dfhack/releases/tag/0.40.24-r5

Edit: changed back to match other releases - both links should work now.
Title: Re: DFHack 0.40.24-r5
Post by: easykiln on December 20, 2015, 11:39:25 am
Thanks v much for this, looking forward to the next release.
Title: Re: DFHack 0.40.24-r5
Post by: Nopenope on December 20, 2015, 05:05:42 pm
Yes, which other renderers work/don't work?

Are there any others than light and trippy? Still not sure what you mean I should test.
Title: Re: DFHack 0.40.24-r5
Post by: Tryss on December 20, 2015, 05:56:42 pm
Edit : I'm tired :p
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 20, 2015, 06:47:22 pm
Yes, which other renderers work/don't work?

Are there any others than light and trippy? Still not sure what you mean I should test.
Yes, there are others listed by running "rendermax", "rendermax help", or "help rendermax" - try "truecolor" and "lua".
Title: Re: DFHack 0.40.24-r5
Post by: Eegxeta on December 24, 2015, 10:32:57 am
So does anyone have a ballpark estimate on how long it will be till dfhack updates? I not looking for a date I just want to have a rough idea if it isn't too much trouble.
Title: Re: DFHack 0.40.24-r5
Post by: ndkid on December 24, 2015, 10:53:26 am
So does anyone have a ballpark estimate on how long it will be till dfhack updates? I not looking for a date I just want to have a rough idea if it isn't too much trouble.
Going back through the archives to look at the .40 release timeline, I think it took about a month for DFHack to get a mostly-functional release together. OTOH, the release before that was less than a week, as I remember. The holiday season will probably add to the lag, so if I were setting an over/under line, I think I'd go with January 7 or so.
Title: Re: DFHack 0.40.24-r5
Post by: notfood on December 25, 2015, 12:16:29 am
If you are in a hurry and live dangerously, there is an unoficial compiled dfhack for windows 42.03-r0 in reddit's QA thread.
Title: Re: DFHack 0.40.24-r5
Post by: Kallyn on December 25, 2015, 08:21:17 am
If you are in a hurry and live dangerously, there is an unoficial compiled dfhack for windows 42.03-r0 in reddit's QA thread.

Thanks! Didn't know about this. I'll live dangerously and post any bugs i find :D
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 25, 2015, 12:55:27 pm
Here's an alpha release - please feel free to test and report issues:
https://github.com/DFHack/dfhack/releases/tag/0.42.03-alpha1

Many things have not been fully tested, so remember to make backups often.
Title: Re: DFHack 0.40.24-r5
Post by: HellishINC on December 25, 2015, 01:18:10 pm
Best xmas present ever! Thanks a ton and Happy Holidays!
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on December 25, 2015, 03:04:54 pm
Everything works great so far, tossed in my changes to gm-editor/advfort, my scripts work right, keybinds work right, still gotta figure out where dances are stored so I'll be poking around a few different avenues to see where the hell the "your character knows these performances" shit is stored unless someone has a good idea where to look.
Title: Re: DFHack 0.40.24-r5
Post by: necrotic on December 25, 2015, 04:10:07 pm
Here's an alpha release - please feel free to test and report issues:
https://github.com/DFHack/dfhack/releases/tag/0.42.03-alpha1

Many things have not been fully tested, so remember to make backups often.

I've been using an r0 from a week or so ago on OSX and it's been working surprisingly well. Very minor problems.

Thanks a lot for all the work you guys put into updating this!
Title: Re: DFHack 0.40.24-r5
Post by: Brody on December 25, 2015, 04:37:23 pm
Armok bless us, every one.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 25, 2015, 05:00:17 pm
Very minor problems.
What kinds of problems?
Title: Re: DFHack 0.40.24-r5
Post by: StubbsPKS on December 25, 2015, 06:22:41 pm
Very minor problems.
What kinds of problems?

Not sure if lethosor is using the same version I was, but I couldn't figure out how to enabled ANY of the UI additions. For instance, to use workflow I couldn't do the key shortcut, I had to use the DFHack console. I assume I just didn't enable something I was supposed to, but I have no idea where to look for that info.

I also didn't seem to be able to search most screens (I don't think I found any I could) and the 'e' stocks menu didn't seem to exist either.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 25, 2015, 06:28:01 pm
Okay, some commands are missing from your dfhack.init. Are you using a pack? The dfhack.init-example file should contain the default commands, so if you can't figure it out, you can add "script dfhack.init-example" on a new line somewhere in dfhack.init.
Title: Re: DFHack 0.40.24-r5
Post by: liamjames on December 25, 2015, 08:33:35 pm
Here's an alpha release - please feel free to test and report issues:
https://github.com/DFHack/dfhack/releases/tag/0.42.03-alpha1

Many things have not been fully tested, so remember to make backups often.

You are Christmas.

Thank you.
Title: Re: DFHack 0.40.24-r5
Post by: StubbsPKS on December 25, 2015, 08:59:43 pm
Okay, some commands are missing from your dfhack.init. Are you using a pack? The dfhack.init-example file should contain the default commands, so if you can't figure it out, you can add "script dfhack.init-example" on a new line somewhere in dfhack.init.

I am using a pack, but it doesn't ship with DFHack yet. I'll look around for that file. Thanks a bunch! Have a great holiday!

Edit: You are my hero. It turns out I didn't actually HAVE a dfhack.init. I just took the example file, made a copy and renamed.
Title: Re: DFHack 0.40.24-r5
Post by: CaptainLambcake on December 25, 2015, 11:14:14 pm
Never used DFHack before.  Is it possible to use it to kill a GCS that's made it so all my dwarves are unable to move because it's staring @ them?
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 25, 2015, 11:16:51 pm
exterminate him

...i mean, use that exact command while highlighting the GCS
Title: Re: DFHack 0.40.24-r5
Post by: CaptainLambcake on December 25, 2015, 11:19:12 pm
I'm trying to download DFHack, not sure how exactly.  Any help would be super appreciated.

Got it, nvm.  Thank you, it worked.
Title: Re: DFHack 0.40.24-r5
Post by: necrotic on December 26, 2015, 12:30:07 am
Very minor problems.
What kinds of problems?

At one point furniture placed in Planning Mode stopped updating when furniture was available. I had to restart the game for them to start working again.

That might have been it, actually.
Title: Re: DFHack 0.40.24-r5
Post by: Da5id on December 26, 2015, 08:51:03 am
EDIT: Sorry wrong thread, too early in the morning...
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on December 26, 2015, 09:24:34 am
Only issue I've seen in adv mode so far is that saving crashes after entering any major settlement. Doesn't matter which type or how long after visiting I save, if a heavily populated site loads, the game won't be able to save. I verified it wasn't just a corrupted save by uninstalling dfhack, and no problem saving.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 26, 2015, 10:04:18 am
Only issue I've seen in adv mode so far is that saving crashes after entering any major settlement. Doesn't matter which type or how long after visiting I save, if a heavily populated site loads, the game won't be able to save. I verified it wasn't just a corrupted save by uninstalling dfhack, and no problem saving.
DFHack doesn't really do much with adventure mode. Are you sure you loaded the same site? Were you using specific DFHack tools? If not, a save would be helpful, as I haven't had crashes in adventure mode.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 26, 2015, 10:05:21 am
Okay, some commands are missing from your dfhack.init. Are you using a pack? The dfhack.init-example file should contain the default commands, so if you can't figure it out, you can add "script dfhack.init-example" on a new line somewhere in dfhack.init.

I am using a pack, but it doesn't ship with DFHack yet. I'll look around for that file. Thanks a bunch! Have a great holiday!

Edit: You are my hero. It turns out I didn't actually HAVE a dfhack.init. I just took the example file, made a copy and renamed.
It should load dfhack.init-example if dfhack.init doesn't exist. Did it not do that?
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on December 26, 2015, 02:59:42 pm
Only issue I've seen in adv mode so far is that saving crashes after entering any major settlement. Doesn't matter which type or how long after visiting I save, if a heavily populated site loads, the game won't be able to save. I verified it wasn't just a corrupted save by uninstalling dfhack, and no problem saving.
DFHack doesn't really do much with adventure mode. Are you sure you loaded the same site? Were you using specific DFHack tools? If not, a save would be helpful, as I haven't had crashes in adventure mode.
I'm sure I was using adv-fort, gm-editor, a few dev utils. DFHack does do much in adventure mode. No problem with using those, but if I go into a town+ population, I have to save, switch back to vanilla .dlls, and after leaving a fortress/city/retreat I can relaunch DFHack and use it. But if I have DFHack running when entering any of those, save will always crash, whether it's done there or several region tiles away.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 26, 2015, 03:35:59 pm
Okay, I'm thinking it's likely to be advfort. What happens if you don't use that?
Title: Re: DFHack 0.40.24-r5
Post by: Halnoth on December 26, 2015, 04:21:03 pm
The keybinds for workflow aren't working. I tried alt-w to set the requirements for a repeating job and got nothing.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on December 26, 2015, 04:38:08 pm
Okay, I'm thinking it's likely to be advfort. What happens if you don't use that?
I don't use advfort in settlements, but I use companion-order. But it doesn't appear to make a difference, even if I just stop into a tavern and save there or on the travel map, crash.

EDIT: I'm going to try removing Rubble, there may be a conflict with it.
Title: Re: DFHack 0.40.24-r5
Post by: Antsan on December 26, 2015, 04:44:19 pm
startdwarf doesn't work on Debian testing, x86.
Code: [Select]
[DFHack]# startdwarf 12
E: RuntimeError: ./hack/scripts/startdwarf.rb:18: patch address not available
 ./hack/scripts/startdwarf.rb:18
 (eval):19:in `load'
 (eval):19
 (eval):19:in `catch'
 (eval):19

The keybinds for workflow aren't working. I tried alt-w to set the requirements for a repeating job and got nothing.
It works fine for me. A specific job needs to be selected inside a workshop for the command to work.
The general workflow gui seems only to be accessible while in the 'z' overview menu.
Title: Re: DFHack 0.40.24-r5
Post by: Halnoth on December 26, 2015, 04:54:04 pm
startdwarf doesn't work on Debian testing, x86.
Code: [Select]
[DFHack]# startdwarf 12
E: RuntimeError: ./hack/scripts/startdwarf.rb:18: patch address not available
 ./hack/scripts/startdwarf.rb:18
 (eval):19:in `load'
 (eval):19
 (eval):19:in `catch'
 (eval):19

The keybinds for workflow aren't working. I tried alt-w to set the requirements for a repeating job and got nothing.
It works fine for me. A specific job needs to be selected inside a workshop for the command to work.
The general workflow gui seems only to be accessible while in the 'z' overview menu.

I selected a specific job and hit alt-w and nothing. I checked the init and the line appears to be there. What could be wrong?
Title: Re: DFHack 0.40.24-r5
Post by: Halnoth on December 26, 2015, 05:05:37 pm
If you are having trouble like I was with keybinds not working for dfhack you need to find the dfhack.init example file and rename it dfhack.init

Thank you reddit lol

Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 26, 2015, 05:25:26 pm
If you are having trouble like I was with keybinds not working for dfhack you need to find the dfhack.init example file and rename it dfhack.init

Thank you reddit lol
Did you have a dfhack.init file? If you didn't, DFHack should have loaded dfhack.init-example and told you.
Title: Re: DFHack 0.40.24-r5
Post by: Halnoth on December 26, 2015, 06:24:56 pm
If you are having trouble like I was with keybinds not working for dfhack you need to find the dfhack.init example file and rename it dfhack.init

Thank you reddit lol
Did you have a dfhack.init file? If you didn't, DFHack should have loaded dfhack.init-example and told you.

It did not. I had to rename the file to get it to work.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on December 26, 2015, 08:38:15 pm
I was able to save and reload fine, but started getting crashes down the road on saving, even without dfhack. I tried deleting all save files from most recent to nemesis, and on reload/save they were all reconstructed except for one unit, so I assume it was corrupted.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on December 26, 2015, 10:26:48 pm
I just made a world and started out here:
Code: [Select]
231: Storluturvad, "Dimpleseal", town
        Owner: The Uncertain Hatchet, dwarves
        Parent Civ: The Waxy Pillars, dwarves
        lady: Domas Tuskdyes, dwarf
        9477 dwarves
        523 humans
        2425 cats
        10 horses
        480 blue peafowls
        2 alligator outcasts
        141 human outcasts
        19 dwarf outcasts
        1 saltwater crocodile outcast
        20 amphibian man outcasts
        1 elf outcast

Didn't crash despite repeated saves, roaming around, etc, not sure what was causing you to crash Uzu but population alone doesn't seem to be it.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on December 26, 2015, 11:55:28 pm
No, I recall unit corruption was an occasional issue with using gm-editor. It's always been an "at-your-own-risk" plugin.
Title: Re: DFHack 0.40.24-r5
Post by: StubbsPKS on December 27, 2015, 02:14:54 pm
Okay, some commands are missing from your dfhack.init. Are you using a pack? The dfhack.init-example file should contain the default commands, so if you can't figure it out, you can add "script dfhack.init-example" on a new line somewhere in dfhack.init.

I am using a pack, but it doesn't ship with DFHack yet. I'll look around for that file. Thanks a bunch! Have a great holiday!

Edit: You are my hero. It turns out I didn't actually HAVE a dfhack.init. I just took the example file, made a copy and renamed.
It should load dfhack.init-example if dfhack.init doesn't exist. Did it not do that?

Oh, it indeed did not do that for me.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 27, 2015, 02:17:31 pm
It should load dfhack.init-example if dfhack.init doesn't exist. Did it not do that?


Oh, it indeed did not do that for me.
It should, and multiple DFHack devs on Windows say that it does. Are you sure that you had a dfhack.init-example file and not a dfhack.init file (not even an empty one)?
Title: Re: DFHack 0.40.24-r5
Post by: Halnoth on December 27, 2015, 04:02:13 pm
It should load dfhack.init-example if dfhack.init doesn't exist. Did it not do that?


Oh, it indeed did not do that for me.
It should, and multiple DFHack devs on Windows say that it does. Are you sure that you had a dfhack.init-example file and not a dfhack.init file (not even an empty one)?

I absolutely did not have the dfhack.init file. I downloaded dfhack seperately and not part of a pack. Its ok though, its pretty easy to fix once you know how.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 27, 2015, 04:38:36 pm
I absolutely did not have the dfhack.init file. I downloaded dfhack seperately and not part of a pack. Its ok though, its pretty easy to fix once you know how.
Oh, did you have a file that had "dfhack" in its name and ended with ".init"?
Title: Re: DFHack 0.40.24-r5
Post by: Halnoth on December 27, 2015, 09:00:18 pm
I absolutely did not have the dfhack.init file. I downloaded dfhack seperately and not part of a pack. Its ok though, its pretty easy to fix once you know how.
Oh, did you have a file that had "dfhack" in its name and ended with ".init"?

No, when I downloaded dfhack there was no file called dfhack.init

Instead there was a file called dfhack.init-example

The dfhack.init-example file was not being read by dfhack

To fix the issue I renamed the dfhack.init-example file to dfhack.init and that solved the issue.

I'm just trying to be helpful here since it was a issue I and seemingly a few others have had. Just reporting it really and providing a fix for anyone with a similar issue.

If specifics are helpful. I am running windows 7. I also still have the unzipped dfhack file if you need it. I don't imagine this is a huge issue though.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 27, 2015, 09:30:48 pm
No, were there files like "dfhack_stuff.init" or "stuff_dfhack.init"? There was an issue where it wouldn't load dfhack.init-example if any files like that existed, which I hopefully just fixed (at least, that's the most likely explanation I can think of).
Title: Re: DFHack 0.40.24-r5
Post by: Manzeenan on December 27, 2015, 10:40:39 pm
is there a good way to increase exp gain from socializing with dfhack?
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on December 27, 2015, 11:02:28 pm
No, were there files like "dfhack_stuff.init" or "stuff_dfhack.init"? There was an issue where it wouldn't load dfhack.init-example if any files like that existed, which I hopefully just fixed (at least, that's the most likely explanation I can think of).

Yep, that would be it. The pack still had the extra init files, as I hadn't anticipated that problem.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 27, 2015, 11:11:12 pm
is there a good way to increase exp gain from socializing with dfhack?

Check every unit every tick for skill gains and increase them further where applicable.

Alternately, you could use SKILL_LEARN_RATE.
Title: Re: DFHack 0.40.24-r5
Post by: Andys on December 28, 2015, 05:35:23 am
Did you have a dfhack.init file? If you didn't, DFHack should have loaded dfhack.init-example and told you.
I don't think so.
That's an old way to provide a config documentation - you name it "something...example" and include every possible configuration option with comments.
User himself copies the file, removes the "example" path and comments out those option he doesn't need.
This "example" file itself is not loaded, it's only acts as more practical version of documentation.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 28, 2015, 08:54:35 am
Did you have a dfhack.init file? If you didn't, DFHack should have loaded dfhack.init-example and told you.
I don't think so.
That's an old way to provide a config documentation - you name it "something...example" and include every possible configuration option with comments.
User himself copies the file, removes the "example" path and comments out those option he doesn't need.
This "example" file itself is not loaded, it's only acts as more practical version of documentation.
Yes, but DFHack is supposed to load dfhack.init-example if it can't find dfhack.init and display a warning, because at one point enough people who installed DFHack didn't read the documentation and were complaining that DFHack tools weren't working.
(Apparently the problem here was that DFHack would treat any dfhack*.init file as acceptable, and PE's pack was still distributing dfhack_onload_pylnp.init or something similar, so DFHack loaded that and didn't check for dfhack.init.)
Title: Re: DFHack 0.40.24-r5
Post by: figment on December 29, 2015, 12:01:22 am
Well on the topic of dfhack on 0.42.03, I built it on windows 2 days ago and have had absolutely no problems with it in Adventure mode.  I even updated my adv_teleport plugin and it still works fine with slight modifications but still has the companions dont teleport with you problem.  I've been all over and at least the things I do with dfhack has not been an issue especially if I'm idle. 
Title: Re: DFHack 0.40.24-r5
Post by: Andys on December 29, 2015, 12:14:16 am
Did you have a dfhack.init file? If you didn't, DFHack should have loaded dfhack.init-example and told you.
I don't think so.
That's an old way to provide a config documentation - you name it "something...example" and include every possible configuration option with comments.
User himself copies the file, removes the "example" path and comments out those option he doesn't need.
This "example" file itself is not loaded, it's only acts as more practical version of documentation.
Yes, but DFHack is supposed to load dfhack.init-example if it can't find dfhack.init and display a warning, because at one point enough people who installed DFHack didn't read the documentation and were complaining that DFHack tools weren't working.
(Apparently the problem here was that DFHack would treat any dfhack*.init file as acceptable, and PE's pack was still distributing dfhack_onload_pylnp.init or something similar, so DFHack loaded that and didn't check for dfhack.init.)
You're right, I just tested this.
I always played with valid dfhack.init so never saw that message box about example file
Title: Re: DFHack 0.40.24-r5
Post by: Brody on December 29, 2015, 10:57:25 am
I don't think this issue is new to 42.XX, as I feel like I ran into it in one of the masterwork packs, but I am having an intermittent issue with designations. Sometimes, after attempting to use the mouse to designate tiles for digging/channel/ramps, the designate tool will not designate any of the "dig" commands except whichever it happened to break while using. It will then start working later. I apologize for the lack of information on the issue. Its certainly not game breaking, just a little annoying when it happens.
Title: Re: DFHack 0.40.24-r5
Post by: Boltgun on December 29, 2015, 11:02:00 am
I don't think this issue is new to 42.XX, as I feel like I ran into it in one of the masterwork packs, but I am having an intermittent issue with designations. Sometimes, after attempting to use the mouse to designate tiles for digging/channel/ramps, the designate tool will not designate any of the "dig" commands except whichever it happened to break while using. It will then start working later. I apologize for the lack of information on the issue. Its certainly not game breaking, just a little annoying when it happens.

Are you sure you did not try to dig with the 'automine ore/vein' or other related options activated? It happens to me all the time.
Title: Re: DFHack 0.40.24-r5
Post by: Brody on December 29, 2015, 03:18:26 pm
No, the only automation I had running was autolabor. It just flat out would not designate new tiles to be dug, or dug into upward ramps, I could, however, channel.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on December 29, 2015, 03:32:05 pm
Boltgun is asking about the "a" option in the vanilla designations menu, not a DFHack feature.
Title: Re: DFHack 0.40.24-r5
Post by: Demki on December 29, 2015, 03:32:48 pm
Are you sure you didn't have this on(that's not a DFhack option, it's a default option that messes with you at times, and makes some things so much better):
Spoiler (click to show/hide)

EDIT: lethosor beat me to it.
Title: Re: DFHack 0.40.24-r5
Post by: Brody on December 29, 2015, 03:42:50 pm
I mean, I may have turned that on, but I don't know why that would make designating any area on the entire map not work for [D]ig or [R]amp, but still work for C[h]annel.
Title: Re: DFHack 0.40.24-r5
Post by: Demki on December 29, 2015, 03:51:01 pm
Designating with it set to anything other than "designate all" would make it only designate ores/gems(depending on the setting) and not care about normal rock. This is true for both Up [r]amp and [d]igging, since these dig the current level's tile and thus can see what that tile is.
C[h]annel doesn't have the option to only designate ore since it digs the tile below it, thus unable to know what it is.

In short: specific ore/gem designation is only available for [d] Mine, [r] Up Ramp, [j] Down Stair, [u] Up Stair, and [i] U/D Stair.
It is NOT available for [h] Channel so it does not affect it
Title: Re: DFHack 0.40.24-r5
Post by: Brody on December 29, 2015, 05:03:03 pm
Weird, I guess I just assumed that channel would follow the same "digging" rules. I apologize for my obtuseness.
Title: Re: DFHack 0.40.24-r5
Post by: forsaken1111 on December 29, 2015, 05:50:48 pm
Weird, I guess I just assumed that channel would follow the same "digging" rules. I apologize for my obtuseness.
Because channeling designates the tile below to be dug, it doesn't follow the same rules.
Title: Re: DFHack 0.40.24-r5
Post by: Kromtec on December 30, 2015, 04:02:10 am
Hi, I get an error when trying to export the additional legends_plus.xml file with the prerelease version.
Spoiler (click to show/hide)

Another issue with exportlegends I came across in DFHack 0.40.24-r5 is that when you retire a fortress and export the legends data, the legends_plus.xml file has an one day younger timestamp than the other files.
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r5
Post by: Meph on December 30, 2015, 07:08:18 am
Thank you Splinterz :)

Edit: Wrong thread. Should have been in the therapist thread, sorry.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on December 31, 2015, 12:25:30 am
Well here's a first run for this, I left in the utils/args bits so it can be extended or folded into one of the add-thought/add-emotion/remove-stress type scripts.

Code: (fillNeeds.lua) [Select]
local utils=require('utils')
local args = utils.processArgs({...}, validArgs)

local unit = args.unit and df.unit.find(args.unit) or dfhack.gui.getSelectedUnit(true)

if not unit then qerror('A unit must be specified or selected.') end

function satisfyNeeds(unit,needs)
    local needs=unit.status.current_soul.personality.unk_v4201_1a
    for k,v in ipairs(needs) do
       needs[k].unk_8 = 400
    end

end

    satisfyNeeds(unit,needs)

I've just been building around the annoying/flat-out impossible to fulfill needs as is, but I figured before I go in and see why a couple of other things are broken (names is targeting something weird) I'd knock out an easy one.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on December 31, 2015, 04:08:11 am
Currently that won't accept any arguments. You need something like

Code: [Select]
local validArgs = utils.invert({
  'unit',
  'someOtherArgument'
})

(untested)

edit: Actually I'm wrong. If you leave validArgs null then it will accept all arguments, but that will silently ignore mistyped arguments.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on December 31, 2015, 04:43:01 am
Yeah, I was just gonna strip it out but it worked my first try with them in there, so I figured I'd leave it in case I wanted to try to figure out if you could make it fill a specific need or something, or apply to all units, etc.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on December 31, 2015, 07:29:51 am
Bump for some dance research, it's just trying to figure out what some of the stuff under the various dances are, I tracked down which ones I knew under df.global.world.dance_forms and then tried to figure out some of the different fields.

Spoiler (click to show/hide)
Mostly just gathering the info to have it written out and see if anything stood out as obvious relationships like the entity one.

The first one is just the solo dancer making clockwise circles with a little group of musicians, the second one is a big mingled crowd moving around and chasing the X, again with a little group of musicians, the third dance I filled out there is a crazy looking one, if you have enough dancers for it then you get multiple pairs, I've seen 4 personally, all whirling around, and apparently doing all 12 of the moves under the dance_form_sub2 header with a large group of musicians that makes it a pain because THEY fill out first so you end up with single dancers all the time and rarely get it started.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on December 31, 2015, 07:31:27 am
Having the exact in-game descriptions of the dance forms would probably be best.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on December 31, 2015, 07:45:56 am
Having the exact in-game descriptions of the dance forms would probably be best.
Oh yeah, forgot that in the middle of breaking down all 12 of those damn moves in the last one.
Spoiler: Euphoric Song (click to show/hide)



There's a lot of relevant stuff linked in through activities, btw, but without more of an idea of what the various strings mean it is hard to figure out, I was able to pick out which performance is mine (type 8, dismissed=false, and my hist_fig id) and I did notice stuff like the kids playing and people praying/filling orders under there too, so that's where the tavern keeper stuff is in part.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 01, 2016, 12:50:29 pm
Here's another alpha release, for 0.42.04 only this time (there was a change to the world layout, among other things, so support for older versions has been dropped):
https://github.com/DFHack/dfhack/releases/tag/0.42.04-alpha1
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on January 01, 2016, 09:33:43 pm
Here's another alpha release, for 0.42.04 only this time (there was a change to the world layout, among other things, so support for older versions has been dropped):
https://github.com/DFHack/dfhack/releases/tag/0.42.04-alpha1
The work you guys pour into these releases is greatly appreciated.  We need the modders to rehearse one of Max™'s dances to show the proper level of appreciation...
Title: Re: DFHack 0.40.24-r5
Post by: BlackSmokeDMax on January 02, 2016, 11:26:45 am
Having a strange issue getting the workflow dashboard to show up.

Here is what *does* work:
1. Going into a workshop and then into a workflow job and then hitting "shift-S"
or
2. Alt-tabbing to dfhack and then entering the command "gui/workflow status"

Trying to use any shortcut to get to that screen seems to do nothing.
(edited in): I've tried using these commands all over... in workshops, in the "z" status menu, while at the main view, etc.

I've checked keybindings, and everything looks fine. Here is what I find in dfhack.init:
# workflow front-end
keybinding add Alt-W@dwarfmode/QueryBuilding/Some/Workshop/Job gui/workflow
keybinding add Alt-W@overallstatus "gui/workflow status"


I've also tried adding new ones, using these attempts: (one at a time)
keybinding add Ctrl-I@dwarfmode "qui/workflow status"
keybinding add Alt-W@dwarfmode "qui/workflow status"
keybinding add Alt-W "qui/workflow status"

I've tried adding these in both dfhack.init and also to the dfhack_PeridexisErrant.init in the extras folder in LNP.

Being that I can get to the screen via the 2 methods shown towards the top of this post, this isn't a huge deal. Suppose it's just some minor OCD wanting it to work correctly.

Appreciate any help! Also, if this is the wrong thread for this, let me know, and I'll move it somewhere more appropriate.

--
As long as I'm posting this, maybe I'll throw this other very basic (showing my newbness) question out here:
While setting up a workflow for making rock blocks, what is the difference between "blocks of rock" and "blocks of any stone" "blocks of any material" as an output? Especially the first two??
--
also please note, I'm still using DF 40.24
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 02, 2016, 11:41:01 am
Are you restarting DF after you add those keybinding commands to dfhack.init?  Does running them in the console work? Do you have a job selected in a workshop when you press Alt-W (for the gui/workflow one)?

I think "blocks of rock" means any inorganic material, or maybe stone without a material type (which could end up allowing stone of any material, but then the "blocks of any stone" option wouldn't make sense). I remember generated sites occasionally containing "rock blocks", which I think Quietust said was due to them not having a material ID (or possibly an invalid one?).
Title: Re: DFHack 0.40.24-r5
Post by: BlackSmokeDMax on January 02, 2016, 11:58:26 am
Are you restarting DF after you add those keybinding commands to dfhack.init?  Does running them in the console work? Do you have a job selected in a workshop when you press Alt-W (for the gui/workflow one)?

I think "blocks of rock" means any inorganic material, or maybe stone without a material type (which could end up allowing stone of any material, but then the "blocks of any stone" option wouldn't make sense). I remember generated sites occasionally containing "rock blocks", which I think Quietust said was due to them not having a material ID (or possibly an invalid one?).

Yeah, I was making sure I was shutting down everything, including the LNP launcher program, just in case.

Do you mean entering the keybindings in the console? Not sure if I tried that... be right back....
   - First one I tried [ keybinding add Ctrl-I "gui/workflow status" ] worked just fine right away! That worked from main area, no need to be in any special menu (although it looks like that isn't the best one to use, as it overrides the Ctrl-I built into the "z"-"stocks"-"e" menu, not that I have ever used that yet, lol
Strange that doesn't work while adding to dfhack.init. Was making sure I was definitely saving as well after editing with notepad++

Alt-W with a job selected does work, and brings me to the standard workflow job entry, and while in there hitting Shift-S has always worked to get to the dashboard. Hitting Alt-W again at any time during that process does not bring me to the workflow overall status.

Sorta glad that "any stone" or "rock" confusion thing isn't just me, any chance one is meaning both non-ore and non-economic? I don't even know for sure what all the materials are that can be made into blocks. I may need to go read the wiki on that subject again.

Thanks for the time lethosor!
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 02, 2016, 01:00:05 pm
Does your dfhack.init have the Alt-W "qui/workflow status" typo your post did?
Title: Re: DFHack 0.40.24-r5
Post by: BlackSmokeDMax on January 02, 2016, 01:11:06 pm
Does your dfhack.init have the Alt-W "qui/workflow status" typo your post did?

Well, damn! LOL, it probably did, I had since deleted anything I added so I can't check. But adding it in there now, it's working correctly! Thanks Max, nice spot!

Although still strange that it wasn't working correctly in the first place, at least it's working correctly now.

Title: Re: DFHack 0.40.24-r5
Post by: foxtrot on January 02, 2016, 01:50:27 pm
I'm having a problem with the "startdwarf" command

Code: [Select]
[DFHack]# startdwarf 20
E: RuntimeError: ./hack/scripts/startdwarf.rb:18: patch address not available
 ./hack/scripts/startdwarf.rb:18
 (eval):19:in `load'
 (eval):19
 (eval):19:in `catch'
 (eval):19

Is there a possible solution to this?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 02, 2016, 02:10:09 pm
The script to find the address startdwarf needs to patch is broken, unfortunately.
Title: Re: DFHack 0.40.24-r5
Post by: foxtrot on January 02, 2016, 02:22:43 pm
Ah okay
Title: Re: DFHack 0.40.24-r5
Post by: nomad_delta on January 02, 2016, 04:44:40 pm
Here's another alpha release, for 0.42.04 only this time (there was a change to the world layout, among other things, so support for older versions has been dropped):
https://github.com/DFHack/dfhack/releases/tag/0.42.04-alpha1

hooray! thanks Lethosor and all of the many wonderful people that contribute to dfhack! <3

I will commence with dfhacking all the things.

--nomad_delta
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 02, 2016, 05:27:25 pm
Does your dfhack.init have the Alt-W "qui/workflow status" typo your post did?

Well, damn! LOL, it probably did, I had since deleted anything I added so I can't check. But adding it in there now, it's working correctly! Thanks Max, nice spot!

Although still strange that it wasn't working correctly in the first place, at least it's working correctly now.


I'm a human spellcheck machine, some call me... The Grammarian?

So I recognize that dfusion is full of cruft and deprecation and duplication but it's just such a habit. I'm gonna have to check out the other change adventurer methods huh.
Title: Re: DFHack 0.40.24-r5
Post by: Halnoth on January 02, 2016, 08:42:34 pm
Stonsesense keeps crashing when switching between z levels. I'm using 42.04. This bug didn't happen for 42.03.
Title: Re: DFHack 0.40.24-r5
Post by: HellishINC on January 03, 2016, 04:22:04 pm
Stonsesense keeps crashing when switching between z levels. I'm using 42.04. This bug didn't happen for 42.03.

It's working fine for me with 42.04. Perhaps try "re-installing"?
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on January 03, 2016, 09:22:10 pm
Why would all unit and nemesis records be listed as 'bad', and what can I do about that to fix my save? What exactly does it mean when it's listed as bad? I know some of them are corrupted, but it couldn't possibly be all of them.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 03, 2016, 09:35:02 pm
Why would all unit and nemesis records be listed as 'bad', and what can I do about that to fix my save? What exactly does it mean when it's listed as bad? I know some of them are corrupted, but it couldn't possibly be all of them.
Where are they listed as "bad"?
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on January 03, 2016, 09:48:31 pm
Why would all unit and nemesis records be listed as 'bad', and what can I do about that to fix my save? What exactly does it mean when it's listed as bad? I know some of them are corrupted, but it couldn't possibly be all of them.
Where are they listed as "bad"?
gui/gm-editor df.global.world.units and df.global.world.nemesis
Every record listed in 'all' is also listed in 'bad'. I'm at a point where any save I attempt after offloading current site data will crash the game. Without exception.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 03, 2016, 10:21:27 pm
gui/gm-editor df.global.world.units and df.global.world.nemesis
Every record listed in 'all' is also listed in 'bad'. I'm at a point where any save I attempt after offloading current site data will crash the game. Without exception.
Your crash is due to something else. units.bad and nemesis.bad are named that because they can contain bad pointers - for example, pointers to unit structures that have been deleted, freed, overwritten, etc.. It's possible that "all" is a subset of "bad" - I've never noticed a save where "all" is larger than "bad", or one where units in "all" aren't in "bad" as well.

There are vanilla DF bugs related to offloading sites, or some aspect of site travel at least, in adventure mode. Does the issue occur without DFHack?
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on January 03, 2016, 10:42:05 pm
gui/gm-editor df.global.world.units and df.global.world.nemesis
Every record listed in 'all' is also listed in 'bad'. I'm at a point where any save I attempt after offloading current site data will crash the game. Without exception.
Your crash is due to something else. units.bad and nemesis.bad are named that because they can contain bad pointers - for example, pointers to unit structures that have been deleted, freed, overwritten, etc.. It's possible that "all" is a subset of "bad" - I've never noticed a save where "all" is larger than "bad", or one where units in "all" aren't in "bad" as well.

There are vanilla DF bugs related to offloading sites, or some aspect of site travel at least, in adventure mode. Does the issue occur without DFHack?
Yes, the issues were all before installing dfhack to see if they could be fixed. Save crashes occur on unit saving, so that's where I expected to find problems. So dfhack isn't responsible, I'm just trying to use it to repair if possible.

I have seen saves prior to this in which there were far fewer bad entries than all of them. I saw a similar corruption beginning in 42.03 in which 5 bad entries turned into the entire list after site offloading. If I reactivate my last legends spin-off, there's only 1 bad entry.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 05, 2016, 11:24:42 pm
Hmm. What do y'all think would be the best way to access a twitch API? I wanna make an OpenRCT2-style "name dwarves after subscribers/followers/chat members" doohickey.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on January 06, 2016, 12:45:24 am
I think warmist made an in-game IRC client.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 06, 2016, 02:06:39 am
Ruby seems a bust; ruby's version in DFHack is 1.8 and Kappa (the API) runs on 1.9.3 and later only.

Also, $LOAD_PATH is funny. I needed to make DF/lib/ruby/1.8 to use require. I made Kappa a module, but the module is made up of a bunch of requires.

EDIT: wait, it's just an HTTP api, duh, and it returns JSON too, I think that shouldn't be too hard to work with in Lua or C++; heck, OpenRCT2 is entirely in C++, that might make it way easier, especially since its functionality is nearly identical to what I want
Title: Re: DFHack 0.40.24-r5
Post by: gchristopher on January 06, 2016, 02:50:07 am
Not sure how significant it is, but I managed to use dfhack to resolve a bug where a dwarf carrying an item erroneously claimed ownership of it.

In this case, the dwarf was carrying an iron minecart to a distant stockpile, and I suspect he turned around to get a drink, and decided he owned the minecart somehow in the process. (That's only a suspicion.)

What worked to resolve it was:

erase the item from unit.owned_items
erase the item from unit.inventory
erase the owned and inventory records from item.general_refs
set item.flags.owned to false
set item.flags.in_inventory to false

This appeared to get it out of ownership and inventory, and sitting invisibly on the ground, probably because the tile wasn't updated to record the item in it. Designating the item for dumping via the stockpile screen appeared to update its visibility, much like resolving the now quashed bug where items moved by water flow became invisible.

Probably someone has already written this up, but it was an impressive test of the current version of dfhack working.

edit: Hmm, that dwarf was found dead a couple months later. Might be related? Let's reload and try again!
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on January 06, 2016, 04:02:11 am
<... stuff ...>
Most importantly check if the item has in_job flag (if so remove from job and unset flag) and don't forget to call dfhack.items.moveToGround so everything is correctly set (e.g. tile flags that it contains item, item list in map chunk etc...)
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on January 06, 2016, 06:14:06 am
edit: Hmm, that dwarf was found dead a couple months later. Might be related? Let's reload and try again!
"You can have this here minecart when you pry it from my cold, dead fingers.  Oh, wait..."
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on January 06, 2016, 11:20:33 am
My real life has been getting in the way of serious DF-ing lately, but will soon be trying to update my mod for 0.42 using the DFHack alpha.

From a Lua script, is it possible to determine if a tile is in a "location" and interrogate some of its characteristics?  The current use case is:

Right now, the mod includes these bulky 3x3 workshops called Tributes that give access to some of the mod's more useful reactions.  I already have a script that allows the player to build a generic Tribute and switch it to the appropriate specific one based on the material used (that is, a generic Tribute made from granite will complete as a Tribute To Granite).  I intend to keep this option, but want to add another.

It makes sense that a smaller 1x1 Altar should be able to perform the same reactions, but only if the Altar is built in an "appropriate" place.  Appropriate means: the tile's base material is the same as the block used to make the Altar, and it is in a Temple dedicated to a deity/entity with at least one Sphere in common with the mod's canon for stone-to-Sphere matching (e.g., metamorphic stones match the EARTH and MOUNTAINS Spheres while igneous intrusive match MOUNTAINS and CAVERNS).

So, a player building a Altar with a granite block in a granite layer in a Temple dedicated to a deity associated with MOUNTAINS or CAVERNS should end up with a functional Altar To Granite.  A constructed floor or paving would not be sufficiently "granite" to allow a functional Altar.

If the player gets something wrong, they should end up with a nonfunctional Altar or better yet a deconstructed block.

Do we know enough about a tile to find its location(s), enough about the location to find the deity, and then enough about the deity to find the Spheres?
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 06, 2016, 08:17:26 pm
Hmmm.
Code: [Select]
/home/thefunk/.df/hack/scripts/names.lua:42: Cannot write field viewscreen_setupadventurest.subscreen: not found.
stack traceback:
        [C]: in function '__newindex'
        /home/thefunk/.df/hack/scripts/names.lua:42: in function 'f'
        ./hack/lua/dfhack.lua:554: in function <./hack/lua/dfhack.lua:495>
        (...tail calls...)

I notice there are pages now in the adventurer setup screens, but none specifically seem to point to the custom name screen.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 06, 2016, 08:18:26 pm
The subscreen field was removed (maybe in 0.40, in fact, but we noticed it in 0.42). That'll need to be fixed.
Title: Re: DFHack 0.40.24-r5
Post by: mifki on January 06, 2016, 08:50:46 pm
Hmmm.
Code: [Select]
/home/thefunk/.df/hack/scripts/names.lua:42: Cannot write field viewscreen_setupadventurest.subscreen: not found.
stack traceback:
        [C]: in function '__newindex'
        /home/thefunk/.df/hack/scripts/names.lua:42: in function 'f'
        ./hack/lua/dfhack.lua:554: in function <./hack/lua/dfhack.lua:495>
        (...tail calls...)

I notice there are pages now in the adventurer setup screens, but none specifically seem to point to the custom name screen.

It is now .page = df.viewscreen_setupadventurest.T_page.Background
Title: Re: DFHack 0.40.24-r5
Post by: gchristopher on January 06, 2016, 09:06:23 pm
<... stuff ...>
Most importantly check if the item has in_job flag (if so remove from job and unset flag) and don't forget to call dfhack.items.moveToGround so everything is correctly set (e.g. tile flags that it contains item, item list in map chunk etc...)
I tried a more minimal approach, just cleared the item.flags.owned flag, the owned item.general_refs and the unit.owned_items entry, then marked the item for dumping. Eventually the dwarf dropped it. However, that dwarf appears to immediately claim that item (the minecart) as owned any time he picks it up for any reason!

However, the bug is pretty endemic. Several dwarves have claimed ownership of whatever item is in their right hands. I'm trying to create a bug tracker account to document it, but the captcha there appears to be broken.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on January 06, 2016, 09:08:25 pm
I have one other related question... Can Lua manipulate the sidebar while placing a building?  This would give the player more immediate feedback if a location is "appropriate".  Any single tile can only have one base material, so a single generic Altar would still work even though building materials aren't selected until after the position (for example, if it's a marble tile, the sidebar can report if the location is suitable for an Altar To Marble).
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 06, 2016, 09:28:24 pm
I have one other related question... Can Lua manipulate the sidebar while placing a building?  This would give the player more immediate feedback if a location is "appropriate".  Any single tile can only have one base material, so a single generic Altar would still work even though building materials aren't selected until after the position (for example, if it's a marble tile, the sidebar can report if the location is suitable for an Altar To Marble).
You can replace the sidebar entirely (well, technically that involves creating a new screen, rendering the parent/dwarfmode screen, and then drawing over (parts of) the sidebar). The HistScreen class at https://github.com/lethosor/dfhack/blob/designation-history/plugins/lua/designation-history.lua is an example.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 06, 2016, 09:34:18 pm
The subscreen field was removed (maybe in 0.40, in fact, but we noticed it in 0.42). That'll need to be fixed.
The subscreen worked in 0.40 though, but I'll try the way mifki suggested.

That worked, still gotta clean it up so it applies the name when you exit the screen but eh.
Title: Re: DFHack 0.40.24-r5
Post by: gchristopher on January 07, 2016, 02:49:44 am
<... stuff ...>
Most importantly check if the item has in_job flag (if so remove from job and unset flag) and don't forget to call dfhack.items.moveToGround so everything is correctly set (e.g. tile flags that it contains item, item list in map chunk etc...)
I tried a more minimal approach, just cleared the item.flags.owned flag, the owned item.general_refs and the unit.owned_items entry, then marked the item for dumping. Eventually the dwarf dropped it. However, that dwarf appears to immediately claim that item (the minecart) as owned any time he picks it up for any reason!

However, the bug is pretty endemic. Several dwarves have claimed ownership of whatever item is in their right hands. I'm trying to create a bug tracker account to document it, but the captcha there appears to be broken.
The item also appears in units.used_items. My doctor was growing attached to a stack of adamantine coins (and who could blame him.) I tried removing the reference to the item from used_items. Let's see if he stops picking it back up now.

Oh, look! The doctor left a job to take a drink, and has again claimed ownership of the item he was using for a previous job. This time I saw it happen start to finish. I'm certain he just picked up the item (a steel coin) and was melting it when he left to get a drink, and now that coin is held in his right hand, and he is its new owner.

Looking over my dwarf population, 3 out of 20 have some inappropriate items in their right hand. One has six glass pots of alcohol in his right hand, and is asleep in bed. (Ha, that sounds about right.)

That bug is definitely confirmed for 42.04, I'll try to get a Mantis account to post it.
Title: Re: DFHack 0.40.24-r5
Post by: Grax on January 07, 2016, 05:09:04 am
Can somebody make dfhack with just a "reveal" module?
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on January 07, 2016, 06:07:31 am
I have one other related question... Can Lua manipulate the sidebar while placing a building?  This would give the player more immediate feedback if a location is "appropriate".  Any single tile can only have one base material, so a single generic Altar would still work even though building materials aren't selected until after the position (for example, if it's a marble tile, the sidebar can report if the location is suitable for an Altar To Marble).
You can replace the sidebar entirely (well, technically that involves creating a new screen, rendering the parent/dwarfmode screen, and then drawing over (parts of) the sidebar). The HistScreen class at https://github.com/lethosor/dfhack/blob/designation-history/plugins/lua/designation-history.lua is an example.
Thanks, I will take a look at this.
Title: Re: DFHack 0.40.24-r5
Post by: Ghills on January 07, 2016, 11:33:26 am
<... stuff ...>
Most importantly check if the item has in_job flag (if so remove from job and unset flag) and don't forget to call dfhack.items.moveToGround so everything is correctly set (e.g. tile flags that it contains item, item list in map chunk etc...)
I tried a more minimal approach, just cleared the item.flags.owned flag, the owned item.general_refs and the unit.owned_items entry, then marked the item for dumping. Eventually the dwarf dropped it. However, that dwarf appears to immediately claim that item (the minecart) as owned any time he picks it up for any reason!

However, the bug is pretty endemic. Several dwarves have claimed ownership of whatever item is in their right hands. I'm trying to create a bug tracker account to document it, but the captcha there appears to be broken.
The item also appears in units.used_items. My doctor was growing attached to a stack of adamantine coins (and who could blame him.) I tried removing the reference to the item from used_items. Let's see if he stops picking it back up now.

Oh, look! The doctor left a job to take a drink, and has again claimed ownership of the item he was using for a previous job. This time I saw it happen start to finish. I'm certain he just picked up the item (a steel coin) and was melting it when he left to get a drink, and now that coin is held in his right hand, and he is its new owner.

Looking over my dwarf population, 3 out of 20 have some inappropriate items in their right hand. One has six glass pots of alcohol in his right hand, and is asleep in bed. (Ha, that sounds about right.)

That bug is definitely confirmed for 42.04, I'll try to get a Mantis account to post it.

Thanks for the heads-up. Guess I'm sticking with 42.03 for now.
Title: Re: DFHack 0.40.24-r5
Post by: scamtank on January 07, 2016, 12:59:48 pm
Just a thought: does this inappropriate hanging-on happen with anything other than TOOLs? I could easily imagine there's something about the way people carry around books and scrolls that's had an awful side effect on other tools.
Title: Re: DFHack 0.40.24-r5
Post by: gchristopher on January 07, 2016, 02:45:56 pm

Thanks for the heads-up. Guess I'm sticking with 42.03 for now.
It's not such a terrible bug, and it's probably related to 0009443: Dwarfs acquire and equip multiple empty goblets (http://www.bay12games.com/dwarves/mantisbt/view.php?id=9443)

All of the dwarves who are claiming ownership of items have a preference for the items material.

Removing ownership references and item attachment references seems to fix the items in question. I will try changing the dwarves preferences so they longer like the item materials and see if they stop pathologically claiming items.

I guess if I'm editing preferences, I could make every dwarf prefer potato wine (vodka) and call it Russian Fortress.

Overall, 42.04 is great! I recommend it. Also thanks to the dfhack team for such a continually amazing effort!
Title: Re: DFHack 0.40.24-r5
Post by: Symmetry on January 07, 2016, 05:39:47 pm
Just a thought: does this inappropriate hanging-on happen with anything other than TOOLs? I could easily imagine there's something about the way people carry around books and scrolls that's had an awful side effect on other tools.

I have seen my soldiers sparring while carrying upto six bars in their hands.  They should be doing nothing buy hauling them.
I can't promise this is the same bug but it seems very likely.

Mine seemed to go away with a "replace clothing" change but I really wasn't paying attention and I was glad of the weight training for the soldiers.  Not sure if that is a real thing but I hope so.
Title: Re: DFHack 0.40.24-r5
Post by: KirigStonebeard on January 07, 2016, 09:12:24 pm
I'm getting an error every time I try to launch DFHack, that I'm running an unknown version of DF. I've tried 0.42.04 and 0.42.03, including fresh installs of both, and I tried redownloading the DFHack zip in case there was an error on the first DL. stderr.log reads as follows:

FirstCall()
Initized HOOKS!
DFHack build: v0.40.24-r5-0-g3330225
Identifying DF version.
Loading hack\symbols.xml ... OK
v0.40.24 SDL: PE: 0x54ad7e66
v0.40.24 linux: MD5: c42f55948a448645d6609102ef6439e8
v0.40.24 osx: MD5: c935236736139882b670ed9f1adec52c
Loaded 3 DF symbol tables.
Unable to retrieve version information.
PE timestamp: 0x567ef345

I'm pretty confused because it doesn't seem like anyone else is having this problem. Anyone have any suggestions?
Title: Re: DFHack 0.40.24-r5
Post by: mifki on January 07, 2016, 09:34:54 pm
DFHack build: v0.40.24-r5-0-g3330225
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 07, 2016, 10:43:11 pm
The first post still links to that. If you want the alpha release for 0.42, you can search for my post above or just grab it from https://github.com/dfhack/dfhack/releases. Maybe Expwnent could add a link to the alpha release in the first post as well, but it's not considered stable yet as not everything has been tested (although everything is included that was in 0.40.24-r5, so it's possible to test).
Title: Re: DFHack 0.40.24-r5
Post by: KirigStonebeard on January 07, 2016, 11:41:16 pm
The first post still links to that. If you want the alpha release for 0.42, you can search for my post above or just grab it from https://github.com/dfhack/dfhack/releases. Maybe Expwnent could add a link to the alpha release in the first post as well, but it's not considered stable yet as not everything has been tested (although everything is included that was in 0.40.24-r5, so it's possible to test).

Oh, duh, probably should've noticed that... still, yeah, a link to the alpha up top (DF is itself an alpha, after all) or at least a note that the latest release version is out of date would be good. Thanks for the tip, I'll go grab the alpha!
Title: Re: DFHack 0.40.24-r5
Post by: pilgrimboy on January 08, 2016, 07:09:45 am
I'm getting an error every time I try to launch DFHack, that I'm running an unknown version of DF. I've tried 0.42.04 and 0.42.03, including fresh installs of both, and I tried redownloading the DFHack zip in case there was an error on the first DL. stderr.log reads as follows:

FirstCall()
Initized HOOKS!
DFHack build: v0.40.24-r5-0-g3330225
Identifying DF version.
Loading hack\symbols.xml ... OK
v0.40.24 SDL: PE: 0x54ad7e66
v0.40.24 linux: MD5: c42f55948a448645d6609102ef6439e8
v0.40.24 osx: MD5: c935236736139882b670ed9f1adec52c
Loaded 3 DF symbol tables.
Unable to retrieve version information.
PE timestamp: 0x567ef345

I'm pretty confused because it doesn't seem like anyone else is having this problem. Anyone have any suggestions?

I'm getting the exact same problem. Does anyone have any solutions?

Here is my stderr.log:
FirstCall()
Initized HOOKS!
DFHack build: 0.42.04-alpha1-0-g9e020bb
Identifying DF version.
Loading hack\symbols.xml ... OK
v0.42.04 SDL: PE: 0x567ef345
Dummy symbol table entry: start_dwarf_count
v0.42.04 linux: MD5: ddd87cd8ebd512790415866bf5de4c4f
Dummy symbol table entry: start_dwarf_count
v0.42.04 osx: MD5: be270c5f694d545dd551612f2e195594
Dummy symbol table entry: start_dwarf_count
Loaded 3 DF symbol tables.
Unable to retrieve version information.
PE timestamp: 0x54ad7e66
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 08, 2016, 10:19:45 am
Are you using DF 0.42.04?
Title: Re: DFHack 0.40.24-r5
Post by: pilgrimboy on January 08, 2016, 11:58:48 am
Yes. It's my day off and I've finally decided to play the new version. Playing it right now without DFHack. Going well. But I miss it.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on January 08, 2016, 12:10:24 pm
To whoever decided to stop including the "include" directory in DFHack releases: You suck.

The "include" directory is an invaluable and easy to access source of Lua API documentation, and while it is possible to get the data elsewhere, it is more convenient to have it in the main download.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 08, 2016, 12:33:30 pm
I've mostly complained that it adds a couple megabytes to the download and nearly doubles extraction time for little-to-no reason, since df-structures and the interactive prompt are both fine ways to find documentation.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on January 08, 2016, 12:50:04 pm
Oh no! It doubles extraction time! What, from half a second to a whole second?
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 08, 2016, 12:51:38 pm
Takes about 15 seconds for me. My hard drive is bad.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on January 08, 2016, 12:56:29 pm
Well it takes a lot more than 15 seconds for me to find and download df-structures.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 08, 2016, 12:58:46 pm
Do you do all your work offline? You don't really need to download that.

Also, the amount of people who merely use DFHack far outweighs the amount of people who develop for it. The saved half a second for >10,000 people who have zero use for the header files is worth far more than the inconvenient minute or two you have to go through to find df-structures.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on January 08, 2016, 01:03:58 pm
Do you do all your work offline? You don't really need to download that.

I have no internet at home, what do you think?

Generally it is good practice to include documentation with a package, since DFHack has no real documentation for it's Lua API (something that really should change, I mean how hard could it be to auto-generate something readable from the XML?) the header files will have to do.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 08, 2016, 01:36:05 pm
To whoever decided to stop including the "include" directory in DFHack releases: You suck.

The "include" directory is an invaluable and easy to access source of Lua API documentation, and while it is possible to get the data elsewhere, it is more convenient to have it in the main download.
It never should have been there unless someone released a build with the BUILD_DEV setting on by mistake, or maybe in 40d if it was enabled by default then.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on January 08, 2016, 01:57:46 pm
It was for most of the 40.x releases...
Title: Re: DFHack 0.40.24-r5
Post by: Ghills on January 08, 2016, 02:48:31 pm

Thanks for the heads-up. Guess I'm sticking with 42.03 for now.
It's not such a terrible bug, and it's probably related to 0009443: Dwarfs acquire and equip multiple empty goblets (http://www.bay12games.com/dwarves/mantisbt/view.php?id=9443)

All of the dwarves who are claiming ownership of items have a preference for the items material.

Removing ownership references and item attachment references seems to fix the items in question. I will try changing the dwarves preferences so they longer like the item materials and see if they stop pathologically claiming items.

I guess if I'm editing preferences, I could make every dwarf prefer potato wine (vodka) and call it Russian Fortress.

Overall, 42.04 is great! I recommend it. Also thanks to the dfhack team for such a continually amazing effort!

It's bad enough to impact gameplay and requires preference editing to handle.  Pass. 
Title: Re: DFHack 0.40.24-r5
Post by: Atomic Chicken on January 08, 2016, 04:11:27 pm
I've got a couple of ideas which require modtools/add-syndrome to work, but have so far been prevented from accomplishing them due to the script not functioning as intended when it comes to removing syndromes. I've been meaning to report this problem since the previous version, but never got round to it. Nevertheless:

Say a unit has a syndrome which, for example, gives the unit the ability to perform an interaction. Attempting to remove the syndrome via "modtools/add-syndrome -target X -syndrome Y -eraseAll" will indeed remove the unit_syndrome from unit.syndromes.active . However, it will NOT remove the syndrome effects, such that the unit retains the ability to perform the interaction, etc.

Digging into the issue, I found that whenever a syndrome is added to a unit, a new unit_wound is created in unit.body.wounds (This, and the following information, may already be common knowledge to a number of you). This unit_wound is referenced in the unit_syndrome as "wound_id". The unit_wound is linked to the raw-defined syndrome via unit_wound.syndrome_id , and unit_wound.curse is what contains the syndrome effects to be applied to the unit. Erasing the unit_wound is what is actually required to remove most of the syndrome effects from a unit. Note that the unit_wound will be recreated if the unit_syndrome is not also erased. Erasing only the unit_syndrome (as is currently done by the eraseSyndrome function in syndrome-util ) will leave the unit_wound and its resultant effects untouched.

I've seemingly fixed the issue in my tests by adding the following to the eraseSyndrome function in syndrome-util:
Code: [Select]
local w1
local wN
local d

 if oldestFirst then
  w1 = 0
  wN = #unit.body.wounds-1
  d = 1
 else
w1 = #unit.body.wounds-1
wN = 0
d = -1
end
 
 local wounds = unit.body.wounds
 for w=w1,wN,d do
  if wounds[w].syndrome_id == syndromeId then
   wounds:erase(w)
   return true
    end
    end
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 08, 2016, 04:34:52 pm
It was for most of the 40.x releases...
Do you mean in the Windows packages? Because the headers aren't in any of the OS X or Linux ones that I've downloaded, which include (heh) most of the releases since 0.34.11.

If they're really useful, I can try to package/upload them separately. I don't know if it would be possible/safe to compile anything with them, though, but I don't think they vary across platforms currently. The size really is a concern, though - the header files currently take up around 10 MB, while a clean DFHack release without them takes around 15-25 MB. There are also 1331 individual files with the latest df-structures, which tends to slow down extractors even if the files aren't that big.

Regarding documentation, I'm not sure how you could really generate something from just the information in the XML files, aside from boring stuff like "the 5th field in the viewscreen_titlest structure is a 32-bit integer named 'sel_submenu_line'". There are comments and ref-target attributes in a few places, sure, but including them would still result in pretty sparse documentation, and going into detail about what every field is would just clutter up the XML files. Maybe I'm misunderstanding your comments about documentation, though, so do feel free to make suggestions.

There is a file called "Lua API.rst", by the way, which covers most of the DFHack-implemented Lua API (i.e. the parts that don't wrap DF structures).
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on January 08, 2016, 04:42:24 pm
Clean, easy to read descriptions of the structures (something that looks like C, without the stuff that the compiler needs but the programmer doesn't), preferably with links connecting types to their definitions. Basically something much like what godoc generates (for example (https://godoc.org/golang.org/x/mobile/app#App)). Anything not exported to Lua can be left out.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 08, 2016, 04:51:46 pm
How's Doxygen? It might be possible to get that working with df-structures's headers.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on January 08, 2016, 05:12:14 pm
Depends on how much you have to mark the headers up, too much markup and it's not worth it. If it can be gotten to work, and produces nice, clear, output (that preferably can be linked into the existing DFHack docs), then it is probably worth the effort required.

Once upon a time I tried to make a document generator that read the XML, but that XML is nearly impossible to parse without a lowering pass (and Go had no XLST library at the time), so I gave up :(
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on January 08, 2016, 06:44:23 pm

Once upon a time I tried to make a document generator that read the XML, but that XML is nearly impossible to parse without a lowering pass (and Go had no XLST library at the time), so I gave up :(

ugh reminds me of the time i did a setup for boost-like documentation. It's a nightmare that hangs by a thread that is built on arcane invocations of xmls and other insanities and there is no agreed upon format for that... We are still not using that part...
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on January 08, 2016, 10:15:44 pm
How's Doxygen? It might be possible to get that working with df-structures's headers.
Doxygen is lovely, just requires a lot of good comments in its style to work as well as it might. That being said, it is a good place to get started.


Edit: For the love of god, don't roll your own. That's a mistake with crypto and code documentation.
Title: Re: DFHack 0.40.24-r5
Post by: Insanegame27 on January 08, 2016, 10:49:57 pm
EDIT NOOBERMIND
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on January 09, 2016, 12:46:44 pm
Spoiler (click to show/hide)

Noted for my todo list. This is a newly-observed problem, so thank you for noticing.

I've been 99% unavailable for the last several months and that will continue for another week. At that point depending on a real life undecided factor I'll either be a little more active or a lot more active. If there have been any problems with add-syndrome, scripts in modtools, event manager, or the create-unit script I've done my best to make a note of them but I may have missed a few.
Title: Re: DFHack 0.40.24-r5
Post by: jobywalker on January 09, 2016, 01:22:25 pm
Is there a reason why the automaterial plugin hasn't been applied to constructed tracks and track stops?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 09, 2016, 01:24:52 pm
Not that I know of. Feel free to make a report on GitHub, as people will probably lose track of it here.
Title: Re: DFHack 0.40.24-r5
Post by: 0x517A5D on January 09, 2016, 07:20:28 pm
That bug is definitely confirmed for 42.04, I'll try to get a Mantis account to post it.

Thanks for the heads-up. Guess I'm sticking with 42.03 for now.

It's bad enough to impact gameplay and requires preference editing to handle.  Pass. 

This is not a new bug just added to 42.04.

The only change related to ownership in .04 was about trade goods in retired/unretired forts.

And I've personally seen this in .03, although I didn't really know what I was looking at.  (I thought it was directly related to tavern drinks, but I now believe that's only a common trigger.)

Your call, but IMO the prayer fix alone justifies upgrading.
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on January 09, 2016, 07:30:04 pm
Yeah, you get some awfully unfulfilled dwarves if they can't pray. Sadly alcohol has one flaw, it can't fix piety.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on January 09, 2016, 07:35:03 pm
Yeah, it's in .03 too.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 09, 2016, 11:41:36 pm
Here's another alpha release: https://github.com/DFHack/dfhack/releases/tag/0.42.04-alpha2

This one has some new stuff in it, and some fixes since alpha1, although apparently there weren't any awful bugs. The Linux build is using a new cross-compiler now - one consequence of this is that you'll have to delete libs/libstdc++.so.6 if you weren't doing that before, since it's GCC 4.8 (and hopefully your system has GCC 4.8 or newer installed). However, rendermax seems to work perfectly on my Linux machine now - I don't know if this is due to the compiler change or not, since I hadn't tested it in a while, but others should investigate as well. Anyway, please report any issues that are reliably reproducible on Linux with this particular alpha2 build only (that don't occur with a native alpha2 build or alpha1), as well as general issues with alpha2 as usual.

Thanks to DersEvvak for providing a Windows build this time!
Title: Re: DFHack 0.40.24-r5
Post by: nomad_delta on January 10, 2016, 04:29:46 am
anyone else having difficulty with AutoChop in 42.x? I'm getting a weird thing where the woodcutter seems to get stuck repeatedly trying to chop down a tree that they already chopped down a while ago.  This is in alpha1 on Windows, haven't tried alpha2 yet.  I'll load that up and run some more tests, see if I can reproduce it in a different fort.

--nomad_delta
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on January 10, 2016, 04:02:23 pm
Here's another alpha release: https://github.com/DFHack/dfhack/releases/tag/0.42.04-alpha2

This one has some new stuff in it, and some fixes since alpha1, although apparently there weren't any awful bugs. The Linux build is using a new cross-compiler now - one consequence of this is that you'll have to delete libs/libstdc++.so.6 if you weren't doing that before, since it's GCC 4.8 (and hopefully your system has GCC 4.8 or newer installed). However, rendermax seems to work perfectly on my Linux machine now - I don't know if this is due to the compiler change or not, since I hadn't tested it in a while, but others should investigate as well. Anyway, please report any issues that are reliably reproducible on Linux with this particular alpha2 build only (that don't occur with a native alpha2 build or alpha1), as well as general issues with alpha2 as usual.

Thanks to DersEvvak for providing a Windows build this time!
Thank you lethosor and DersEvvak!
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on January 10, 2016, 04:18:47 pm
So all the things in the dfhack windows release have no directory hierarchy. This is somewhat inconvenient...


Not even an edit: Peazip was just wrong. Edit: There was a directory hierarchy, it just wasn't reported for some reason  ::)
Title: Re: DFHack 0.40.24-r5
Post by: forsaken1111 on January 10, 2016, 04:33:17 pm
Yeah I was about to say... I've been using it fine for hours now. :P
Title: Re: DFHack 0.40.24-r5
Post by: gchristopher on January 10, 2016, 06:51:48 pm
Hey! What is df.global.world.interaction_instances?

For a world with three evil biomes, I'm seeing three entries in that array, and each one has a value for anon_1 that is in the range of indices for the regional interactions?

Did you find part of the long-sought connection between regions and evil weather?

Edit: YES! It does! Changing that to a selected interaction index from df.global.world.raws.interactions changed the evil weather for a test region! (I still don't know how to tell which region goes with which world.interaction_instances entry, so for the test; I changed them all.)

When did someone figure that out? Way to go! That's a fantastic development for custom embark scripting.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on January 10, 2016, 10:23:42 pm
The "include" directory is an invaluable and easy to access source of Lua API documentation, and while it is possible to get the data elsewhere, it is more convenient to have it in the main download.

Generally it is good practice to include documentation with a package, since DFHack has no real documentation for it's Lua API (something that really should change, I mean how hard could it be to auto-generate something readable from the XML?) the header files will have to do.

If they're really useful, I can try to package/upload them separately. I don't know if it would be possible/safe to compile anything with them, though, but I don't think they vary across platforms currently.

Regarding documentation, I'm not sure how you could really generate something from just the information in the XML files, aside from boring stuff like "the 5th field in the viewscreen_titlest structure is a 32-bit integer named 'sel_submenu_line'". There are comments and ref-target attributes in a few places, sure, but including them would still result in pretty sparse documentation, and going into detail about what every field is would just clutter up the XML files. Maybe I'm misunderstanding your comments about documentation, though, so do feel free to make suggestions.

There is a file called "Lua API.rst", by the way, which covers most of the DFHack-implemented Lua API (i.e. the parts that don't wrap DF structures).

Clean, easy to read descriptions of the structures (something that looks like C, without the stuff that the compiler needs but the programmer doesn't), preferably with links connecting types to their definitions. Basically something much like what godoc generates (for example (https://godoc.org/golang.org/x/mobile/app#App)). Anything not exported to Lua can be left out.

How's Doxygen? It might be possible to get that working with df-structures's headers.

Depends on how much you have to mark the headers up, too much markup and it's not worth it. If it can be gotten to work, and produces nice, clear, output (that preferably can be linked into the existing DFHack docs), then it is probably worth the effort required.

Once upon a time I tried to make a document generator that read the XML, but that XML is nearly impossible to parse without a lowering pass (and Go had no XLST library at the time), so I gave up :(

Summarizing:  DFHack doesn't have an API reference.

After considerable expansion and reorganisation, https://dfhack.rtfd.org covers the equivalent for users.  However, a comprehensive API reference for developers would be really useful, both as an introduction to the data structures and utility functions provided and as a detailed listing of the same.

See https://github.com/DFHack/dfhack/issues/794
Title: Re: DFHack 0.40.24-r5 (DFHack 0.42.04 alpha 2)
Post by: Taybabie on January 11, 2016, 08:31:17 am
I am having an issue with the mouse/active pointer. I am sorry if this isn't the correct place to report this problem. But this is the forum where I look for the updates for DFHack. Currently I am using Dwarf Fortress 42.04 with Iron Hand graphics, Dwarf Theripist, SoundSense and DFHack 0.42.04 alpha 2 ( I also had this problem with the Alpha 1 version).

The mouse won't select anything out of an 11by11 area of the active X. Sometimes even the active X dissappears from the screen entirely. I have to esc out and then return to the game to get it to reappear. Sometimes(most of the time) as well, the active x won't even select a large area. My selecting area is forced to be within the 11by11 area. And if it is within 10 tiles of the edge of the screen the active x woun't click. It will still be there but it won't click. Then it is like the active x is dead. I won't do anything else, again I have to esc out and then return to the game to have it active. When I say it won't do anything else I mean even the k, q, and t keyboard keys won't work as well.

This problem hasn't caused a crash. But it is very annoying. Please let me know if you need any other information from me, I will try and get it to you.

I Do Thank-you for all of your hard work.
Angelina
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 11, 2016, 04:03:10 pm
Are you using TwbT? Did you resize the window during the intro movies, if they're enabled?
Title: Re: DFHack 0.40.24-r5 (DFHack 0.42.04 alpha 2)
Post by: Taybabie on January 11, 2016, 04:29:10 pm
No I am not using Twbt. I beleive it is 2D. I always turn off the intro movie before I start the first game. I do F12 at the main screen to make my text bigger, if that helps.
Title: Re: DFHack 0.40.24-r5
Post by: Dutrius on January 11, 2016, 07:18:12 pm
PTW. Should have done this earlier.
Title: Re: DFHack 0.40.24-r5
Post by: Dwurf on January 12, 2016, 05:02:06 pm
For anyone else having trouble getting dfhack working for 42.04 on Arch Linux (and possibly other linux distributions as well), here's what I've found out:
The makepkg script by default will strip "unneeded symbols" from binaries and libraries. For the Dwarf Fortress binary, this only changes one byte, but that's enough to
change the md5sum which in turn makes dfhack not recognize the binary. (It also makes Dwarf Therapist fail to recognize DF for the same reason.)
Fix this by adding "options=(!strip)" to the PKGBUILD file (add it near the top of the file, where there are similar lines).

And if dfhack just exits with this error in stderr.log:
Quote
./libs/Dwarf_Fortress: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZN8rendererD1Ev
try doing a fresh, manual rebuild of libgraphics.so (dwarf_fortress_unfuck) and copy it into your DF libs folder (in my case: /opt/df_linux-sf/libs)

After doing this, I've got dfhack working now with DF 0.42.04 ;D
No crashes so far, after playing for a couple of hours.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 13, 2016, 02:48:32 am
Heck, I just uninstalled the native version to try and fix the openGL related errors and simply use the download from the bay12 site and the github dfhack dropped into the same folder.
Title: Re: DFHack 0.40.24-r5
Post by: Abadrausar on January 13, 2016, 06:54:15 am
I need to make already prepared_food (using it as a reagent in a reaction) into dehydrated flour(ingredient) in the quern using some fuel by stack of dried prepared_food.
Losing value, dorf time and fuel but gaining more dorf-exp in milling and cooking and biggers stacks by lavish cooking again and with that, using some QS stockpiles; the possibility of better FPS.

My problem:
 I does not find the identifier of prepared_food, I have even generated a custom stockpile with only prepared_food enabled and looked at the generated file "prepared food.dfstock" in directory stocksettings to no avail, what can be found is:
Spoiler (click to show/hide)
Instead of something like
Spoiler (click to show/hide)
I know that some special identifiers such as those corresponding to 3 kinds of glass have been known by means of binary string dumpers or Reverse engineering.

So my question is:

Anyone knows the internal identifier of PREPARED_FOOD to use it in reactions?
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on January 13, 2016, 07:50:25 pm
Where can I find the flags for handedness in gm-editor?
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 13, 2016, 08:17:21 pm
Meaning gauntlet handedness or unit handedness? For gauntlets, it's apparently just handedness in gauntlets. There's a method to grab it too (gauntlet:getGloveHandedness()).

For units: unit.body.weapon_bp is which hand they'll use to hold weapons.
Title: Re: DFHack 0.40.24-r5
Post by: Abadrausar on January 14, 2016, 04:59:11 am
Anyone knows the internal identifier of PREPARED_FOOD to use it in reactions?
Finally I found it in http://dwarffortresswiki.org/index.php/DF2014:Item_token

71   FOOD    item_food.txt   Prepared meals.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on January 14, 2016, 02:53:16 pm
How do you disable the pre-release notice? It often interrupts loading processes that normally don't require user maintenance.
Title: Re: DFHack 0.40.24-r5
Post by: khearn on January 14, 2016, 03:02:34 pm
Yeah, I usually turn away and do other things once a load starts, expecting it will be done when I get back. Instead I get back and find the warning notice, and still have to wait for the rest of the load. It would be nice if the notice could come at the very start, or very end of the load. But I realize that dfhack may not be able to get that sort of timing, so some way to turn it off would be nice.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on January 14, 2016, 03:03:20 pm
Meaning gauntlet handedness or unit handedness? For gauntlets, it's apparently just handedness in gauntlets. There's a method to grab it too (gauntlet:getGloveHandedness()).

For units: unit.body.weapon_bp is which hand they'll use to hold weapons.
Gauntlet handedness. I want to give some handedness to the gauntlets I just made in adventure mode.

How do you disable the pre-release notice? It often interrupts loading processes that normally don't require user maintenance.
Ditto
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on January 14, 2016, 03:09:39 pm
Meaning gauntlet handedness or unit handedness? For gauntlets, it's apparently just handedness in gauntlets. There's a method to grab it too (gauntlet:getGloveHandedness()).

For units: unit.body.weapon_bp is which hand they'll use to hold weapons.
Gauntlet handedness. I want to give some handedness to the gauntlets I just made in adventure mode.
Right:
Code: [Select]
gauntlet.handedness[0]=true
gauntlet.handedness[1]=false
Left:
Code: [Select]
gauntlet.handedness[1]=true
gauntlet.handedness[0]=false
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on January 14, 2016, 03:19:21 pm
Thanks, I am now wearing a pair of masterwork rusted metal gauntlets.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 14, 2016, 04:51:41 pm
How do you disable the pre-release notice? It often interrupts loading processes that normally don't require user maintenance.
Just delete everything in the pre-release warning lua file and save it like that.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on January 14, 2016, 06:41:26 pm
Meaning gauntlet handedness or unit handedness? For gauntlets, it's apparently just handedness in gauntlets. There's a method to grab it too (gauntlet:getGloveHandedness()).

For units: unit.body.weapon_bp is which hand they'll use to hold weapons.
Gauntlet handedness. I want to give some handedness to the gauntlets I just made in adventure mode.
Right:
Code: [Select]
gauntlet.handedness[0]=true
gauntlet.handedness[1]=false
Left:
Code: [Select]
gauntlet.handedness[1]=true
gauntlet.handedness[0]=false
Can they both be true for ambidextrous gloves?
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on January 14, 2016, 06:52:48 pm
You can try it.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on January 14, 2016, 07:17:13 pm
You can try it.
Would love to be able to run the game here, but can't.  Just thought it would be a quick test for someone who is running it right now.
Title: Re: DFHack 0.40.24-r5
Post by: Ygdrad on January 15, 2016, 12:53:58 am
Meaning gauntlet handedness or unit handedness? For gauntlets, it's apparently just handedness in gauntlets. There's a method to grab it too (gauntlet:getGloveHandedness()).

For units: unit.body.weapon_bp is which hand they'll use to hold weapons.
Gauntlet handedness. I want to give some handedness to the gauntlets I just made in adventure mode.
Right:
Code: [Select]
gauntlet.handedness[0]=true
gauntlet.handedness[1]=false
Left:
Code: [Select]
gauntlet.handedness[1]=true
gauntlet.handedness[0]=false

How would I go about doing this? I'm a complete noob when it comes to DFHack and this is the only thing I would need it for at the moment.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 15, 2016, 02:11:00 am
I just do gui/gm-editor with a gauntlet selected, down at the bottom is handedness, but I have a gm-editor hotkey specifically for stuff like that.
Title: Re: DFHack 0.40.24-r5
Post by: jobywalker on January 15, 2016, 07:09:44 am
Is there a way to clear the SIEGE designation?  I had an attack from a necromancer tower but they tried to cross the river and got washed off the map, but the SIEGE designation has continued for 3 more seasons.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 15, 2016, 10:20:16 am
Have you checked the unit list for any invaders/animals remaining?
Title: Re: DFHack 0.40.24-r5
Post by: jobywalker on January 15, 2016, 10:43:15 am
Yeah, they all left within a few days.  The SIEGE designation was finally lifted after a year.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on January 15, 2016, 04:49:04 pm
How do you disable the pre-release notice? It often interrupts loading processes that normally don't require user maintenance.
Just delete everything in the pre-release warning lua file and save it like that.
Would you know the name of that file?

EDIT: Nm, did a text search through files and found it in gui/
Title: Re: DFHack 0.40.24-r5
Post by: scamtank on January 15, 2016, 04:51:21 pm
If it's a .lua (it be) and it fucks with the UI (it do), /hack/plugins/scripts/GUI is the best place to check first.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 15, 2016, 07:49:28 pm
(hack/scripts/gui, actually - there's no plugins/scripts folder.)
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 16, 2016, 12:28:05 am
huh, there's nothing i can do with generated music for now is there
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 16, 2016, 01:55:27 am
huh, there's nothing i can do with generated music for now is there
Not terribly much, I dug into them some but it's much like dances, without a full mapping of all the structures in there and what they do it's really hit and miss and I have no clue how the numbers and stuff translate directly into what happens in game consistently.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on January 16, 2016, 12:12:01 pm
I've been 99% unavailable for the last several months and that will continue for another week. At that point depending on a real life undecided factor I'll either be a little more active or a lot more active. If there have been any problems with add-syndrome, scripts in modtools, event manager, or the create-unit script I've done my best to make a note of them but I may have missed a few.

The good news is I'll be a lot more active, the bad news is it will probably be closer to February.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 16, 2016, 08:59:42 pm
EDIT: wait what

my adventurer's skill count mismatched with the visual in-game, so I was making some assumptions based on that, but when the game crashed as I tried to edit an unknown value (something I 100% expected but had to try anyway) and I reopened it the skill count now matches up with the in-game display

EDIT 2: Nope, still mismatches. Weird weird weird. I doubt "The Great Standard" is being stored in the standard skills vector, so unit_soul.unk_v42_1 is probably new unit skills. My unit only has one, a poetic form called The Great Standard, one notch in the skill, unk_v42_1 was 100110011010110010011100111000 last time I saw it but now it's 100101001000011101000100000000, that's probably not that weird.

EDIT 3: unk_v42_1 is almost surely poetic etc. skills, I just practiced in the grand standard again and it changed from 0x2521D100 to 0x31B3DE88.

EDIT 4: lol i was dumb and forgot the obvious thing to do, just tested by sleeping for 8 hours and it changed even though i didn't practice anything; that could be explainable by skill rust, but that assumes that skills was a good, well-established hypothesis in the first place, which it sorta wasn't
Title: Re: DFHack 0.40.24-r5
Post by: Just Some Guy on January 16, 2016, 10:19:44 pm
I've decided to resume work on an abandoned mod dependent on Putnam's scripts.

Do the work like they used to, with the RAWS and all?
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 16, 2016, 10:21:00 pm
Most of them have been superseded by scripts included with DFHack and no longer use raws, instead using init registration.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 17, 2016, 01:00:08 am
EDIT: wait what

my adventurer's skill count mismatched with the visual in-game, so I was making some assumptions based on that, but when the game crashed as I tried to edit an unknown value (something I 100% expected but had to try anyway) and I reopened it the skill count now matches up with the in-game display

EDIT 2: Nope, still mismatches. Weird weird weird. I doubt "The Great Standard" is being stored in the standard skills vector, so unit_soul.unk_v42_1 is probably new unit skills. My unit only has one, a poetic form called The Great Standard, one notch in the skill, unk_v42_1 was 100110011010110010011100111000 last time I saw it but now it's 100101001000011101000100000000, that's probably not that weird.

EDIT 3: unk_v42_1 is almost surely poetic etc. skills, I just practiced in the grand standard again and it changed from 0x2521D100 to 0x31B3DE88.

EDIT 4: lol i was dumb and forgot the obvious thing to do, just tested by sleeping for 8 hours and it changed even though i didn't practice anything; that could be explainable by skill rust, but that assumes that skills was a good, well-established hypothesis in the first place, which it sorta wasn't
Noticed how that and current_soul.personality.unk_v4201_2 are almost identical?

They always seem to differ by a hundred or so in gm-editor, always negative too.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 17, 2016, 01:09:54 am
Here's the proper research from sv-esk (https://github.com/sv-esk/df-structures/commit/cffe5e3ce7c59246fc6d7a499bd868e1c6dd4f8b)

Looking at that, it should be trivial to put in some funnily-named instrument and use that as an arbitrary skill for DFHack purposes. Unfortunately, you almost definitely can't use that for reactions. If you could, you could skip DFHack entirely.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 17, 2016, 01:39:27 am
Hmmm, so why does it change whether you do anything with music or not?

When I posted my comment earlier the values were like
current_soul.unk_v42_1: -5xx,xxx,xxx
current_soul.personality.unk_v4201_2: -5xx,xxx,xxx +104

Now they are

current_soul.unk_v42_1: -927962048
current_soul.personality.unk_v4201_2: -713759800

Just from an 8 hour sleep.

Walking a couple steps in travel mode:

current_soul.unk_v42_1: -992763144
current_soul.personality.unk_v4201_2: -365862712

Wtf? They were a hundred apart several times when I checked after traveling around and now one is going up slowly and the other down super fast? I know gm-editor is interpreting from the binary/hex into an int but that is just weird.

If unk_v42_1 is the instruments stuff, what is unk_v4201_2 and why are they sometimes so close?

I'd pull it up in edb and poke at it but KDE5 is still buggy and seems to no likey edb by itself, much less trying to open df or anything else in it.


Couple more steps in travel mode:

v42_1: -341361224
v4201_2: -341561752

Couple more steps and they're back close to each other?

v42_1: -481752872
v4201_2: -481752976

Longer trip around a keep and back over near where I took my nap:

v42_1: -925012536
v4201_2: -925012640

I'm pretty sure they'll stay offset by 104 until I sleep again.

Or not... another decent length walk around the roads by the keep:

v42_1: -807170240
v4201_2: -1072832808

???

That is weird as hell but I get the feeling there is something interesting going on there.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 17, 2016, 02:01:22 am
It's probably silliness with memory getting shuffled around and garbage data being read into the int-that-shouldn't-be.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on January 17, 2016, 02:06:26 am
Yeah, it seems like it gets cycled, v42_1 a little higher, v4201_2 way lower, v4201_2 a little higher, almost equal for a little while, then it looks like a rollover with v4201_2 getting really high, like the -1,000,000,000 value I listed above, then they seem to go back to the flipfopping.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 17, 2016, 08:53:07 am
There are other possibilities, like those fields actually being pointers or multiple smaller integers.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on January 19, 2016, 01:38:26 am
Is there a plan for a stable, non-prerelease version of DFHack soon?  How much more work needs to be done, and how could we help?  What's the ETA?

For context, the prerelease nature of the DFHack build is the only thing holding me back from a stable Starter Pack :D
Title: Re: DFHack 0.40.24-r5
Post by: Karater on January 19, 2016, 06:02:42 am
when trying to compile dfhack on osx 10.11.2 I get the following errors:

Code: [Select]
[ 33%] Building CXX object library/CMakeFiles/dfhack.dir/DataStaticsFields.cpp.o
/var/folders/db/pp9mfd491gn92jzm1_1gltmm0000gn/T//ccy0du2C.s:9739:2: error: ambiguous instructions require an explicit suffix (could be 'filds', or 'fildl')
        fild    (%eax)
        ^
/var/folders/db/pp9mfd491gn92jzm1_1gltmm0000gn/T//ccy0du2C.s:9757:2: error: ambiguous instructions require an explicit suffix (could be 'fistps', or 'fistpl')
        fistp   (%eax)
        ^
/var/folders/db/pp9mfd491gn92jzm1_1gltmm0000gn/T//ccy0du2C.s:9774:2: error: ambiguous instructions require an explicit suffix (could be 'filds', or 'fildl')
        fild    (%esp)
        ^
/var/folders/db/pp9mfd491gn92jzm1_1gltmm0000gn/T//ccy0du2C.s:9793:2: error: ambiguous instructions require an explicit suffix (could be 'fistps', or 'fistpl')
        fistp   (%esp)
        ^
/var/folders/db/pp9mfd491gn92jzm1_1gltmm0000gn/T//ccy0du2C.s:9813:2: error: ambiguous instructions require an explicit suffix (could be 'filds', or 'fildl')
        fild    (%esp)
        ^
/var/folders/db/pp9mfd491gn92jzm1_1gltmm0000gn/T//ccy0du2C.s:9832:2: error: ambiguous instructions require an explicit suffix (could be 'fistps', or 'fistpl')
        fistp   (%esp)
        ^
/var/folders/db/pp9mfd491gn92jzm1_1gltmm0000gn/T//ccy0du2C.s:9852:2: error: ambiguous instructions require an explicit suffix (could be 'filds', or 'fildl')
        fild    (%esp)
        ^
/var/folders/db/pp9mfd491gn92jzm1_1gltmm0000gn/T//ccy0du2C.s:9871:2: error: ambiguous instructions require an explicit suffix (could be 'fistps', or 'fistpl')
        fistp   (%esp)
        ^
make[2]: *** [library/CMakeFiles/dfhack.dir/DataStaticsFields.cpp.o] Error 1
make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
make: *** [all] Error 2

i used these instructions (http://dfhack.readthedocs.org/en/stable/docs/Compile.html#mac-os-x) but had to use gcc48 instead of gcc45, because:

Code: [Select]
gcc45: This formula either does not compile or function as expected on OS X
versions newer than Yosemite due to an upstream incompatibility.

is there anything I can do to get it to compile?
Title: Re: DFHack 0.40.24-r5
Post by: Grax on January 19, 2016, 06:05:48 am
Is there any possibility to change biome? (maybe just like "changelayer") ;-)
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 19, 2016, 06:45:53 am
Karater: I haven't tried it myself, but apparently installing XCode 6 and switching to it on the command line with xcode-select works.
Title: Re: DFHack 0.40.24-r5
Post by: Karater on January 19, 2016, 07:38:50 am
Karater: I haven't tried it myself, but apparently installing XCode 6 and switching to it on the command line with xcode-select works.
got it  :)
perhaps someone can update the docs and add this as a note
Title: Re: DFHack 0.40.24-r5
Post by: Roses on January 19, 2016, 03:01:39 pm
Has anyone experimented much with diplomacy? Can you make enemy civs hostile/friendly with DFHack?

EDIT: Follow up question, has anyone done much work with changing a units allegiance? I have written a small script that changes a few basic things, but the changed units don't quite behave the way they should. I am wondering if there are flags and such I'm not properly switching. What all goes into determining if two units are hostile/neutral/friendly to eachother?
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on January 19, 2016, 11:12:05 pm
Has anyone experimented much with diplomacy? Can you make enemy civs hostile/friendly with DFHack?

EDIT: Follow up question, has anyone done much work with changing a units allegiance? I have written a small script that changes a few basic things, but the changed units don't quite behave the way they should. I am wondering if there are flags and such I'm not properly switching. What all goes into determining if two units are hostile/neutral/friendly to eachother?

There's a global "enemy" table that keeps track of sides in a fight but I have no idea how it works.
Title: Re: DFHack 0.40.24-r5
Post by: Roses on January 21, 2016, 03:55:00 pm
Has anyone experimented much with diplomacy? Can you make enemy civs hostile/friendly with DFHack?

EDIT: Follow up question, has anyone done much work with changing a units allegiance? I have written a small script that changes a few basic things, but the changed units don't quite behave the way they should. I am wondering if there are flags and such I'm not properly switching. What all goes into determining if two units are hostile/neutral/friendly to eachother?

There's a global "enemy" table that keeps track of sides in a fight but I have no idea how it works.

Hmm is this table available for research purposes?
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on January 21, 2016, 08:42:16 pm
I think Warmist knows a bit about it but I could be remembering wrong. I'd ask him.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 22, 2016, 12:40:57 am
if a new alpha or full release is done, will it have the structures for poetry etc. skills?

i would like those very much
Title: Re: DFHack 0.40.24-r5
Post by: Karater on January 22, 2016, 04:42:32 am
Structures for art forms are already available. But all fields except name are labeled "unknown" and need some research what they do.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on January 22, 2016, 10:30:34 am
I'm more worried about skills specifically.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on January 22, 2016, 04:06:16 pm
Has anyone experimented much with diplomacy? Can you make enemy civs hostile/friendly with DFHack?

EDIT: Follow up question, has anyone done much work with changing a units allegiance? I have written a small script that changes a few basic things, but the changed units don't quite behave the way they should. I am wondering if there are flags and such I'm not properly switching. What all goes into determining if two units are hostile/neutral/friendly to eachother?

There's a global "enemy" table that keeps track of sides in a fight but I have no idea how it works.

Hmm is this table available for research purposes?
Diplomacy not so much: probably just mess around with entity (i.e. current site entity vs other one) add appropriate hist-entity links etc...

As for allegiance: it's controlled by few factors: it's civ_id and there is also it's history (e.g. crimes etc...) that get recalculated ever so often into a cache table (which i guess Roses mentioned) I think it was called df.global.world.enemy_cache, but could be wrong... The research in that table entry values is here:
  gist  (https://gist.github.com/warmist/3017dc796a6173c215bb) Totally not finished and could be wrong. But the idea is that you might need to change them when you change civ_id so they would not attack wrong unit while it gets recalculated. Or you could change it to force unit to attack (and then the crimes and etc. system takes care of holding them as enemy).
Title: Re: DFHack 0.40.24-r5
Post by: Roses on January 23, 2016, 01:54:51 am
Has anyone experimented much with diplomacy? Can you make enemy civs hostile/friendly with DFHack?

EDIT: Follow up question, has anyone done much work with changing a units allegiance? I have written a small script that changes a few basic things, but the changed units don't quite behave the way they should. I am wondering if there are flags and such I'm not properly switching. What all goes into determining if two units are hostile/neutral/friendly to eachother?

There's a global "enemy" table that keeps track of sides in a fight but I have no idea how it works.

Hmm is this table available for research purposes?
Diplomacy not so much: probably just mess around with entity (i.e. current site entity vs other one) add appropriate hist-entity links etc...

As for allegiance: it's controlled by few factors: it's civ_id and there is also it's history (e.g. crimes etc...) that get recalculated ever so often into a cache table (which i guess Roses mentioned) I think it was called df.global.world.enemy_cache, but could be wrong... The research in that table entry values is here:
  gist  (https://gist.github.com/warmist/3017dc796a6173c215bb) Totally not finished and could be wrong. But the idea is that you might need to change them when you change civ_id so they would not attack wrong unit while it gets recalculated. Or you could change it to force unit to attack (and then the crimes and etc. system takes care of holding them as enemy).

Hmm, this charm unit script is becoming troublesome. Does anyone have a save in 40.24 that has invaders in it? Preferably with merchants at the same time, although not necessary.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on January 23, 2016, 01:37:52 pm
I'm more worried about skills specifically.
It would be great to cull out unwanted forms and examples and make the lists less spammy.
Title: Re: DFHack 0.40.24-r5
Post by: Nagidal on January 24, 2016, 04:15:17 pm
Does anyone have a save in 40.24 that has invaders in it? Preferably with merchants at the same time, although not necessary.

I hope that my savegame can be of service. Human siege, no merchants. I saved it the very first moment they spawned on the map.

Haven't unpaused it before the save. This siege did not start with the usual black screen "A vile force of darkness has arrived!" but with a popup "The enemy have come and are laying siege to the fortress."

http://dffd.bay12games.com/file.php?id=11700 (http://dffd.bay12games.com/file.php?id=11700)
Title: Re: DFHack 0.40.24-r5
Post by: Roses on January 24, 2016, 05:58:36 pm
Does anyone have a save in 40.24 that has invaders in it? Preferably with merchants at the same time, although not necessary.

I hope that my savegame can be of service. Human siege, no merchants. I saved it the very first moment they spawned on the map.

Haven't unpaused it before the save. This siege did not start with the usual black screen "A vile force of darkness has arrived!" but with a popup "The enemy have come and are laying siege to the fortress."

http://dffd.bay12games.com/file.php?id=11700 (http://dffd.bay12games.com/file.php?id=11700)

Indeed it does, especially since you have a couple goblins from a previous invasion trapped and two forgotten beasts. The first thing I notice (besides coward being set true for some and not for others) in the unit.enemy table anon_6, anon_7, and anon_8 are set different for each invasion, with anon_8 being userdata. And unk_874_cntr is set to one value for invaders and another for other things. The trick now is figuring out why they are what they are. For one invasion its
Code: [Select]
anon_6 = 1935455
anon_7 = 570428152
while an earlier one is
Code: [Select]
anon_6 = 1675531
anon_7 = 570414840
Can't seem to find any reason
Title: Re: DFHack 0.40.24-r5
Post by: Nagidal on January 25, 2016, 11:28:16 am
Does anyone have a save in 40.24 that has invaders in it? Preferably with merchants at the same time, although not necessary.

If you need some more, here is a savegame with some merchants now. The caged goblins and forgotten beasts are still there.

http://dffd.bay12games.com/file.php?id=11706 (http://dffd.bay12games.com/file.php?id=11706)
Title: "Spawn" insect colony
Post by: Kha on January 27, 2016, 10:49:14 am
DISCLAIMER: I do not really know much about what I am doing here, but it works. BackUp your saves either way. If my method is old news or outdated, ignore this post, but a search just turned up two people asking and nobody answering.
DF Version:  PeridexisErrant's Starter Pack 0.42.04-r03 with DFHack 0.42.04-alpha2
GOAL: Get a bee (or other) colony on your embark site where no colonies are present.

1) Colonies are vermin with the 'is_colony' flag set to TRUE.
2) My understanding is that DFHack currently can create units and items, but no vermin. So we take an existing vermin and change it into a colony.
3) DFHack command:
Code: [Select]
gui/gm-editor "world.vermin" => all. (Or just "world", there is a lot resources for !!SCIENCE!! right there)
4) Choosing the vermin: As far as my knowledge goes any vermin with a set countdown will do, as it would disappear afterwards anyway
5) Set vermin values:

Spoiler (click to show/hide)
6) my beekeepers somehow only recognize the newly "build" colony once I savequit and reload the game, so do that (after BACKUP, remember this is all experimental)

That´s it. Good luck and thanks to the DFHack team for providing us with such a powerful tool as gm-editor.

EDIT: I realize this is the 0.40.24 thread, but it should work in all DFHack versions with the gm-editor and there is no 0.42.04 thread yet
EDIT2: expressed goal more explicit
Title: Re: DFHack 0.40.24-r5
Post by: Njals on January 27, 2016, 12:41:19 pm
Hi guys, thanks for the great work! Is it possible to use .04 alpha with .05? Or just build version from https://github.com/DFHack/dfhack/tree/develop ?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 27, 2016, 01:23:28 pm
DFHack versions will never work with newer DF versions than what they're named after (so DFHack 0.42.04-anything will not work with DF versions newer than 0.42.04). You can build from there, but read the compilation instructions (in particular, run "git submodule update" after you check out the develop branch).


About that - has anyone tested DFHack with 0.42.05? I haven't had time to do much testing recently, but I didn't notice any changes in the brief time I did get to test it. I'm able to put together an alpha release today, but my main concern is that it'll be inadequately tested and pushed out to people who aren't interested in testing.
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on January 27, 2016, 02:35:35 pm
I been using a windows build of develop branch I downloaded with an unofficial prebuild of twbt. I think it's in the twbt thread from mid/late last week, in a spoiler tagpostered offered up twbt alone or with his dfhack build. I was pleased cause my windows development environment is still not working, although my Linux box is fine(need windows to play at work shhhh)

It works great for twbt, prospect, and reveal...I tried a quick save during a brain fart and it corrupted the save...but no crashed or any hiccups at all with my limited use...
Title: Re: DFHack 0.40.24-r5
Post by: khearn on January 27, 2016, 02:38:58 pm
I did a linux build from the develop branch yesterday. It seems to work, but I haven't been using it very long. But it doesn't blow up immediately. :)
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 27, 2016, 02:53:09 pm
I tried a quick save during a brain fart and it corrupted the save
What does that mean? If quicksave is causing corruption, that's a serious problem.
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on January 27, 2016, 03:45:13 pm
I did a linux build from the develop branch with my additions 9 days ago. It seems to work fine. Used quicksave - no corruption/crashes encountered.
job-duplicate or workshop-job seems to cause minor problem sometimes - dwarves wont pickup jobs from workshop(probably old problem - havenot used it in older versions). Built-in DwarfTherapist works with dwarves, not citizens - its annoying(0.42.01 problem).
And question about my commits nevermind
Title: Re: "Spawn" insect colony
Post by: PeridexisErrant on January 27, 2016, 06:36:52 pm
GOAL: Get a bee (or other colony) on your embark site.

2) My understanding is that DFHack currently can create units and items, but no vermin. So we take an existing vermin and change it into a colony.

https://dfhack.readthedocs.org/en/stable/docs/Plugins.html#colonies

There's a plugin for that!  (It would be great if we could also spawn colonies, but nobody knows how)
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on January 27, 2016, 11:26:49 pm
It means I just wanted dfhack to cheat my way to a nice iron embark and knew that even if I got that build to work, I knew I shouldn't use the quicksave feature. Not knowing if dfhack merely initiated a df native save process or if it nuts and bolts wrote wrote a save file, I "decided" to only use prospect and reveal. However, I had a brain Fart and my fingers shot out to the quick save key combo and crash and corruption as I expected.

I figured it was a super early dev build and I should expect that sort of thing,and since it was the expected behavior, the armegeddeon of yet another digital world...that's not really a hiccup to me. But rereading my post its pretty funny. 
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 27, 2016, 11:29:06 pm
It's not expected at all. What DF/DFHack version was that? quicksave sets a single native DF flag that causes DF to save on its own. Are you saying the save was permanently corrupted (i.e. it wouldn't load)? Did you terminate DF while it was saving?
Title: Re: DFHack 0.40.24-r5
Post by: Grax on January 28, 2016, 12:01:59 am
I just realized i've played 10 years fortress without DFHack!
Even prospecting can be done with savescumming.

The only thing that now absent without варфсл and i'm regret of is the search among those so mant different names.
And the designations to chop/dig. It's so sad DF can't designate to chop trees in 'k' mode.
Title: Re: "Spawn" insect colony
Post by: Warmist on January 28, 2016, 08:42:54 am
GOAL: Get a bee (or other colony) on your embark site.

2) My understanding is that DFHack currently can create units and items, but no vermin. So we take an existing vermin and change it into a colony.

https://dfhack.readthedocs.org/en/stable/docs/Plugins.html#colonies

There's a plugin for that!  (It would be great if we could also spawn colonies, but nobody knows how)
I might know... I had a script for that i think...
Title: Re: "Spawn" insect colony
Post by: Kha on January 28, 2016, 03:41:17 pm
There's a plugin for that!  (It would be great if we could also spawn colonies, but nobody knows how)
I had a look at the script from the command before I posted, but all it does is scan for existing colonies and change the race value to HONEY_BEE. That´s not really helpful if you embark in a warm temperate forest with river (no colonies there), but want to set up a mead production.
To spawn colonies as far as I know you would have to write a script similar to create-unit.lua from the modtools and even there they are using the "arena_spawn" function if I got that right, so not sure if that would work for vermin.
Thats why I came up with this dirty way of "creating" a vermin colony from a random temporary vermin.


I might know... I had a script for that i think...

Would be great!
Title: Re: DFHack 0.40.24-r5
Post by: Manzeenan on January 28, 2016, 04:42:44 pm
So could we in theory make fish farms with hives?
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on January 28, 2016, 09:04:59 pm
It was figments build from page 125 of the twbt thread.
His Link
http://www.mediafire.com/download/2979w71ddp6gbns/dfhack-0.42.05-alpha0-Windows-figment-twbt.zip

it crashed during saving, I know it takes a while and windows will fade it and say it crashed even when its fine, but I waited a while and no dice.

Could have been a fluke, I expected it to crash, maybe I willed it. I didn't build it so maybe he got a branch or something. I know I wont be quicksaving till a stable release lol, but as you see, others report it as fine.

I wouldn't even keep mentioning it and elaborating, but I am in case the information is useful to you guys. Not that there is really any, but you did ask what version...



Title: Re: DFHack 0.40.24-r5
Post by: Grax on January 29, 2016, 03:26:51 am
Wow it's working. Revtoggle and autodump at least. Thank you ;-)
Title: Re: DFHack 0.40.24-r5
Post by: Abadrausar on January 29, 2016, 05:34:31 am
So could we in theory make fish farms with hives?
This would be specially useful, if the creatures of the new modded colonies were given the TAGs [UBIQUITOUS],  [AMPHIBIOUS], [VERMIN_SOIL_COLONY], [VERMIN_FISH], [FISHITEM], [COOKABLE_LIVE],  [UNDERGROUND_DEPTH:min:max], [COLONY_EXTERNAL:], [ARTIFICIAL_HIVEABLE], [HIVE_PRODUCT::::::] and then, the hives placed near a well or another source of water.

Then we could have, all biomes around underground colonies of fishable creatures, some examples with industry involved:

1) Apple snails: produces meat, shell and purple dye.
2) Naked mole-rat: produces meat, tooth and leather and is a vermin eater. Those also predates over your other colonies not only natural vermin.
3) Angora rabbit: a wooly high value pet, for your thread industry, there are some evidence that romans had developed cuniculture before S. I a.C. How could our dorfs do worse than romans? :P
4) Deep Termite: Big amounts of slurry for the paper industry and some tasty dried termite flour.
5) Leafcutter Silkant: recollection of the hive produces a stack of brewable fungus and some silk.
6) Cavern Jellyfish: they are brewable and their sting is mildly toxic. ;D Those can train a little your hospital roles without being a real danger, no FUN here. Bonus points if the toxine is milkable (HARD to do) and then distillated into a stronger toxine via reaction.
7) Dairy colonies: if the milking thing of the [COLONY_EXTERNAL] creatures were at all possible we could have some nice dairy farms (FPS aware) placing the hives next to the farmers workshop.
8) Silkmoth: more silk than cheese.
9) Carmine Cochineal: An insect that produces a delicious and valuable DyeFlour that you can use either as an edible flour colorant in food preparations or as a natural dye in your thread industry.
10) Black soldier fly:  They will devour all your remains and other refuse rotting in your stockpiles, producing meat and compost (potash) in the process. (so better FPS -> less items in your refuse stockpiles -> connect or adapt to the decay mod)
...
It could also be a good idea to convert to this system some of the already [UBIQUITOUS] creatures, reusing some of the permanents slots into each biome, grasshoppers farms for a creative kitchen (OMS), anyone?
Best of all that is that maybe some FPS could be saved with this system (less pathfinding required then quick and more abstract simulation), some SCIENCE!!! required.
Title: Re: "Spawn" insect colony
Post by: Warmist on January 30, 2016, 03:25:12 pm
There's a plugin for that!  (It would be great if we could also spawn colonies, but nobody knows how)
I had a look at the script from the command before I posted, but all it does is scan for existing colonies and change the race value to HONEY_BEE. That´s not really helpful if you embark in a warm temperate forest with river (no colonies there), but want to set up a mead production.
To spawn colonies as far as I know you would have to write a script similar to create-unit.lua from the modtools and even there they are using the "arena_spawn" function if I got that right, so not sure if that would work for vermin.
Thats why I came up with this dirty way of "creating" a vermin colony from a random temporary vermin.


I might know... I had a script for that i think...

Would be great!
Finally got around to it!
Code: [Select]
-- creates a honey_bee (or other vermin) colony at pointer
local args={...}
local vermin_name=args[1] or "HONEY_BEE"
local vermin_id
function findVermin(name)
    for k,v in pairs(df.global.world.raws.creatures.all) do
        if v.creature_id==name then
            return k
        end
    end
    qerror("No vermin found with name:"..name)
end
vermin_id=findVermin(vermin_name)
local pos=copyall(df.global.cursor)
if pos.x==-30000 then
    qerror("Cursor must be pointing somewhere")
end
local verm=df.vermin:new()
verm.race=vermin_id
verm.flags.is_colony=true
verm.caste=-1 -- check for queen bee?
verm.amount=18826
verm.visible=true
verm.pos:assign(pos)
df.global.world.vermin.colonies:insert("#",verm)
df.global.world.vermin.all:insert("#",verm)
Should create colony at cursor.
Title: Re: "Spawn" insect colony
Post by: Abadrausar on January 31, 2016, 03:10:55 am
Should create colony at cursor.
It seems really nice warmist!

If you add a colonies list option, could your script substitute the colonies pluging in DFHACK?
Title: Re: DFHack 0.40.24-r5
Post by: Rose on January 31, 2016, 03:34:44 am
Can dfhack be used to make trees grow somewhat normally on top of constructions?
Title: Re: "Spawn" insect colony
Post by: PeridexisErrant on January 31, 2016, 07:45:38 am
Should create colony at cursor.
It seems really nice warmist!

If you add a colonies list option, could your script substitute the colonies pluging in DFHACK?

Almost, and there's an issue open for this and a few other conversions. I've got a port I just need to test, and then just merge this in.
Title: Re: DFHack 0.40.24-r5
Post by: SimRobert2001 on January 31, 2016, 11:07:48 am
Its been a bit since 40.05 came out. Is there a problem with it?
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on January 31, 2016, 11:28:33 am
Its been a bit since 40.05 came out. Is there a problem with it?
I think .06 is expected soon.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 31, 2016, 11:51:01 am
Its been a bit since 40.05 came out. Is there a problem with it?
It hadn't been tested much, although there don't seem to be many issues.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on January 31, 2016, 02:51:27 pm
Its been a bit since 40.05 came out. Is there a problem with it?
It hadn't been tested much, although there don't seem to be many issues.
Are you confident in it enough to release an alpha? Or is it already there and I'm just not looking in the right place?
Title: Re: DFHack 0.40.24-r5
Post by: Rose on January 31, 2016, 03:16:26 pm
I haven't run into any problems with basic day-to-day functions, like workflow, etc, but I haven't done any extensive testing.
Title: Re: DFHack 0.40.24-r5
Post by: Salkryn on January 31, 2016, 05:05:54 pm
I'm a bit curious, it feels like this release has taken longer for DFHack than the .40 versions, and I've been wondering why. Is it because of the additions of visitors and non-dwarf immigrants, or something else? I'm not trying to be critical, I'm just interested as a non-coder looking in on the creation process.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on January 31, 2016, 05:15:50 pm
There were a couple rapid alpha releases for 0.42.04, and there could probably be one now for 0.42.05 (the main delay this time was due to nobody testing it). My main obstacle is not having a Windows DFHack dev environment - I'm often able to put up at least weekly builds (once DFHack is stable enough, of course), but a lack of Windows builds tends to go unappreciated, so I usually end up waiting until someone is around to compile for Windows too.
DFHack 0.40.08-r1 took a considerably longer time to be released than 0.42 releases so far, but that was due to more changes and testing before it was released. Alpha builds ideally help speed up the testing process, but we don't want to release anything completely broken, because people who aren't interested in testing sometimes end up using alpha builds as well.
Title: Re: DFHack 0.40.24-r5
Post by: Salkryn on January 31, 2016, 05:19:57 pm
Fair enough. I'm looking forward to the next full release. Thanks for all of the work you put in.
Title: Re: DFHack 0.40.24-r5
Post by: notfood on January 31, 2016, 11:44:40 pm
Linux 0.42.05 seems fine, even with TWBT. I've been through a few forts and I haven't had any issue.
Title: Re: DFHack 0.40.24-r5
Post by: kochano on February 01, 2016, 03:28:02 am
I'm looking forward to the next DFHack alpha release on Windoze as well. Been delaying my 42.05 move until that day arrives...
Title: Re: DFHack 0.40.24-r5
Post by: Kuikka on February 01, 2016, 07:00:44 am
I'm also waiting patiently for tech wizards to finish tinkering with the 42.05 build :) too bad there's always the next DF version around the corner that keep on promising fixes or features so new and alluring >_>
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 01, 2016, 09:42:01 am
Its been a bit since 40.05 came out. Is there a problem with it?
I think .06 is expected soon.
As in minutes after PE's Starter Pack ships with DFHack for 42.05? :)
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on February 01, 2016, 09:57:31 am
Its been a bit since 40.05 came out. Is there a problem with it?
I think .06 is expected soon.
As in minutes after PE's Starter Pack ships with DFHack for 42.05? :)
Yes. And in order to take advantage of any of the changes and fixes you've been waiting for the most, you must generate a new world.
Title: Re: DFHack 0.40.24-r5
Post by: Salkryn on February 01, 2016, 10:18:36 am
Its been a bit since 40.05 came out. Is there a problem with it?
I think .06 is expected soon.
As in minutes after PE's Starter Pack ships with DFHack for 42.05? :)
Yes. And in order to take advantage of any of the changes and fixes you've been waiting for the most, you must generate a new world.
Well, that's always a risk with simultaneous development. It took several months last time to get to the point where updating the packs was a relatively minor thing, and it coincided with Toady tapering off the releases and going back into the long development cycle.
Title: Re: DFHack 0.40.24-r5
Post by: UristWoodie on February 01, 2016, 01:24:27 pm
Fine, I'm playing enough w/ 42.04, that I might as well do a little documentation, and become and alpha tester.

Where do I sign up?
Title: Re: DFHack 0.40.24-r5
Post by: Muffinator on February 01, 2016, 01:53:29 pm
I would like to also sign up in that I don't mind testing the super buggy versions for 42.05 on Windows. You're gonna have to feed me how to compile it though, because I have no clue how, and my friend can't help me until finald are over in a month.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on February 01, 2016, 02:59:29 pm
https://github.com/DFHack/dfhack/releases/tag/0.42.05-alpha1

Alpha release is up.
Title: Re: DFHack 0.40.24-r5
Post by: khearn on February 01, 2016, 06:47:24 pm
Thanks for the alpha release. I can build from the develop branch on Linux, but I've never set up a build environment for Windows, and I play sometimes on a Linux machine, and sometimes on Windows.
Title: Re: DFHack 0.40.24-r5
Post by: Salkryn on February 03, 2016, 01:14:13 am
Running this with the latest LNP on windows 7. No problems so far, but I don't really use any of the more advanced tools. I mostly just use reveal and the more basic tweaks.
Title: Re: DFHack 0.40.24-r5
Post by: Hesperid on February 03, 2016, 09:22:34 am
Built the newest commit in the repository but symbols.xml doesn't have an entry for the newest version of Dwarf Fortress, so dfhack deactivates on startup. Are there other changes in the pre-built binary that aren't in the source version?
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on February 03, 2016, 09:35:03 am
Built the newest commit in the repository but symbols.xml doesn't have an entry for the newest version of Dwarf Fortress, so dfhack deactivates on startup. Are there other changes in the pre-built binary that aren't in the source version?
My guess is that you need to use develop branch. That is there all the (hot) action is going :)
Title: Re: DFHack 0.40.24-r5
Post by: Muffinator on February 03, 2016, 09:38:08 am
Hey I just downloaded the newest LNP for windows with DFHack enabled, and after generating a new (large) world, i used the exportlegends maps command, and it crashed while the trade map was generating. Is there crash logs somewhere for DFHack, and is this the kind of stuff you're looking for as far as testing?
Title: Re: DFHack 0.40.24-r5
Post by: Hesperid on February 03, 2016, 10:03:59 am
My guess is that you need to use develop branch. That is there all the (hot) action is going :)

You're right. Actually the zipped up version of the source code offered for download under the binaries, for some reason, has old versions of the submodules baked in and won't compile into the actual executable being offered.

So here's what I did:

Code: [Select]
# get a fresh copy of the repo
git clone https://github.com/DFHack/dfhack.git .

# get (hot) action
git branch develop
git checkout develop
git pull origin develop

# the following step is what you can't do if you just downloaded the zip
git submodule update

Then cmake, make, make install into directory of your choice, where you have a copy of DF 0.40.25 waiting. I can't verify that this produces exactly the same as the precompiled binary that's offered for download, but it runs.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 03, 2016, 11:20:20 pm
Built the newest commit in the repository but symbols.xml doesn't have an entry for the newest version of Dwarf Fortress, so dfhack deactivates on startup. Are there other changes in the pre-built binary that aren't in the source version?
Yes. We didn't update the library/xml submodule, so the develop branch doesn't point to a df-structures commit with Windows 0.42.05 support. That should be fixed now (once you run "git pull" and "git submodule update", of course).
Title: Re: DFHack 0.40.24-r5
Post by: Wutnold124 on February 04, 2016, 04:46:49 pm
The gamestart message says "Rename DFhack.init-example to DFhack.init and edit it to customize it" or something like that, but I don't have any program that can open/edit a .init
Any help?
Title: Re: DFHack 0.40.24-r5
Post by: scamtank on February 04, 2016, 05:02:58 pm
Just use a text editor, you big lug.
Title: Re: DFHack 0.40.24-r5
Post by: Wutnold124 on February 04, 2016, 05:10:14 pm
Just use a text editor, you big lug.
I just now thought of that.
I apparently have lost 40% of my brain.
Title: Re: DFHack 0.40.24-r5
Post by: khearn on February 05, 2016, 06:41:18 pm
Found a couple of problems with the new autogem plugin. Or really just one, I guess.

I started getting a lot of cancellation spam "Urist McJeweler cancels cut clear tourmaline: Needs rough clear tourmalines.

I checked my stocks screen, and the only rough clear tourmalines I had were either marked for dumping or forbidden. Apparently autogem goes ahead and creates cut jobs for these gems, even though the gemcutter can't use them.

Also, I had a dwarf get a strange mood, which needed rough gems. All of my rough gems had been autocut, so I dug out a couple more, which the moody dwarf immediately grabbed. But autogem continued to schedule tasks for cutting these gems, resulting in more cancellation spam until the artifact was done.

So autocut definitely needs to notice that rough gems are forbidden or marked for dumping before creating tasks to cut them, and it also needs to be able to notice that some other task, such as a mood, has taken the gem.

Having all of one's rough gems get cut can cause a problem when strange moods arise, so players need to be able to forbid at least a few gems to keep them in reserve for moods. But if this will result in constant cancellation spam, then it's just not workable.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on February 05, 2016, 07:51:42 pm
autogems definitely needs to notice that rough gems are forbidden or marked for dumping before creating tasks to cut them, and it also needs to be able to notice that some other task, such as a mood, has taken the gem.

Enabling the plugin should not also enable the workshop order IMO, as automatically cutting rough gems is a big change from vanilla behavior with potentially serious downsides for moody dwarves.  (I've had a few comments on this in the Starter Pack thread too)
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 06, 2016, 10:17:54 am
As I'm sure you know they really should be asking here. It's important for people to know at least approximately where the different tools come from.
Title: Re: DFHack 0.40.24-r5
Post by: TheKaspa on February 06, 2016, 03:57:37 pm
If you set up a stockpile with links to the workshops, the cancellation spam stops
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on February 06, 2016, 04:44:34 pm
Has anyone identified the event/rumor data for adventurer mode? I thought it would be in the nemesis file, which would explain the lag every time it displays. Is it buried in userdata?

I'm trying to cull out the insignificant ones to make the list fit for purpose. At this stage of play, the rumors dialog is unusable and simply opening the journal takes a few seconds. I predict the journal will get as bad as the rumor list.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on February 06, 2016, 05:14:24 pm
Has anyone identified the event/rumor data for adventurer mode? I thought it would be in the nemesis file, which would explain the lag every time it displays. Is it buried in userdata?

I'm trying to cull out the insignificant ones to make the list fit for purpose. At this stage of play, the rumors dialog is unusable and simply opening the journal takes a few seconds. I predict the journal will get as bad as the rumor list.
it might get digging in history of world. That usually takes ages as it's a VERY big list.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on February 06, 2016, 05:17:38 pm
df.global.world.incidents
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on February 06, 2016, 11:29:19 pm
I doubt these are in the history of the world, it's full of items too trivial for history. Such as when a wild animal gets spooked by any other creature's presence, and every single occurrence of the performance of every single tale or text. There's scant overlap between what goes into this rumors list and what is retained in legends. Also, none of it transfers to any other character or fortress.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on February 07, 2016, 03:46:18 am
I doubt these are in the history of the world, it's full of items too trivial for history. Such as when a wild animal gets spooked by any other creature's presence, and every single occurrence of the performance of every single tale or text. There's scant overlap between what goes into this rumors list and what is retained in legends. Also, none of it transfers to any other character or fortress.
It can filter or look up by id. E.g. your adventurer has a list of historical_event ids and then you open menu game looks every one of them up thus binary searching through a HUGE amount of events.
Title: Re: DFHack 0.40.24-r5
Post by: BlackSmokeDMax on February 08, 2016, 01:59:50 pm
So am I right in assuming that in regards to gem cutting:

1. The new Autogem starts enabled with the Starter Pack install of DFHack?
2. I can stop using a workflow setup where I start with cutting any old gem and then while setting up a Workflow changing it from the specific gem I selected to using "gem of any type"?

or

3. Autogems cut all gems, yes? So perhaps I should keep on with my current method as at least I can link up a stock pile and more easily prevent gems I do not want cut from being cut?

Thoughts anyone?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 08, 2016, 04:38:16 pm
It's good to mention which starter pack you're using (I assume it's PE's, but that's not the only one, and there's at least one other distributing DFHack with autogems). That said, DFHack's default configuration does enable autogems, so it's likely that your pack does too.

I haven't tried the workflow technique before, but I assume the two are equivalent. Autogems doesn't allow specifying individual workshops, though, so if that's important, workflow might be a better option for you. It also doesn't allow specific gem controls, and I don't think it takes stockpile links into account, but those could be implemented.
Title: Re: DFHack 0.40.24-r5
Post by: BlackSmokeDMax on February 08, 2016, 07:48:36 pm
Yes, PE's Starter Pack, I'll start including that in my posts from now on.

Guess I'll just mess with both for a bit yet and see if I find any other differences. Could be Autogems will be fine as long as I forbid what ever gems I want saved. That is of course, if forbidding gems stops them from being cut. Will have to test to make sure. I'd imagine that will be easy to test early game before too many rough gems pile up.

Thanks for the input!
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on February 08, 2016, 08:16:51 pm
Yes, PE's Starter Pack, I'll start including that in my posts from now on.

The exact version is also often helpful, to allow identification of which version of eg DFHack you're using, whether anything else was added, etc.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on February 09, 2016, 12:42:14 am
heyo, research on unit_personality.T_unk_v4201_1a

unit.personality.unk_v4201_1a is a vector of needs. I would just call it "needs".

needs.unk_0: df.need_type enum (int32) (I'd call it "type")
unk_4: ?? (the only reason this isn't a pull request to df-structures) EDIT: anything's better than nothing
unk_8: how well the need's been fulfilled (int32) (I'd call it "fulfillment" or similar)
unk_c: how much unk_8 will increment per time (times -1; for example, unk_c=20 will make unk_8 go down by 20 every time it goes down) (I'd call it "increment_counter" or something like that)
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 09, 2016, 01:00:24 am
 unk_4 is deity historical figure id (for pray need). -1 for all others needs
This is over month gathering dust in the issues and nobody cares
https://github.com/DFHack/df-structures/issues/74
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on February 09, 2016, 01:08:28 am
you should make that a pull request
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 09, 2016, 01:34:23 am
Done. Since I deleted all those comments from xml and issue is going to be closed when(if) pull request will be accepted, I copied comments in here.
Spoiler (click to show/hide)
Spoiler (click to show/hide)
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on February 09, 2016, 02:04:31 am
Oh, also, got a slight bit of poetic form research done:

Poetic form:

anon_1: civ id
anon_2: probably part of an enum governing poem usage, given these results:
    0: guides poets during improvised performance
   1: improvised
   2: individual poems which can be recited
   3: individual poems
   4: improvised
   5: improvised
   6: individual poems
   7: individual poems
   8: improvised
   9: improvised

It was 1 when I got to it.

anon_5: vector of distinct parts in poetic form.

anon_5.anon_1: Probably part of another enum, these results:

0: couplet
1: couplet
2: brief verse paragraph
3: brief verse paragraph

etc.

wow it's bedtime
Title: Re: DFHack 0.40.24-r5
Post by: UristWoodie on February 09, 2016, 10:28:00 pm
Been running the pre-release StarterPack bundle (PyLNP 0.10e, 42.05-r01) on Windows 8, x64.
DF 0.42.05
DFHack 0.42.05-alpha1
Therapist 36.0.0
TWBT mode with PHoebus 16px
Seasonal Saves
Got about 3-4 years of this fortress.

Issues:
=> With .42.05 generated world, only one CrashToDesktop - unable to reproduce on demand. (With pre-.05 generated worlds, repeated CTD. Seemed to be related to cutting a tree down, and then trying to floor over the resulting hole.)
==> AutoGem turned on by default. (Unexpected, non-vanilla behavior)
==> Graphics - Numerous "anomalies"...dwarves are mostly the same shape, just different colors. (Could be user error)
==> Unable to name stock piles. :(

Overall: has been pretty stable for me.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 09, 2016, 10:36:08 pm
==> Graphics - Numerous "anomalies"...dwarves are mostly the same shape, just different colors. (Could be user error)
Might be due to TwbT.
Quote
==> Unable to name stock piles. :(
How are you trying to rename them?
Title: Re: DFHack 0.40.24-r5
Post by: UristWoodie on February 10, 2016, 09:00:26 am
IIRC...it was from the q menu, over a stockpile. I thought there used to be an n for Name in the DFHack menu choices at the bottom of the screen.

Colors - yes, I suspect user error as well.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 10, 2016, 09:50:06 am
I don't remember that option, but there's a ctrl-shift-n hotkey in the default configuration that should work.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 10, 2016, 10:03:23 am
What are the current settings for autogem and how are they changes?  My mod uses rough gems as reagents, so I'll need to include instructions on turning this off entirely and/or how to systematically exclude several types of rough gems from automatic cutting.
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on February 10, 2016, 10:56:42 am
Havent seen it but I believe I saw it was under (orders)
Title: Re: DFHack 0.40.24-r5
Post by: breadman on February 10, 2016, 01:15:36 pm
So autocut definitely needs to notice that rough gems are forbidden or marked for dumping before creating tasks to cut them, and it also needs to be able to notice that some other task, such as a mood, has taken the gem.
Sorry about that; I now have a potential fix that I'll submit after testing.  Meanwhile, as has been noted, you can link one stockpile to the workshop(s), while keeping a few gems in an unlinked stockpile for moods.

Enabling the plugin should not also enable the workshop order IMO, as automatically cutting rough gems is a big change from vanilla behavior with potentially serious downsides for moody dwarves.  (I've had a few comments on this in the Starter Pack thread too)
It makes sense when the only people enabling it are those who intend to do so.  Apparently, that's not the case, so I can also leave it disabled by default.  It can be enabled on a per-world basis easily enough.

(And to think, there was a concern at one point that gems wouldn't be getting auto-cut quickly enough...)

So am I right in assuming that in regards to gem cutting:

1. The new Autogem starts enabled with the Starter Pack install of DFHack?
2. I can stop using a workflow setup where I start with cutting any old gem and then while setting up a Workflow changing it from the specific gem I selected to using "gem of any type"?

or

3. Autogems cut all gems, yes? So perhaps I should keep on with my current method as at least I can link up a stock pile and more easily prevent gems I do not want cut from being cut?
I can't speak to #1, but yes, autogems should render such a workflow hack obsolete.  Autogems does respect stockpile links, so it only cuts all gems if you have an unlinked workshop.

What are the current settings for autogem and how are they changes?  My mod uses rough gems as reagents, so I'll need to include instructions on turning this off entirely and/or how to systematically exclude several types of rough gems from automatic cutting.
Currently, it can be enabled or disabled on two levels:
First, the enable and disable commands on the DFHack command line or in a configuration file;
Second, the o-W "Current Workshop Orders" screen.
In addition, stockpile links can be used to limit a workshop to cutting only certain types of gem.
I'm open to ideas for other configuration options, as long as they're easy to use.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 10, 2016, 01:41:29 pm
What are the current settings for autogem and how are they changes?  My mod uses rough gems as reagents, so I'll need to include instructions on turning this off entirely and/or how to systematically exclude several types of rough gems from automatic cutting.
Currently, it can be enabled or disabled on two levels:
First, the enable and disable commands on the DFHack command line or in a configuration file;
Second, the o-W "Current Workshop Orders" screen.
In addition, stockpile links can be used to limit a workshop to cutting only certain types of gem.
I'm open to ideas for other configuration options, as long as they're easy to use.
Thank you, this is helpful.  Wishlist items would be
1. command-line parameters to -exclude specific gem materials (either by token or by material ID number, I'll make it work either way).
2. Workflow-like reserves, ideally on a per-gem basis.

A modder could be put these into the onLoad.init script to keep things tidy.  My intuition is that the former would easier to code (just skip over the job-spawning if the material is on the exclude table).

autogem -exclude [ "HIDDEN AMBER OPAL" "HIDDEN AMETHYST" "HIDDEN AQUAMARINE" ]
autogem -reserve [ [ DIAMOND_FY 5 ] [ EMERALD 10 ] ]
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 11, 2016, 09:45:02 am
In other news, I found a bug in modtools/create-unit.lua for DFHack 0.42.05-r1

I can only spawn wild animals if I change line 440 from

elseif args.civId and tonumber(args.civId) then

to

elseif args.civId and tonumber(args.civId) and tonumber(args.civId) ~= -1 then

This skips over nemesis creation for creatures in civ -1 and runs without errors, but I'm not sure if all of the loose ends are properly tied up.  I can get one of the animals named then save and reload, but not sure how else to test for save consistency.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 11, 2016, 06:32:06 pm
As an update, it appears that spawned critters become insubstantial after a save and reload.  This particular one has earned a name and is thus a historical figure.  After reloading, there are dozens of pages of dwarves' attacks passing through the creature and the creature's attacks deflecting off of clothing.  Prior to saving, the creature had the beginnings of an impressive kill list.
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on February 11, 2016, 09:45:06 pm
As an update, it appears that spawned critters become insubstantial after a save and reload.  This particular one has earned a name and is thus a historical figure.  After reloading, there are dozens of pages of dwarves' attacks passing through the creature and the creature's attacks deflecting off of clothing.  Prior to saving, the creature had the beginnings of an impressive kill list.


What a bug though.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 12, 2016, 05:03:37 pm
Sooo... ETA on 42.06?
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on February 12, 2016, 05:22:41 pm
It was inevitable...
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 13, 2016, 01:47:13 pm
No guarantees. We're working on it.

(By "we" I mean Quietust.)
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on February 13, 2016, 01:57:45 pm
Does anyone know if it is possible to change the color scheme (the data loaded from "data/init/colors.txt" on the fly? If so I want to make a script that allows mods to use custom color schemes without needing to install them separately (why? Take a look at this. (http://www.bay12forums.com/smf/index.php?topic=154960.msg6703020#msg6703020))
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on February 13, 2016, 02:10:26 pm
Does anyone know if it is possible to change the color scheme (the data loaded from "data/init/colors.txt" on the fly? If so I want to make a script that allows mods to use custom color schemes without needing to install them separately (why? Take a look at this. (http://www.bay12forums.com/smf/index.php?topic=154960.msg6703020#msg6703020))
Yes.
See df.global.enabler.ccolor.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on February 13, 2016, 02:13:52 pm
Awesome!

Coming soon: Advanced color palette script for total conversion mod authors!
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 13, 2016, 04:04:30 pm
gui/settings-manager allows editing colors in-game, by the way.
(Edit: autocorrect)
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on February 13, 2016, 04:11:10 pm
I see that in the docs, but nowhere else...
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 14, 2016, 05:21:31 pm
You mean it's not included in DFHack? It should be bound to alt-s on the title screen, I think, but it's hard for me to check at the moment.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on February 14, 2016, 05:28:05 pm
I mean I can't find it on the repo.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on February 14, 2016, 06:40:28 pm
I mean I can't find it on the repo.

It's in a seperate repo:
https://github.com/DFHack/lethosor-scripts/blob/master/gui/settings-manager.lua

Issue to fix these problems:
https://github.com/DFHack/dfhack/issues/723
Title: Re: DFHack 0.40.24-r5
Post by: UristWoodie on February 15, 2016, 08:57:36 am
I don't remember that option, but there's a ctrl-shift-n hotkey in the default configuration that should work.

Thank you...that was it. Doesn't show in the DFH menu where the other custom commands are.
Title: Re: DFHack 0.40.24-r5
Post by: Orange Wizard on February 16, 2016, 09:57:18 pm
Is there an ETA for a 42.06 build?
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on February 16, 2016, 10:30:58 pm
Go to the GitHub page for dfhack, link in the original post, select the develop branch, look at the logged changes, most notably the cmakelists.txt. If it says oldversion (42.05) its no where near ready. if it says newversion (42.06) then its still at least a week away, because , to protect the impatient our friendly dfhack devs will not release a version until its had some testing.

On "being a tester", if your not able to compile it yourself then you are probably not a good candidate for testing it. Although, I have never had a conversation with the dfhack dev team and am unsure of their policy, learning to set up a dev environment should be a minimum so you don't have to bug them to send you a new binary every time they change some code..  I don't even think there are official "testers" its just all the people that can compile it running it reporting back. basically I am trying to prevent this post from turning into "funky dwarf said I could be a tester" and "how do I be a testor send me's da filez" instigator. 

and if you wanna compile it yourself after they change the cmakelist , know its probably going to corrupt your save cause they just changed that file and nothing else yet, and read the great great great dfhack documentation webpage which you can find if you try, its all in there. there is some more info on compiling in the GitHub repository , but the read the doc page is a lot better and more complete.

Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on February 17, 2016, 12:07:32 am
Seconding @funkydwarf; we'll get an alpha build once it's ready for general testing.  Until then, there's not much you can do to help without compiling DFHack.

Note that pretty much all the docs are available as text files in the ./docs/ folder on github as well as on readthedocs.org
Title: Re: DFHack 0.40.24-r5
Post by: Rose on February 17, 2016, 12:16:17 am
Yeah, compiling DFHack isn't that hard, either. Just follow the instructions step by step.

The biggest headache is the download time for all the required stuff. Also finding a copy of visual studio 2010, since MS stopped making the express version easy to find.
Title: Re: DFHack 0.40.24-r5
Post by: Orange Wizard on February 17, 2016, 01:33:29 am
and if you wanna compile it yourself after they change the cmakelist , know its probably going to corrupt your save cause they just changed that file and nothing else yet, and read the great great great dfhack documentation webpage which you can find if you try, its all in there. there is some more info on compiling in the GitHub repository , but the read the doc page is a lot better and more complete.
Neat, thanks.

Also finding a copy of visual studio 2010
I have multiple installations of it for some reason so I think I'm good. Is there a reason DFHack still uses 2010 instead of moving to a newer Community edition or whatever?
Title: Re: DFHack 0.40.24-r5
Post by: Rose on February 17, 2016, 01:50:36 am
Also finding a copy of visual studio 2010
I have multiple installations of it for some reason so I think I'm good. Is there a reason DFHack still uses 2010 instead of moving to a newer Community edition or whatever?
Yeah, DFHack absolutely has to use whichever compiler was used for Dwarf Fortress, or it won't work.

That said, you can still open the project with any newer visual studio and compile it from there, as long as you tell it not to upgrade the project. Then it will still use the 2010 compiler, but you sill need at least VS2010 express installed, and upgraded to SP1
Title: Re: DFHack 0.40.24-r5
Post by: SatelliteOfLove on February 17, 2016, 02:25:39 pm
Yeah, compiling DFHack isn't that hard, either. Just follow the instructions step by step.

I'll second that - just be careful to follow the instructions exactly, and make sure that you're getting the "develop" branch from the git repository, not the standard branch.

The cool thing (imo) about compiling your own dfhack is that you never have to ask "is it ready yet/when will it be ready" - you can try it out for yourself and find out without bothering a soul.
Title: Re: DFHack 0.40.24-r5
Post by: Sanctume on February 17, 2016, 02:38:24 pm
Yeah, compiling DFHack isn't that hard, either. Just follow the instructions step by step.

The biggest headache is the download time for all the required stuff. Also finding a copy of visual studio 2010, since MS stopped making the express version easy to find.

Wait, that's all I need, Microsoft's Visual Studio 2010? 
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 17, 2016, 03:10:39 pm
Wait, that's all I need, Microsoft's Visual Studio 2010?

http://dfhack.readthedocs.org/en/stable/docs/Compile.html

The cool thing (imo) about compiling your own dfhack is that you never have to ask "is it ready yet/when will it be ready" - you can try it out for yourself and find out without bothering a soul.

Be aware that just because it compiles doesn't mean it works.
Title: Re: DFHack 0.40.24-r5
Post by: SatelliteOfLove on February 17, 2016, 10:39:00 pm
Wait, that's all I need, Microsoft's Visual Studio 2010?

http://dfhack.readthedocs.org/en/stable/docs/Compile.html

The cool thing (imo) about compiling your own dfhack is that you never have to ask "is it ready yet/when will it be ready" - you can try it out for yourself and find out without bothering a soul.

Be aware that just because it compiles doesn't mean it works.

Absolutely.  If your computer explodes into flame and your dwarves all cry for milk and cookies instead of beer and whiskey, at least you know that dfhack isn't ready yet for the version you're trying to run ;)

You need a handful of things to compile dfhack.  It's like playing Dwarf Fortress, except you're compiling code instead of killing off alcohol-fueled beards.  Remember, losing is !!FUN!!
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 17, 2016, 11:27:10 pm
On a more routine note, does anyone know how to attach a location to an announcement in Lua's dfhack.gui?  I'd like the player to be able to hit z to zoom to the location.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on February 17, 2016, 11:36:53 pm
makeAnnouncement has a pos argument
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 18, 2016, 11:13:45 am
makeAnnouncement has a pos argument
Thanks for the pointer, but I apparently failed to decipher gui.h properly.  This is the header line
Code: [Select]
DFHACK_EXPORT int makeAnnouncement(df::announcement_type type, df::announcement_flags mode, df::coord pos, std::string message, int color = 7, bool bright = true);but I get errors about a "complex object" in my tests, mostly likely an issue with the announcement_flags.  Would you mind giving me the code to announce "This is a test" at position {x=10,y=20,z=30} with no zooming or pausing?
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 18, 2016, 12:26:30 pm
https://github.com/sv-esk/df-structures/commit/dd6dc08faa0a977115c0a48a015eb9768fc06359
While updating structures I've encountered a problem.
I am sure these two compounds ("waypoints" and "burrows" in "df.global.ui") are correct and are  in the right place. 6 points, 3 burrows, "In_edit_waypoints_mode" is true when I am editing route. Structures look and behave same as they were in 42.05. But there are "16 bytes of something" between them on windows 0.42.06, and only 12 bytes on linux 0.42.06. How to describe these 16(12)bytes in xml? Or am I doing something wrong?
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 18, 2016, 03:28:52 pm
<snip>
but I get errors about a "complex object" in my tests, mostly likely an issue with the announcement_flags.  Would you mind giving me the code to announce "This is a test" at position {x=10,y=20,z=30} with no zooming or pausing?

It could also be that it wants a df.coord instance, not an Lua table that happens to have x, y, and z fields. I think the syntax to make one is df.coord:new().
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 18, 2016, 03:32:48 pm
Thanks expwnent!
Title: Re: DFHack 0.40.24-r5
Post by: necrotic on February 18, 2016, 04:12:21 pm
https://github.com/sv-esk/df-structures/commit/dd6dc08faa0a977115c0a48a015eb9768fc06359
While updating structures I've encountered a problem.
I am sure these two compounds ("waypoints" and "burrows" in "df.global.ui") are correct and are  in the right place. 6 points, 3 burrows, "In_edit_waypoints_mode" is true when I am editing route. Structures look and behave same as they were in 42.05. But there are "16 bytes of something" between them on windows 0.42.06, and only 12 bytes on linux 0.42.06. How to describe these 16(12)bytes in xml? Or am I doing something wrong?
Spoiler (click to show/hide)

Aren't the platform-specific folders there for overrides like this? It looks like you can make a file of the same name and only redefine what you need to override.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 18, 2016, 04:17:58 pm
If you mean the folders in the DF-structures repo, that's not what they're for - they mostly contain platform-specific csv files. I suspect the padding is a vector or some other stl structure, although I don't remember the size of a vector under msvc.
Title: Re: DFHack 0.40.24-r5
Post by: Brody on February 18, 2016, 04:35:41 pm
Is there an easy way to tell if a crash is DFHack related vs normal DF crash?
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 18, 2016, 05:41:58 pm
<snip>
but I get errors about a "complex object" in my tests, mostly likely an issue with the announcement_flags.  Would you mind giving me the code to announce "This is a test" at position {x=10,y=20,z=30} with no zooming or pausing?

It could also be that it wants a df.coord instance, not an Lua table that happens to have x, y, and z fields. I think the syntax to make one is df.coord:new().
After much trial and error, this works:
Code: [Select]
dfhack.gui.makeAnnouncement(5,{false,false,false,true},xyz2pos(10,20,30),"You have struck whatchamacallit!",6,1)
Title: Re: DFHack 0.40.24-r5
Post by: Roses on February 18, 2016, 06:12:35 pm
So I have been tinkering with turning units undead and animating the dead with DFHack. I have found that adding a df.unit.T_enemy.T_undead:new() to the unit.enemy.undead is enough to make them nearly unkillable.

In my first tests I chopped creatures heads off and they would only die of blood loss or suffocation.
My second tests involved also adding a syndrome with NOBREATH and removing HAS_BLOOD, this time the units would run around like dwarves with their heads chopped off.

My question is, has anyone else tinkered with simulating the I_EFFECT:ANIMATE interaction effect? The only other difference I found was that animated dead lacked a soul (by this I mean unit.status.current_soul = nil). I'm wondering if there are any other things that are different, or if anyone has any advice.
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 18, 2016, 06:40:19 pm
Thanks, it seems to be empty stl-vector indeed. Did not know that its size depends on compiler. Same thing in new sidebar compound (https://github.com/sv-esk/df-structures/commit/0f320187ab0f9ede3c0584b98c34228b56c5b2ba). It contains stl-vectors and stl-strings. And they have different sizes in linux and windows. So cannot temporary put padding here. Have to figure out what stl structures here and put them.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 19, 2016, 04:25:38 pm
A further update on the spawned creature issue.  It becomes insubstantial the moment it gets a name (since it is spawned without a name, this is probably the moment it gets a historical figure ID).  Saving has nothing to do with it.  Still trying to find a way to fix it.
Title: Re: DFHack 0.40.24-r5
Post by: Boltgun on February 20, 2016, 06:49:54 am
While we're on the subject of spawning, create-unit move the camera around because it simulate some arena mode input and zooms into whenever the game felt spawning the unit to, even if I teleport is towards its intended location.

So I want to save the camera's position and zooms it back at the end of the script but I cannot find any position for the player's view anywhere. Is this accessible?
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 20, 2016, 07:30:21 am
So I want to save the camera's position and zooms it back
df.global.window_x
df.global.window_y
df.global.window_z
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 20, 2016, 03:11:38 pm
While we're on the subject of spawning, create-unit move the camera around because it simulate some arena mode input and zooms into whenever the game felt spawning the unit to, even if I teleport is towards its intended location.

So I want to save the camera's position and zooms it back at the end of the script but I cannot find any position for the player's view anywhere. Is this accessible?

Right now you have to do it yourself. I think create-unit has bigger problems at the moment though. It's currently a proof of concept more than a working thing.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 20, 2016, 03:42:59 pm
While we're on the subject of spawning, create-unit move the camera around because it simulate some arena mode input and zooms into whenever the game felt spawning the unit to, even if I teleport is towards its intended location.

So I want to save the camera's position and zooms it back at the end of the script but I cannot find any position for the player's view anywhere. Is this accessible?

Right now you have to do it yourself. I think create-unit has bigger problems at the moment though. It's currently a proof of concept more than a working thing.
I'll try to incorporate restoring the view into any fixed code I come up with.  There is definitely something broken about creatures in civ -1 becoming historical.  Next step (when I get a chance, maybe Monday) is to see if it affects creatures in a real civ.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 20, 2016, 04:10:41 pm
Dirst: is this (https://github.com/DFHack/dfhack/blob/develop/scripts/modtools/create-unit.lua) the most recent/functional version of create-unit?
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 20, 2016, 05:07:09 pm
Dirst: is this (https://github.com/DFHack/dfhack/blob/develop/scripts/modtools/create-unit.lua) the most recent/functional version of create-unit?
That is identical to what shipped with PE Starter Pack for 42.05, which is where I started but that errors out.  These changes make it run without errors, but may be the source of the insubstantial historical figure issue:

In other news, I found a bug in modtools/create-unit.lua for DFHack 0.42.05-r1

I can only spawn wild animals if I change line 440 from

elseif args.civId and tonumber(args.civId) then

to

elseif args.civId and tonumber(args.civId) and tonumber(args.civId) ~= -1 then

This skips over nemesis creation for creatures in civ -1 and runs without errors, but I'm not sure if all of the loose ends are properly tied up.  I can get one of the animals named then save and reload, but not sure how else to test for save consistency.
So, there appears to be a really serious loose end here :(
Title: Re: DFHack 0.40.24-r5
Post by: Boltgun on February 20, 2016, 05:58:38 pm
So I want to save the camera's position and zooms it back
df.global.window_x
df.global.window_y
df.global.window_z

Thank you.
While we're on the subject of spawning, create-unit move the camera around because it simulate some arena mode input and zooms into whenever the game felt spawning the unit to, even if I teleport is towards its intended location.

So I want to save the camera's position and zooms it back at the end of the script but I cannot find any position for the player's view anywhere. Is this accessible?

Right now you have to do it yourself. I think create-unit has bigger problems at the moment though. It's currently a proof of concept more than a working thing.

It seems more reliable than a patchy spawnunit from 0.40, for pets at least.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 20, 2016, 07:03:44 pm
OK. That will be in the next version. You said "these changes" but I only saw one. Is that the only one?
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on February 20, 2016, 07:20:57 pm
How would one go about differentiating an stl-string from an stl-vector from just the binary?


I imagine that they both look about the same as far as what data is required to represent them.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 20, 2016, 07:29:19 pm
If you look at the raw data array you should see ascii characters in a string.

One thing that helps is that we can run DF in Windows, OSX, Linux, and WINE. Different ones are useful for discovering different things. I don't know the particulars. Only Quietust and Angavrilov do.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 20, 2016, 08:02:23 pm
Under GCC, vectors consist of 3 pointers (12 bytes) internally, while strings consist of just 1 pointer (to a buffer with some header information followed by ASCII characters, I think). The layout of these is different under MSVC (heck, it's even different between some MSVC versions) - apparently vectors are 16 bytes with MSVC 2010, but I don't know much else.
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on February 20, 2016, 09:34:35 pm
If you look at the raw data array you should see ascii characters in a string.

One thing that helps is that we can run DF in Windows, OSX, Linux, and WINE. Different ones are useful for discovering different things. I don't know the particulars. Only Quietust and Angavrilov do.


I found the command for this actually, run strings on linux. It'll dig out all of the human readable text.


Under GCC, vectors consist of 3 pointers (12 bytes) internally, while strings consist of just 1 pointer (to a buffer with some header information followed by ASCII characters, I think). The layout of these is different under MSVC (heck, it's even different between some MSVC versions) - apparently vectors are 16 bytes with MSVC 2010, but I don't know much else.


Why are there two pointers in the gcc implementation?


Never mind, I found the stuff in the implementation, it's the pointer to the start of the vector and one element past the end, it might actually be three pointers, from what I've just read.  One for the beginning, one for the end of the used range, and one for the end of the allocated space.


Then there's the allocator, which is an element that I've never touched, and I'm not sure if it is compiled to a compile time constant, or instantiated for each instance of the class.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 20, 2016, 09:45:01 pm
I think there's a specialization of the template so that if the allocator is the default one then instances of the vector don't have a field for it. That's how I would write it.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 20, 2016, 09:52:07 pm
OK. That will be in the next version. You said "these changes" but I only saw one. Is that the only one?
Sorry, bad phrasing.  It was just the one change there.  I've made a lot of other changes to a WIP copy but nothing else has been an improvement.
Title: Re: DFHack 0.40.24-r5
Post by: Legless on February 22, 2016, 07:42:10 am
Hey guys! Is there any chance to grab even unstable version (42.06) of DFHack? Need just a couple of commands.
Title: Re: DFHack 0.40.24-r5
Post by: scamtank on February 22, 2016, 08:22:31 am
Nope, structures aren't mapped yet.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 22, 2016, 12:17:17 pm
sv-esk has updated some things, which I'll take a look at merging later today. I don't think they've checked everything, though, but if it's usable I'll try to make an alpha release soon after.
Title: Re: DFHack 0.40.24-r5
Post by: notfood on February 22, 2016, 04:40:43 pm
It's very usable. At least under Linux.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 23, 2016, 03:24:03 pm
For compiling, where do I find the solution after I have run one of the "generate" batch files?
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 23, 2016, 04:03:31 pm
dfhack.sln will be in build/VC2010 folder, if you are seeking it.
For compiling run one of the "package" batch files. "dfhack-something-Windows.zip" package will be in build/VC2010 folder
Or run set_df_path.vbs and then run one of the "install". Package will be installed in the selected folder.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 23, 2016, 04:26:27 pm
Well, this is irritating.  I'm trying to get a naturally occurring wild animal to gain a name, so I'm sending a bunch of unarmed beards against them so the animal can wrack up some injuring and kills.

When did dwarves gain the ability to run down and punch out a unicorn and a giant cougar?

Maybe someone already knows what the historical figure attributes look like for a name-worthy animal?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 23, 2016, 04:39:55 pm
sv-esk: Did you re-run the automatic scans after your changes to structures and {linux,osx,windows}/df.globals.xml? There are some missing globals that are usually automatically-located (e.g. ui_look_list, created_item_count, and created_item_matindex on OS X), so I'm wondering if those could be fixed by re-running the scans (or at least the ones that find globals - I'm not sure if make-scans.sh would fail since there are already entries for 0.42.06 in symbols.xml, but maybe scan_ctors.rb/scan_ctors_osx.rb would work).

Most development discussion takes place on IRC (#dfhack on freenode), by the way, so feel free to stop by if you haven't.
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 23, 2016, 04:50:45 pm
Yes, but I havent changed osx/* files manually. No osx devices/virtual environment to test. Missing globals will be fixed after manual fixing osx/* and re-runnung scans, I guess. No it won't fix.
It seems I didnt updated linux/df.globals.xml properly. So thats why lisp-tool doubled globals.
manual fix&re-run scripts result (https://github.com/sv-esk/df-structures/tree/osx)
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 23, 2016, 05:33:03 pm
I didn't find anything in the ...2010 folder.
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 23, 2016, 05:53:56 pm
I didn't find anything in the ...2010 folder.
generate batch failed to do its work. Run it in console to see its output.
Totally empty folder? It should have make at least log
Code: [Select]
See also "......../build/VC2010/CMakeFiles/CMakeOutput.log".
See also "......../build/VC2010/CMakeFiles/CMakeError.log". 
Title: Re: DFHack 0.40.24-r5
Post by: Nimrod on February 24, 2016, 12:55:53 am
sv-esk has updated some things, which I'll take a look at merging later today. I don't think they've checked everything, though, but if it's usable I'll try to make an alpha release soon after.

Looking forward to that alpha! :D

cheers!
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on February 24, 2016, 01:22:57 am
(https://i.imgflip.com/zqaum.jpg) (https://imgflip.com/i/zqaum) (https://imgflip.com/memegenerator)
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 24, 2016, 09:53:11 pm
Not a file is produced. Just an empty folder.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on February 24, 2016, 10:02:31 pm
Are there any error messages?

Do you  have cmake installed?
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on February 24, 2016, 10:05:56 pm
are you following the build information in the git repository ore th einfo on the readthedocs sight linked in the first page?

The read the docs page is much more detailed if my memory serves...
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 24, 2016, 10:49:32 pm
The read the docs page is much more detailed if my memory serves...
They're exactly the same, assuming you mean https://dfhack.readthedocs.org/en/latest/docs/Compile.html and https://github.com/DFHack/dfhack/blob/develop/docs/Compile.rst. (The copy on ReadTheDocs is generated whenever the GitHub copy is changed.)
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on February 24, 2016, 11:35:01 pm
Sure is! Memory does not serve me well!


Jwoodward48df have you tried from a console (command prompt) to watch what happens like the helpful sv-esk suggested?
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on February 25, 2016, 12:38:50 am
Perhaps troubleshooting could be taken to the IRC channel?  A forum thread is not the best format...
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on February 25, 2016, 05:57:16 am
I'm debating moving my todo list onto github so people can see and comment on stuff but I'm not sure if it's worth the effort. Right now it's just a text file.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on February 25, 2016, 05:59:12 am
I'm debating moving my todo list onto github so people can see and comment on stuff but I'm not sure if it's worth the effort. Right now it's just a text file.
Do it halfway: gist :D

Mine are here: https://gist.github.com/warmist/3905090
Title: Re: DFHack 0.40.24-r5
Post by: Abadrausar on February 25, 2016, 09:24:30 pm
startdwarf the lua script that enables embarking with more than 7 dwarves does not work (fails silently), in DF Tool 2.3 that works, so AbdulovHell has found the fix for his utility. As he is also a C++ programmer I have asked him if  the transfer of this know-how towards DFHACK could be possible, he is however not fluent in english. Help him please!
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on February 25, 2016, 10:27:04 pm
startdwarf the lua script that enables embarking with more than 7 dwarves does not work (fails silently), in DF Tool 2.3 that works, so AbdulovHell has found the fix for his utility. As he is also a C++ programmer I have asked him if  the transfer of this know-how towards DFHACK could be possible, he is however not fluent in english. Help him please!
I'm still amazed he did that by himself before DFHack was updated.
Sadly I don't speak Russian(which I believe he said he speaks).
Title: Re: DFHack 0.40.24-r5
Post by: Abadrausar on February 26, 2016, 05:44:08 am
...

All my gratitude for the hard work that the DFHACK team do.
This work profit all our community.
Please keep it the good work.
Special thanks to the historic head maintainers: angavrilov, expwnent and lethosor and all the other people that contribute to such a nice project as DFHACK is.
Title: Re: DFHack 0.40.24-r5
Post by: Hesperid on February 27, 2016, 11:05:09 am
Perhaps troubleshooting could be taken to the IRC channel?  A forum thread is not the best format...

I think the forum is a much better place than IRC, because if the problem is endemic then the IRC channel gets to answer the same question 20 times (spoiler: after the second or third person, they won't). On the forum the solution gets archived and reused.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 27, 2016, 03:28:30 pm
'cmake' is not recognized as an internal or external command, operable program or batch file.

I'm pretty sure I downloaded and installed the right thing...
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 27, 2016, 03:54:30 pm
Yes, you installed, but windows have no idea where.
Did you selected "Add CMake to the system PATH option"?
Spoiler: this (click to show/hide)
Check your path system variable. (see (http://www.computerhope.com/issues/ch000549.htm))
It should contain something like "C:\Program Files (x86)\CMake 2.8\bin\"
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on February 27, 2016, 04:48:18 pm
Here is an excerpt from the build documentation. Why are you bothering people when you didn't even bother to read and follow the instructions? 

CMake

You can get the win32 installer version from the official site. It has the usual installer wizard. Make sure you let it add its binary folder to your binary search PATH so the tool can be later run from anywhere.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 27, 2016, 09:23:56 pm
Why are you bothering me when I am trying to juggle four different prerequisite installations, some of which must be ran as an exe, others which must be copied to a different folder, and even more that I can't even find where it's going, with each of them giving me dozens of options, some of which don't really seem relevant to my efforts, and which I cannot seem to find a way to change after the installation?

Seriously, I am trying to get into this thing. Thank you, everybody who's taking a few seconds to give recommendations, and NO THANK YOU people who are just here to complain about a newbie not completely understanding these programs, and not even adding anything as the person an hour before them just explain how I went wrong.
Title: Re: DFHack 0.40.24-r5
Post by: Nimrod on February 28, 2016, 12:53:20 am
Why are you bothering me when I am trying to juggle four different prerequisite installations, some of which must be ran as an exe, others which must be copied to a different folder, and even more that I can't even find where it's going, with each of them giving me dozens of options, some of which don't really seem relevant to my efforts, and which I cannot seem to find a way to change after the installation?

Seriously, I am trying to get into this thing. Thank you, everybody who's taking a few seconds to give recommendations, and NO THANK YOU people who are just here to complain about a newbie not completely understanding these programs, and not even adding anything as the person an hour before them just explain how I went wrong.

I hear you, mate! Some seem to see this as an elitist only club and use every opportunity to strike at others. Best to ignore the haters. There are good people out there too. God knows not many. But you only need a few. :D
I am by now way computer-illiterate, but I gave up compiling dfhack myself for windows. I choose to be dependent on others to release it. So I wait ... Fun thing is I actually need it for a few things "Text will be Text", digvein, the search function and maybe this material sort thing. Sadly 0.42.05-alpha1 crashes randomly without any error logs, so I run a clean 0.42.06 (with spacefox) for now.

I wish you the best of luck!
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 28, 2016, 08:15:47 am
So do I simply add the root "cmake" folder, the one that contains folders like "utilities" and "help" and files like "configure", to my path? By adding a new variable? I've restarted cmd after making these changes, but it's still not working. Same error.

I'm now deleting cmake and reinstalling with the correct setting.

Thanks, Nimrod, and once I've gotten DFHack compiled, I'll be sure to post a DFFD link here.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 28, 2016, 08:17:26 am
No, find the folder that contains cmake.exe (it's probably within that folder).

Regarding crashes, a number of them have been linked to TwbT in v0.42, so try disabling that temporarily and see if it helps.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 28, 2016, 08:31:32 am
Hmm. I've reinstalled with the setting to add CMake to my path. I've manually set the path to include CMake. I've restarted. None of these things have fixed it, but there's now this message: "CMake Error: The source directory C:\Users does not appear to contain CMakeLists.txt."
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 28, 2016, 09:00:34 am
Are you following the instructions in Compile.rst, specifically https://github.com/DFHack/dfhack/blob/develop/docs/Compile.rst#build-1 ? I haven't compiled DFHack on Windows myself, but it looks to me like cmake is being run in the wrong folder. How are you running it?
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 28, 2016, 09:17:00 am
I'm running the generate-all batch file.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on February 28, 2016, 09:25:26 am
where is the batch file located? did you move it anywhere?

The path should resemble this, more or less:

(http://i.imgur.com/bBs90ie.png)

at least the .../dfhack/build/generate-something.bat part, anyway.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 28, 2016, 01:14:44 pm
It looks just like that, yes.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 28, 2016, 06:40:28 pm
ALL OF A SUDDEN IT WORKS YES WOOHOO THNX FOR UR HELP EVERYONE

EDIT: It still has the same error, but it pretends to work. Hrumph.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 28, 2016, 06:55:50 pm
So where do I find the files once git's finished updating the init submodule?

Edit: Nvm, it handily went to the spot I wanted it to!
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 28, 2016, 07:17:19 pm
I HATE THE BUGS

Spoiler: CMakeError.log (click to show/hide)
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on February 28, 2016, 07:29:29 pm
You need ServicePack 1 for visual studio 2010
https://www.microsoft.com/en-us/download/details.aspx?id=23691
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on February 28, 2016, 08:30:18 pm
Seriously, print out the compile doc and READ and complete each line, then check it off.  You will save yourself and more importantly others time.  I am helping, its called tough love. its meant to embarrass you so you actually go read every line of available documentation. In future tasks, this will allow you to complete your task vs reading the heading and trying each thing and then getting stuck from not reading the details, such as when you ignored the documentation and did not select the button the set the PATH, and again possibly now with not having SV 2010 SP1.

If you want to get into this thing,(programming/compiling code/ advanced windows use?) You are going to have to learn to follow instructions and thoroughly at that.

If that makes me a troll, I guess I am a troll,but, I like to think I am more of a funky dwarf.
Title: Re: DFHack 0.40.24-r5
Post by: gasznak on February 28, 2016, 08:37:34 pm
Any news on the 42.06 version?
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 28, 2016, 09:15:46 pm
There is NO DOCUMENTATION REGARDING WHAT TO DO IN THIS SITUATION. I have reinstalled EVERY PROGRAM, making it through the COMPLETE LACK OF UI of many of them, checking off with the readthedocs site as I go.

That was ONE THING. I made it through the sea of prerequisite programs with only one problem, searched through the forums to find a problem not found in the documentation, and it's still not working.
Title: Re: DFHack 0.40.24-r5
Post by: jaked122 on February 28, 2016, 09:56:57 pm
There is NO DOCUMENTATION REGARDING WHAT TO DO IN THIS SITUATION. I have reinstalled EVERY PROGRAM, making it through the COMPLETE LACK OF UI of many of them, checking off with the readthedocs site as I go.

That was ONE THING. I made it through the sea of prerequisite programs with only one problem, searched through the forums to find a problem not found in the documentation, and it's still not working.


CMake isn't the best easiest to use on windows, is that what you are using?


CMake really shines when it has pkg-config to consult.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on February 28, 2016, 10:01:10 pm
DFHack is built with CMake.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on February 29, 2016, 03:05:43 am
I just wrote an extension to family.lua that lets the user export a given family to a .csv file that Gramps can read as well as to a FamilyScript file (https://gist.github.com/Putnam3145/34f7046481256cc4709d)
Title: Re: DFHack 0.40.24-r5
Post by: Rose on February 29, 2016, 03:59:45 am
Any examples of the output?
Title: Re: DFHack 0.40.24-r5
Post by: Antsan on February 29, 2016, 09:09:07 am
I am helping, its called tough love. its meant to embarrass you so you actually go read every line of available documentation.
"Tough love" is bullshit and has been shown to be bullshit. It's mostly promoted by people who either don't actually need to teach anyone anything and by people who don't have enough patience to actually teach people properly. The latter then often complain how awful their students are and wonder why others get along better with them.
Embarrassing someone who is trying to learn something is more likely to turn them away from learning anything at all than causing them to do it more thoroughly.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 29, 2016, 09:13:34 am
Still working on create-unit as my busy schedule permits.  The script's method of allocating the nemesis' save_file_id and member_idx depend on a historical figure belonging to a valid civ, whereas DF itself seems perfectly content to bestow names on wild animals in civ -1.

It seems to work just fine if I plug in the previous historical figure's save_file_id and member_idx+1, but from the original code it looks like you would need to allocate a new "save_file" if the current one has 100 elements.

The last few historical figures in that test game had the same save_file_id.  Is it just a running list independent of the civ?  If it is, I can probably reference the save_file_id, member_idx and next_member_idx from any civ, while keeping this unit's civ as -1.

By the way, if an invalid nemesis ends up getting created (with a save_file_id of -1 or something), the game will merrily add a second nemesis to the unit when it earns a name.  This doesn't overwrite the original... the unit ends up with an array of two nemeses.  Is an array of nemeses intended for vampire's assumed identities or something?
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on February 29, 2016, 12:45:07 pm
Any examples of the output?

Nah, can't figure out gramps for crap.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on February 29, 2016, 10:00:23 pm
http://www.bay12forums.com/smf/index.php?topic=64051.0

Just so that this can be OVER and there is no more need to discuss tough love.

NinjaEdit: Ninjaed by... half a day! I have too much homework.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on February 29, 2016, 10:42:53 pm
Nope, each civ keeps its own save file.  When a chunk is added it is whatever-anyone-else-used + 1.

So I'll scan backwards until I find the most recent historical figure of civ -1 and increment from that.  But where could the game keep its next_member_idx for civ -1???
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on March 01, 2016, 01:23:08 am
Nope, each civ keeps its own save file.  When a chunk is added it is whatever-anyone-else-used + 1.

So I'll scan backwards until I find the most recent historical figure of civ -1 and increment from that.  But where could the game keep its next_member_idx for civ -1???
I think there are two ways unit is saved: either into civ or into site. Though not sure.

One way to test this is try this: create adventurer, save,checksum save (each file), try dying to a wildlife (it makes them histfigure), check what changed.

While it's not what you are looking for exactly, the wildlife gets a histfigure. So it's save file should show up. However there is also the problem of that the items you leave (e.g. corpse) will save and your adventurer is also updated as being dead.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 01, 2016, 04:45:37 am
Ghost yourself and clear the death flag?
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 01, 2016, 08:35:15 am
Went the easier route: creatures spawned in civ -1 are simply not historical figures.  If they're dangerous, they'll get a name by themselves fast enough.

Spoiler: create-unit.lua (click to show/hide)

This also fixes the cursor-whiplash problem.

EDIT: Note that supposedly hostile creatures still appear as "friendly" on the unit screen, and they act pretty calm unless prodded with berserkness or something.  This appears tied to the arena-spawning method.

EDIT EDIT: Dug up an old workaround.  It uses handwavium to insert the spawned creature into population 1 of region (1,1) which classifies the critter as a wild animal but might do some damage to the world data.  Anyone know how to creature a population entry on the active map block?
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 02, 2016, 12:45:42 am
Went the easier route: creatures spawned in civ -1 are simply not historical figures.  If they're dangerous, they'll get a name by themselves fast enough.

Spoiler: create-unit.lua (click to show/hide)

This also fixes the cursor-whiplash problem.

EDIT: Note that supposedly hostile creatures still appear as "friendly" on the unit screen, and they act pretty calm unless prodded with berserkness or something.  This appears tied to the arena-spawning method.

EDIT EDIT: Dug up an old workaround.  It uses handwavium to insert the spawned creature into population 1 of region (1,1) which classifies the critter as a wild animal but might do some damage to the world data.  Anyone know how to creature a population entry on the active map block?

Merged.
Title: Re: DFHack 0.40.24-r5
Post by: MystRunner on March 02, 2016, 02:03:00 am
I seem to be having issues installing DF Hack. It's the first time I've ever had this issue before but I did what I always did. Download Dorf Fort. Unzip it. Download Hack. Unzip it into Dorf Fort. I was surprised to see Hack not asking to over ride the SDL.dll like it use to. I looked for the install instructions (rather hard because the .html read me just said it couldn't find the file). It still mentions to install it that you need to make sure the SDL file is over written. Checked the DFHack Master Zip and there was no SDL.dll file. Is there something I am missing that has changed?

~*~
Nevermind I figured it out. Github always confuses me with were the heck to find the downloads at for the versions.
Title: Re: DFHack 0.40.24-r5
Post by: Bumber on March 02, 2016, 02:45:44 am
What are the possible key bindings for dfhack commands? I see Shift/Ctrl/Alt, letters, and function keys (F1-F12) in the example init. I assume numbers work as well. Are there any others?
Title: Re: DFHack 0.40.24-r5
Post by: CaptainMcClellan on March 02, 2016, 05:44:22 am
Request: Extend rename.lua to rename forts as well.
Title: Re: DFHack 0.40.24-r5
Post by: vomov on March 02, 2016, 06:37:36 am
Two quick questions:
1) It's been hinted that DFHack (develop branch?) is somewhat compatible with 42.06. Is that correct?
2) I've been trying to compile. Unfortunately, without success (friggin' Windows computer). Would it be possible to do a small 'barely working' release?
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on March 02, 2016, 10:17:53 am
42.07 won't be released until dfhack has a .06 release. Toady's trolling like that.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on March 02, 2016, 03:25:42 pm
Has anyone else noticed that custom professions no longer work properly in manipulator?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 02, 2016, 04:10:51 pm
What exactly is the issue?
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on March 02, 2016, 04:31:50 pm
Create a profession from an dwarf, try to apply that profession to another dwarf, nothing happens.
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on March 02, 2016, 05:39:23 pm
It seems, only the last custom profession from the list is not applyable.
Title: Re: DFHack 0.40.24-r5
Post by: milo christiansen on March 02, 2016, 05:50:08 pm
Well... I never tried it with more than one profession, so I can't confirm.
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on March 02, 2016, 06:18:10 pm
error on 1101 if (selected >= manager.templates.size())
should be ">" since selected starts with 1
Title: Re: DFHack 0.40.24-r5
Post by: Orbotosh on March 02, 2016, 06:41:11 pm
Is there a script that can force a civ to only have a predefined pantheon?
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 03, 2016, 02:42:29 am
Is there a script that can force a civ to only have a predefined pantheon?

No, but modtools/moddable-gods.lua can create specified deities.
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on March 03, 2016, 09:24:17 pm
Old news now
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 03, 2016, 09:38:19 pm
I will gladly reshare tomorrow on any other free file site you guys recommend , but I am trying to leave work today and typing this is taking to long already so I am out, good luck, and your credit cards are belong to me if you use this (kidding I promise this is the develop branch of the git for dfhack, but internet, ya know)
How about a permalink to the file in your free Dropbox?
Title: Re: DFHack 0.40.24-r5
Post by: Orbotosh on March 03, 2016, 09:44:04 pm
Little question, why can't DFHack do anything to worldgen?
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on March 03, 2016, 09:45:15 pm
It can, it just requires weird frame timing stuff and I haven't actually tried it so it might be crashy as hell.
Title: Re: DFHack 0.40.24-r5
Post by: Orbotosh on March 03, 2016, 09:47:58 pm
It can, it just requires weird frame timing stuff and I haven't actually tried it so it might be crashy as hell.

So that means player specified pantheons are actually possible?
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on March 03, 2016, 10:23:59 pm
I will gladly reshare tomorrow on any other free file site you guys recommend , but I am trying to leave work today and typing this is taking to long already so I am out, good luck, and your credit cards are belong to me if you use this (kidding I promise this is the develop branch of the git for dfhack, but internet, ya know)
How about a permalink to the file in your free Dropbox?
http://dffd.bay12games.com/

Literally designed for free hosting of any DF-related file  ;D
Title: Re: DFHack 0.40.24-r5
Post by: funkydwarf on March 03, 2016, 10:43:56 pm
Link delete
How about Google? I dropped it in my google drive before I left work and remembered I could share it from there.

But I am not comfortable with this, I am not familiar enough with Google shares to know the world can't see all my stuff now. But, I think you are an advanced user based on your posts, and you probably have already compiled your own,and you are trying to call me out as if I am doing something malicious, in an effort maybe to protect the community. so I am posting this on here, linked to my personal Google drive on my personal email account I have used forever professionally, to show that I am not being malicious and used zippy share out of lazyness not maliciousness. And don't misunderstand my tone, I am being blunt not angry, in fact i applaud the inoculous question tryn g to smoke out a bad guy, which i am not,but this should show this is me simply trying to share, as it's been awhile and I bet there are alot of people that use prospect and reveal as their only dfhack tools to start a fort and may be waiting patiently.  Even though I am a jerk, I value being a tiny member of this community and don't want people  to think I am malicious.

The point of that wall of text is to say I will remove the Google link in a few days, so get it while its hot, but BACK U P YOUR SAVES, and do not bother to the pack maintainers with yelling WHEN it corrupts your save, instead, post the juicy details of what you were doing and if you have a tileset and/or other mods so they can get a tip about where to look for bugs. Phrase it like a report and not a complaint.

They will release it when they are comfortable with it, they do not release it early because it's not worth their time to have people that won't BACK U P THEIR saves cry about their lost fort, so please don't do that and make it my fault that they are getting angry emails about dfhack blowing up their computer.  *edit*  however , it seems they would like reports on the specifics for bug hunting

I thought about dffd, but this felt so unofficial I didn't think it would be cool. Seriously, I dont even know if this is cool, if it was ready for release, they would release it, its obviously not, but after reading the post pleaing for a pre alpha/cuniaform version, and I had just compiled it, it seemed like a good idea at the time. *edit* The post after this is a request to please REPORT specifics of what happened with errors so they can hunt bugs. I am adding" please remember it is a report and not a request for help, they may ask for more info or they may not respond at all"
*



Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 03, 2016, 10:56:34 pm
It's not really release-ready, but it's getting closer, and I was hoping to fit in an alpha release this weekend, so that build probably won't explode significantly more than alpha1. Anyway, it would be helpful if people using that build could hunt down and report issues, instead of assuming we know about them (we probably don't) and waiting for the next alpha build.
Title: Re: DFHack 0.40.24-r5
Post by: CaptainMcClellan on March 03, 2016, 11:09:08 pm
It's not really release-ready, but it's getting closer, and I was hoping to fit in an alpha release this weekend, so that build probably won't explode significantly more than alpha1. Anyway, it would be helpful if people using that build could hunt down and report issues, instead of assuming we know about them (we probably don't) and waiting for the next alpha build.
I can build it and bugreport for Linux if you tell me what parts you need tested.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 03, 2016, 11:09:48 pm
It's not really release-ready, but it's getting closer, and I was hoping to fit in an alpha release this weekend, so that build probably won't explode significantly more than alpha1. Anyway, it would be helpful if people using that build could hunt down and report issues, instead of assuming we know about them (we probably don't) and waiting for the next alpha build.
I wish I could help. The alpha build has just been so damned stable for me, it's annoying! ;)
Title: Re: DFHack 0.40.24-r5
Post by: CaptainMcClellan on March 03, 2016, 11:14:41 pm
It's not really release-ready, but it's getting closer, and I was hoping to fit in an alpha release this weekend, so that build probably won't explode significantly more than alpha1. Anyway, it would be helpful if people using that build could hunt down and report issues, instead of assuming we know about them (we probably don't) and waiting for the next alpha build.
I wish I could help. The alpha build has just been so damned stable for me, it's annoying! ;)
Is the alpha build compatible with v42.06? If so, I can git it tonight and bug test everything in Linny Mint and Win 7. :D ( I really need dfhack for something, sooner rather than later. I don't mind if it inflicts !!weird!! on my saves or crashes the game now and again as long as it's >70% stable and does the one thing I need it for. ( Unit and location renaming. ) Besides that having Stonesense and Soundsense again would be very nice.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 03, 2016, 11:22:19 pm
I just updated the develop branch to point to the latest df-structures commit, so ensuring that you have the latest develop branch (of DFHack) and running "git submodule update" should get you a working df-structures. Thanks to sv-esk, the offsets should be complete on all three platforms, so DFHack should at least start up normally, although I haven't tested anything on Linux yet. OS X definitely works, though.
Title: Re: DFHack 0.40.24-r5
Post by: Seleucian on March 04, 2016, 03:19:08 am
So after many failed attempts I just managed to compile and build DFhack. Turns out in my previous attempts I made one (probably very silly) mistake. I downloaded the code via the 'Download Zip' instead of using this command
Code: [Select]
git clone --recursive https://github.com/DFHack/dfhack
cd dfhack
.
Then I followed the instructions and it would always fail.
It might be useful to make a note of this right at the top of the instructions for Windows, because that's where I started reading the page, thinking that was where I should start. I think that might be very helpful for other noobs of Github, like myself.

Anyway, I'm now ready to try it out, thanks for a great tool!
Title: Re: DFHack 0.40.24-r5
Post by: CaptainMcClellan on March 04, 2016, 03:33:30 am
So after many failed attempts I just managed to compile and build DFhack. Turns out in my previous attempts I made one (probably very silly) mistake. I downloaded the code via the 'Download Zip' instead of using this command
Code: [Select]
git clone --recursive https://github.com/DFHack/dfhack
cd dfhack
.
Then I followed the instructions and it would always fail.
It might be useful to make a note of this right at the top of the instructions for Windows, because that's where I started reading the page, thinking that was where I should start. I think that might be very helpful for other noobs of Github, like myself.

Anyway, I'm now ready to try it out, thanks for a great tool!
Thanks, I was just having the same problem because I was trying to use "remote add" in my git command. >_>
Title: Re: DFHack 0.40.24-r5
Post by: deepfield on March 04, 2016, 04:16:14 am
I just updated the develop branch to point to the latest df-structures commit, so ensuring that you have the latest develop branch (of DFHack) and running "git submodule update" should get you a working df-structures. Thanks to sv-esk, the offsets should be complete on all three platforms, so DFHack should at least start up normally, although I haven't tested anything on Linux yet. OS X definitely works, though.

Confirming, works on Windows :)
Title: Re: DFHack 0.40.24-r5
Post by: wuphonsreach on March 04, 2016, 06:47:42 am
https://drive.google.com/file/d/0ByxHQd6Tsa3nUEJyV3lHdzJQRVE/view?usp=docslist_api (https://drive.google.com/file/d/0ByxHQd6Tsa3nUEJyV3lHdzJQRVE/view?usp=docslist_api)

How about Google? I dropped it in my google drive before I left work and remembered I could share it from there.

But I am not comfortable with this, I am not familiar enough with Google shares to know the world can't see all my stuff now.

You can either share at the folder level or file level (https://support.google.com/drive/answer/2494886).  For most uses, I recommend creating a folder specifically for a particular project, then putting files inside of that.  That gives you the choice of either sharing everything within the folder, or just the file itself.

By default, files/folders are not visible to others.

If you look through your list of files/folders, the items that are shared will have a multi-headed person icon after the filename.

You can also set an expiration time for the share item when you create the URL.
Title: Re: DFHack 0.40.24-r5
Post by: gasznak on March 04, 2016, 09:22:10 am
So after many failed attempts I just managed to compile and build DFhack. Turns out in my previous attempts I made one (probably very silly) mistake. I downloaded the code via the 'Download Zip' instead of using this command
Code: [Select]
git clone --recursive https://github.com/DFHack/dfhack
cd dfhack
.
Then I followed the instructions and it would always fail.
It might be useful to make a note of this right at the top of the instructions for Windows, because that's where I started reading the page, thinking that was where I should start. I think that might be very helpful for other noobs of Github, like myself.

Anyway, I'm now ready to try it out, thanks for a great tool!
Thanks, I was just having the same problem because I was trying to use "remote add" in my git command. >_>

I just updated the develop branch to point to the latest df-structures commit, so ensuring that you have the latest develop branch (of DFHack) and running "git submodule update" should get you a working df-structures. Thanks to sv-esk, the offsets should be complete on all three platforms, so DFHack should at least start up normally, although I haven't tested anything on Linux yet. OS X definitely works, though.

Confirming, works on Windows :)

Could you guys please upload that version and link it here?
I mean the .dll and other dhack files like in normal versions.

I desperately need the Dfhack (can't really play without workflow anymore) but when I tried to download that Git program and compile it myself I realized I have no idea what I'm doing. :P Not everyone is a programmer. However if you need any legal counseling (civil law), let me know. :)

If you guys could do that, I'll be really, really thankful.

Cheers,
Matt

PS. I'm assuming there is a newer version that the one posted on the previous page since you guys had to compile it yourself.


Edit. Got it. Thanks Santa! :)
Title: Re: DFHack 0.40.24-r5
Post by: qorthos on March 04, 2016, 11:00:56 am
Edit. Got it. Thanks Santa! :)

Sharing is caring ;)

How about helping some other brothers out?
Title: Re: DFHack 0.40.24-r5
Post by: gasznak on March 04, 2016, 11:48:29 am
Edit. Got it. Thanks Santa! :)

Sharing is caring ;)

How about helping some other brothers out?

I got it via a private msg. Author didn't want to post it here.
Check your inbox. :)
Title: Re: DFHack 0.40.24-r5
Post by: notfood on March 04, 2016, 12:10:22 pm
It's not really release-ready, but it's getting closer, and I was hoping to fit in an alpha release this weekend, so that build probably won't explode significantly more than alpha1. Anyway, it would be helpful if people using that build could hunt down and report issues, instead of assuming we know about them (we probably don't) and waiting for the next alpha build.
I wish I could help. The alpha build has just been so damned stable for me, it's annoying! ;)

Same here under Linux. There is nothing to report. Perhaps I don't test extensively or rare scenarios, but for day to day use, it hasn't crashed or corrupted my worlds (yet?).
Title: Re: DFHack 0.40.24-r5
Post by: Wilm0chimp on March 04, 2016, 01:05:19 pm
and I was hoping to fit in an alpha release this weekend

My body is ready.
Title: Re: DFHack 0.40.24-r5
Post by: khearn on March 04, 2016, 03:24:57 pm
I just built the develop branch on ubuntu and it starts up just fine. Haven't done much yet, but it's a good start.
Title: Re: DFHack 0.40.24-r5
Post by: CaptainMcClellan on March 04, 2016, 03:30:20 pm
Had trouble compiling, suspect it's the compiler I used.
I just built the develop branch on ubuntu and it starts up just fine. Haven't done much yet, but it's a good start.

What compile parameters did you use?
Title: Re: DFHack 0.40.24-r5
Post by: khearn on March 04, 2016, 03:42:00 pm
Actually, on closer inspection, dfhack doesn't seem to be starting at all. I'm not getting the message that it's an unrecognized df version, but I'm also not getting the alpha version popups, have no dfhack functionality in game, and have no prompt in the terminal from which I started dfhack. I'm not sure what's going on.

Edit: Looking in stderr.log, I'm seeing this:
Spoiler (click to show/hide)

So my build isn't working. :-(
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on March 04, 2016, 03:48:24 pm
Prerelease-warning is not present in 0.40.24 r5.
Build tutorial assumes you know something about git.
In order to get 0.42.06-compatible sources you should clone develop branch, not default (0.40.24 r5). And DFHack/dfhack repo is currently actual
Code: [Select]
git clone --recursive https://github.com/DFHack/dfhack -b develop
cd dfhack
Title: Re: DFHack 0.40.24-r5
Post by: gasznak on March 04, 2016, 03:55:07 pm
For a couple of dfhack scripts/plugins (i.e autolabor, workflow) there is some data stored separately for each save file. Where is it stored? Is it possible to copy it from one save to another?

For example I have some dwarf labor rules set up in autolabor in game A. I did set it up once and then every time I load that save it's there. Is it possible to copy it to my next games without manually typing everything in dfhack console?

Thanks in advance!

Cheers,
Matt
Title: Re: DFHack 0.40.24-r5
Post by: khearn on March 04, 2016, 04:14:08 pm
Ahh, I think I figured it out. I was following old instructions and cloning quietust's develop branch. Yeah, when I build from the regular develop branch it looks like dfhack. I do get some error/warning messages at startup:

Loading bindings from data/init/interface.txt
Resetting textures
Plugin weather: missing symbol: plugin_name
Can't load plugin misery
Plugin drybuckets: missing symbol: plugin_name
Plugin remotefortressreader: missing symbol: plugin_name
Plugin feature: missing symbol: plugin_name
Plugin initflags: missing symbol: plugin_name
DFHack is ready. Have a nice day!
DFHack version 0.42.06-alpha0 (development build 0.42.05-alpha1-40-g8eb39cc)

But it starts up, gives the usual prerelease warnings, workflow seems to be working. Enhanced stock screen looks good. I've definitely got dfhack running this time.
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on March 04, 2016, 04:19:15 pm
Something is wrong. All 0.42.06 symbols are known. missing symbol error shoul not be a thing
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 04, 2016, 04:19:21 pm
For a couple of dfhack scripts/plugins (i.e autolabor, workflow) there is some data stored separately for each save file. Where is it stored? Is it possible to copy it from one save to another?

For example I have some dwarf labor rules set up in autolabor in game A. I did set it up once and then every time I load that save it's there. Is it possible to copy it to my next games without manually typing everything in dfhack console?

Thanks in advance!

Cheers,
Matt
Those two store their data as fake historical figures, which means it gets written to world.sav when DF saves (or unit#.sav, or something else). There's not a really easy way to extract that, although those plugins could implement their own export functionality.

One thing you can do is save the commands you use to a file, say "autolabor-setup.txt", then use DFHack's "script" command to execute all of the commands in that file (specifying the filename, e.g. "script autolabor-setup.txt"). Some plugins actually have a way to export the commands you would need to use for this technique, although I don't remember exactly which ones (the zone plugin might).

Ahh, I think I figured it out. I was following old instructions and cloning quietust's develop branch. Yeah, when I build from the regular develop branch it looks like dfhack. I do get some error/warning messages at startup:

Loading bindings from data/init/interface.txt
Resetting textures
Plugin weather: missing symbol: plugin_name
Can't load plugin misery
Plugin drybuckets: missing symbol: plugin_name
Plugin remotefortressreader: missing symbol: plugin_name
Plugin feature: missing symbol: plugin_name
Plugin initflags: missing symbol: plugin_name
DFHack is ready. Have a nice day!
DFHack version 0.42.06-alpha0 (development build 0.42.05-alpha1-40-g8eb39cc)

But it starts up, gives the usual prerelease warnings, workflow seems to be working. Enhanced stock screen looks good. I've definitely got dfhack running this time.

I'm going to guess that those plugins in red are left over from the older version of DFHack. You can safely remove those. (If you're on Linux, remotefortressreader was renamed to RemoteFortressReader, so I expect you have both in the folder and can get rid of the lowercase one.)

Something is wrong. All 0.42.06 symbols are known. missing symbol error shoul not be a thing
"symbol" in this case is a symbol defined in a plugin (or shared object, returned by dlopen()/dlsym()), not a DF global.
Title: Re: DFHack 0.40.24-r5
Post by: Manzeenan on March 04, 2016, 04:46:11 pm
was there ever a working plugin to give medical care to animals?
Title: Re: DFHack 0.40.24-r5
Post by: khearn on March 04, 2016, 05:04:36 pm
Ahh, I think I figured it out. I was following old instructions and cloning quietust's develop branch. Yeah, when I build from the regular develop branch it looks like dfhack. I do get some error/warning messages at startup:

Loading bindings from data/init/interface.txt
Resetting textures
Plugin weather: missing symbol: plugin_name
Can't load plugin misery
Plugin drybuckets: missing symbol: plugin_name
Plugin remotefortressreader: missing symbol: plugin_name
Plugin feature: missing symbol: plugin_name
Plugin initflags: missing symbol: plugin_name
DFHack is ready. Have a nice day!
DFHack version 0.42.06-alpha0 (development build 0.42.05-alpha1-40-g8eb39cc)

But it starts up, gives the usual prerelease warnings, workflow seems to be working. Enhanced stock screen looks good. I've definitely got dfhack running this time.

I'm going to guess that those plugins in red are left over from the older version of DFHack. You can safely remove those. (If you're on Linux, remotefortressreader was renamed to RemoteFortressReader, so I expect you have both in the folder and can get rid of the lowercase one.)

Yup, sorting hack/plugins by timestamp shows that those plugins (and only those plugins) are older than my latest make install. After removing them the warnings went away.

Thanks!
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on March 04, 2016, 07:19:00 pm
This may be a poor time to request a core feature, but could someone consider it on the back burner?

Aliases for commonly used command strings, pre-configurable in .init, usable in command window and interactive lua. This would be especially helpful for referencing the df.* heirarchy; ie aliasing 'df.global.world.world_data.sites' to 'SITES' and 'SITES[ # ]'. Could also include the command in the alias.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 04, 2016, 08:27:19 pm
Not sure what command window you're referring to, but I just added support for things like that to the interactive "lua" interpreter 5 minutes ago. Making it configurable would take some more time, but it's doable.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on March 04, 2016, 09:27:01 pm
Not sure what command window you're referring to,
The only command-line window that opens in conjunction with DF+dfhack. And by configurable I'm talking about letting people assign their own sets aliases in an .init file, so they can use abbreviations convenient to them to refer to longer strings on command line as well as in the interpreter.

So I could enter something like this on command line:  ED UNITS[id#]
and it would be translated to: gui/gm-editor df.global.world.units.active[id#]
then for a lua search loop: for x,y in pairs(UNITS) do
and UNITS could be expanded to "df.global.world.units.active".
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 04, 2016, 09:32:16 pm
Oh, you want aliases for normal commands too. That's also possible, although there isn't an easy way to do that yet. For Lua scripts, it's possible to set up redirects (see scripts/gui/hack-wish for an example - only the first line is necessary), but those are cumbersome. I think there's a suggestion for easier-to-use aliases on the issue tracker, e.g. an "alias alias-name command-name" command.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 04, 2016, 09:38:32 pm
0.42.06-alpha1 is up: https://github.com/DFHack/dfhack/releases/tag/0.42.06-alpha1
It contains some more fixes than the builds from yesterday, but the new stuff could also introduce problems that people didn't find earlier, so back things up, report problems, etc.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on March 04, 2016, 10:26:05 pm
This may be a poor time to request a core feature, but could someone consider it on the back burner?

Aliases for commonly used command strings, pre-configurable in .init, usable in command window and interactive lua. This would be especially helpful for referencing the df.* heirarchy; ie aliasing 'df.global.world.world_data.sites' to 'SITES' and 'SITES[ # ]'. Could also include the command in the alias.
https://github.com/DFHack/dfhack/issues/701

Considered, and indeed on the back burner ;)
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 04, 2016, 11:02:49 pm
0.42.06-alpha1 is up: https://github.com/DFHack/dfhack/releases/tag/0.42.06-alpha1
It contains some more fixes than the builds from yesterday, but the new stuff could also introduce problems that people didn't find earlier, so back things up, report problems, etc.
Someone posted about it not being updated on /dfg/ literally seconds before I posted the link to it.
Title: Re: DFHack 0.40.24-r5
Post by: Nimrod on March 05, 2016, 12:37:57 am
Thanks to you all! You are exalted among dwarves (and men).
Title: Re: DFHack 0.40.24-r5
Post by: soul4hdwn on March 05, 2016, 01:17:17 am
sorry for referring to 0.40.26 still but tele-dwarves kinda cause babies to be abandoned, random babies lying around most of the time.  either they don't hunger/thirst or my absolute laziness waiting for the right phase of game to "be normal" on one of my worlds keeping teledwarf on is having dwarves provide... but they're perfectly fine and even grow up.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on March 05, 2016, 01:22:01 am
Considering the way teledwarf works (by checking every unit on every tick to see if they're pathing, then teleporting them to the path destination should there be one), that doesn't surprise me in the slightest. "Teleporting" here refers to a process where all occupancy flags at the beginning and ending locations are set up properly for the new positions, the teleporting unit's laying-down flag is set as appropriate for if there's a standing creature at the destination, and the teleporting creature's position is set to the destination. Note that none of that accounts for babies, which I have no idea how the game keeps track of babies being held (some sort of general ref?)
Title: Re: DFHack 0.40.24-r5
Post by: Rose on March 05, 2016, 02:05:14 am
babies are counted as riding the mothers, I believe.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on March 05, 2016, 02:16:23 am
sorry for referring to 0.40.26 still but tele-dwarves kinda cause babies to be abandoned, random babies lying around most of the time.  either they don't hunger/thirst or my absolute laziness waiting for the right phase of game to "be normal" on one of my worlds keeping teledwarf on is having dwarves provide... but they're perfectly fine and even grow up.
Considering the way teledwarf works (by checking every unit on every tick to see if they're pathing, then teleporting them to the path destination should there be one), that doesn't surprise me in the slightest. "Teleporting" here refers to a process where all occupancy flags at the beginning and ending locations are set up properly for the new positions, the teleporting unit's laying-down flag is set as appropriate for if there's a standing creature at the destination, and the teleporting creature's position is set to the destination. Note that none of that accounts for babies, which I have no idea how the game keeps track of babies being held (some sort of general ref?)
babies are counted as riding the mothers, I believe.

Quoting for the benefit of a bug report - https://github.com/DFHack/dfhack/issues/835
Title: Re: DFHack 0.40.24-r5
Post by: gasznak on March 05, 2016, 08:20:21 am
0.42.06-alpha1 is up: https://github.com/DFHack/dfhack/releases/tag/0.42.06-alpha1
It contains some more fixes than the builds from yesterday, but the new stuff could also introduce problems that people didn't find earlier, so back things up, report problems, etc.

Thank you kind sir for you awesome work!
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on March 05, 2016, 11:04:55 am
Trying to insert a string class value, but getting "Type 'string not found". They're all over the raws, so the structure can't be opaque to anyone. Do I need to add a delimiter, or reference it in some esoteric fashion?
Title: Re: DFHack 0.40.24-r5
Post by: Rose on March 05, 2016, 01:40:39 pm
Try using stl;?
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on March 05, 2016, 02:24:43 pm
Type 'stl; not found.

Btw, I'm doing this on command line, not lua interpreter. I'm trying to mod a generated reaction so the mod would be effective in a generated world. I need to add strings to a string vector, and I can add any wildly inappropriate value to it, but...not strings?

EDIT: Doh, sorry, I'm doing this in gm-editor, not command line or lua.
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on March 05, 2016, 02:55:54 pm
How do I use reaction-product-trigger? I suspect it has something to do with my limited understanding of all programming languages that are not java, but I can't find anything on the arguments part of the file that indicates how to tell it which product to cause it to trigger.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on March 05, 2016, 04:37:10 pm
Where would typenames be defined? Is there documentation on available types and their structures? It boggles the mind that something as critical to any programming as string types aren't somehow defined in a way that can be referenced by the user.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 05, 2016, 04:54:40 pm
The issue is with gm-editor not being able to create strings, because its type selection dialog only searches for types of DF data (e.g. when given "viewscreen", it uses "df.viewscreen", but "df.string" isn't a valid type). It would be possible to have it fall back to primitive types (like string, as well as int32_t, bool, etc.), although those are a little trickier to validate.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on March 05, 2016, 05:24:35 pm
The issue is with gm-editor not being able to create strings, because its type selection dialog only searches for types of DF data (e.g. when given "viewscreen", it uses "df.viewscreen", but "df.string" isn't a valid type). It would be possible to have it fall back to primitive types (like string, as well as int32_t, bool, etc.), although those are a little trickier to validate.
Would copy/paste be a simple work-around? That would be useful for transferring other data types to other vectors, or duplicating one with values close to the ones desired and then editing it.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 05, 2016, 05:32:39 pm
Duplication of elements within a vector would be pretty easy, but copying/pasting elements between vectors would probably be harder than adding support for primitive data types.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 05, 2016, 05:56:51 pm
Yeah you gotta do the lua interpreter bit to get a string in, I think?
Title: Re: DFHack 0.40.24-r5
Post by: Rose on March 05, 2016, 10:40:41 pm
Oops, I was assuming c++

I hadn't even considered it could be Lua or something.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 06, 2016, 03:12:04 am
How do I use reaction-product-trigger? I suspect it has something to do with my limited understanding of all programming languages that are not java, but I can't find anything on the arguments part of the file that indicates how to tell it which product to cause it to trigger.

The first step is to decide whether you want reaction-trigger or reaction-product-trigger. reaction-trigger fires scripts when custom reactions complete, and reaction-product-trigger fires once per item produced. If your reaction produces nothing you should use reaction-trigger. If you have a reaction that produces an item with a certain probability then you want reaction-product-trigger. reaction-trigger also cannot give you direct access to the input items or output items.

Code: [Select]
modtools/reaction-product-trigger -reactionName MAKE_CLAY_JUG -command [ devel/print-args "worker id = " \\WORKER_ID ", input items = " \\INPUT_ITEMS ", output items = " \\OUTPUT_ITEMS ]

This should print things when the MAKE_CLAY_JUG reaction produces a clay jug. You can use the same syntax to forward the relevant information to a script you write and then do something more interesting than printing it.

If you have something more specific in mind I can help more.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 06, 2016, 03:25:09 am
sorry for referring to 0.40.26 still but tele-dwarves kinda cause babies to be abandoned, random babies lying around most of the time.  either they don't hunger/thirst or my absolute laziness waiting for the right phase of game to "be normal" on one of my worlds keeping teledwarf on is having dwarves provide... but they're perfectly fine and even grow up.
Considering the way teledwarf works (by checking every unit on every tick to see if they're pathing, then teleporting them to the path destination should there be one), that doesn't surprise me in the slightest. "Teleporting" here refers to a process where all occupancy flags at the beginning and ending locations are set up properly for the new positions, the teleporting unit's laying-down flag is set as appropriate for if there's a standing creature at the destination, and the teleporting creature's position is set to the destination. Note that none of that accounts for babies, which I have no idea how the game keeps track of babies being held (some sort of general ref?)
babies are counted as riding the mothers, I believe.

Quoting for the benefit of a bug report - https://github.com/DFHack/dfhack/issues/835

If someone could upload a small save with a dwarf carrying a baby that would save developer time a bit fixing it.
Title: Re: DFHack 0.40.24-r5
Post by: Rumrusher on March 06, 2016, 04:37:44 am
sorry for referring to 0.40.26 still but tele-dwarves kinda cause babies to be abandoned, random babies lying around most of the time.  either they don't hunger/thirst or my absolute laziness waiting for the right phase of game to "be normal" on one of my worlds keeping teledwarf on is having dwarves provide... but they're perfectly fine and even grow up.
Considering the way teledwarf works (by checking every unit on every tick to see if they're pathing, then teleporting them to the path destination should there be one), that doesn't surprise me in the slightest. "Teleporting" here refers to a process where all occupancy flags at the beginning and ending locations are set up properly for the new positions, the teleporting unit's laying-down flag is set as appropriate for if there's a standing creature at the destination, and the teleporting creature's position is set to the destination. Note that none of that accounts for babies, which I have no idea how the game keeps track of babies being held (some sort of general ref?)
babies are counted as riding the mothers, I believe.

Quoting for the benefit of a bug report - https://github.com/DFHack/dfhack/issues/835

If someone could upload a small save with a dwarf carrying a baby that would save developer time a bit fixing it.
oh yeah funny thing about carry mechanics you can technically teleport the rider to anyone's backs if you slap the mount flag on the unit and change the rider's mount relationship to that unit with the mount flag on.
once the mount moves the rider will instantly teleport to the rider. you could also stack riders and mounts on top of each other this way. sadly there can be only 1 mount but many riders... or something to that degree last I remember gm-editor manipulations.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 06, 2016, 05:15:39 am
Hmmm, haven't been able to get any useful output from the error logs but could someone else check and see if trying to make (in adventurer mode for sure, not sure about fort mode, no fort saves) a:

figurine
with a new image specified
of a historical figure

Doing so crashes with:
Code: [Select]
./dfhack: line 66: 23167 Segmentation fault     
(core dumped) setarch i386 -R env LD_PRELOAD="$PRELOAD_LIB" ./libs/Dwarf_Fortress "$@"
Every time I try so far, actually even if I try to do it for a historical figure direct OR for a specify new > historical figure, it crashes. Multiple saves too.

Just checked to see if it was because of having cull historical figures and no, doesn't seem to be that.
Title: Re: DFHack 0.40.24-r5
Post by: TheKaspa on March 06, 2016, 08:57:29 am
Is there a plugin that shows the stockpile of metal ores and metal/charcoal bars?
Title: Re: DFHack 0.40.24-r5
Post by: Hesperid on March 06, 2016, 11:01:53 am
Yeah bind a hotkey to run "stocks show" and then you just have to type in b a r s and it lists all your different metal bars nicely.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 06, 2016, 12:34:37 pm
There's also gui/dfstatus, which I think is bound to Alt+I in the main fortress mode view. It displays bar totals, and you can customize the bars it shows in <DF>/dfhack-config/dfstatus.lua, but I don't think it supports ores at all. (I also don't think it takes stockpiles into account, but it could.)
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on March 06, 2016, 02:05:19 pm
-snip-
Thanks for the answer. I guess I misunderstood it then. Is there any script that allows for multiple possible results? What I mean is: the reaction is run, with X% chance of effect A, and Y% of effect B.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 06, 2016, 02:25:03 pm
-snip-
Thanks for the answer. I guess I misunderstood it then. Is there any script that allows for multiple possible results? What I mean is: the reaction is run, with X% chance of effect A, and Y% of effect B.

If you want a "cumulative probability" where if there's a 10% chance it happens exactly every 10 times then you can use reaction-product-trigger using DF's built-in partial product system. If you want an independent probability each time, you can do something like

Code: [Select]
modtools/random-trigger -outcomeListName myOutcomeList -weight 1 -command [ devel/print-args "outcome 1" ]
modtools/random-trigger -outcomeListName myOutcomeList -weight 2 -command [ devel/print-args "outcome 2" ]
modtools/reaction-trigger -reactionName MY_REACTION -command [ modtools/random-trigger -outcomeListName myOutcomeList -trigger -preserveList ]

Every time MY_REACTION completes, it will print "outcome 1" with probability 1/3 and "outcome 2" with probability 2/3, and it will never print both at once.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 06, 2016, 05:53:51 pm
So apparently my crashes are related to the vanilla bug, but they aren't consistent across saves. All of the saves in the folder I'm playing were made fresh for 42.06 to use the new reactions. One of them works fine (http://i.imgur.com/zBNZDWU.png) with ./df or ./dfhack, but the others crash.

When I try ./df for the crashing ones I get this instead of the usual segfault message though:
Code: [Select]
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
Dwarf_Fortress: xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
./df: line 6: 32410 Aborted                 
(core dumped) ./libs/Dwarf_Fortress "$@"

So... that's weird.

Edit: correction!

One of the saves which I can make figurines in with ./df does not work when I launch with ./dfhack:
Code: [Select]
./dfhack: line 66:   899 Segmentation fault     
(core dumped) setarch i386 -R env LD_PRELOAD="$PRELOAD_LIB" ./libs/Dwarf_Fortress "$@"

I took this after launching with ./df:
Spoiler (click to show/hide)

I get the above segfault when I try the same thing with ./dfhack.
Title: Re: DFHack 0.40.24-r5
Post by: plenum on March 06, 2016, 08:13:43 pm
Have anyone tried (or know how) to change savagery/evilness of fort map? Is it even possible (easy) with DFHack?
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on March 06, 2016, 09:12:50 pm
Why would you want to do that? It wouldn't change wildlife or regional interactions.
Title: Re: DFHack 0.40.24-r5
Post by: plenum on March 06, 2016, 11:23:30 pm
I would do that to make game a bit more fun, when my embark becomes a bit less vulnerable. Besides, for me it's not easy to do such a worldgen, which would satisfy all interests at once...

I was hoping to find way to make fort environment more aggressive at some point - at least for animals, that appear on surface. Yes, I know, it's possible to find evil in underground caverns, but still, is it possible?
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 06, 2016, 11:51:53 pm
Technically?

...maybe.

Easy without ruining your save?

No.

There are a lot ofspots you have to find and make sure are changed to avoid: loading crashes, saving crashes, units entering map crashes, weather crashes, units leaving map crashes, death crashes, birth crashes, seasonal growth crashes, and many more.
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on March 07, 2016, 07:42:20 am
-snip-
Thanks for the answer. I guess I misunderstood it then. Is there any script that allows for multiple possible results? What I mean is: the reaction is run, with X% chance of effect A, and Y% of effect B.

If you want a "cumulative probability" where if there's a 10% chance it happens exactly every 10 times then you can use reaction-product-trigger using DF's built-in partial product system. If you want an independent probability each time, you can do something like

Code: [Select]
modtools/random-trigger -outcomeListName myOutcomeList -weight 1 -command [ devel/print-args "outcome 1" ]
modtools/random-trigger -outcomeListName myOutcomeList -weight 2 -command [ devel/print-args "outcome 2" ]
modtools/reaction-trigger -reactionName MY_REACTION -command [ modtools/random-trigger -outcomeListName myOutcomeList -trigger -preserveList ]

Every time MY_REACTION completes, it will print "outcome 1" with probability 1/3 and "outcome 2" with probability 2/3, and it will never print both at once.
I think I understand. Thanks.
Title: Re: DFHack 0.40.24-r5
Post by: Uzu Bash on March 07, 2016, 09:25:38 am
When constructing in advfort I've been finding foreign objects in the material selection. For example when building floors underground, I found glumprong logs as the first selection. There aren't any glumprongs on the ground, in my inventory, or in the entire biome. I also accidentally built aboveground floors with pear wood blocks when I haven't made any, and there are no pear trees around to make them from. These non-existent logs and blocks are selectable from random tiles, usually a few of them in a row.
Title: Re: DFHack 0.40.24-r5
Post by: TheKaspa on March 07, 2016, 03:58:35 pm
Yeah bind a hotkey to run "stocks show" and then you just have to type in b a r s and it lists all your different metal bars nicely.

That is helpful, but I'd like to be able to understand with a glance if it's more convenient to smelt hematite or limonite, for instance
Title: Re: DFHack 0.40.24-r5
Post by: Blue_Dwarf on March 07, 2016, 04:02:54 pm
How do you take screenshots with DFHack installed? If I use Prt Scr or Alt Prt Scr, DFHack apparently changes the active window or something, making it impossible.

I'm using PeridexisErrant's Starter Pack, 40.24-r20 (http://www.bay12forums.com/smf/index.php?topic=126076).
Title: Re: DFHack 0.40.24-r5
Post by: IAmTheRad on March 07, 2016, 11:06:49 pm
42.06-alpha1 has a crash when loading up the historical figure for details to make for a statue/figurine.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 07, 2016, 11:07:58 pm
Does that occur without DFHack? Can you provide steps or a save to reproduce?
Title: Re: DFHack 0.40.24-r5
Post by: IAmTheRad on March 07, 2016, 11:20:20 pm
Does not occur without dfhack.

To reproduce, create a pocket world (Default settings). Embark anywhere, doesn't matter. Build a mason's workshop ASAP, and then make a statue in the workshop. Choose details, and choose to change the image. Select 'historical figure'.

Game will crash with dfhack.
Title: Re: DFHack 0.40.24-r5
Post by: Nimrod on March 08, 2016, 12:43:46 am
Does not occur without dfhack.

To reproduce, create a pocket world (Default settings). Embark anywhere, doesn't matter. Build a mason's workshop ASAP, and then make a statue in the workshop. Choose details, and choose to change the image. Select 'historical figure'.

Game will crash with dfhack.

I can confirm this. Happens with my (dfhack 0.42.06-alpha1) game 100% of the time.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 08, 2016, 01:19:31 am
Same thing as in adventurer mode apparently, I've got saves where I can launch with ./df and make figurines and ones where I can't at all, but none of them work when I ./dfhack and try to make a figurine.
So apparently my crashes are related to the vanilla bug, but they aren't consistent across saves. All of the saves in the folder I'm playing were made fresh for 42.06 to use the new reactions. One of them works fine (http://i.imgur.com/zBNZDWU.png) with ./df or ./dfhack, but the others crash.

When I try ./df for the crashing ones I get this instead of the usual segfault message though:
Code: [Select]
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
Dwarf_Fortress: xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
./df: line 6: 32410 Aborted                 
(core dumped) ./libs/Dwarf_Fortress "$@"

So... that's weird.

Edit: correction!

One of the saves which I can make figurines in with ./df does not work when I launch with ./dfhack:
Code: [Select]
./dfhack: line 66:   899 Segmentation fault     
(core dumped) setarch i386 -R env LD_PRELOAD="$PRELOAD_LIB" ./libs/Dwarf_Fortress "$@"

I took this after launching with ./df:
Spoiler (click to show/hide)

I get the above segfault when I try the same thing with ./dfhack.
Title: Re: DFHack 0.40.24-r5
Post by: Lamb on March 08, 2016, 03:04:16 am
I can also confirm that running the game with dfhack on the 42.06-alpha1 causes a crash when you attempt to access the historical figures section when editing the details of certain objects such as statues. However, when I embark on a site on a game with dfhack off, I am permitted to access the historical figures.

Strangely, it seems that for forts that have been saved with dfhack on, loading those forts later after having turned off dfhack leads to the same aformentioned crash. It basically looks like this:
>create a fresh embark without DFHack
>able to access the historical figures section when editing the details of certain objects
>save fort, reload fort with DFHack enabled
>crashes when you select the historical figures section
>reload fort with DFHack enabled, save the game (as many here would have had before we noticed the crash), close the game
>turn off DFHack, reload fort that had been saved alongside DFHack, aforementioned crashes continue despite DFHack having been turned off

Does DFHack leave any lingering files in your folders after having DFHack turned off? It feels like I'm muddling this up somehow. Hopefully we can get this issue fixed.

The errorlog shows me "Unrecognized Announcement Token: TRAVEL_ADVISORY" but I don't know if that's really behind the crash.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on March 08, 2016, 03:06:48 am
DFHack saves stuff as historical figures, so that might be it.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 08, 2016, 04:00:41 am
DFHack saves stuff as historical figures, so that might be it.

That could definitely be it. We'll have to check whether they're being created properly.

On the bright side it's an excuse to implement persistent data without using historical figures, something I've been putting off.
Title: Re: DFHack 0.40.24-r5
Post by: Abadrausar on March 08, 2016, 06:58:06 am
...implement persistent data without using historical figures...
Could a sqlite database file in the DF game save directory do the thing?
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 08, 2016, 07:31:18 am
DFHack saves stuff as historical figures, so that might be it.

That could definitely be it. We'll have to check whether they're being created properly.

On the bright side it's an excuse to implement persistent data without using historical figures, something I've been putting off.
Is there a list of tools that insert fake historical figures?  That might be useful for the pack maintainers to know so they can either turn them off by default or at least warn their users.

Personally I don't use workflow and such, but I also don't do anything to disable the stuff I don't use.
Title: Re: DFHack 0.40.24-r5
Post by: sv-esk on March 08, 2016, 08:06:47 am
invalid (-1) language id causes segfault
I changed it to 0 with this script(it seems to be not unused for datastoring anyway):
Code: [Select]
local figs = df.global.world.history.figures

for i=0,#figs-1,1 do
   local v = figs[i]
   if v.id<0 then
      print(v.id..' '..v.name.first_name..' '..v.name.language)
      v.name.language = 0
   end
end
and it stopped crashing on figurine-design historical figure choose screen:
Spoiler (click to show/hide)
edit: this script was integrated in dfhack-alpha2 and runs automatically, and default language was fixed
Title: Re: DFHack 0.40.24-r5
Post by: Nimrod on March 08, 2016, 08:59:09 am
invalid (-1) language id causes segfault
I changed it to 0 with this script(it seems to be not unused for datastoring anyway):
Code: [Select]
local figs = df.global.world.history.figures

for i=0,#figs-1,1 do
   local v = figs[i]
   if v.id<0 then
      print(v.id..' '..v.name.first_name..' '..v.name.language)
      v.name.language = 0
   end
end
and it stopped crashing on figurine-design historical figure choose screen:
Spoiler (click to show/hide)

Sorry for my noobish question, but do you run this script directly in the dfhack console? Or is it applied to a specific file in the save folder? (I have no clue where or how things are stored in the DF files ... )

cheers
Title: Re: DFHack 0.40.24-r5
Post by: scamtank on March 08, 2016, 09:05:10 am
If you're an idiot who doesn't know how to work the lua interpreter like me, just throw those magic words into a text file, save it as filename.lua in \hack\scripts and then use the command "filename" in the console.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 08, 2016, 09:07:58 am
Nice work, sv-esk!

Autochop/config Abbeybrew sounds very lonely.
Title: Re: DFHack 0.40.24-r5
Post by: Nimrod on March 08, 2016, 09:10:38 am
If you're an idiot who doesn't know how to work the lua interpreter like me, just throw those magic words into a text file, save it as filename.lua in \hack\scripts and then use the command "filename" in the console.

I am way more of an idiot than you, so I name you my king! Thanks for the advice! :D

Edit: Works like a charm! Awesome. Thank you from the bottom of my dwarves!
Title: Re: DFHack 0.40.24-r5
Post by: devek on March 08, 2016, 10:15:04 am
...implement persistent data without using historical figures...
Could a sqlite database file in the DF game save directory do the thing?

As long as people were mindful that it might not be synced to the actual save. :)

(Those sqlite uses quite a bit of memory in a game that already pushes the memory limits for a lot of users, 99% of what people use sql for would be better served by flat files. http://fallabs.com/tokyocabinet/ is what I use for everything, but there might be something better that came out since I last looked hehe. At one point it was the fastest/smallest database there was.)
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 08, 2016, 10:21:48 am
I would prefer a flat file that was at least nominally human-readable, most likely including some base64 bricks to hold the bulk of the data in a serialized format.  That can then be slurped up into a lightweight database during runtime.
Title: Re: DFHack 0.40.24-r5
Post by: devek on March 08, 2016, 11:48:32 am
That would just be xml, which is fine too and still uses way less ram than sqlite :P
Title: Re: DFHack 0.40.24-r5
Post by: Rose on March 08, 2016, 12:12:05 pm
Apparently json is good too.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 08, 2016, 12:19:47 pm
That fix looks good to me. Combine it with repeat.lua for extra safety if you know how.

I don't know the list of things that use histfigs. Workflow does, persist-table does so many of Roses' scripts do.

I was thinking of using JSON. It's platform independent without being too bulky. During runtime it will have a more concise representation the way I'm thinking of implementing it. It will actually use less RAM and disk space than histfigs. Histfigs have a bigger overhead than you'd think.

Japa ninjaposted me to it.
Title: Re: DFHack 0.40.24-r5
Post by: khearn on March 08, 2016, 01:28:27 pm
I'd hazard a guess that autochop and autolabor use histfigs. :)
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 08, 2016, 01:34:26 pm
I'd hazard a guess that autochop and autolabor use histfigs. :)
Autochop/config Abbeybrew is real!  And so is the Tooth Fairy, and the Great Pumpkin, and a Rational Economic Plan, and ...

Now look, you made Autochop/config cry!
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 08, 2016, 02:28:12 pm
Weird. I checked the persistent data stuff and the constructor for df.historical_figure and df.language_name and it really looks like that field is being initialized to 0, not -1.

Can someone who's having this problem and hasn't run the fix script post the output of this script?

Code: [Select]
--test_figs.lua
local figs = df.global.world.history.figures

for i=0,#figs-1,1 do
   local v = figs[i]
   if v.id<0 and v.name.language < 0 then
      print(v.id..' '..v.name.first_name..' '..v.name.language)
   end
end

edit: Never mind, I fixed it. The problem should go away in the next release.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on March 08, 2016, 02:51:55 pm
Thank Armok, DFHack is usable.
Title: Re: DFHack 0.40.24-r5
Post by: Raven on March 09, 2016, 05:39:27 am
nevermind.. my mistake
Title: Re: DFHack 0.40.24-r5
Post by: SatelliteOfLove on March 09, 2016, 11:31:25 pm
A huge THANK YOU to the devs for their steady and dedicated work.  Yay for dfhack 42.06-alpha-1!  Hopefully my dorfs won't know what hit them  ;)
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 10, 2016, 09:21:24 am
New alpha release. (https://github.com/DFHack/dfhack/releases/tag/0.42.06-alpha2) This release fixes a few bugs with the old release.

Title: Re: DFHack 0.40.24-r5
Post by: Hesperid on March 10, 2016, 10:55:34 am
Goddamn you scared me, I thought it was a new DF release! I mean, that's how 0.42.06 snuck up on us.
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on March 10, 2016, 12:45:44 pm
Got a few more questions (my apologies if this is annoying to anyone here) about if there are scrips that enable me to do certain things. I suspect the answer to all might be no, but...

1) Is it possible to make, say, a flamethrower that consumes ammunition? (I know that item-trigger allows me to simulate the flamethrower, but no idea on the ammo)

2) Is it possible to make a custom siege weapon (without making it a workshop that gives material-emission interactions)?

3) Is there a way to assign gods created through moddable-gods to specific entities? (and do those gods even do any actions in worldgen?)
Title: Re: DFHack 0.40.24-r5
Post by: noirscape on March 10, 2016, 01:19:24 pm
New alpha release. (https://github.com/DFHack/dfhack/releases/tag/0.42.06-alpha2) This release fixes a few bugs with the old release.

You forgot the Linux and Mac binaries. There's only a windows binary in the release.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 10, 2016, 04:21:06 pm
Not everyone can build on all systems. I generally try to wait for all binaries to be available, but that didn't happen this time. I'll be able to build and put them up in an hour and a half or so.
Edit: They're up now: https://github.com/DFHack/dfhack/releases/tag/0.42.06-alpha2
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 11, 2016, 04:26:11 am
Got a few more questions (my apologies if this is annoying to anyone here) about if there are scrips that enable me to do certain things. I suspect the answer to all might be no, but...

1) Is it possible to make, say, a flamethrower that consumes ammunition? (I know that item-trigger allows me to simulate the flamethrower, but no idea on the ammo)

2) Is it possible to make a custom siege weapon (without making it a workshop that gives material-emission interactions)?

3) Is there a way to assign gods created through moddable-gods to specific entities? (and do those gods even do any actions in worldgen?)

1. A flamethrower that consumes ammunition would be hard to do. I'd make it work like a crossbow and make DFHack periodically create fire around the projectile. The problem would be making sure that it only uses a special type of ammunition and not bolts. I'm not sure how to do that.

2. What do you want it to do?

3. Not yet (unless you do it yourself with an lua script), and no. They are created after worldgen.
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on March 11, 2016, 05:40:37 am
2. What do you want it to do?
Just fire projectiles, I suppose.

Anyway, thanks for the answers. I should probably learn lua.
Title: Re: DFHack 0.40.24-r5
Post by: Couchmonster on March 11, 2016, 08:49:28 am
Can someone help me to get dfhack to run on gentoo linux x64
I get the tileset not found error on dfhack, but df works fine.
I had it fixed once... but I cannot seem to get it to work anymore.

df 42.06
dfhack 42.06 alpha2
twbt 5.5.8

running sh -x dfhack produces the following
Code: [Select]
and a tileset not found error.

[code]++ dirname dfhack
+ DF_DIR=.
+ cd .
+ export SDL_DISABLE_LOCK_KEYS=1
+ SDL_DISABLE_LOCK_KEYS=1
+ RC=.dfhackrc
+ '[' -r /home/hem39212/.dfhackrc ']'
+ '[' -r ./.dfhackrc ']'
+ libcxx_orig=libs/libstdc++.so.6
+ libcxx_backup=libs/libstdc++.so.6.backup
+ '[' -z '' ']'
+ '[' -e libs/libstdc++.so.6 ']'
+ '[' '!' -e libs/libstdc++.so.6.backup ']'
+ mv libs/libstdc++.so.6 libs/libstdc++.so.6.backup
+ cat
NOTICE: libs/libstdc++.so.6 has been moved to libs/libstdc++.so.6.backup
for better compatibility. If you are using an older distro and this breaks,
run "cp libs/libstdc++.so.6.backup libs/libstdc++.so.6", or add this to
/home/hem39212/.dfhackrc to affect future DFHack installations:

    export DFHACK_NO_RENAME_LIBSTDCXX=1

++ stty -g
+ old_tty_settings=5500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
+ DISTROFIXES=distro_fixes.sh
+ '[' -r distro_fixes.sh ']'
+ export LD_LIBRARY_PATH=:./hack/libs:./hack
+ LD_LIBRARY_PATH=:./hack/libs:./hack
+ PRELOAD_LIB=./hack/libdfhack.so
+ case "$1" in
+ setarch i386 -R env LD_PRELOAD=./hack/libdfhack.so ./libs/Dwarf_Fortress
+ ret=1
+ stty 5500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
+ echo

+ '[' -n '' ']'
+ exit 1

Same for DF + DFhack only

Code: [Select]
++ dirname dfhack                                                                                                                                                                                                 
+ DF_DIR=.                                                                                                                                                                                                         
+ cd .                                                                                                                                                                                                             
+ export SDL_DISABLE_LOCK_KEYS=1                                                                                                                                                                                   
+ SDL_DISABLE_LOCK_KEYS=1                                                                                                                                                                                         
+ RC=.dfhackrc                                                                                                                                                                                                     
+ '[' -r /home/hem39212/.dfhackrc ']'                                                                                                                                                                             
+ '[' -r ./.dfhackrc ']'                                                                                                                                                                                           
+ libcxx_orig=libs/libstdc++.so.6                                                                                                                                                                                 
+ libcxx_backup=libs/libstdc++.so.6.backup                                                                                                                                                                         
+ '[' -z '' ']'                                                                                                                                                                                                   
+ '[' -e libs/libstdc++.so.6 ']'                                                                                                                                                                                   
++ stty -g                                                                                                                                                                                                         
+ old_tty_settings=5500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0                                                                                                         
+ DISTROFIXES=distro_fixes.sh                                                                                                                                                                                     
+ '[' -r distro_fixes.sh ']'                                                                                                                                                                                       
+ export LD_LIBRARY_PATH=:./hack/libs:./hack                                                                                                                                                                       
+ LD_LIBRARY_PATH=:./hack/libs:./hack                                                                                                                                                                             
+ PRELOAD_LIB=./hack/libdfhack.so                                                                                                                                                                                 
+ case "$1" in                                                                                                                                                                                                     
+ setarch i386 -R env LD_PRELOAD=./hack/libdfhack.so ./libs/Dwarf_Fortress                                                                                                                                         
+ ret=1                                                                                                                                                                                                           
+ stty 5500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0                                                                                                                     
+ echo                                                                                                                                                                                                             
                                                                                                                                                                                                                   
+ '[' -n '' ']'                                                                                                                                                                                                   
+ exit 1
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 11, 2016, 09:53:41 am
Are you saying the df script works?
Title: Re: DFHack 0.40.24-r5
Post by: devek on March 11, 2016, 11:01:53 am
Now that dwarfs socialize as a job instead of going on break, can someone make the "Idlers" count useful in 42?

Title: Re: DFHack 0.40.24-r5
Post by: Rumrusher on March 11, 2016, 06:01:19 pm
it's been awhile so I don't know if this is old news but I just found out dfhack made sites if set to player fort will pop up in the menu for fort mode now.
so you can reclaim a site work on by an adventurer now.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 12, 2016, 07:02:36 am
Now that dwarfs socialize as a job instead of going on break, can someone make the "Idlers" count useful in 42?

That's doable.
Title: Re: DFHack 0.40.24-r5
Post by: kane_t on March 13, 2016, 10:36:54 am
Quick question: is it possible to change artifact names with DFHack?  It looks like they're stored in a separate data structure (artifacts have a ref that gives an artifact ID) but I couldn't find anything in the docs about it.

EDIT: Whoop, I'm an idiot, sorry.  Guess I should've searched the thread, first: df.artifact_record.find(artifact id) in the lua interface.  If I could delete this post I would ;)
DOUBLE-EDIT: For anyone else looking for this information: parts_of_speech in the artifact record indicates which variation of the word in that slot you're using.  So, changing this allows you to use word forms in positions they wouldn't normally be allowed, like plural nouns in the adjective slot.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on March 13, 2016, 03:23:23 pm
no, definitely keep it, if you had a problem then other people might and now you have a searchable post with an easy solution
Title: Re: DFHack 0.40.24-r5
Post by: arbarbonif on March 13, 2016, 04:09:21 pm
Just had an interesting spasm from DFHack.  Version is the one from 42.06.01 Win LazyNewbPack.  I was just setting up some flooring when I got the following in the DFHack window in red text: (pulled from stderr.log)
Code: [Select]
error in __gc metamethod (bad argument #1 to '?' (FILE* expected, got userdata))
table: 38614F00
table: 37BFE690
(invalid error: error in __gc metamethod (bad argument #1 to '?' (FILE* expected, got userdata)))
table: 37D8A890
table: 38616508
table: 383F5A20
table: 383F1510
The table lines continued for several pages in constant rapid stream before I quit the fort and they stopped.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 13, 2016, 05:13:44 pm
Quick question: is it possible to change artifact names with DFHack?  It looks like they're stored in a separate data structure (artifacts have a ref that gives an artifact ID) but I couldn't find anything in the docs about it.

EDIT: Whoop, I'm an idiot, sorry.  Guess I should've searched the thread, first: df.artifact_record.find(artifact id) in the lua interface.  If I could delete this post I would ;)
I really gotta update artifake and figure out what happened with names that makes it not wanna work sometimes. I did add in the specific -item flag for artifacts, real or fake, though.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on March 14, 2016, 06:42:00 pm
For my own curiosity, what's left to fix that makes DFHack 42.06-alpha2 a pre-release version?  Known bugs, things not in structure, or what?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 14, 2016, 07:12:21 pm
We don't know exactly. The main purpose of the alpha releases is for people to be able to test and report issues that need fixing. It seems to be working better than what we did before (that is, trying to test as much as we could on our own and then making a normal release), which is nice.


Just had an interesting spasm from DFHack.  Version is the one from 42.06.01 Win LazyNewbPack.  I was just setting up some flooring when I got the following in the DFHack window in red text: (pulled from stderr.log)
Code: [Select]
error in __gc metamethod (bad argument #1 to '?' (FILE* expected, got userdata))
table: 38614F00
table: 37BFE690
(invalid error: error in __gc metamethod (bad argument #1 to '?' (FILE* expected, got userdata)))
table: 37D8A890
table: 38616508
table: 383F5A20
table: 383F1510
The table lines continued for several pages in constant rapid stream before I quit the fort and they stopped.
Wow, that looks pretty serious. What DFHack tools have you been using (particularly any third-party ones)? Did you replace lua.dll or something? Is it reproducible?
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 14, 2016, 09:01:45 pm
For those using it who are aware of the risks associated with it being a pre-release version, there's a couple things that check for the actual pre-release-warning.lua to be there, and I couldn't find them immediately. So, partially due to my laziness meaning just removing it is a hassle, I knew you could just delete the text in it and save it as a blank file to stop the warning pop-ups.
Title: Re: DFHack 0.40.24-r5
Post by: KillzEmAllGod on March 15, 2016, 07:16:07 pm
Now that dwarfs socialize as a job instead of going on break, can someone make the "Idlers" count useful in 42?

That's doable.
What about the difference between the need (when its purple) and just when they're idleing?
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 16, 2016, 01:56:19 am
Now that dwarfs socialize as a job instead of going on break, can someone make the "Idlers" count useful in 42?

That's doable.
What about the difference between the need (when its purple) and just when they're idleing?

I don't understand this sentence.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on March 16, 2016, 01:57:43 am
"Worship" vs "Worship!"
Title: Re: DFHack 0.40.24-r5
Post by: devek on March 16, 2016, 02:15:35 am
That's obviously what I meant by making idle count useful.

As far as idles is concerned:

1) A purple personal job is the same as being "on break" in the past. It IS NOT idle and will not take new jobs until it finishes its personal business. This works fine.

2) A green personal job is just the dwarf letting off steam while waiting on a job, it IS an idle dwarf but not counted as one. This is wrong.

Since every dwarf will attempt to take a green personal job when idle, the idle count ends up being nearly 0 even in a fort with hundreds of dwarfs doing nothing.. this makes the count useless. Useful would be if green personal jobs were added to the idle count. :D

Title: Re: DFHack 0.40.24-r5
Post by: Roses on March 16, 2016, 02:33:03 pm
Does anyone know if you can put pretty pictures in the in-game gui, or is it limited to just text and simple shapes?
Title: Re: DFHack 0.40.24-r5
Post by: Rumrusher on March 16, 2016, 02:44:29 pm
https://gist.github.com/Rumrusher/0d3ab09089e609e61a43 (https://gist.github.com/Rumrusher/0d3ab09089e609e61a43)
okay so touch up on a old script that use to pull a bunch of preselected civ to now randomly pull a Civ and each time you use it adds more civs to the pool.
so players can finally play a hamlet, or a town, or cave swallow men or ant men and a bunch of random civ sites that you usually would have to mod into dwarf fortress.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 16, 2016, 03:03:49 pm
Does anyone know if you can put pretty pictures in the in-game gui, or is it limited to just text and simple shapes?
Are you just talking about the simple shapes you can build with text or special characters? I'm not aware of anything else you can do, really.

There is a way to draw more complicated stuff on the screen, like the Stonesense overlay does, but it's really complicated and varies depending on the print mode (I don't think anyone's managed to do it in OpenGL print modes yet, which a lot of people use).
Title: Re: DFHack 0.40.24-r5
Post by: Roses on March 16, 2016, 03:26:13 pm
Does anyone know if you can put pretty pictures in the in-game gui, or is it limited to just text and simple shapes?
Are you just talking about the simple shapes you can build with text or special characters? I'm not aware of anything else you can do, really.

There is a way to draw more complicated stuff on the screen, like the Stonesense overlay does, but it's really complicated and varies depending on the print mode (I don't think anyone's managed to do it in OpenGL print modes yet, which a lot of people use).

Yeah, the simple shapes you can make with text and special characters is the fanciest I know of. Was just wondering you could maybe import graphics. Thought maybe that since you can give units graphics you might be able to input something. But not worth it for my project if its Stonesense level complicated.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on March 16, 2016, 03:39:34 pm
Does anyone know if you can put pretty pictures in the in-game gui, or is it limited to just text and simple shapes?
There are few ways to do it. Depends on what you want.
I might find the code for the third one. It's limited but i really liked it.
Basic idea is this: when we have graphics (might be that you could do it with graphics off even...) we put image in some unused unit graphics. Then we just draw those parts.
Edit: also mifki uses offset for code that loads textures into memory so you could have it work without graphics and without hacking any unit graphics...
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 16, 2016, 03:52:27 pm
Putnam did something similar to that to create black-and-white buttons for a mod.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on March 16, 2016, 04:06:16 pm
Here is an example
(http://i.imgur.com/Ft5F04t.png)
How to do it:
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r5
Post by: devek on March 16, 2016, 04:15:30 pm
You mean to say I could have built a fortress of cocks this entire time?
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on March 16, 2016, 05:05:44 pm
Putnam did something similar to that to create black-and-white buttons for a mod.

I have full color images in the SCP mod.
Title: Re: DFHack 0.40.24-r5
Post by: Gorobay on March 16, 2016, 10:00:55 pm
How can a script get the path to itself? The following seems to work but I would rather not use the internal API if there’s another way.
Code: [Select]
local function get_path_hither()
  for path, script in pairs(dfhack.internal.scripts) do
    if script.env.dfhack_flags == dfhack_flags then
      return path
    end
  end
end
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 16, 2016, 10:07:27 pm
"if script.env == _ENV" might work too. I don't know if there is a way, although I could easily expose "path" and "script" to scripts, say as "_PATH", "__path", "__path__", etc.. That obviously won't work in existing DFHack versions, though, so I'm not sure if adding that would be helpful for you currently. (That is a pretty good way to find the script's path, though.)
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on March 19, 2016, 02:35:24 pm
Is there an updated tool for exporting generated raws?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 19, 2016, 05:08:46 pm
A DFHack tool or an external one?
If you're looking to edit generated raws, that's actually pretty easy to do in-game with DFHack (e.g. "gui/gm-editor df.global.world.raws"), although you should definitely make backups if you're trying that.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 19, 2016, 06:28:03 pm
I think he means things like forgotten beasts.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on March 19, 2016, 06:38:44 pm
I just want to look at demon syndromes, but you have the right idea.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 19, 2016, 06:54:00 pm
I think he means things like forgotten beasts.
Yeah, that's what I meant. Assuming their raws are in world.raws, that would be a way of editing them in-game.

If you just want to export them, they're embedded somewhere in world.dat or world.sav. I'm not aware of tools that can decompress and extract raws from those files, but Andux's save tools might be able to. (They're Windows-only, as I recall, although I've been thinking of writing a cross-platform replacement in Go or something.)
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on March 19, 2016, 07:26:12 pm
Andux hasn't updated those tools since 2012. What about export-generated-raws, which is what I used in 0.40?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 19, 2016, 07:34:54 pm
If it worked in 0.40, it should still work - I don't think the compressed raw format has changed at all. If it has, Andux is still around.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on March 19, 2016, 08:28:37 pm
I'll try it. I'm doing research for writing class and I want to see how a particular demon's poison works so I can write it accurately.

EDIT: I can't get it to work, it just crashes instantly after opening. All the files do. I'm on windows.
Title: Re: DFHack 0.40.24-r5
Post by: Greiger on March 20, 2016, 01:12:15 am
Maybe I'm misunderstanding but I still seem to be able to see generated creature raws just by loading up world.sav in a text editor.  Only issue is that the save needs to be uncompressed, which I think you can do in an existing world by just setting the uncompressed saves init option, loading a world and then re-saving.

It's a little bit of a slog finding exactly the right creature, and it's not as nicely formatted as the actual raws, but they are there. 
If you try this method I would recommend copying some lines from the description and trying to do a find in the file.  the generated raws are all plain text in the file. including a [DESCRIPTION:x] flag.  So trying to find a relatively unique line from the description should locate it.

Oh and don't try to edit anything in that file, yer save will probably break.  Even though there is plain text in the file, most of it is still not text formatted, and at least in my experience text editors fail to format everything right after an edit.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on March 20, 2016, 08:07:07 am
I've never been able to, even on an uncompressed save.
Title: Re: DFHack 0.40.24-r5
Post by: Greiger on March 20, 2016, 11:06:05 am
Odd maybe it's a feature of notepad++ then.  *tries* *successfully finds  forgotten beast raws using builtin windows notepad* what kind of text editor are you using?  If windows notepad can pull these up successfully I imagine anything can.

Heck it looks like it contains raws for the random instruments now too.

It's pretty much just a matter of ignoring the garbage data and imagining each tag in it's own line.

Code: ( an example of a forgotten beast, straight copy and pasted from basic windows notepad) [Select]
[CREATURE:FORGOTTEN_BEAST_1] [GENERATED] [FEATURE_BEAST] [ATTACK_TRIGGER:0:0:50000]7 [NAME:forgotten beast:forgotten beasts:forgotten beast]= [CASTE_NAME:forgotten beast:forgotten beasts:forgotten beast] [NO_GENDER] [CARNIVORE] [DIFFICULTY:10] [NATURAL_SKILL:WRESTLING:6] [NATURAL_SKILL:BITE:6] [NATURAL_SKILL:GRASP_STRIKE:6] [NATURAL_SKILL:STANCE_STRIKE:6] [NATURAL_SKILL:MELEE_COMBAT:6] [NATURAL_SKILL:DODGING:6]' [NATURAL_SKILL:SITUATIONAL_AWARENESS:6] [AMPHIBIOUS] [BIOME:SUBTERRANEAN_CHASM] [PETVALUE:2000] [GRASSTRAMPLE:20] [BUILDINGDESTROYER:2] [ALL_ACTIVE] [SWIMS_INNATE] [TRAPAVOID] [NOPAIN] [NOSTUN]
 [NONAUSEA] [NOFEAR] [NOEXERT] [NO_DIZZINESS] [NO_FEVERS] [LARGE_PREDATOR] [SPHERE:CAVERNS] [SPHERE:DISEASE] [BODY_SIZE:0:0:10000000] [CREATURE_TILE:83]Á [BODY:RCP_CEPHALOTHORAX:RCP_ABDOMEN:RCP_FIRST_SIMPLE_LEGS:RCP_SECOND_SIMPLE_LEGS:RCP_THIRD_SIMPLE_LEGS:RCP_PINCERS:RCP_3_TAILS:RCP_1_EYE:RCP_HEART:RCP_GUTS:RCP_BRAIN:RCP_MOUTH:RCP_TAIL_STINGER]% [BODY_DETAIL_PLAN:STANDARD_MATERIALS] [REMOVE_MATERIAL:HAIR] [REMOVE_MATERIAL:SKIN]. [USE_MATERIAL_TEMPLATE:CHITIN:CHITIN_TEMPLATE]# [BODY_DETAIL_PLAN:STANDARD_TISSUES] [REMOVE_TISSUE:HAIR] [REMOVE_TISSUE:SKIN], [USE_TISSUE_TEMPLATE:CHITIN:CHITIN_TEMPLATE]> [BODY_DETAIL_PLAN:EXOSKELETON_TISSUE_LAYERS:CHITIN:FAT:MUSCLE]* [BODY_DETAIL_PLAN:STANDARD_HEAD_POSITIONS]* [BODY_DETAIL_PLAN:HUMANOID_HEAD_POSITIONS]$ [BODY_DETAIL_PLAN:HUMANOID_RELSIZES], [USE_MATERIAL_TEMPLATE:SINEW:SINEW_TEMPLATE]& [TENDONS:LOCAL_CREATURE_MAT:SINEW:200]( [LIGAMENTS:LOCAL_CREATURE_MAT:SINEW:200] [HAS_NERVES] [HOMEOTHERM:10040] [SELECT_MATERIAL:CHITIN]# [STATE_COLOR:ALL_SOLID:BURNT_UMBER]
 [COLOR:6:0:0]- [SELECT_TISSUE_LAYER:HEART:BY_CATEGORY:HEART], [PLUS_TISSUE_LAYER:SCALE:BY_CATEGORY:THROAT] [TL_MAJOR_ARTERIES], [USE_MATERIAL_TEMPLATE:ICHOR:ICHOR_TEMPLATE]' [BLOOD:LOCAL_CREATURE_MAT:ICHOR:LIQUID] [CREATURE_CLASS:GENERAL_POISON]8 [USE_MATERIAL_TEMPLATE:POISON:CREATURE_EXTRACT_TEMPLATE] [ENTERS_BLOOD]
 [SYNDROME] [SYN_NAME:beast sickness]# [SYN_AFFECTED_CLASS:GENERAL_POISON]+ [SYN_IMMUNE_CREATURE:FORGOTTEN_BEAST_1:ALL] [SYN_INJECTED]
 [SYN_CONTACT]
 [SYN_INHALED] [SYN_INGESTED]N [CE_PAIN:SEV:100:PROB:100:START:782:PEAK:1962:END:3858:LOCALIZED:SIZE_DILUTES]g [CE_IMPAIR_FUNCTION:SEV:100:PROB:100:START:551:PEAK:972:END:3508:BP:BY_CATEGORY:ALL:BRAIN:SIZE_DILUTES]+ [ATTACK:PINCER:BODYPART:BY_CATEGORY:PINCER] [ATTACK_SKILL:GRASP_STRIKE] [ATTACK_VERB:snatch:snatches] [ATTACK_CONTACT_PERC:100] [ATTACK_PENETRATION_PERC:100]  [ATTACK_PREPARE_AND_RECOVER:2:2] [ATTACK_FLAG_EDGE] [ATTACK_PRIORITY:MAIN] [ATTACK_FLAG_CANLATCH] [ATTACK_FLAG_WITH]% [ATTACK:KICK:BODYPART:BY_TYPE:STANCE] [ATTACK_SKILL:STANCE_STRIKE] [ATTACK_VERB:kick:kicks] [ATTACK_CONTACT_PERC:100]  [ATTACK_PREPARE_AND_RECOVER:2:2] [ATTACK_FLAG_WITH] [ATTACK_PRIORITY:MAIN] [ATTACK_FLAG_BAD_MULTIATTACK]+ [ATTACK:STING:BODYPART:BY_CATEGORY:STINGER] [ATTACK_SKILL:STANCE_STRIKE] [ATTACK_VERB:sting:stings] [ATTACK_CONTACT_PERC:5] [ATTACK_PENETRATION_PERC:100]  [ATTACK_PREPARE_AND_RECOVER:2:2] [ATTACK_FLAG_EDGE] [ATTACK_PRIORITY:MAIN]G [SPECIALATTACK_INJECT_EXTRACT:LOCAL_CREATURE_MAT:POISON:LIQUID:100:100]( [ATTACK:BITE:BODYPART:BY_CATEGORY:MOUTH] [ATTACK_SKILL:BITE] [ATTACK_VERB:bite:bites] [ATTACK_CONTACT_PERC:100]  [ATTACK_PREPARE_AND_RECOVER:2:2] [ATTACK_PRIORITY:MAIN] [ATTACK_FLAG_CANLATCH]] [GAIT:SWIM:Maximum Swim Speed:725:10:3:2175:50:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:50]V [GAIT:SWIM:Faster Swim:1450:5:3:2175:10:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:20]V [GAIT:SWIM:Fast Swim:2175:NO_BUILD_UP:5:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:10]# [GAIT:SWIM:Swim:2900:NO_BUILD_UP:0]( [GAIT:SWIM:Slow Swim:3900:NO_BUILD_UP:0], [GAIT:SWIM:Creeping Swim:5900:NO_BUILD_UP:0]V [GAIT:WALK:Fastest Walk:225:10:3:675:50:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:50]T [GAIT:WALK:Faster Walk:450:5:3:675:10:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:20]U [GAIT:WALK:Fast Walk:675:NO_BUILD_UP:5:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:10]" [GAIT:WALK:Walk:900:NO_BUILD_UP:0]( [GAIT:WALK:Slow Walk:1900:NO_BUILD_UP:0]+ [GAIT:WALK:Slowest Walk:2900:NO_BUILD_UP:0]S [GAIT:CRAWL:Scramble:225:10:3:675:50:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:50]V [GAIT:CRAWL:Faster Crawl:450:5:3:675:10:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:20]W [GAIT:CRAWL:Fast Crawl:675:NO_BUILD_UP:5:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:10]$ [GAIT:CRAWL:Crawl:900:NO_BUILD_UP:0]* [GAIT:CRAWL:Slow Crawl:1900:NO_BUILD_UP:0]% [GAIT:CRAWL:Creep:2900:NO_BUILD_UP:0]S [GAIT:CLIMB:Scramble:225:10:3:675:50:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:50]V [GAIT:CLIMB:Faster Climb:450:5:3:675:10:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:20]W [GAIT:CLIMB:Fast Climb:675:NO_BUILD_UP:5:LAYERS_SLOW:STRENGTH:AGILITY:STEALTH_SLOWS:10]$ [GAIT:CLIMB:Climb:900:NO_BUILD_UP:0]* [GAIT:CLIMB:Slow Climb:1900:NO_BUILD_UP:0]% [GAIT:CLIMB:Creep:2900:NO_BUILD_UP:0]ž [DESCRIPTION:A great one-eyed scorpion.  It has three short tails and it is slavering.  Its burnt umber exoskeleton is leathery.  Beware its poisonous sting!]

Maybe that will help locate it if it was just a matter of not being able to find the stuff in the wall of tags note that the description is at the END of the entry.

EDIT: It seems posting that has disabled my quick modify button for this post. I pasted it with the garbage data between lines intact (though the forum seemed to have ignored them) but it might still be messing with the forum software.  Let me know if things on this page seem to break and I'll remove it.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on March 20, 2016, 01:21:50 pm
Alright, I'll give it another try.
Title: Re: DFHack 0.40.24-r5
Post by: kane_t on March 22, 2016, 09:53:25 am
Has anybody figured out a way to manually create written quires in Fortress Mode?

I've done a little research myself:

The wall I hit was that itemimprovement_writingst.anon_1 has the same name as an anonymous field in a base class, which is some type of number.  Because of this, I can't reference the vector field (Lua just only understands .anon_1 as the base class field), and the gm-editor won't let me insert primitive types (like int32), so there's no way for me to insert a new field into the vector.  Also, I'm not entirely sure where the written_content entries are stored.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on March 22, 2016, 04:50:17 pm
I can't even decompress my save, even though I set compressed saves to no and made and retired an adventurer. What gives?
Title: Re: DFHack 0.40.24-r5
Post by: KillzEmAllGod on March 23, 2016, 03:44:45 am
Getting a crash now and then when going to some units through to unit menu as well as when pressing v to inspect or examining creatures. Mostly seems to happen to creatures on different z levels, think it might be with some of the DFHack options on some of these things.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 23, 2016, 05:47:11 am
Are you using TwbT?
Title: Re: DFHack 0.40.24-r5
Post by: KillzEmAllGod on March 23, 2016, 07:11:45 pm
No just the default stuff with alpha 2.
Title: Re: DFHack 0.40.24-r5
Post by: Gorobay on March 23, 2016, 09:22:19 pm
How can I find the phase of a generated material at a given temperature? Here is what I have tried:
Code: [Select]
[lua]# m=df.inorganic_raw.find(300).material
[lua]# ~m.state_name
<string[]: 0x177ce2e8>
Solid                    = frozen fetid filth
Liquid                   = fetid filth
Gas                      = boiling fetid filth
Powder                   = frozen fetid filth
Paste                    = frozen fetid filth
Pressed                  = frozen fetid filth
[lua]# ~m.heat
<material_common.T_heat: 0x177ce2b4>
spec_heat                = 4181
heatdam_point            = 60001
colddam_point            = 60001
ignite_point             = 60001
melting_point            = 60001
boiling_point            = 60001
mat_fixed_temp           = 10000
It seems this material has no melting or boiling points, so how does DF know which state_name to use?
Title: Re: DFHack 0.40.24-r5
Post by: mifki on March 23, 2016, 09:32:43 pm
It seems this material has no melting or boiling points, so how does DF know which state_name to use?

It has fixed temperature, so.. um.. temperature/state is always the same.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 23, 2016, 09:55:06 pm
nvm... what Putnam said.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on March 23, 2016, 09:55:35 pm
And it only appears in the form of rain, probably, or maybe a LIQUID_GLOB or UNDIRECTED_VAPOR or TRAILING_VAPOR_FLOW.
Title: Re: DFHack 0.40.24-r5
Post by: Gorobay on March 23, 2016, 10:11:56 pm
It has fixed temperature, so.. um.. temperature/state is always the same.
Clearly. But which state is it always in?

I know that this example is an evil rain and will always be a liquid, but I want a script to determine this automatically for any material.
Title: Re: DFHack 0.40.24-r5
Post by: mifki on March 23, 2016, 10:50:50 pm
It has fixed temperature, so.. um.. temperature/state is always the same.
Clearly. But which state is it always in?

I know that this example is an evil rain and will always be a liquid, but I want a script to determine this automatically for any material.

Ah, sure.. well, if it doesn't have melting point, then, I'd say it doesn't melt, so it's solid.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on March 24, 2016, 08:54:38 am
How can I find the phase of a generated material at a given temperature? Here is what I have tried:
-snop-
It seems this material has no melting or boiling points, so how does DF know which state_name to use?
How did you get that information?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 24, 2016, 09:12:14 am
From the lua interpreter:
Code: [Select]
[lua]# m=df.inorganic_raw.find(300).material
[lua]# ~m.state_name
<string[]: 0x177ce2e8>
Solid                    = frozen fetid filth
Liquid                   = fetid filth
Gas                      = boiling fetid filth
Powder                   = frozen fetid filth
Paste                    = frozen fetid filth
Pressed                  = frozen fetid filth
[lua]# ~m.heat
<material_common.T_heat: 0x177ce2b4>
spec_heat                = 4181
heatdam_point            = 60001
colddam_point            = 60001
ignite_point             = 60001
melting_point            = 60001
boiling_point            = 60001
mat_fixed_temp           = 10000

I assume 60001 corresponds to no melting/boiling point.
Title: Re: DFHack 0.40.24-r5
Post by: Gorobay on March 24, 2016, 05:41:40 pm
I assume 60001 corresponds to no melting/boiling point.
That is what it means, according to the wiki (http://dwarffortresswiki.org/index.php/DF2014:Temperature#Temperature_scale).

For now, I have decided to use a text-based heuristic (https://github.com/dscorbett/dfhack-scripts/blob/1e9e965e10426d9fdea2395b33cc06916c0c0f44/babel.lua#L5121) which should work until Toady changes the generated material name format.
Title: Re: DFHack 0.40.24-r5
Post by: alyas0 on March 25, 2016, 12:10:44 pm
Whenever I try to launch Dwarf Fortress with DFHack I just get the regular menu and no command line. Did I install it incorrectly?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 25, 2016, 02:05:36 pm
Maybe. What OS are you using?
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 26, 2016, 11:42:32 pm
Since I can't target a regional interaction from a creature, is there a way from DFHack to (1) know if it's raining and (2) make it rain on queue?  I already know how to make the script run at the right time, just not how to read/write the weather.

I'm fine with the rain turning out to be snow if it's cold, but if it can be either then it would make more sense for it to be actual liquid rain.


And weather.lua was right there in front of me.  Nevermind me, go about your regular business...
Title: Re: DFHack 0.40.24-r5
Post by: argo on March 29, 2016, 06:32:57 am
Could some kind soul perhaps add a feature to prioritize the designations made from digv and friends (digvx, digl etc)? Currently, when I designate some digging with priority 1 and have a designation made from digv (which doesn't seem to have a priority), the miners randomly change between them (which is kinda annoying).

Also, thanks a lot for the work you guys put into it.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on March 29, 2016, 07:03:05 am
Could some kind soul perhaps add a feature to prioritize the designations made from digv and friends (digvx, digl etc)? Currently, when I designate some digging with priority 1 and have a designation made from digv (which doesn't seem to have a priority), the miners randomly change between them (which is kinda annoying).

Known issue, which certainly deserves some attention:  https://github.com/DFHack/dfhack/issues/481

(maybe feature requests should move off the issue tracker?  they tend to hang around forever and hide the actual bugs)
Title: Re: DFHack 0.40.24-r5
Post by: argo on March 29, 2016, 09:36:56 am
Could some kind soul perhaps add a feature to prioritize the designations made from digv and friends (digvx, digl etc)? Currently, when I designate some digging with priority 1 and have a designation made from digv (which doesn't seem to have a priority), the miners randomly change between them (which is kinda annoying).

Known issue, which certainly deserves some attention:  https://github.com/DFHack/dfhack/issues/481

(maybe feature requests should move off the issue tracker?  they tend to hang around forever and hide the actual bugs)
I looked at the github issue tracker, but decided it was better to post it here instead. Last update was november 2015 which is a while ago...

I'm no expert on stuff like this, but... Wouldn't it be relatively straightforward to implement the feature so one could do digv 2 to dig with a priority of 2.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on March 29, 2016, 11:08:05 am
Could some kind soul perhaps add a feature to prioritize the designations made from digv and friends (digvx, digl etc)? Currently, when I designate some digging with priority 1 and have a designation made from digv (which doesn't seem to have a priority), the miners randomly change between them (which is kinda annoying).

Known issue, which certainly deserves some attention:  https://github.com/DFHack/dfhack/issues/481

(maybe feature requests should move off the issue tracker?  they tend to hang around forever and hide the actual bugs)
I looked at the github issue tracker, but decided it was better to post it here instead. Last update was november 2015 which is a while ago...

I'm no expert on stuff like this, but... Wouldn't it be relatively straightforward to implement the feature so one could do digv 2 to dig with a priority of 2.
It's not as straightforward as it might seem. Digging priority is saved differently from the rest of data. You would need to manage that. It's not very hard but a bit annoying.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 29, 2016, 12:04:00 pm
November was the last stable release. The last code update (on the develop branch) was about 12 hours ago.

Regarding the issue tracker, searching for the "bug" label is straightforward enough.
Title: Re: DFHack 0.40.24-r5
Post by: nimbus25 on March 29, 2016, 03:20:38 pm
Just decided to try the newest version of DF (I last played 40.24), and I installed DF Hack, extracted into my df 42.06 folder, and now when I run DF, it says it's not a known release, then DF crashes (which it does not do without DF Hack).
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 29, 2016, 04:02:05 pm
"tweak advmode-contained" seems to be causing crashes (e.g. this (https://github.com/DFHack/dfhack/issues/883)) due to a structure problem. It's possible that other things could crash too because of that, but I recommend running "tweak advmode-contained disable" or commenting out any "tweak advmode-contained" lines in dfhack.init for now.

Just decided to try the newest version of DF (I last played 40.24), and I installed DF Hack, extracted into my df 42.06 folder, and now when I run DF, it says it's not a known release, then DF crashes (which it does not do without DF Hack).
What DFHack version are you using? (Regardless of that, DF shouldn't crash if DFHack disables itself, although that seems to happen on Windows for some reason.)
Title: Re: DFHack 0.40.24-r5
Post by: nimbus25 on March 29, 2016, 04:17:47 pm

What DFHack version are you using? (Regardless of that, DF shouldn't crash if DFHack disables itself, although that seems to happen on Windows for some reason.)


40.24-r5, which is what the download link sent me to

EDIT: dug around in the github page and found 42.06 alpha2, which does indeed work
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 29, 2016, 11:51:16 pm
I was going to bump the isoworld thread but it's pretty out of date, does anybody have an unofficial linux build or maybe even an arch build that works? I've compiled it with all the instructions listed in the thread there and it winds up doing everything up until it starts spitting out errors regarding... crap I can't even find the error logs from all the crap I tried to fix it.

There were several errors about the icon and other resources which were in the folders but for some reason it didn't show up in the cmake build.

I'll try the build again tomorrow when the AC kicks back on, it'll get hot right now if I try, and that'll let me post the errors. I was doing the full build with dfhack (which is a functioning dfhack version btw: DFHack is ready. Have a nice day!
DFHack version 0.42.06-alpha2 (development build 0.42.06-alpha2-48-g85cfaa6)
Type in '?' or 'help' for general help, 'ls' to see all commands.) as well as trying to build it by itself and such.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on March 30, 2016, 12:07:53 am
Isoworld is pretty broken at the moment, but some of the errors are probably relating to allegro.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 30, 2016, 06:31:27 am
Rats, I cleared the allegro errors incidentally by way of ccmake helping me figure out what was going on better.

YES I AM NOOB AND USED CCMAKE INSTEAD OF PURE CLI, APOLOGY!
Title: Re: DFHack 0.40.24-r5
Post by: Rose on March 30, 2016, 07:44:07 am
What are the other compiler errors?

Also if you want it to work properly after compiling, you need to get the latest updates from my branch.

I just recently got it to recognize the new naming scheme in DF.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 30, 2016, 08:18:43 am
Yeah, I was pulling them from your branch with git, plus the agui stuff, but it's at that weird temperature right now where it gets hot as shit upstairs but the ac won't kick on til it hits 15 or 16 outside so I can't see what the errors are yet. I'll try it later and see if that fixes it but I remember it was doing something about not being able to find the icons or something?

Ok, ac is on, everythings chilly, let it build, went through these steps:

removed my dfhack folder
git clone dfhackblah
git checkout develop
git update blah
cd plugins
rm -r isoworld
git clone japaisoworldblah
cd isoworld
rm -r agui
git clone jmasterxaguiblah
cd agui
mkdir lib
cd lib
etc
etc
etc
Did the make for agui, that worked, did the whole thing and wound up back at dfhack/build, did the whole make there, it runs, gets to 95% and then:
Spoiler (click to show/hide)
Splut.
Title: Re: DFHack 0.40.24-r5
Post by: WaffleEggnog on March 30, 2016, 05:36:11 pm
I get a message saying that DFhack cannot recognize my version of DF. DF then promptly crashes. What's up? I'm using the latest release.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 30, 2016, 05:44:50 pm
I get a message saying that DFhack cannot recognize my version of DF. DF then promptly crashes. What's up? I'm using the latest release.
Please specify exactly which DFHack release you're using. If it's 0.40.24-r5, that's not the latest release. There are alpha releases for 0.42.06 on Github: https://github.com/DFHack/dfhack/releases/

(Someone else experienced this problem less than 10 posts before yours, by the way.)
Title: Re: DFHack 0.40.24-r5
Post by: NW_Kohaku on March 30, 2016, 09:20:15 pm
Out of curiosity, what still stands between the latest alpha release and being a "stable release" right now?  Is there anything that you want testing on, or anything to watch for?
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on March 30, 2016, 09:44:11 pm
When the most recent two releases were published there was less testing than normal. I was away so there wasn't much testing on Windows, for example. It certainly seems stable. I'm working on another release in a few weeks that will probably be a "real" release. Hopefully I'll beat Toady to it or it'll be a bit later.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on March 30, 2016, 09:52:29 pm
I'm working on another release in a few weeks that will probably be a "real" release. Hopefully I'll beat Toady to it or it'll be a bit later.

This is great news - I'll finally get to update the stable starter pack  :D
Title: Re: DFHack 0.40.24-r5
Post by: NW_Kohaku on March 30, 2016, 10:01:30 pm
Is there anything I could help test, or at the least, look for as something not yet thoroughly tested?  (I am on Windows 7, myself.)
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 30, 2016, 10:18:40 pm
There are a couple newly-identified problems that would end up preventing a 'stable' release until they're resolved (e.g. the tweak issue I mentioned above). I probably would have done an alpha3 release if I hadn't run into them, though, but that'll be pushed back a bit too.

Really, just using DFHack tools and finding ways that they reliably crash is most helpful. In theory, as long as the basic stuff is working on all platforms, most playtesting should be equivalent regardless of the platform, and it's pretty obvious when basic stuff is broken (except possibly in the case of newer structures that haven't been checked across platforms).
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on March 30, 2016, 10:47:16 pm
Well, the only semi-reliable crashes I get are on trying to quit the game from the main menu (from a save or aborting the arena).  No idea if it's DFHack related or not... I just think of it as the game punishing me for daring to do something else with my time.
Title: Re: DFHack 0.40.24-r5
Post by: devek on March 31, 2016, 04:36:31 am
I get a pretty constant crash when placing furniture(doors, beds, armor stands). I can never reproduce it intentionally, but I save now before building every time because it happens enough.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 31, 2016, 05:50:27 am
Some people have attributed that one to TwbT, so you could see if disabling that helps.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 31, 2016, 10:07:12 am
The only thing I've noticed isn't actually a crash and it's not REALLY hanging, but if you have tiletypes (or possibly liquids or other similar plugins) open and try to quit the game won't actually shut down until you q out of the active plugin. Could honestly be deliberate though, since it can save tiletypes settings between saves and such this way, but I don't use twbt either due to the adventurer mode issues with it.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on March 31, 2016, 01:43:08 pm
Yeah, that's a pretty old issue with plugins that use the line editing system. (I started to rewrite parts of that at one point, but I don't think I managed to figure out what was causing that or if it's platform-specific).
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on March 31, 2016, 01:47:17 pm
Yeah, like I said it's not actually a bad bug, and I do have times where I leave tiletypes open between saving/reloading a world so that's actually kinda handy having it keep the settings, just confusing sometimes when you're trying to hit quit and it won't shut down, but you can change the selector and such so it's obviously not frozen.
Title: Re: DFHack 0.40.24-r5
Post by: Robsoie on April 02, 2016, 11:35:42 pm
When playing long session with my fortress (i let it run in the background while i'm browsing) , i noticed half of the time when i want to quit DF, at the end of the save process, things just crash.
(playing with dfhack 42.06 alpha-2, i do not have made any custom dfhack init, so it's using the default)
oddly the saved game is never corrupted as i could load and play without problem on my next DF session.

I have no idea if the crash is linked to dfhack, as i've been playing long fortress on df42.06 only since a few weeks (as my early 42.06 games were more about testing or short lived stuff), and immediately grabbed dfhack (my precious autodump destroy/clean map, i need my precious)
Title: Re: DFHack 0.40.24-r5
Post by: tapk on April 03, 2016, 07:06:20 pm
I get a pretty constant crash when placing furniture(doors, beds, armor stands). I can never reproduce it intentionally, but I save now before building every time because it happens enough.
Same annoying bug. Really bothers because of randomness: you can build a lot of stuff and suddenly - crash, start over.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 03, 2016, 08:05:18 pm
Are you sure that that's related to DFHack and is not related to TwbT?
Title: Re: DFHack 0.40.24-r5
Post by: KillzEmAllGod on April 03, 2016, 09:51:20 pm
Is TwbT turned on by default for the alpha?
Really feels like its some of the extra things that DFHack adds to menus.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 03, 2016, 10:33:09 pm
TwbT is not distributed with the alpha.
What extra things in particular? buildingplan? automaterial? You could try running "disable buildingplan" or "disable automaterial" to test and see if either of those fix the issue.
Title: Re: DFHack 0.40.24-r5
Post by: NW_Kohaku on April 03, 2016, 10:43:52 pm
What is it about TwbT that makes it so crash-prone that it seems to be the default answer to any crash, anyway?
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on April 03, 2016, 11:04:20 pm
What is it about TwbT that makes it so crash-prone that it seems to be the default answer to any crash, anyway?

Super-duper tricky messing with graphics code - up to outright replacing bits - and a massive amount of data access for multilevel rendering.

But mostly that it's a third-party plugin with much less testing than most DFHack code.
Title: Re: DFHack 0.40.24-r5
Post by: KillzEmAllGod on April 04, 2016, 01:24:28 am
Is there anything that can change evil rain to normal rain?
Title: Re: DFHack 0.40.24-r5
Post by: tapk on April 04, 2016, 01:43:00 am
Are you sure that that's related to DFHack and is not related to TwbT?
Not really. Bug is pure random, so I can't say for sure if it will repeat with TWBT turned off and dfhack turned on.
TwbT is not distributed with the alpha.
What extra things in particular? buildingplan? automaterial? You could try running "disable buildingplan" or "disable automaterial" to test and see if either of those fix the issue.
I'll try to test more.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 06, 2016, 07:43:43 pm
Hmmm.

The trick mifki showed me doesn't work now.

Code: [Select]
choices=df.new(df.viewscreen_layer_choose_language_namest) ; choices.subscreen = 3 ;Now it spits out:
Code: [Select]
/home/thefunk/.df/hack/scripts/names.lua:43: Cannot write field viewscreen_layer_choose_language_namest.subscreen: not found.
I can't figure out what got renamed because I didn't fully understand the wizardry mifki pulled off in the first place.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 06, 2016, 09:41:57 pm
I don't know if there's ever been a subscreen field in viewscreen_layer_choose_language_namest. There was one in viewscreen_setupadventurest, but it was replaced.
What is that supposed to do?

Also, df.viewscreen_layer_choose_language_namest:new() is a shorter alternative to df.new(df.viewscreen_layer_choose_language_namest).
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 06, 2016, 10:12:19 pm
That's what I was looking for, it was a trick mifki showed me to pull up the actual name selection screen with the full random functions and dictionaries.

Man, that enum+subscreen > compound change has exhausted my dfhackery. I can't figure out how to translate the old stuff.subscreen[3] into the newstuff.language_name or newstuff.adventurer.name or what.
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on April 09, 2016, 01:18:02 pm
Hey, I am trying to make prepackaged versions of my mod (including DFHack) for all 3 OSes, but am running into a snag: I cannot extract the linux version because it has symbolic links. Any way around this other than telling the user to manually install DFHack themselves?

Sorry if this isn't the most appropriate place for this question, but it's still about DFHack, even if tangentially.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 09, 2016, 01:35:55 pm
What entries are symbolic links?

Edit: Oh, looks like just the allegro libraries, which are in the OS X distribution too. Those links *need* to be there, though - what are you using to extract the archives?

I suppose it would be possible to recreate the symlinks in the startup script on Linux and OS X, if it's absolutely necessary.
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on April 09, 2016, 01:49:09 pm
what are you using to extract the archives?
7zip.

If it's more trouble than its worth to fix (apparently same error happens when trying to extract DF's (not DFHack) OSX version, so probably), I'll just have to add install instructions and hope people have no trouble following them.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 09, 2016, 02:21:47 pm
There are nearly identical symlinks in the Linux and OS X DFHack packages (e.g. liballegro.5.0.dylib -> liballegro.dylib), so you should run into the same issue. I'm guessing the issue in the OS X DFHack package is libs/SDL.framework/SDL -> libs/SDL.framework/Versions/A/SDL (and similar links for SDL_image and SDL_ttf), and those are more important, so I'm really not sure what a good solution there is.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on April 09, 2016, 05:48:05 pm
I suppose it would be possible to recreate the symlinks in the startup script on Linux and OS X, if it's absolutely necessary.

This sounds like a good idea to me; there are so many ways for symlinks to go missing when DFHack is redistributed that it's bound to happen.
Title: Re: DFHack 0.40.24-r5
Post by: Loci on April 10, 2016, 12:41:06 pm
I'm running v0.42.06 with the v 0.42.06-alpha1 (release) of DFHack. Several times now I've experienced a crash when pressing the 'v' key (view units) following one or more save/load cycles (not quicksaves). Is this a known issue?

I'll try updating to the alpha2 version and see if it still crashes.
Title: Re: DFHack 0.40.24-r5
Post by: Goatmaan on April 10, 2016, 11:27:30 pm
I'm playing a 40.19 r2 lazy newb pack fort.
On the dfhack tab I have performance tweaks on.(dump worn items, remove all contaminants)
does the remove contaminants command stop the need/use of soap?
If it does, how do I stop it and keep the dump items part?

Also what is... found total 192472 items?
   Cleaned 105 of 30456 map blocks? (Of what?)
   Removed 1042 contaminants from 65 creatures?

infections are rampant in my fort, and with 682 adults,248 kids,15 babies its way past time to find the cause.

   Goatmaan
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on April 10, 2016, 11:39:25 pm
You can see the exact DFHack commands this runs by reading "LNP/PyLNP.json", and cross-referencing them with the DFHack readme.

Respectively total items in you fort, cleaned that much mud or contaminants from tiles and creatures.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 11, 2016, 01:08:44 am
I don't know if there's ever been a subscreen field in viewscreen_layer_choose_language_namest. There was one in viewscreen_setupadventurest, but it was replaced.
What is that supposed to do?

Also, df.viewscreen_layer_choose_language_namest:new() is a shorter alternative to df.new(df.viewscreen_layer_choose_language_namest).
Hmmm, I've poked around more in the structures and with gm-editor to explore it but I'm still stumped, what would be the equivalent to the old subscreen[3]? It isn't the pages as far as I can tell, since the names field is opened up off of the background page.
Title: Re: DFHack 0.40.24-r5
Post by: Goatmaan on April 11, 2016, 03:09:16 am
I figured that 200k was items.
But the soap vs. Clean command?
I disabled cleaning, to see if soap usage starts. Harvest time will provide plenty of puke cleaning jobs.
Time for an across the board item purge.
First infinite usage item consumer turned on?
SOAP.

    Goatmaan
Title: Re: DFHack 0.40.24-r5
Post by: perkel on April 11, 2016, 05:08:48 pm
trying to take screenshots when using stonesense (ctrl+f5) but screenshots don't show up anywhere...

Anyone knows where are those screenshots ?
Title: Re: DFHack 0.40.24-r5
Post by: indyofcomo on April 12, 2016, 06:58:06 am
probably in your clipboard. You'll have to paste them into new image file.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on April 12, 2016, 08:06:42 am
Stonesense screenshots are saved to your DF folder, called "screenshot1.png" (2, 3, 4...).

Make sure you read the feedback in the DFHack prompt, as sometimes you'll need to zoom out and try again.
Title: Re: DFHack 0.40.24-r5
Post by: perkel on April 12, 2016, 06:11:29 pm
nvm found it
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on April 12, 2016, 07:13:14 pm
Spoiler: nvm found it (click to show/hide)
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on April 12, 2016, 07:56:01 pm
WEAPON:ITEM_WEAPON_SWORD_SHORT, not ITEM_WEAPON.

I would use (by which I mean I use) gui/create-item.
Title: Re: DFHack 0.40.24-r5
Post by: tapk on April 12, 2016, 09:10:47 pm
Are you sure that that's related to DFHack and is not related to TwbT?
Not really. Bug is pure random, so I can't say for sure if it will repeat with TWBT turned off and dfhack turned on.
TwbT is not distributed with the alpha.
What extra things in particular? buildingplan? automaterial? You could try running "disable buildingplan" or "disable automaterial" to test and see if either of those fix the issue.
I'll try to test more.
I tested a bit on two different computers (different LNP installs, different saves). The bug indeed appears only with TWBT turned on, and without TWBT (print mode:2D) all seems to work fine.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 12, 2016, 09:40:43 pm
Here's a beta release: https://github.com/DFHack/dfhack/releases/tag/0.42.06-beta1

r1 will probably happen soon unless there's a nasty issue with that that warrants another beta release.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on April 12, 2016, 10:02:13 pm
Here's a beta release: https://github.com/DFHack/dfhack/releases/tag/0.42.06-beta1

r1 will probably happen soon unless there's a nasty issue with that that warrants another beta release.
The devs' efforts are much appreciated!

Excuse me, I'm going to wear out my F5 key "waiting" for r1... :)
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 12, 2016, 10:16:56 pm
There's a bot that announces those sorts of things in the IRC channel (#dfhack on freenode), by the way.
Title: Re: DFHack 0.40.24-r5
Post by: mifki on April 12, 2016, 11:05:33 pm
What's the status of support for new 0.42 features/screens in DFHack? Need to make Remote work with .42 but not much point if the actual new stuff won't be accessible.
Title: Re: DFHack 0.40.24-r5
Post by: Aussiemon on April 13, 2016, 12:35:29 am
Crash at save in 0.42.06-alpha2. I've just seen that you've released an update, but this might still be helpful.

Here is the crash log:
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 13, 2016, 01:00:02 am
What's the status of support for new 0.42 features/screens in DFHack? Need to make Remote work with .42 but not much point if the actual new stuff won't be accessible.
I think everything is just about accessible and even named right.

Heyyy, you wouldn't happen to know what changed from the df.viewscreen_setupadventurerst.subscreen[3] trick that broke pulling up the name selection screen with the new pages layout would you?
Title: Re: DFHack 0.40.24-r5
Post by: dhthwy on April 13, 2016, 03:16:50 am
I went and grabbed the latest dfhack version hoping I'd be able to mark items for trading from the extended stocks screen. It is greyed out and still is in the beta. I really miss that feature. Is it working for anyone else?
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 13, 2016, 05:23:54 am
Alright, familiarized myself a little bit with DFHack and did few tests with it.

Point is, I need 'elevate-physical' and 'elevate-mental' plus 'make-legendary' scripts to buff it all up to the very max of 5000 and not 4000 or 2000 something. :-\

EDIT: Erhm.. re-checked the skill max limit and yeah, I just need the very max abilities is all and I suck even more with coding than making/adding reactions and custom creatures in DF.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 13, 2016, 06:54:20 am
I went and grabbed the latest dfhack version hoping I'd be able to mark items for trading from the extended stocks screen. It is greyed out and still is in the beta. I really miss that feature. Is it working for anyone else?

Is there a caravan present?
Title: Re: DFHack 0.40.24-r5
Post by: dhthwy on April 13, 2016, 07:03:31 am
Yea of course, not sure if links are allowed here but here's a cpl screenshots

https://gyazo.com/cd9650cae49e8959591acfb293dbc225

https://gyazo.com/922c257edd4149c84134a55aa30b9de5
Title: Re: DFHack 0.40.24-r5
Post by: mifki on April 13, 2016, 07:08:35 am
Heyyy, you wouldn't happen to know what changed from the df.viewscreen_setupadventurerst.subscreen[3] trick that broke pulling up the name selection screen with the new pages layout would you?

I tried but couldn't get it to work so far, sorry.
Title: Re: DFHack 0.40.24-r5
Post by: dhthwy on April 13, 2016, 07:14:55 am
So I'm assuming then that others are able to trade from that screen, ah well, I think I'll compile dfhack to see if I can massage it to work.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 13, 2016, 07:55:49 am
I remember changing the trade option, so maybe it's being disabled incorrectly. I'll take a look.

Edit: well, it's working for me. Could you upload your save?

Crash at save in 0.42.06-alpha2. I've just seen that you've released an update, but this might still be helpful.

Here is the crash log:
Spoiler (click to show/hide)
Well, I have no idea what the issue is there. Has it happened more than once? Do you have anything in onUnloadWorld.init-related files? Have you added stuff to onLoadWorld.init, etc.?
Title: Re: DFHack 0.40.24-r5
Post by: dhthwy on April 13, 2016, 08:09:02 am
Quote
I remember changing the trade option, so maybe it's being disabled incorrectly. I'll take a look.

Just to be clear, It didn't work on alpha2 for me either, which is why I hurried to try the new release. Got it to compile though, might be able to play with it, copying just the new stocks dll over to df didn't work tho (unable to load plugin), will figure it out.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 13, 2016, 08:24:18 am
Was that the entire error message? There might be more details in stderr.log.
Given that it works for me, there could be something weird going on with that caravan, so it would be helpful to have that save.
Title: Re: DFHack 0.40.24-r5
Post by: dhthwy on April 13, 2016, 08:37:29 am
Quote
Was that the entire error message? There might be more details in stderr.log.
Given that it works for me, there could be something weird going on with that caravan, so it would be helpful to have that save.

No, now I'm just confusing you:
The plugin from the dfhack build loads fine, the error message I was referring to was me building the stable dfhack and copying the new stock plugin dll i built to dfhack's beta1 version. I didn't realize I was building the stable dfhack.

I can't mark items to trade for any caravan that shows up (in the extended stocks UI, can do it from the trade depot), I can upload a save.

Here is the save:
http://dffd.bay12games.com/file.php?id=11948
Title: Re: DFHack 0.40.24-r5
Post by: dhthwy on April 13, 2016, 10:20:46 am
.
Title: Re: DFHack 0.40.24-r5
Post by: Aussiemon on April 13, 2016, 11:46:35 am
Quote
Crash at save in 0.42.06-alpha2. I've just seen that you've released an update, but this might still be helpful.

Here is the crash log:
Spoiler (click to show/hide)
Well, I have no idea what the issue is there. Has it happened more than once? Do you have anything in onUnloadWorld.init-related files? Have you added stuff to onLoadWorld.init, etc.?

Nothing added to either of those, only dfhack.init, wherein I disabled several plug-ins from the standard Starter Pack default. The crash happened twice, but it actually gave me an error message this time so I thought I'd post it. No saves to upload though because the save still went through before the crash.

Sorry I couldn't be of more help. I'll post again if I can reproduce it.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 13, 2016, 11:49:02 am
Heyyy, you wouldn't happen to know what changed from the df.viewscreen_setupadventurerst.subscreen[3] trick that broke pulling up the name selection screen with the new pages layout would you?

I tried but couldn't get it to work so far, sorry.
Hey man, I appreciate the effort, wasn't sure if it was just me not being able to work it out or what. It's confusing because the structures lists the page and such but I can't figure out how to point a script at it the same way as the old subscreen[3] method did.
Alright, familiarized myself a little bit with DFHack and did few tests with it.

Point is, I need 'elevate-physical' and 'elevate-mental' plus 'make-legendary' scripts to buff it all up to the very max of 5000 and not 4000 or 2000 something. :-\

EDIT: Erhm.. re-checked the skill max limit and yeah, I just need the very max abilities is all and I suck even more with coding than making/adding reactions and custom creatures in DF.
Save this as elevate_attributes.lua:
Code: [Select]
-- This script will elevate all the attributes of a unit
-- by vjek
--[[=begin

elevate_attributes portion stolen from armoks_blessing
================

=end]]
local utils=require('utils')
local args = utils.processArgs({...}, validArgs)
local unit = args.unit and df.unit.find(args.unit) or dfhack.gui.getSelectedUnit(true)

function elevate_attributes(unit)
    if unit==nil then
        print ("No unit available!  Aborting with extreme prejudice.")
        return
    end

    local ok,f,t,k = pcall(pairs,unit.status.current_soul.mental_attrs)
    if ok then
        for k,v in f,t,k do
            v.value=10000
    v.max_value=20000
        end
    end

    local ok,f,t,k = pcall(pairs,unit.body.physical_attrs)
    if ok then
        for k,v in f,t,k do
            v.value=10000
    v.max_value=20000
        end
    end
end

    elevate_attributes(unit)
You can change the caps to whatever you want, 5000 is not hard cap, only a "natural from the raws" cap.
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 13, 2016, 12:50:45 pm
Save this as elevate_attributes.lua:
Spoiler (click to show/hide)
You can change the caps to whatever you want, 5000 is not hard cap, only a "natural from the raws" cap.

Ah, explains why I was able to go beyond 50 (or beyond 20-25) on the character creation screen with 'adv-max-skills' and...
Thank you! Will test the code straight away and again, thanks. :) Hopefully by studying/looking at those codes I'll get better at it.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 13, 2016, 12:55:13 pm
Yar, I mostly pulled the bits from armoks_blessing out like that so you could see how it is put together and play with it.

I had put a script together to fill needs, it works fine when targeting a unit but making it grab the residents/visitors is trickier than I thought.
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 13, 2016, 01:07:00 pm
Yar, I mostly pulled the bits from armoks_blessing out like that so you could see how it is put together and play with it.

I noticed upon a closer look at the code but still for what it's worth: thanks. :) Probably could've done it myself but the thing with me is most of the time I can't make heads and tails of a code.

EDIT: Oh and awesome, tested it in an earlier save where my minothar lass was still heading off to kill Ngaxa the minotaur. Works like a charm in the adventurer's stat menu.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 13, 2016, 02:15:56 pm
Apparently the Windows build has the wrong version number again. I'm putting up a fixed build now, but the old one will be unavailable for a few minutes.

Edit: Okay, the Windows build should be fixed. I recommend replacing your copy of DFHack 0.42.06-beta1 if you've downloaded it already on Windows.
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 13, 2016, 02:45:54 pm
Apparently the Windows build has the wrong version number again. I'm putting up a fixed build now, but the old one will be unavailable for a few minutes.

Edit: Okay, the Windows build should be fixed. I recommend replacing your copy of DFHack 0.42.06-beta1 if you've downloaded it already on Windows.

Uh, link? :-\
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 13, 2016, 02:51:13 pm
Here's a beta release: https://github.com/DFHack/dfhack/releases/tag/0.42.06-beta1

r1 will probably happen soon unless there's a nasty issue with that that warrants another beta release.

(The latest one is always at the top of https://github.com/DFHack/dfhack/releases)
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 13, 2016, 03:21:45 pm
Here's a beta release: https://github.com/DFHack/dfhack/releases/tag/0.42.06-beta1

r1 will probably happen soon unless there's a nasty issue with that that warrants another beta release.

(The latest one is always at the top of https://github.com/DFHack/dfhack/releases)

Ah, good to know, got confused and started scamming through github to no avail. Github's confusing at times.
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on April 14, 2016, 07:38:13 pm
I think prospect causes a crash. Latest version (v.0.42.06, latest dfhack version) and all that. Didn't in 42.05.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on April 14, 2016, 07:39:12 pm
I think it only crashes in reclaimed worldgen forts.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 15, 2016, 04:29:15 am
Was gonna say, I've got probe, prospect all, and reveal on hotkeys I use a lot while scouting sites in adventurer mode and I've never seen them cause a crash, but I don't have world-gen forts since I made them town builders to cut down lag (yes, dorf towns of 10k pop are less laggy than even a 1~2k pop fort) until the "rush up and down the central ramp" issue is fixed.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 15, 2016, 06:16:46 am
I think prospect causes a crash. Latest version (v.0.42.06, latest dfhack version) and all that. Didn't in 42.05.
Does it crash when you're running it (i.e.before the DFHack prompt shows up again)? If not, it's highly unlikely, since prospect just reads map data briefly.
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 15, 2016, 07:38:45 am
Another thing that's been important to me is getting/having dance forms of the created world known to my female characters.

What sorcery will I need? :-\

Also, how do I use DFhack to remove my adventurer from worshipping something?
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 15, 2016, 10:28:05 am
Removing a deity... you'll need your histfig_id, it's down towards the bottom when you open gm-editor on yourself. Then, I'm blanking on the find syntax for a histfig_id actually, I'd just pull up gui/gm-editor df.global.history.figures and check the bottom (scroll up) of the list to see what range of histfig_id's those are, then scroll up until I found myself. There is a better way of course but like I said, brainfart.

Either way once you get that open you go down to histfig_links I think and it should have entries for worships_deityst or something like that, hit alt+d to delete them. The rest of the links should clear when you save/reload, but you wouldn't see them in game anyways.
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 15, 2016, 05:12:56 pm
Hmm, what about dance forms?

EDIT: can't open "gui/gm-editor df.global.history.figures" as I'm met with error about something to do with expressions everytime.

EDIT2: I did how ever got the list of this open "gui/gm-editor df.global.world.dance_forms.all". I wonder how am I gonna give meself a dance form?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 15, 2016, 06:24:47 pm
EDIT: can't open "gui/gm-editor df.global.history.figures" as I'm met with error about something to do with expressions everytime.
Try df.global.world.history.figures.
Also, copying and pasting the error message is generally more helpful, like this:
Code: [Select]
[string "expression"]:1: Cannot read field global.history: not found.If you're on an older version of Windows, you won't be able to select text normally, but there should be an option for it if you right-click the title bar. It should also be logged to stderr.log, although it may be slightly delayed.

Latest version (v.0.42.06, latest dfhack version) and all that.
It's probably not relevant in this case, but please, please, specify the exact DFHack version you're using. It's displayed in the upper-left corner of the title screen and logged to the DFHack console when the game starts. I know you think you're using the latest DFHack version (which is currently 0.42.06-beta1, released 3 days ago), but people sometimes don't notice releases, especially pre-releases, so it's impossible for us to know for sure if that's what you're using.
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 15, 2016, 07:25:03 pm
Yeah I'm using DFHack 0.42.06-beta1. Sorry, completely forgot mentioning it due to being overwhelmed with my own issues. Ugh.

Here's the issue as I'm too lazy to type it:

(http://i886.photobucket.com/albums/ac66/Stafath/dfhack_gui_gm-editor_issue_zps6byi8bny.png)
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on April 15, 2016, 08:00:17 pm
df.global.world.history.figures[1]

if you want to get to the list in gm editor:

gui/gm-editor df.global.world.history.figures

not sure what the period you keep putting at the end is for
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 15, 2016, 08:24:50 pm
df.global.world.history.figures[1]

Ahh, the number at the end defines the entity but still no luck with pinpointing the deity. Nor getting dance forms to my character forcibly.

Problem with historical figures is that none of them are deities. Let me elaborate: in legends.xml Kupek Outragebored appears as entity id 1161 but typing df.global.world.history.figures[1161] brings up a human: Thrut.

EDIT: Nevermind df.global.world.history.figures[1162] and I got kupek. Whew. Lucky that there is no mortal with that name (I checked). The 'legends_plus.xml' has no deities in it. Also, good grief 5+ hours on this madness of mine alone (including ways to get dance forms), FML. *drops flat on his back*

EDIT2:

histfig_links I think and it should have entries for worships_deityst

It's empty.. nothing to select at all.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 15, 2016, 10:22:39 pm
There's not a histfig_hf_link_deityst entry?

Ok, can you pray to anyone when starting a conversation? That's actually the shortcut to becoming a god I used, flip the deity flag under your df.global.history.figures entry then talk to someone and you can get them to worship you, editing your conversation targets via df.global.ui_adv_mode.conversation.targets to make the histfig_id your own lets you address yourself as a deity.
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 15, 2016, 10:55:19 pm
There's not a histfig_hf_link_deityst entry?

Ok, can you pray to anyone when starting a conversation? That's actually the shortcut to becoming a god I used, flip the deity flag under your df.global.history.figures entry then talk to someone and you can get them to worship you, editing your conversation targets via df.global.ui_adv_mode.conversation.targets to make the histfig_id your own lets you address yourself as a deity.

Uhh, I can't find the deity flag to tag in my adventurer's menu and haven't even found histfig_hf_link_deityst anywhere.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on April 15, 2016, 11:05:41 pm
Does anyone know how to get the dimensions of the on-screen map, or the corrdinates of the middle tile?  df.global.window_x, df.global.window_y and df.global.window_z seem to indicate the top-left corner, and although things like the window width can be found, I don't know how to determine if the map is normal width or extended by hiding menus and/or the mini-map.

I'm trying to come up with a safe failover for the cursor position, defaulting to the middle of the map view.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on April 15, 2016, 11:08:28 pm
df.global.gps.screenx df.global.gps.screeny

middle tile is average of df.global.window_(var) and df.global.gps.screen(var)

see this script i wrote for positional sound in soundsense (http://www.bay12forums.com/smf/index.php?topic=60287.msg6214010#msg6214010)
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on April 15, 2016, 11:19:05 pm
df.global.gps.screenx df.global.gps.screeny

middle tile is average of df.global.window_(var) and df.global.gps.screen(var)

see this script i wrote for positional sound in soundsense (http://www.bay12forums.com/smf/index.php?topic=60287.msg6214010#msg6214010)
Thanks, I'll check out that script when I get a chance.

I'm getting zero for df.global.gps.screeny, but since df.global.gps.dimy seems to be the window height in tiles, I might be able to use that instead.  The real problem is that none of these values seem to update when I tab the map into a wider setting.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 15, 2016, 11:23:48 pm
I feel you Dirst, I was trying to figure out if I could pull the currently highlighted location on the adventurer quest log map and use that to get the relevant army posx/posy to teleport around by ponting at spots on the map. Not as easy as I hoped it would be since the "aim myself at the cursor" trick worked so well with launch. Apparently you can't solve every problem by hurling dorfs at it at high velocities.

There's not a histfig_hf_link_deityst entry?

Ok, can you pray to anyone when starting a conversation? That's actually the shortcut to becoming a god I used, flip the deity flag under your df.global.history.figures entry then talk to someone and you can get them to worship you, editing your conversation targets via df.global.ui_adv_mode.conversation.targets to make the histfig_id your own lets you address yourself as a deity.

Uhh, I can't find the deity flag to tag in my adventurer's menu and haven't even found histfig_hf_link_deityst anywhere.
No no, in your df.global.world.history.figures[your adventurer] there is a flags entry which has deity under it, and if you worshipped a deity you would find it under the histfig_links as a histfig_hf_link_deityst entry... unless maybe it's a force or something, I never checked.
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 15, 2016, 11:44:13 pm
No no, in your df.global.world.history.figures[your adventurer] there is a flags entry which has deity under it, and if you worshipped a deity you would find it under the histfig_links as a histfig_hf_link_deityst entry... unless maybe it's a force or something, I never checked.

Oih, of course. Yeah that did the trick and indeed when being a deity inquiring about troubles you can't ask about the specifics. A big silver lining here is that I made the object of worship's race into that of an ischrotaur and changed its name and gender to male and turns out I can indeed remove the object of worship which is awesome. I checked it in legends by retiring and no more worshipped entity. Progress! And.. thank you! :)

Anyway, while I was messing with the gm-editor and took a look at my crafted modded-in 'drolth' sword. The age old thing for me now: how do I give a custom name to an item?
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 16, 2016, 07:25:06 am
df.global.gps.screenx df.global.gps.screeny

middle tile is average of df.global.window_(var) and df.global.gps.screen(var)

see this script i wrote for positional sound in soundsense (http://www.bay12forums.com/smf/index.php?topic=60287.msg6214010#msg6214010)
Thanks, I'll check out that script when I get a chance.

I'm getting zero for df.global.gps.screeny, but since df.global.gps.dimy seems to be the window height in tiles, I might be able to use that instead.  The real problem is that none of these values seem to update when I tab the map into a wider setting.

dimx and dimy are the window size. Unless you resize the window (not the map with [tab]), they won't change. screenx and screeny appear to be used internally for rendering.

If you want the map dimensions, you can use the "getPanelLayout" function in the gui.dwarfmode module:
Code: [Select]
printall(require('gui.dwarfmode').getPanelLayout())

or

dwarfmode = require('gui.dwarfmode')
printall(dwarfmode.getPanelLayout())

or

dm = require('gui.dwarfmode')
printall(dm.getPanelLayout())

etc.
Title: Re: DFHack 0.40.24-r5
Post by: kane_t on April 16, 2016, 11:14:26 am
Noticed a problem with the gui/create-item plugin: it doesn't correctly set the subtype for plant growths.  If you try to create an apple, for instance (plant growth -> plants -> apple tree -> fruit) it'll leave the subtype as -1, which results in a glitched item with no name or properties.  The correct subtype for fruits should be 2.
Title: Re: DFHack 0.40.24-r5
Post by: Bordellimies on April 16, 2016, 12:28:07 pm
Hey, I have the latest version of DF and the map I am playing on is just chock-full of stains I would like to clean up, but I can't seem to make DFhack work as it says it doesnt recognize the version of the DF. I'm a newb when it comes to DFHack so any help with that would be appreciated!
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 16, 2016, 12:45:14 pm
Hey, I have the latest version of DF-

Uh, sorry to be that guy but basically this:

Latest version (v.0.42.06, latest dfhack version) and all that.
It's probably not relevant in this case, but please, please, specify the exact DFHack version you're using. It's displayed in the upper-left corner of the title screen and logged to the DFHack console when the game starts. I know you think you're using the latest DFHack version (which is currently 0.42.06-beta1, released 3 days ago), but people sometimes don't notice releases, especially pre-releases, so it's impossible for us to know for sure if that's what you're using.
Title: Re: DFHack 0.40.24-r5
Post by: Bordellimies on April 16, 2016, 01:05:26 pm
I mean I have the latest version of Dwarf Fortress, not DFHack. I can't get DFHack to work with it. I tried the same version as in the thread name, 0.40.24-r5 (https://github.com/DFHack/dfhack/releases/tag/0.40.24-r5).
Title: Re: DFHack 0.40.24-r5
Post by: Hesperid on April 16, 2016, 02:50:20 pm
You can't use dfhack 40.24 on Dwarf Fortress 42.06.

There is a newer version, the pre-release, whose source code you can get off lethosor's repository, OR use one of the prebuilt binaries that a few posters have supplied. If you're on 64-bit Linux I can send you mine, for instance.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 16, 2016, 03:45:11 pm
Binary releases for DFHack for 0.42.06 are at https://github.com/dfhack/dfhack/releases, as are all releases. It's just marked as a prerelease, and Expwnent hasn't linked to it from this thread.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 16, 2016, 03:59:45 pm
Quote
Was that the entire error message? There might be more details in stderr.log.
Given that it works for me, there could be something weird going on with that caravan, so it would be helpful to have that save.

No, now I'm just confusing you:
The plugin from the dfhack build loads fine, the error message I was referring to was me building the stable dfhack and copying the new stock plugin dll i built to dfhack's beta1 version. I didn't realize I was building the stable dfhack.

I can't mark items to trade for any caravan that shows up (in the extended stocks UI, can do it from the trade depot), I can upload a save.

Here is the save:
http://dffd.bay12games.com/file.php?id=11948

Okay, the issue is that you have multiple caravans on the map and one has left. Apparently canTrade() checks if all caravans can trade, rather than just one. Should be simple enough to fix.
Title: Re: DFHack 0.40.24-r5
Post by: gchristopher on April 16, 2016, 06:58:49 pm
What's the best way to submit suggestions for structure names?

The df.global.world.interaction_instances structure is definitely what associates a region interaction (evil weather) with a region.

The anon_1 variable is the index of the interaction in df.global.world.raws.interactions.

The anon_3 variable is the index of the region in df.global.world.world_data.region.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 16, 2016, 07:41:43 pm
What's the best way to submit suggestions for structure names?

The df.global.world.interaction_instances structure is definitely what associates a region interaction (evil weather) with a region.

The anon_1 variable is the index of the interaction in df.global.world.raws.interactions.

The anon_3 variable is the index of the region in df.global.world.world_data.region.

Fork it, make the change, submit a pull request.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on April 16, 2016, 08:01:08 pm
What's the best way to submit suggestions for structure names?

The df.global.world.interaction_instances structure is definitely what associates a region interaction (evil weather) with a region.

The anon_1 variable is the index of the interaction in df.global.world.raws.interactions.

The anon_3 variable is the index of the region in df.global.world.world_data.region.

Fork it, make the change, submit a pull request.

Specifically, this:  https://github.com/DFHack/df-structures
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 17, 2016, 02:00:25 am
Sorry, forgot to specify that, but yeah. It's the easiest way and quite helpful having stuff identified.
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on April 17, 2016, 01:48:25 pm
So I'm getting an error...
(http://i.imgur.com/epVqnH5.png)

... and am quite sure it's something I did wrong with onLoad.ini. Could anyone check it (posted below) for what might be causing that, as well any other mistakes that may be present? I'd be deeply grateful.
Spoiler (click to show/hide)
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on April 17, 2016, 03:26:41 pm
Oh geez that's a lot of stuff. I will look into it. If you can find the full error output that would help. It might be in stderr.log, I forget.
Title: Re: DFHack 0.40.24-r5
Post by: gchristopher on April 17, 2016, 11:46:59 pm
What's the best way to submit suggestions for structure names?...
Fork it, make the change, submit a pull request.

Specifically, this:  https://github.com/DFHack/df-structures
Thanks! Done!
Title: Re: DFHack 0.40.24-r5
Post by: Atomic Chicken on April 18, 2016, 03:18:27 pm
Oh geez that's a lot of stuff. I will look into it. If you can find the full error output that would help. It might be in stderr.log, I forget.
I modified my copy of item-trigger to fix this error (which has actually been around for ages) a while ago; if I remember correctly, the issue was caused by the script's inability to handle the hardcoded item types, and had a pretty simple solution. However, I never got around to sharing it, primarily because I haven't yet figured out how to use github. Could someone give me a solid explanation regarding how to contribute to dfhack, beyond the simple explanation of "fork, modify, submit pull request"?


Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 18, 2016, 04:22:37 pm
Outside of using git for this stuff (which is somewhat arcane feeling) it's pretty much just following what the button prompts say. While on the dfhack github page there is a little Y shaped symbol labeled fork, click that and it gives you a version on your account, make the changes in your copy, then I think you click compare versions and it gives you the option to submit a pull upstream to the dfhack version. There's an faq I looked through that has this too somewhere but it was in a weird spot as I recall.
Title: Re: DFHack 0.40.24-r5
Post by: PeridexisErrant on April 18, 2016, 07:13:17 pm
Oh geez that's a lot of stuff. I will look into it. If you can find the full error output that would help. It might be in stderr.log, I forget.
I modified my copy of item-trigger to fix this error (which has actually been around for ages) a while ago; if I remember correctly, the issue was caused by the script's inability to handle the hardcoded item types, and had a pretty simple solution. However, I never got around to sharing it, primarily because I haven't yet figured out how to use github. Could someone give me a solid explanation regarding how to contribute to dfhack, beyond the simple explanation of "fork, modify, submit pull request"?

The GitHub "hello world" tutorial (https://guides.github.com/activities/hello-world/) is simple, but a good place to start.  I suggest grabbing a GUI client - Sourcetree or "Github for windows" are both decent - and then it should be pretty easy.  #dfhack IRC can help more.

Tips:
 - Pull requests for DFHack should be against the "develop" branch, not "master" (the default)
 - Keep the diff minimal - make sure you start with the latest code
 - Ensure documentation is also up to date; for scripts it's all in the file
 - If in doubt, see the "for developers" section of the docs, and/or ask in IRC
Title: Re: DFHack 0.40.24-r5
Post by: Atomic Chicken on April 19, 2016, 07:49:55 am
Thanks for the help! I'll give it a shot.
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on April 19, 2016, 10:41:04 am
Oh geez that's a lot of stuff. I will look into it. If you can find the full error output that would help. It might be in stderr.log, I forget.
Sorry that this took a while, but this is the error output. I also cannot seem to make certain reaction-trigger stuff work, though for some reason it didn't appear in the output.
Spoiler: the one before (click to show/hide)

Title: Re: DFHack 0.40.24-r5
Post by: zackman0010 on April 19, 2016, 11:54:13 am
I'm not a developer, just a user. I was just wondering if the latest version of DFHack will eventually be upgraded to full release with the original thread changed. I apologize if this has been asked already, and yes I've seen the pre-release versions that work for the latest version of DF. I'm just curious if they'll ever stop being pre-release versions.
Title: Re: DFHack 0.40.24-r5
Post by: Roses on April 19, 2016, 02:04:15 pm
A few questions:

1. If moods are turned to off, can I still trigger strange moods with the dfhack strangemood command?
2. Is it possible to assign burrows with dfhack? For example, if I wanted to create a civilization that automatically made burrows around certain buildings?
3. Has interaction-trigger been updated to include self targeting interactions like would be found with [USAGE_HINT:FLEEING]?
4. If I have a syndrome that transforms a unit (or transform a unit via the script) and they drop their items, will item-trigger trigger?
5. Can addReactionToShop be used to add reactions to custom buildings? And can default reactions (like butcher animal or melt item) be added to different buildings?
6. Does addReactionToShop need to be run each time you load a save?

PS: I think the description here (https://dfhack.readthedocs.org/en/stable/docs/_auto/base.html#hfs-pit) for hfs_pit command has a type. When describing the examples they both say that they have stairs but no walls, I believe one should say walls but no stairs.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 19, 2016, 04:50:37 pm
I'm not a developer, just a user. I was just wondering if the latest version of DFHack will eventually be upgraded to full release with the original thread changed. I apologize if this has been asked already, and yes I've seen the pre-release versions that work for the latest version of DF. I'm just curious if they'll ever stop being pre-release versions.
Of course they will - the point of prereleases is to make testing easier before making a more stable release. I'm hoping to do a stable release in a few days, but I'll have to see when I have time for it. (I also don't have the ability to edit this forum post, when that happens, so it could be delayed a bit.)
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 19, 2016, 07:50:17 pm
I'm not a developer, just a user. I was just wondering if the latest version of DFHack will eventually be upgraded to full release with the original thread changed. I apologize if this has been asked already, and yes I've seen the pre-release versions that work for the latest version of DF. I'm just curious if they'll ever stop being pre-release versions.
If you're sufficiently warned, select the text in pre-release-warning.lua and delete it then save the blank file. It won't break the stuff that looks for it that way.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 19, 2016, 08:04:51 pm
Not sure if that warning was an issue, but in the latest DFHack release, there's a "don't show this warning again" option in the dialog.
Title: Re: DFHack 0.40.24-r5
Post by: Max™ on April 19, 2016, 09:42:52 pm
Ah, I hadn't noticed that, whenever I install a new version I swap over some of my personal scripts, replace gm-editor and advfort with my versions, and then I just saved the pre-release as empty.
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on April 20, 2016, 01:54:59 pm
I also cannot seem to make certain reaction-trigger stuff work, though for some reason it didn't appear in the output.

I think I managed to find what's wrong, but don't have the knowledge to fix it so I must, again, ask for help here. I am pretty sure that random-trigger cannot read \\WORKER_ID from the instance reaction-trigger that is calling it and, as such, fails. Is there any way for the random events of random-trigger affect whatever unit is running the reaction?
Title: Re: DFHack 0.40.24-r5
Post by: Teneb on April 21, 2016, 11:53:48 am
I also cannot seem to make certain reaction-trigger stuff work, though for some reason it didn't appear in the output.

I think I managed to find what's wrong, but don't have the knowledge to fix it so I must, again, ask for help here. I am pretty sure that random-trigger cannot read \\WORKER_ID from the instance reaction-trigger that is calling it and, as such, fails. Is there any way for the random events of random-trigger affect whatever unit is running the reaction?
Well, nevermind it all. I managed to find a way around that.
Title: Re: DFHack 0.40.24-r5
Post by: Roses on April 21, 2016, 02:03:39 pm
A few questions:

1. If moods are turned to off, can I still trigger strange moods with the dfhack strangemood command?
2. Is it possible to assign burrows with dfhack? For example, if I wanted to create a civilization that automatically made burrows around certain buildings?
3. Has interaction-trigger been updated to include self targeting interactions like would be found with [USAGE_HINT:FLEEING]?
4. If I have a syndrome that transforms a unit (or transform a unit via the script) and they drop their items, will item-trigger trigger?
5. Can addReactionToShop be used to add reactions to custom buildings? And can default reactions (like butcher animal or melt item) be added to different buildings?
6. Does addReactionToShop need to be run each time you load a save?

PS: I think the description here (https://dfhack.readthedocs.org/en/stable/docs/_auto/base.html#hfs-pit) for hfs_pit command has a type. When describing the examples they both say that they have stairs but no walls, I believe one should say walls but no stairs.

Re-quoting this just to see if anyone has any knowledge to share. But the real reason I am posting is because I had a dream about DF last night and came up with two new ideas for future projects and wanted to check on their feasibility. So here's the pitch;

1. An Expedition system. Right now I have a couple scripts that allow dwarfs to "leave" the fortress on predefined "missions", but what I am hoping to do is to actually influence the world instead of just arbitrary things. What I want is to recreate the embark location screen, except most of the world is covered in "fog of war" so that you only know where you are, where your home civilization's cities are, and where any allies/traders cities are. You can then send out explorers to reveal more of the map (other cities, monster lairs, caverns, features, etc...). Once discovered you could send scouts to see what kind of threat there is and then send adventurers to go and loot/raid/siege/trade/etc...

Now this sounds like a major endeavor, but most of the needed code I have already in some way/shape/form, the complication is how to get said screen. I have tried just copying the screen and then displaying it later, but that causes crashes. I could read the world information and recreate it from scratch, but I'm not entirely sure if that would work. Has anyone thought about accessing the world map from a fortress?

For reference this is the screen I am talking about.
(https://i.img.ie/sZL.png)

2. Multistory buildings. It seems silly to continue to have single story only buildings. Now I already have a script that requires a certain amount of open space above a building (it works the same way outside-only does, if you try to build the building without n z-levels of open space above it, it will instantly deconstruct the building), and we have other scripts that will create buildings, so my thought is, what if you created multiple BUILDING raws, say CATHEDRAL_FLOOR_1, CATHEDRAL_FLOOR_2, CATHEDRAL_FLOOR_3, etc... Then when you build CATHEDRAL_BASE the game also construct the other building floors above that one. You could even tie their building into different phases of the CATHEDRAL_BASE building. Now of course you wouldn't be able to use the other floors for any reactions, but it would be something at least.

The only problem I foresee about this is, is it possible to construct a building (with DFHack) in the middle of the air?

Any thoughts on either idea?
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 22, 2016, 01:18:18 am
I'm not good with understanding code stuff entirely. Currently I'm trying to use the full-heal command to resurrect a dead being in the arena. I just lack the info of how to put the creature's ID after full-heal command.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 22, 2016, 05:52:05 pm
You could just select the dead unit in the units list (under the dead/missing tab) and run full-heal without arguments.

If you want the unit ID, there are several ways to get that, including:
- Run ":lua ~dfhack.gui.getSelectedUnit().id" with the unit selected (or ":lua !dfhack.gui.getSelectedUnit().id", or ":lua print(dfhack.gui.getSelectedUnit().id)", etc.). This won't work for dead units unless you select them in the list, which is kind of pointless since full-heal works from that list too.
- Run "gui/gm-editor unit" with the unit selected and look for the "id" field.
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 22, 2016, 06:09:18 pm
You could just select the dead unit in the units list (under the dead/missing tab) and run full-heal without arguments.

If you want the unit ID, there are several ways to get that, including:
- Run ":lua ~dfhack.gui.getSelectedUnit().id" with the unit selected (or ":lua !dfhack.gui.getSelectedUnit().id", or ":lua print(dfhack.gui.getSelectedUnit().id)", etc.). This won't work for dead units unless you select them in the list, which is kind of pointless since full-heal works from that list too.
- Run "gui/gm-editor unit" with the unit selected and look for the "id" field.

Thanks but I still don't understand how am I supposed to select a dead unit, I know the ID of the unit but not how to punch in the code so it works, nothing I've tried works. An example would help of full-heal and gui/gm-editor unit commands in action so my stupid self would understand what I need to do in terms of function icons ranging from '!', '[', '{', '/', to '=', and etc. Sorry for being a complete inept with this but if I try too hard I just end up feeling like breaking something.
Title: Re: DFHack 0.40.24-r5
Post by: TheFlame52 on April 22, 2016, 06:34:03 pm
I'm actually interested in knowing too.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on April 22, 2016, 07:06:54 pm
If you know the unit's ID, you just punch in the unit's ID.

-unit ID
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 22, 2016, 07:15:14 pm
If you know the unit's ID, you just punch in the unit's ID.

-unit ID

Didn't work, the unit stayed dead in the arena
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on April 22, 2016, 07:37:35 pm
Are you making sure to include the -r argument?

You can use -help to get argument help. If that doesn't work for any command, make an issue of it.
Title: Re: DFHack 0.40.24-r5
Post by: Rumrusher on April 22, 2016, 08:07:51 pm
warmist and I kinda found a better solution to this issue by using the 'get creature at pointer' function to grab the dead unit where they Last died at.
it saved a many lives when you need to rez someone who body kinda burn up but you remember where they died at.
sadly the issue that pops up from this is if there's more than one dead guy ...which could be solved by healing and pushing the folks off the spot til you get the right person.

Code: [Select]
function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end
function getCreatureAtPos(x,y,z) -- gets the creature index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.units.all -- load all creatures
for i = 0, #vector-1 do -- look into all creatures offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("Creature not found!")
return nil

end
--heal unit from all wounds and damage
function healunit(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit==nil then
error("Failed to Heal unit. Unit not selected/valid")
end
    for i=#unit.body.wounds-1,0,-1 do
    unit.body.wounds[i]:delete()
    end
    unit.body.wounds:resize(0)
unit.body.blood_count=unit.body.blood_max
--set flags for standing and grasping...
unit.status2.limbs_stand_max=4
unit.status2.limbs_stand_count=4
unit.status2.limbs_grasp_max=4
unit.status2.limbs_grasp_count=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' or k=='layer_status' then v[kk].whole = 0  else v[kk] = 0 end
end
end
end
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 22, 2016, 08:42:29 pm
You could just select the dead unit in the units list (under the dead/missing tab) and run full-heal without arguments.

If you want the unit ID, there are several ways to get that, including:
- Run ":lua ~dfhack.gui.getSelectedUnit().id" with the unit selected (or ":lua !dfhack.gui.getSelectedUnit().id", or ":lua print(dfhack.gui.getSelectedUnit().id)", etc.). This won't work for dead units unless you select them in the list, which is kind of pointless since full-heal works from that list too.
- Run "gui/gm-editor unit" with the unit selected and look for the "id" field.

Thanks but I still don't understand how am I supposed to select a dead unit.
Like I said, you can select it in the Dead/Missing tab of the units list (unless it's been cleared somehow).


Are you making sure to include the -r argument?

You can use -help to get argument help. If that doesn't work for any command, make an issue of it.
This only works for some commands. Most commands that are part of plugins use "help command-name" instead, and some also recognize "command-name help", but not "command-name -help".
Title: Re: DFHack 0.40.24-r5
Post by: Dozebôm Lolumzalìs on April 22, 2016, 09:10:15 pm
I think the problem with multi-story buildings is that most buildings need to be completely supported by floors.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on April 22, 2016, 11:25:54 pm
I've noticed that the df-structures have a ton of description in them that I can't seem to access from Lua.  In particular I'm looking at tile types.

dfhack.maps.getTileType(pos) will return a number like 403, which turns out to be pebbles.  That is enumerated in the XML with a nice human-friendly name attribute, but I can't figure out how to access it.  I suppose with enough Notepad++ I could morph the XML into a Lua array, but I'd rather not re-invent the wheel if I don't have to.
Title: Re: DFHack 0.40.24-r5
Post by: Putnam on April 22, 2016, 11:31:44 pm
df.tiletype[num]

<enum-type type-name='tiletype' base-type='int16_t'>

you want df.type-name there

Code: [Select]
        <enum-attr name='caption'/>
        <enum-attr name='shape' type-name='tiletype_shape' default-value='NONE'/>
        <enum-attr name='material' type-name='tiletype_material' default-value='NONE'/>
        <enum-attr name='variant' type-name='tiletype_variant' default-value='NONE'/>
        <enum-attr name='special' type-name='tiletype_special' default-value='NONE'/>
        <enum-attr name='direction' default-value='--------'/>

to access these you use (for example) df.tiletype.attrs[num].shape
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on April 22, 2016, 11:42:01 pm
Thanks!  I was looking under dfhack.* not df.*
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on April 23, 2016, 12:57:28 am
Wow that turned out to be much easier than I expected.

df.tiletype_material[df.tiletype.attrs[tile_type].material] .. " " .. df.tiletype_shape[df.tiletype.attrs[tile_type].shape]

gives you a nice terse description of the tile, with only a couple oddities like a TREE RAMP at the top of a trunk.  Thanks again Putnam!
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 23, 2016, 08:16:44 am
I think the problem with multi-story buildings is that most buildings need to be completely supported by floors.
True. Also, floors can't be supported by buildings, so creating floors on demand wouldn't work (unless we could create a wall for support, but it would have to extend outside of the building). It's possible that the building-hacks plugin could help with this, but I don't remember everything it's capable of.
Title: Re: DFHack 0.40.24-r5
Post by: Rose on April 23, 2016, 08:48:41 am
Would it work by making them mechanics?
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 23, 2016, 09:37:20 pm
Like I said, you can select it in the Dead/Missing tab of the units list (unless it's been cleared somehow).

Ah, my reasons for the full-heal resurrect was for my own adventurer but I already found out that it's best to avoid getting killed.

Anyhow, I made an alternate version of my ischrotaur, one who is damageable by regular means. Just wondering how can I use DFhack to update my current adventurer with the new file in the raws?
Title: Re: DFHack 0.40.24-r5
Post by: baldamundo on April 24, 2016, 04:12:52 pm
What's the stability of the 0.42.06 version like? I've been getting a few crashes and wondering if the beta DFhack version's behind it.
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 24, 2016, 04:40:13 pm
Here's r1! https://github.com/DFHack/dfhack/releases/tag/0.42.06-r1
Thanks to everyone who helped test the pre-releases and reported back.

What's the stability of the 0.42.06 version like? I've been getting a few crashes and wondering if the beta DFhack version's behind it.
Hopefully not. Some crashes in 0.42 have been attributed to TwbT, so try disabling that first and see if it helps. Otherwise, it would help if you could test without DFHack entirely and see if it's reproducible.
Title: Re: DFHack 0.40.24-r5
Post by: expwnent on April 24, 2016, 04:43:29 pm
I'll edit the front post next time I'm not on mobile.
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on April 24, 2016, 04:45:21 pm
Here's r1! https://github.com/DFHack/dfhack/releases/tag/0.42.06-r1
Thanks to everyone who helped test the pre-releases and reported back.
A big thank you to everyone on the team!  A weapon trap with masterwork silver serrated discs and mechanisms for each of your rooms :)
Title: Re: DFHack 0.40.24-r5
Post by: Droggarth on April 24, 2016, 08:39:35 pm
Here's r1! https://github.com/DFHack/dfhack/releases/tag/0.42.06-r1
Thanks to everyone who helped test the pre-releases and reported back.

Awesome!

A big thank you to everyone on the team!  A weapon trap with masterwork silver serrated discs and mechanisms for each of your rooms :)

Can I have one of the levers? So when the dire hour comes we can in unison pull at least 2-3 levers and then there goes the dev team.. the de- uhhh. Has anyone even thought this through? :-\ I mean DFHack sorcery workers/devs should be protected from the angry dwarven mob instead.

Heheh, joking aside. You folks have my thanks too!
Title: Re: DFHack 0.40.24-r5
Post by: lethosor on April 24, 2016, 08:46:38 pm
Here's r1! https://github.com/DFHack/dfhack/releases/tag/0.42.06-r1
Thanks to everyone who helped test the pre-releases and reported back.
A big thank you to everyone on the team!  A weapon trap with masterwork silver serrated discs and mechanisms for each of your rooms :)
Ooh, impressive (I normally just use regular mechanisms because I have extra stone lying around and my mechanics don't know what they're doing).
Title: Re: DFHack 0.40.24-r5
Post by: Dirst on April 24, 2016, 11:01:51 pm
Does anyone have a handle on determining if a given tile is inside a fort's temple location, and figuring out the Spheres of the power to which it is dedicated (if any)?
Title: Re: DFHack 0.42.06-r1
Post by: expwnent on April 25, 2016, 01:49:01 am
Front post edited.
Title: Re: DFHack 0.40.24-r5
Post by: Abadrausar on April 25, 2016, 04:15:55 am
Here's r1! https://github.com/DFHack/dfhack/releases/tag/0.42.06-r1
Thanks to everyone who helped test the pre-releases and reported back.
Thanks for your team effort! :)

There are any plans to include support, as a dependency, for Luasocket in DFHACK ? https://github.com/diegonehab/luasocket
Apparently it is all that is needed to use most of lua debuggers out there!  ZeroBrane -> https://studio.zerobrane.com/
It supports windows, linux and OSX platforms, lua versions from 5.1 up to 5.3 and visual studio.
Following this https://github.com/diegonehab/luasocket/blob/master/doc/lua05.ppt presentation in their docs, the total number of lines for the version 2.0 are:
1. 4600 C code
2. 2500 Lua code
3. 4700 man code
With each new DFHACK version more and more external DF utilities use some kind of remote connection with DF to have access to its internal in real time.

The Network support that luasocket brings for the Lua language  https://github.com/diegonehab/luasocket/blob/master/doc/lua05.ppt is object oriented, extensive, standard, documented, tiny (as it does not weigh a lot, as we have seen) and it has interfaces polished over the years.
Should we question what would represent more effort in the long term?
a) Integrating luaSocket once as a dependency and have access to their bug corrections and evolutions.
b) Integrating little by little the regions of functionality that are actually used in DFHACK.

My concern is that if we continue to use the path b) we could lose some corrections or have interfaces slightly differing one of the other for one operation of the same kind, depending of the version of luaSocket taken at the moment of their integration into the DFHACK base, this could be potentially tricky and time consuming for the DFHACK developers, the project will have a reduced functionality (substandard), hardships in the maintenance versus really little reductions in the number of lines integrated into DFHACK...

And we should not forget that the blobs of lines copy-pasted and adapted in a project are maintained as a whole only by this project, however if a project includes another as a dependency and then adds over some adaptations, their responsibility in the maintenance is limited to their own internal adaptation, if they use the interfaces of the depended upon project.

My opinion is that option a) gives more possibilities and requires less developer effort over the long term, but also that it could generate some initial breakage of some utils (specially if some transitory transparent support for the old system is not enabled for a few versions) and worse, it would generate one actual peak of work that maybe no one have the time or interest to do.
There are any other opinions about the convenience or not of opening such an issue in DFHACK?
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on April 25, 2016, 11:35:55 am
<quite good analysis of lua sockets status>
One point missed though. We have almost working lua socket replacement that uses csockets(our socket lib) and is mostly compatible. However I lacked the necessary experience at that time to get it as bug free as possible.
Code is  C side  (https://github.com/DFHack/dfhack/blob/master/plugins/luasocket.cpp) and  lua part  (https://github.com/DFHack/dfhack/blob/master/plugins/lua/luasocket.lua)
Also there is already an issue: https://github.com/DFHack/dfhack/issues/420

Oh and generally: you can spam the #dfhack channel in freenode irc and/or open issues on everything. Currently we are not (yet) that big that the issue count would be (pardon the pun) an issue :) Just try searching before posting.


Title: Re: DFHack 0.40.24-r5
Post by: Warmist on April 25, 2016, 01:55:24 pm
1. An Expedition system. <...>

Yes that would be fun. I think i'll make a widget that allows to see the world map in biggest scale (as i think df generates small scale details on the fly so it's quite hard to make small scale maps). From there on you need there is the small part of "causing changes to the world". This would probably require huge amount of code (e.g. adding historic events by hand, figuring out the details for various historical things, etc...)
Title: Re: DFHack 0.40.24-r5
Post by: Roses on April 25, 2016, 02:11:27 pm
1. An Expedition system. <...>

Yes that would be fun. I think i'll make a widget that allows to see the world map in biggest scale (as i think df generates small scale details on the fly so it's quite hard to make small scale maps). From there on you need there is the small part of "causing changes to the world". This would probably require huge amount of code (e.g. adding historic events by hand, figuring out the details for various historical things, etc...)

If you could get the world map I could work on the rest. The most basic system I think would just move items around and kill creatures, which are both pretty easy to do. But being able to trigger actual historic events would be awesome. I suppose I should just look at a bunch of previous historic events and see what is there. I wonder if you could even send out expeditions to learn about new animals and tame them.

I'm not sure how DF handles the map generation, I was poking around in df.global.world.world_data but wasn't really able to piece anything coherent together. Several of the tables have values that aren't present when looking at them, but can still be accessed (e.g. ~df.global.world.world_data.region_areas will only print value as an output but numbers work as well) unfortunately some of those that I tried to access caused crashes, so that slowed things down. Luckily you really don't need small details for an expedition system, you would mainly just want if there are any features (caves, fortresses, hfs, etc...) and the general animal population. More specific information, like if a cave has an artifact or megabeast in it, will be stored in the site/feature information and that is pretty easy to access.
Title: Re: DFHack 0.40.24-r5
Post by: Warmist on April 25, 2016, 02:21:41 pm
I'm not sure how DF handles the map generation, I was poking around in df.global.world.world_data but wasn't really able to piece anything coherent together. Several of the tables have values that aren't present when looking at them, but can still be accessed (e.g. ~df.global.world.world_data.region_areas will only print value as an output but numbers work as well) unfortunately some of those that I tried to access caused crashes, so that slowed things down. Luckily you really don't need small details for an expedition system, you would mainly just want if there are any features (caves, fortresses, hfs, etc...) and the general animal population. More specific information, like if a cave has an artifact or megabeast in it, will be stored in the site/feature information and that is pretty easy to access.

I've currently had an irc chat with ragundo just about this last 6 month work in this theme. You can see it here:  his pull request  (https://github.com/DFHack/dfhack/pull/903) so he could be an expert in that regard.
Title: Re: DFHack 0.42.06-r1
Post by: Roses on April 25, 2016, 02:56:35 pm

I've currently had an irc chat with ragundo just about this last 6 month work in this theme. You can see it here:  his pull request  (https://github.com/DFHack/dfhack/pull/903) so he could be an expert in that regard.
Interesting, I will give that a look.


And as per the multistory buildings topic, I present you with a floating building
(https://i.img.ie/sgM.png)

By changing the tile designation of the tile to that of a floor I built a building using dfhack.buildings.allocInstance and then placed it on said floor. Two seasons later and it is still floating there, so it is definitely possible to do multistory buildings. The only issue I could see would be deconstruction. If you take out the bottom level it's going to need to deconstruct the top levels and return it to open space, but that can all be done. So, as soon as I can get back into DF I will provide a utility for constructing multistory buildings.

EDIT: Hmmm, I may have spoken too soon. After a year the structure collapsed. More testing is needed. But I still think something should be possible.
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on April 25, 2016, 03:14:04 pm
I think building in same 16x16 block might trigger to df do the collapse logic and this would fall down. However i'm not sure...
Title: Re: DFHack 0.40.24-r5
Post by: baldamundo on April 25, 2016, 03:19:26 pm
Hopefully not. Some crashes in 0.42 have been attributed to TwbT, so try disabling that first and see if it helps. Otherwise, it would help if you could test without DFHack entirely and see if it's reproducible.

Cheers - turned of TWBT and it's been working fine since. And made me discover Truetype mode which is actually amazing (tbf probably the one weakness of Ironhand is the fonts)!
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 25, 2016, 04:52:03 pm
As far as I can tell, none of the plugins or scripts or the Lua API directly allow moving items from units' or buildings' inventories to the ground.  But, it should be possible, right?  Just set the item's position, remove the references to it being in the inventory, and set the appropriate flags.  Is there a reason why this isn't done in any of the existing scripts and plugins, like for autodump and cleanowned?

(I'm trying to get back some clothing items that a dwarf annoyingly claimed and put on, and don't want to wait for however long it takes them to get dumped after I clear the ownership flags and set them for dumping)
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on April 25, 2016, 04:55:38 pm
As far as I can tell, none of the plugins or scripts or the Lua API directly allow moving items from units' or buildings' inventories to the ground.

dfhack.items.moveToGround(item,pos)
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 25, 2016, 06:48:37 pm

dfhack.items.moveToGround(item,pos)

When I try that, it consistently returns "false."  It only fails for items that are in inventories, though.  I could probably manually delete all the inventory references and then try moveToGround(), but I'm assuming there must be some reason it doesn't do that itself.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on April 25, 2016, 07:22:20 pm
There are a number of cases where it will refuse to move items, including that. I don't know if there are specific reasons behind all of those cases, or if it was just too much effort to make it handle everything properly.

(The relevant function that moveToGround() calls out to is detachItem() in library/modules/Items.cpp, if you want to take a look.)
Title: Re: DFHack 0.40.24-r5
Post by: Abadrausar on April 25, 2016, 07:26:32 pm
One point missed though. We have almost working lua socket replacement that uses csockets(our socket lib) and is mostly compatible. However I lacked the necessary experience at that time to get it as bug free as possible.
Plain ridiculous, that you try to justify one half backed intellectual creation, that had not worked as you originally intended for years, attacking the people that states the same fact that you just recognize. You are better than that! Or should aspire to be at least... If you do not have the willpower, the competence or the time to finish one project, please free yourself recognizing it!
Oh and generally: you can spam the #dfhack channel in freenode irc and/or open issues on everything. Currently we are not (yet) that big that the issue count would be (pardon the pun) an issue :) Just try searching before posting.
If you really think, that anyone in this forum needs or ask your authorization or consent, to freely express his own opinions or state facts as they are perceived, you should pardon yourself for the image that you are giving of your personality. You are being acquiescent and childish there, and you know it. If you act like a scoundrel with other people there are few chances that they could respect you, or even that you should be able to respect yourself.
That said, anyone  can have a bad day, if that is the case, for me all this is over. Otherwise, next time you need a victim to spit upon your frustrations, consider to do it in other forums, people here have self respect and dignity and would not suffer gladly such behaviours.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 25, 2016, 07:28:20 pm
There are a number of cases where it will refuse to move items, including that. I don't know if there are specific reasons behind all of those cases, or if it was just too much effort to make it handle everything properly.

(The relevant function that moveToGround() calls out to is detachItem() in library/modules/Items.cpp, if you want to take a look.)

I actually did check it, right after posting that, and found out that it doesn't move things that are currently in a job.  I hadn't realised they were in a job--because nobody was doing anything, it was one of those jobs that exists in the list but nobody will ever claim, ever, because of burrow restrictions--so that hadn't occured to me.  Forbid/unforbid and now they're movable.

Incidentally, the other problem was that it refuses to move things that are listed in a UI viewscreen, which I actually had learned last year when I wrote a script to combine drinks in a stockpile, but had since forgotten.  That's the other problem I was having, since I was trying to move things I had selected in the UI.

So, if anyone's having the same problem, make sure the items aren't visible in the UI (meaning, you can't use gui.getSelectedItem(), you have to store them in a variable), and forbid them to kill any jobs pointing to them.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on April 25, 2016, 07:33:59 pm
There are a number of cases where it will refuse to move items, including that. I don't know if there are specific reasons behind all of those cases, or if it was just too much effort to make it handle everything properly.

(The relevant function that moveToGround() calls out to is detachItem() in library/modules/Items.cpp, if you want to take a look.)

I actually did check it, right after posting that, and found out that it doesn't move things that are currently in a job.  I hadn't realised they were in a job--because nobody was doing anything, it was one of those jobs that exists in the list but nobody will ever claim, ever, because of burrow restrictions--so that hadn't occured to me.  Forbid/unforbid and now they're movable.

Incidentally, the other problem was that it refuses to move things that are listed in a UI viewscreen, which I actually had learned last year when I wrote a script to combine drinks in a stockpile, but had since forgotten.  That's the other problem I was having, since I was trying to move things I had selected in the UI.

So, if anyone's having the same problem, make sure the items aren't visible in the UI (meaning, you can't use gui.getSelectedItem(), you have to store them in a variable), and forbid them to kill any jobs pointing to them.
So basically you're writing moveToGroundSeriouslyIMeanItThisTime()? :)
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 25, 2016, 09:14:02 pm
So basically you're writing moveToGroundSeriouslyIMeanItThisTime()? :)

I considered writing "goddamnitDoWhatIWantRightNow()" but it seemed like too large a project scope.

(Actually, I'm still having problems, because detachItem() actually does fail out when an item is stored in a building.  Fails if there's a BUILDING_HOLDER general ref.  Still not sure why, or what the danger is of proceeding in that case.)
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on April 25, 2016, 11:32:59 pm
So basically you're writing moveToGroundSeriouslyIMeanItThisTime()? :)

I considered writing "goddamnitDoWhatIWantRightNow()" but it seemed like too large a project scope.

(Actually, I'm still having problems, because detachItem() actually does fail out when an item is stored in a building.  Fails if there's a BUILDING_HOLDER general ref.  Still not sure why, or what the danger is of proceeding in that case.)
I have an issue in github about just that. It's not very hard to drastically improve the functionality of detach item and in turn to moveTo* functions.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 26, 2016, 11:15:40 am

I have an issue in github about just that. It's not very hard to drastically improve the functionality of detach item and in turn to moveTo* functions.

I've been looking through the code myself, mainly just out of curiosity, but a lot of files seem to be missing from the github repo.  Stuff like the more than 1,200 headers that should be in include\df.  Is there a second repository somewhere that has the core DFHack files?
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on April 26, 2016, 11:25:09 am
Those are all generated at compile time from df-structures.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 26, 2016, 12:33:44 pm
Those are all generated at compile time from df-structures.

Ah, very clever.  In retrospect, I should've guessed that myself.

The reason I was looking into it was because I possibly noticed a problem with job-duplicate, and wanted to take a look at the df::job copy constructor to see if there was a bug there.  Basically, it was changing the input item/material weirdly on duplication.  I'll put in a proper bug report when I have a chance to sit down and do some testing to see what the exact conditions are.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on April 26, 2016, 01:43:01 pm
There aren't any generated copy constructors that I'm aware of, so the problem is likely with however job-duplicate is copying jobs.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 26, 2016, 01:51:36 pm
There aren't any generated copy constructors that I'm aware of, so the problem is likely with however job-duplicate is copying jobs.

It's definitely using a copy constructor:
Code: [Select]
df::job *DFHack::Job::cloneJobStruct(df::job *job, bool keepEverything)
{
    CHECK_NULL_POINTER(job);

    df::job *pnew = new df::job(*job);

And it uses the copy constructor for job_item, too:
Code: [Select]
    for ( size_t a = 0; a < pnew->job_items.size(); a++ )
        pnew->job_items[a] = new df::job_item(*pnew->job_items[a]);

Those are probably compiler-generated, though, instead of generated from the XML, in which case I'd assume they're correct.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on April 27, 2016, 08:14:49 am
And as usual I still don't have an answer to how to I make an item like sword into an artifact with it's own name? Please I need help here. I asked this a few pages ago.

Since then I now also need answers to how do I turn my character into a necromancer with DFhack? As I don't have any necromancer towers whatsoever and I'm missing out a part of the game here because of it.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 27, 2016, 05:33:08 pm
And as usual I still don't have an answer to how to I make an item like sword into an artifact with it's own name? Please I need help here. I asked this a few pages ago.

Since then I now also need answers to how do I turn my character into a necromancer with DFhack? As I don't have any necromancer towers whatsoever and I'm missing out a part of the game here because of it.

I actually have a partial explanation for this.  I recently needed to write a script to turn things into artifacts, and it looks like this:
Code: [Select]
function findImage(id, subid)
local result = nil
for _,i in ipairs(df.global.world.art_image_chunks) do
if i.id == id then
result = i.images[subid]
end
end
return result
end

local item = dfhack.gui.getSelectedItem()

if not item then
print("No item selected")
else

local already_artifact = false
for i,v in ipairs(item.general_refs) do if df.general_ref_is_artifactst:is_instance(v) then already_artifact = true end end
if already_artifact then
print("Already an artifact")
else

local artifact_record = df.artifact_record:new()
local artifact_ref = df.general_ref_is_artifactst:new()
local history_event = df.history_event_artifact_createdst:new()

artifact_record.id = df.global.artifact_next_id
artifact_record.item = item
artifact_record.anon_1 = -1000000
artifact_record.anon_2 = -1000000
artifact_record.anon_3 = -1000000

artifact_ref.artifact_id = artifact_record.id

item.flags.artifact = true
item.flags.artifact_mood = true
item:setQuality(5)
for _,v in ipairs(item.improvements) do
v.quality = 5
end

if item.masterpiece_event == -1 then
history_event.year = df.global.cur_year
history_event.seconds = df.global.cur_year_tick_advmode
else
local masterpiece_event = df.global.world.history.events[item.masterpiece_event]
history_event.year = masterpiece_event.year
history_event.seconds = masterpiece_event.seconds
end
history_event.id = df.global.hist_event_next_id
history_event.artifact_id = artifact_record.id
history_event.hfid = item.maker
history_event.unit_id = df.historical_figure.find(item.maker).unit_id
history_event.site = df.global.world.world_data.active_site[0].id

item.general_refs:insert('#', artifact_ref)
df.global.world.artifacts.all:insert('#', artifact_record)
df.global.artifact_next_id = artifact_record.id + 1
df.global.world.history.events:insert('#', history_event)
df.global.hist_event_next_id = df.global.hist_event_next_id + 1

-- Look for a name
local named_image = nil
if df.item_figurinest:is_instance(item) then
print("is figurine")
local image = findImage(item.image.id, item.image.subid)
print("found image") print(image)
if image and image.name.has_name then
print("set name")
named_image = image
end
end
if not named_image then
for _,i in ipairs(item.improvements) do
if df.itemimprovement_art_imagest:is_instance(i)
or df.itemimprovement_illustrationst:is_instance(i)
or df.itemimprovement_sewn_imagest:is_instance(i) then

local image = findImage(i.image.id, i.image.subid)
if image and image.name.has_name then
named_image = image
end
end
end
end

if named_image then
for i=0,6 do
artifact_record.name.words[i] = named_image.name.words[i]
artifact_record.name.parts_of_speech[i] = named_image.name.parts_of_speech[i]
end
artifact_record.name.language = named_image.name.language
artifact_record.name.has_name = true
end
end
end

Note: this is very sketchy, but should be enough to work off of.  The script currently looks for a name on a decoration on the item and, if it finds one, just copies that name into the artifact record.  But, you could manually edit the artifact_record::name through the interactive Lua interface.  You can find the word IDs (for name::words) at df.global.world.raws.language.words.  They're actually just indexed in the order they appear in language_words.txt.  The parts_of_speech is the specific variant of the word to use.  0 and 1 are singular and plural noun, for example.

You could also just skip all this, set all the words to -1, and then set the first_name to whatever you want, but that's less fun.

For an artifact weapon, you'll want to manually set the sharpness and such to the correct values for an artifact weapon.  Search on Google for a script called "artifake," which I based mine off of.  It sets the sharpness, so you can see how to do that from there.

EDIT: BTW, here's a useful thing for getting the word IDs:
Code: [Select]
for i,v in ipairs(df.global.world.raws.language.words) do dfhack.printerr(v.word .. ': ' .. i) endThat'll print the words and their IDs out to DFHack's error log.  Copy/paste them into a text file, and you'll have a reference for any time you need to look up word IDs.

I considered writing a script to parse language_names from plain text, which would actually not be too hard, since everything's there in raws.language.words.  The only tricky bit is the first, compound word.  You'd have to first search for single words matching it, then try every split position until you find one that gives you two valid words.  It ended up being overengineered for what I needed, though, so I've just been doing it manually when I need to.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on April 27, 2016, 07:10:10 pm
-snip-

Thanks! Will look into this tomorrow or the day after in my currently on-halt adventure as I have sword that just needs it's own name and be registered as an artifact in the legends. Even if I can't achieve the latter, I'll be just content having at least my own sword with a custom name so I know that it has artifact quality.
And.. thanks! :)

Still need scripts/clues for DFhack sorcery to make my adventurer a necromancer. Honestly, all the worlds I've created I've noticed not a single necromancer tower. Probably because I always set the world age to generate only up to 5 years as to avoid lag and also because to be an ancient being in the DF world at the end of it's cycle. Kinda like the mighty Vikings with their gods of old with their stories of Ragnarök and gods doing battle with evil (Thor has always been my favorite of the Viking lore along with the hammer he has, Mjölnir).

EDIT: Ugh. I feel like my head is about to shutdown and my stomach lose it's lunch. Good grief, I just can't make heads and tails of coding stuff. I look at it, try to understand it and fail, fail after a fail, after a fail, after a fail, after a fail, after a fail, after a fail, after a fail, after a fail... somebody give me better brain. Or better yet.
A finished script with in-depth instructions of what the actual fuck I'm supposed to do.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 28, 2016, 12:06:47 pm
BTW, for the folks working on df-structures, I've identified a flag for you.  This may already be known by now, but item_flags2[3] is the flag that indicates if a quire has a writing on it.  It's used along with a check for an itemimprovement_writingst in the quire's improvements list to determine if an item matches the "written-on quire" requirement for the "bind book" job.  (That requirement looks to be "HAS_WRITING_IMPROVEMENT," so that's maybe a good name for the flag.)

Incidentally, if you set the flag on a book binding, the job won't recognise it as a book binding anymore.  And the secondary check for an itemimprovement_writingst for the actual quire doesn't look to see if there's any actual writing on there, it'll queue up just fine with an empty anon_1 vector.

And, speaking of which, the anon_1 vector is the list of IDs of the writings on the quire.  Each one is a reference into df.global.world.written_contents.  I mentioned that a few pages back, though.

(EDIT: Also, written_content_type 23 is "star chart")
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on April 28, 2016, 02:32:37 pm
I gave up on the artifact/item naming thing for the time being as getting to be a necromancer is more important. Just went over all of the worlds in legends mode I've had adventurers in and NONE of them have necromancers and their towers in them, something to do with 'Age of Myth' and only 5 years in?

How old most the world be for them to generate!? Why of why can't I just turn my character into a necromancer!?? I have DFhack and don't know how to use it properly or at all, or barely. FUCK!!! >:(

*takes deep breather*

Look I'm just exhausted and furious from all the modding and reading and I just wanna play and enjoy the game and try out the necromancer in DF. To put it simply: I'm running on a very low thinking battery as of late when it comes to having to do something complicated.

By the way, do at least tombs have necromancers or slabs about necromancy in them because I seem to have alot of tombs in my generated worlds.
Title: Re: DFHack 0.42.06-r1
Post by: Urlance Woolsbane on April 28, 2016, 03:13:51 pm
I gave up on the artifact/item naming thing for the time being as getting to be a necromancer is more important. Just went over all of the worlds in legends mode I've had adventurers in and NONE of them have necromancers and their towers in them, something to do with 'Age of Myth' and only 5 years in?

How old most the world be for them to generate!? Why of why can't I just turn my character into a necromancer!?? I have DFhack and don't know how to use it properly or at all, or barely. FUCK!!! >:(
Individuals can only become Necromancers if they become obsessed with their own mortality.  Five years is simply not enough time for a vanilla sapient to worry about death. Complicating matters is the apparent limit of this anxiety to authorities, the delay between the starts of their quests and their completions, and the time needed to amass the fifty zombies required for a tower (until which, they act as bandits, living in camps.)

What size world do you play in? Generating a "small" world, with lots of civs and site, for 250 years is fairly quick, results (for my laptop, at least) in a tolerable amount of lag, and should get you at least one tower.

You could also simply add the ability to raise the dead to your custom race.

Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on April 28, 2016, 03:31:42 pm
Ah, means genning yet another world and on top of that traveling the world and setting up stuff for who knows how long and adding a new reaction probably means genning a new world also so balls to it for now.

I play in medium world size with high amount of everything usually, I intentionally keep the history short as to avoid lag as I just can't stand lag nor load times.
Title: Re: DFHack 0.42.06-r1
Post by: Atomic Chicken on April 28, 2016, 03:33:34 pm
-snip-

If you're already comfortable with gm-editor and want to avoid scripting, this is probably the simplest method:

1) Obtain a (not necessarily blank) slab. If you can't find one/want to avoid the hassle, you can utilise gui/create-item to make a new one.
2) Enter "gui/gm-editor df.global.world.raws.interactions" in the DFHack console.
3) Look through the entries, until you find one named "SECRET_1" or similar (not SECRET_ANIMATE). Assuming you haven't modded in any new secrets, this should relate to necromancy. Otherwise, if you're unsure about its nature, looking through its sources and effects should give you an indication.
4) Now, take note of the interaction's id (listed just below the name).
5) Use gm-editor to modify the slab: set engraving_type to 6 (Secrets) and topic to the secret's id.

And voilà! A fully-functional necromancy-inducing slab. Reading it (of course, this assumes that your unit is not illiterate) should apply the interaction.

Spoiler: side-note (click to show/hide)
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on April 28, 2016, 04:16:56 pm
-snip-

If you're already comfortable with gm-editor and want to avoid scripting, this is probably the simplest method:

1) Obtain a (not necessarily blank) slab. If you can't find one/want to avoid the hassle, you can utilise gui/create-item to make a new one.
2) Enter "gui/gm-editor df.global.world.raws.interactions" in the DFHack console.
3) Look through the entries, until you find one named "SECRET_1" or similar (not SECRET_ANIMATE). Assuming you haven't modded in any new secrets, this should relate to necromancy. Otherwise, if you're unsure about its nature, looking through its sources and effects should give you an indication.
4) Now, take note of the interaction's id (listed just below the name).
5) Use gm-editor to modify the slab: set engraving_type to 6 (Secrets) and topic to the secret's id.

And voilà! A fully-functional necromancy-inducing slab. Reading it (of course, this assumes that your unit is not illiterate) should apply the interaction.

Spoiler: side-note (click to show/hide)

Thanks! I'm sorry about my frustrated post, I couldn't even think straight at that moment.

Anyhow, I did as instructed but for some reason it didn't work, I found the SECRET_1 thing in 4th line, added it's ID to topic, saved the game and re-load the game, read the slab and nothing. Nothing under 'acquired power' menu. I spawned the slab.
Title: Re: DFHack 0.42.06-r1
Post by: Atomic Chicken on April 28, 2016, 04:34:08 pm
Anyhow, I did as instructed but for some reason it didn't work, I found the SECRET_1 thing in 4th line, added it's ID to topic, saved the game and re-load the game, read the slab and nothing. Nothing under 'acquired power' menu. I spawned the slab.
That's unusual. Did you remember to change the slab's engraving_type?

If that's not the issue, are you playing a modded race? Necromancy secrets are generated with a requirement for [MORTAL], [CAN_SPEAK], [CAN_LEARN] - reading necromancy slabs has no effect on races which lack such tags, so this method would not work.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on April 28, 2016, 05:25:52 pm
Anyhow, I did as instructed but for some reason it didn't work, I found the SECRET_1 thing in 4th line, added it's ID to topic, saved the game and re-load the game, read the slab and nothing. Nothing under 'acquired power' menu. I spawned the slab.
That's unusual. Did you remember to change the slab's engraving_type?

If that's not the issue, are you playing a modded race? Necromancy secrets are generated with a requirement for [MORTAL], [CAN_SPEAK], [CAN_LEARN] - reading necromancy slabs has no effect on races which lack such tags, so this method would not work.

Yeah, that was the issue. Added a bit of mortality to my custom beast and tested it in the arena and it worked. Now I just need to enable the thing for my current adventurer.

EDIT: Heh, mission accomplished! Nah didn't enable it for the current adventurer but I can make a new one that generates with the modified raws and since I haven't done much with the current character anyway and thanks to DFhack createitem commands I can easily get crafting materials! Splendid! Thank you guys! I'm terribly sorry for being ranty/seemingly aggressive. Was not the intention. Like I said couldn't think straight. Will try harder to avoid this situation in the future as I'm conflicted about it myself.

NEW EDIT!:
By the way, I'm gonna need a different version of the full-heal command, like cut something from it as using it on my damaged necromancer adventurer de-necromances them. :o Some line perhaps that keeps the necromancy/raising dead condition?
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on April 28, 2016, 07:30:27 pm
BTW, for the folks working on df-structures, I've identified a flag for you.

Probably best to open an issue at the repo (https://github.com/DFHack/df-structures/issues), since it's easy for comments here to get lost.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on April 28, 2016, 09:48:06 pm
And as usual I still don't have an answer to how to I make an item like sword into an artifact with it's own name? Please I need help here. I asked this a few pages ago.

Since then I now also need answers to how do I turn my character into a necromancer with DFhack? As I don't have any necromancer towers whatsoever and I'm missing out a part of the game here because of it.

I actually have a partial explanation for this.  I recently needed to write a script to turn things into artifacts, and it looks like this:
Spoiler (click to show/hide)

Note: this is very sketchy, but should be enough to work off of.  The script currently looks for a name on a decoration on the item and, if it finds one, just copies that name into the artifact record.  But, you could manually edit the artifact_record::name through the interactive Lua interface.  You can find the word IDs (for name::words) at df.global.world.raws.language.words.  They're actually just indexed in the order they appear in language_words.txt.  The parts_of_speech is the specific variant of the word to use.  0 and 1 are singular and plural noun, for example.

You could also just skip all this, set all the words to -1, and then set the first_name to whatever you want, but that's less fun.

For an artifact weapon, you'll want to manually set the sharpness and such to the correct values for an artifact weapon.  Search on Google for a script called "artifake," which I based mine off of.  It sets the sharpness, so you can see how to do that from there.

EDIT: BTW, here's a useful thing for getting the word IDs:
Code: [Select]
for i,v in ipairs(df.global.world.raws.language.words) do dfhack.printerr(v.word .. ': ' .. i) endThat'll print the words and their IDs out to DFHack's error log.  Copy/paste them into a text file, and you'll have a reference for any time you need to look up word IDs.

I considered writing a script to parse language_names from plain text, which would actually not be too hard, since everything's there in raws.language.words.  The only tricky bit is the first, compound word.  You'd have to first search for single words matching it, then try every split position until you find one that gives you two valid words.  It ended up being overengineered for what I needed, though, so I've just been doing it manually when I need to.
Interesting tricks, I'll have to check over it and see if I can use what you did to streamline https://github.com/maxthyme/dfstuff/blob/master/artifake.lua more. The names script is still broken because I can't figure out how to duplicate the trick mifki used to pull up the old in-game adventurer name selection screen.
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on April 29, 2016, 08:13:45 am
so with dfhack we can change the layout of a town and install any building or room just by messing with 'realizations' I wonder is it possible to make a new site type that produces it's very own layout like if site type is 24(or for ease own by a race of slavers) then dfhack picks up on that and adds a prison filled with filled cages linked to levers? probably be alot of inserting stuff to sites to pull this idea off.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on April 29, 2016, 10:49:16 am
Oh yeah I remember you talking about that, I'll have to poke around at those some myself since I've got so many towns in the worlds I play on.
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on April 29, 2016, 04:13:14 pm
been thinking about how would one make a shotgun spread in dwarf fortress.
idea on doing so is using minecart physics to launch a collected amount of items out in a direction assign by a cursor.
either that or thinking up a way to rewrite the 'launch/jump' script into telekinesis script for launching objects from one point to another.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on April 29, 2016, 08:56:07 pm
Hmmm, replacing the unit with an item in launch should work, but how you'd get it to work with context is trickier, but cloning it to just make shotgun.lua or something for items seems doable.
Title: Re: DFHack 0.42.06-r1
Post by: Roses on April 29, 2016, 09:47:44 pm
been thinking about how would one make a shotgun spread in dwarf fortress.
idea on doing so is using minecart physics to launch a collected amount of items out in a direction assign by a cursor.
either that or thinking up a way to rewrite the 'launch/jump' script into telekinesis script for launching objects from one point to another.

Code: [Select]
modtools/interaction-trigger -onAttackStr "shotgun" -suppressAttack -command [ wrapper -unitSource \\ATTACKER_ID -locTarget \\DEFENDER_ID -locCheck 2r_circle.txt -script [ item/projectile -unitSource \\SOURCE -locationTarget \\LOCATION -item AMMO:ITEM_AMMO_PELLET -mat INORGANIC:IRON ] ]
This shoots a pellet starting from the source unit and targeting a circle around the target unit, firing a total of 13 pellets.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 30, 2016, 03:12:49 pm
Interesting tricks, I'll have to check over it and see if I can use what you did to streamline https://github.com/maxthyme/dfstuff/blob/master/artifake.lua more. The names script is still broken because I can't figure out how to duplicate the trick mifki used to pull up the old in-game adventurer name selection screen.

Well, I hope you didn't start yet, because I just noticed a bug in that code.  I was setting the artifact ID in the history event record to the item id.  I edited that post and fixed it.  I also wrote a script to go through the history events and fix all the events with that mistake, so if anyone's already used the artifact-naming script, let me know and I'll post the fixit script.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on April 30, 2016, 04:19:50 pm
Yeah, already got the history event bit in there since I wanted to make sure they were recorded right in legends mode.

I still can't figure out why the first one you make in a world ends up turning into a slab-duplicate that crashes unless removed.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on April 30, 2016, 07:44:57 pm
Yeah, already got the history event bit in there since I wanted to make sure they were recorded right in legends mode.

I still can't figure out why the first one you make in a world ends up turning into a slab-duplicate that crashes unless removed.

If the code on your github repo is up-to-date, it's probably because of the way you try to find and initialise the artifact record.  You go through df.global.world.artifacts.all looking for an id of 0, which will be the first artifact created during world generation, which is probably a slab containing the secrets of life and death.  Then, for some reason, you change its item pointer to point to a newly-heap-allocated item (which I think you make as a copy of the item you already made earlier? I'm not totally sure how the Lua API does that table-initialisation thing) that isn't in the items list.  You never get around to inserting it into the items list, so you've got an artifact record pointing to an object that's out in the void, that the game otherwise doesn't know about.  Since it isn't in the items list, it won't get serialised out when you save the game.  The original artifact with id 0 will get serialised out to the save file, though, except its general_ref_is_artifactst will be pointing to an artifact record that doesn't point to it, and instead points to a non-existant item.
EDIT: Also, I totally forgot the part that causes it to only happen once: you set the id of artifacts.all[0] to global.artifact_next_id, so when you next try to create a new item it'll skip over it.  But, from what I can tell, it should just go through the whole loop and do nothing, because it shouldn't ever find an artifact with an ID of 0 (unless {new=df.artifact_record} initialises the id to 0, instead of -1 like df.artifact_record:new() does).

You should ditch that whole loop.  If you insert a new artifact record with '#' as the index, you don't need to find it, it'll always be at the end of the vector (so, df.global.world.artifacts.all[#df.global.world.artifacts.all - 1] or df.global.world.artifacts.all[df.global.artifact_next_id]).  No need to find it with a loop looking for an unintialised ID (which would be -1, not 0, as you're doing there; not expected, I know, but it's how dfhack initialises objects).  And, set the artifact record's item field to base, which is the item you already created with createItem(), then set it up from there, don't try to create another new object.

Also, you weirdly call new() on the artifact record and history events records, which shouldn't even work in a sane language, but in Lua probably means that a pair of vectors get heap allocated and then immediately discarded.  That probably wouldn't cause a crash on its own, just a tiny memory leak, but you should remove the "df.global.world.artifacts.all:new()" and "df.global.world.history.events:new()" lines just to be a good citizen, anyway.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on May 01, 2016, 11:42:44 am
I will look at that when I'm woken up more and fix it, thanks! Though, I thought I did the ' # ' index trick.
Title: Re: DFHack 0.42.06-r1
Post by: Roses on May 01, 2016, 04:50:09 pm
Does creating items with a the create-item script function the same as a reaction? That is to say, can I mimic the "make rock crafts" reaction or other hard coded reactions?
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on May 01, 2016, 05:15:45 pm
It uses the reaction code to create items but I'm pretty sure hard coded reactions aren't actually reactions.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 01, 2016, 06:57:31 pm
Does creating items with a the create-item script function the same as a reaction? That is to say, can I mimic the "make rock crafts" reaction or other hard coded reactions?

I'm not 100% sure if it does or not, but I can say that it produces some unnatural results.  For example, naturally mined boulders have their heat properties set correctly for their material types, but if you create a boulder with createitem BOULDER NATIVE_GOLD, for instance, all its heat properties will be set to 0 or -1.

It doesn't seem to have any gameplay effect, though.  Presumably, DF actually gets the material properties from the base material data in df.global.world.raws, and the material properties in the item struct are just there either for legacy reasons or for when the game can't find a mat_type/mat_index match.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 02, 2016, 08:23:13 am
Quick question: There seems to be a new dfhack plugin that shows information in material/item descriptions. How do I add, remove or alter those?

I noticed that when I looked at "dog leather", which gave me some random information about animal leathers in DF.

The issue for me is that I also looked at "dragon scales" and "antman chitinplate", which are actually good materials in the game, and I get the same description about "leathers are not terribly good in DF".

I assume its not related to material, but rather an item description for TANNED_SKIN ?
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 02, 2016, 08:49:25 am
Quick question: There seems to be a new dfhack plugin that shows information in material/item descriptions. How do I add, remove or alter those?

I noticed that when I looked at "dog leather", which gave me some random information about animal leathers in DF.

The issue for me is that I also looked at "dragon scales" and "antman chitinplate", which are actually good materials in the game, and I get the same description about "leathers are not terribly good in DF".

I assume its not related to material, but rather an item description for TANNED_SKIN ?
The info is in item-descriptions.lua and view-item-info.lua. And yes it does look into item type only.
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on May 02, 2016, 07:55:52 pm
Quick question: There seems to be a new dfhack plugin that shows information in material/item descriptions. How do I add, remove or alter those?

I noticed that when I looked at "dog leather", which gave me some random information about animal leathers in DF.

The issue for me is that I also looked at "dragon scales" and "antman chitinplate", which are actually good materials in the game, and I get the same description about "leathers are not terribly good in DF".

I assume its not related to material, but rather an item description for TANNED_SKIN ?

This is view-item-info.lua (https://github.com/DFHack/dfhack/blob/master/scripts/view-item-info.lua), which I designed with mod-ability in mind.

It takes item descriptions from hack/scripts/item-descriptions.lua (https://github.com/DFHack/dfhack/blob/master/scripts/item-descriptions.lua), based on the item type (or subtype, for items with subtypes).  You can supplement this with a script in the same format in the raw folder, called raw/scripts/more-item-descriptions.lua - entries in this file take priority.  If you put a modified copy of item-descriptions.lua in the raw folder, view-item-info will not fall back to the vanilla descriptions.

Hope that helps and makes sense!

If you want to add material descriptions -- beyond the property listing that already happens -- it shouldn't be too hard to add a system similar to item descriptions.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 03, 2016, 01:47:27 am
Thanks Warmist and Peridexis :)

Seems like Toady didnt add the item-descriptions (like he has done for tools), but the community did. :)
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 03, 2016, 08:18:43 am
I'm curious: when you use tiletypes to change a construction to natural stone, what happens to the block or boulder that was used to build it?  Blocks used in constructions still appear in the stocks screen, and the count doesn't seem to decrease when you use tiletypes to replace them with natural stone, so is that object just getting orphaned and sitting in the items list forever?
Title: Re: DFHack 0.42.06-r1
Post by: Rose on May 03, 2016, 08:25:08 am
Yes.
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 03, 2016, 08:56:20 am
I'm curious: when you use tiletypes to change a construction to natural stone, what happens to the block or boulder that was used to build it?  Blocks used in constructions still appear in the stocks screen, and the count doesn't seem to decrease when you use tiletypes to replace them with natural stone, so is that object just getting orphaned and sitting in the items list forever?
If you are curious about constructions in general i had a stab at making moving walls so there is relevant code  here  (https://github.com/warmist/df-mini-mods/blob/master/mechanicalWorkshops/wall_mover.lua) and there was a tweak that compacted walls by deleting their items and setting them to non-item based walls  here  (https://github.com/DFHack/dfhack/blob/33302251c343324b0cd17bfb206d16a626093dd7/plugins/cleanconst.cpp)

Also by just changing tiletype you leave an orphaned construction which probably is also a Bad thing (tm)
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 03, 2016, 09:12:32 am
Ah, shame.  I wonder how hard it would be to update tiletypes to just remove the orphaned constructions and blocks if it's turning a construction into not-a-construction.  I mean, would it be that easy?
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 03, 2016, 09:55:58 am
Ah, shame.  I wonder how hard it would be to update tiletypes to just remove the orphaned constructions and blocks if it's turning a construction into not-a-construction.  I mean, would it be that easy?
Tile type manipulation is full of stuff like this. E.g. if it's part of vein you need to find the vein entry and remove the tile from it's mask. Also tree and shrubs have special logic and so on...

Making sure that each one work correctly would take someone ages (and it would probably break a lot) but anyone who wants to do that is welcome :)
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 03, 2016, 10:03:30 am
Ah, shame.  I wonder how hard it would be to update tiletypes to just remove the orphaned constructions and blocks if it's turning a construction into not-a-construction.  I mean, would it be that easy?
Tile type manipulation is full of stuff like this. E.g. if it's part of vein you need to find the vein entry and remove the tile from it's mask. Also tree and shrubs have special logic and so on...

Making sure that each one work correctly would take someone ages (and it would probably break a lot) but anyone who wants to do that is welcome :)

Haha, fair enough.  Thanks for cleanconst, BTW, that actually does help a lot.

I actually might write a quick little script, just for myself, to clean up orphaned constructions from my tiletypes usage.  Shouldn't be too hard to iterate the list of constructions and remove the ones that are located at tiles that aren't constructions anymore.  I take it, from skimming the code on github, that the tiletypes enum isn't laid out in a sane way where I can just use a mask to figure out which ones are constructions and which ones aren't.  Unless I want to write a full plugin that can use df::enum_attrs, I'll have to just make a list of all the tile types that are constructions, right?
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 03, 2016, 10:16:52 am
Ah, shame.  I wonder how hard it would be to update tiletypes to just remove the orphaned constructions and blocks if it's turning a construction into not-a-construction.  I mean, would it be that easy?
Tile type manipulation is full of stuff like this. E.g. if it's part of vein you need to find the vein entry and remove the tile from it's mask. Also tree and shrubs have special logic and so on...

Making sure that each one work correctly would take someone ages (and it would probably break a lot) but anyone who wants to do that is welcome :)

Haha, fair enough.  Thanks for cleanconst, BTW, that actually does help a lot.

I actually might write a quick little script, just for myself, to clean up orphaned constructions from my tiletypes usage.  Shouldn't be too hard to iterate the list of constructions and remove the ones that are located at tiles that aren't constructions anymore.  I take it, from skimming the code on github, that the tiletypes enum isn't laid out in a sane way where I can just use a mask to figure out which ones are constructions and which ones aren't.  Unless I want to write a full plugin that can use df::enum_attrs, I'll have to just make a list of all the tile types that are constructions, right?
There is actually tile attrs for materials. And one of them is "CONSTRUCTION" so you could use that. Also scripts can use those attrs just finde you don't need plugin for that (unless you want to do it often on a whole map).
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 03, 2016, 10:57:45 am
There is actually tile attrs for materials. And one of them is "CONSTRUCTION" so you could use that. Also scripts can use those attrs just finde you don't need plugin for that (unless you want to do it often on a whole map).

Cheers.  My script found 1650 orphaned constructions, which sounds about right, and deleted them without issue.  Easier than I was expecting.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 03, 2016, 11:30:17 am
The assumption is no, but can I:

1. Still use Rendermax with 42.06 and TWBT?
2. Still trigger invasions somehow?
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on May 03, 2016, 11:45:39 am
No to both.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 03, 2016, 12:29:20 pm
Thank you again, even if that is fairly horrible news. Testing invaders will have to be done the hard way, countless hours of play and player feedback.
Title: Re: DFHack 0.42.06-r1
Post by: Roses on May 03, 2016, 01:44:33 pm
Thank you again, even if that is fairly horrible news. Testing invaders will have to be done the hard way, countless hours of play and player feedback.

I am working on a simulated siege script, but it is on the back burner until I finish my thesis (as is everything else in my life). For now I have the spawning component worked out, you specify the number or a range of numbers of units to spawn, it then uses the castes pop ratios to pick the correct mix of units, it then allocates a number of skill points (user defined) to each unit, and it uses the equipment and materials available to the civilization to create appropriate uniforms. You can also overwrite all the automatic selection stuff by saying you want X of caste 1, Y of caste 2, Z of caste 3, etc... and you want a specific uniform and skill distribution. But I haven't gotten it to register as an actually siege, so it doesn't do much and the units just hang out on the edge of the map.

And of course this all bypasses the whole "army" thing DF uses now. It's possible I will try to link it to armies in the future, but again, until June all I can do is read the forums and add to my to-do list.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 03, 2016, 01:54:22 pm
I can work around it by making them allies and spawning caravans with bodyguards.

That way I can see which materials they use, if items and graphics work, how the guards are equipped...
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on May 03, 2016, 06:12:20 pm
on the back burner until I finish my thesis (as is everything else in my life) ... until June all I can do is read the forums and add to my to-do list.

Amen; and good luck!
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 03, 2016, 07:42:31 pm
until I finish my thesis
When DF is your sanity break, you know you've made a wise career choice.

Fortunately for me, I didn't discover DF until well after I'd finished my thesis.
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on May 04, 2016, 01:54:25 pm
okay got throwing to work so I figured why not recreate Golf strangely I kept throwing my musical instrument per stroke
(http://www.truimagz.com/host/rumrusher/folder1/Golf-might-be-doable-now.gif)
which then I threw a stone throne around and then notice something wonderful about tagging the same item with projectile prompts
and tested this with a corpse.
(http://www.truimagz.com/host/rumrusher/folder1/telekinesis-Corpse-explosion.gif)
so uhh telekinesis.lua is set up.
 (https://gist.github.com/Rumrusher/a8f1bfefa2fbed450b6d63f6739b2562)
at least now I can scratch off itemshotgun off the Dfhack todo list.
Title: Re: DFHack 0.42.06-r1
Post by: Roses on May 04, 2016, 02:46:27 pm
until I finish my thesis
When DF is your sanity break, you know you've made a wise career choice.

Fortunately for me, I didn't discover DF until well after I'd finished my thesis.

Not sure Physicist is a wise career choice, but I've been in graduate school for 7 years now so I am just ready to be done.

okay got throwing to work so I figured why not recreate Golf strangely I kept throwing my musical instrument per stroke
at least now I can scratch off itemshotgun off the Dfhack todo list.

Two Questions:
1. What happens if there are more than one item at a position?
2. Do you find it faster to check for an item going through the entire item list instead of checking the occupancy? (I may be remembering occupancy wrong, does that just tell you True or False and you would have to look through the list anyway?)

On a side note I did manage to think up a way to get multilevel buildings to work. After a building is built it is possible to change the tile type inside a building to be a pillar (or wall or what have you) that can then support the next floor above it. I am thinking I will try to write a script that will modify a building to change unpassable tiles or something like that to pillars or walls and then build on top of it. The only question that remains is will it cause crashes? Who knows. (Also if I turn a workshop tile into stairs could a dwarf use those stairs? Could we actually allow for different stories that dwarfs can access? I doubt it, but it would be cool)
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on May 04, 2016, 04:28:58 pm
until I finish my thesis
When DF is your sanity break, you know you've made a wise career choice.

Fortunately for me, I didn't discover DF until well after I'd finished my thesis.

Not sure Physicist is a wise career choice, but I've been in graduate school for 7 years now so I am just ready to be done.

okay got throwing to work so I figured why not recreate Golf strangely I kept throwing my musical instrument per stroke
at least now I can scratch off itemshotgun off the Dfhack todo list.

Two Questions:
1. What happens if there are more than one item at a position?
2. Do you find it faster to check for an item going through the entire item list instead of checking the occupancy? (I may be remembering occupancy wrong, does that just tell you True or False and you would have to look through the list anyway?)

On a side note I did manage to think up a way to get multilevel buildings to work. After a building is built it is possible to change the tile type inside a building to be a pillar (or wall or what have you) that can then support the next floor above it. I am thinking I will try to write a script that will modify a building to change unpassable tiles or something like that to pillars or walls and then build on top of it. The only question that remains is will it cause crashes? Who knows. (Also if I turn a workshop tile into stairs could a dwarf use those stairs? Could we actually allow for different stories that dwarfs can access? I doubt it, but it would be cool)
1. it pulls the top most item from the list usually throwing 1 item
2. I comment out the occupancy stuff as I didn't figure out how to do item tile checks also that items usually don't block movement.
I also had to pull one of warmist old corpse explosion scripts to figure out how to check for items... then realized oh yeah adding a pause so you can poke the item then point to the direction you want to fling it.
also I think I possibly simpler to just swap out the items.all for items.other.IN_PLAY to search for stuff in field than all items in existence but hey.
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 04, 2016, 11:16:21 pm
@roses there is block-local item storage that MUST be up-to-date. It has item ids and you can get items quicker that way.
Title: Re: DFHack 0.42.06-r1
Post by: Roses on May 05, 2016, 12:05:41 pm
@roses there is block-local item storage that MUST be up-to-date. It has item ids and you can get items quicker that way.

Thanks, that's good to know. Better than searching through tens of thousands of items. Does the local storage also handle items that are in constructions/buildings/inventories or only those on the ground?

EDIT: So looking at tasks that are hardcoded that can't be done with a custom reaction I have
Code: [Select]
Butcher a dead animal (maybe a script which enters arena mode and hits the butcher key?)
Extract from dead animal
Capture a live land animal
Milk Creature
Shear Creatue
Capture a live fish
Engrave memorial (not sure about this one)
Melt Item (can be done, but doesn't handle the fractional bars and such, script should be able to replicate)
Prepare meal (not sure about this one)
Collect Sand
Collect Webs
Collect Clay
Are there any other I am missing, or are there any I have that people think could be done with scripts? Obviously I think they could all be "done" with scripts, but I was thinking about replicating the exact features not just, sand bag is created, remove some sand from map.
Title: Re: DFHack 0.42.06-r1
Post by: indyofcomo on May 05, 2016, 09:45:12 pm
Auto-allocate beds/etc to mayor/etc doesn't seem to be working for me. Any known issues with that in 42.04-r1?
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on May 05, 2016, 10:14:37 pm
There isn't a 0.42.04-r1 DFHack release. What are you using? I remember testing that feature at some point in the 0.42 series and seeing it work, though.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 05, 2016, 11:03:19 pm
Does anybody know why the modtools/force script can't start a diplomat event?  Or, alternatively, where the data on wars and conflicts is stored.  I was hoping to end a war (against my civilisation) by just spawning in a diplomat event, but it just doesn't seem to happen.
Title: Re: DFHack 0.42.06-r1
Post by: indyofcomo on May 06, 2016, 09:35:11 am
There isn't a 0.42.04-r1 DFHack release. What are you using? I remember testing that feature at some point in the 0.42 series and seeing it work, though.
Oh, silly me. That's the version number of LazyNewb I'm using. So the dfhack it has is 0.42.04-alpha2.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on May 06, 2016, 12:26:23 pm
okay got throwing to work so I figured why not recreate Golf strangely I kept throwing my musical instrument per stroke
http://www.truimagz.com/host/rumrusher/folder1/Golf-might-be-doable-now.gif
which then I threw a stone throne around and then notice something wonderful about tagging the same item with projectile prompts
and tested this with a corpse.
http://www.truimagz.com/host/rumrusher/folder1/telekinesis-Corpse-explosion.gif
so uhh telekinesis.lua is set up.
 (https://gist.github.com/Rumrusher/a8f1bfefa2fbed450b6d63f6739b2562)
at least now I can scratch off itemshotgun off the Dfhack todo list.
Oh good lord.
Spoiler (click to show/hide)
Title: Re: DFHack 0.42.06-r1
Post by: Roses on May 06, 2016, 01:01:54 pm
okay got throwing to work so I figured why not recreate Golf strangely I kept throwing my musical instrument per stroke
http://www.truimagz.com/host/rumrusher/folder1/Golf-might-be-doable-now.gif
which then I threw a stone throne around and then notice something wonderful about tagging the same item with projectile prompts
and tested this with a corpse.
http://www.truimagz.com/host/rumrusher/folder1/telekinesis-Corpse-explosion.gif
so uhh telekinesis.lua is set up.
 (https://gist.github.com/Rumrusher/a8f1bfefa2fbed450b6d63f6739b2562)
at least now I can scratch off itemshotgun off the Dfhack todo list.
Oh good lord.
Spoiler (click to show/hide)

I meant to comment on this before, but is there a reason you chose the falling/minecart projectile mechanics over the shooting mechanics? I currently split my projectile scripts allowing you to chose which one you want, but if falling/minecart is always better then I might just remove the choice to simplify the script.
Title: Re: DFHack 0.42.06-r1
Post by: Urlance Woolsbane on May 06, 2016, 04:42:03 pm
Masterwork's return has given me the modding bug, so I'm probably going to have a spate of questions over the next few weeks. I'm a DFHack newb, so please pardon my naivete.


Thanks in advance!
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on May 06, 2016, 04:43:47 pm
1. I'm pretty sure no.

2. No; in general, world site stuff is basically infeasible to mess with, and custom sites are probably the infeasible of anything.

3. I'm not sure it could be done on the current region if that region doesn't have an interaction already, but I haven't messed around with interaction instances.
Title: Re: DFHack 0.42.06-r1
Post by: Urlance Woolsbane on May 06, 2016, 04:44:27 pm
1. I'm pretty sure no.

2. No; in general, world site stuff is basically infeasible to mess with, and custom sites are probably the infeasible of anything.

3. I'm not sure it could be done on the current region if that region doesn't have an interaction already, but I haven't messed around with interaction instances.
Thanks!
Title: Re: DFHack 0.42.06-r1
Post by: kuertee on May 07, 2016, 08:42:01 am
Hey all, was wondering...

Is there a script that would export the local fortress map into an English readable text file (e.g. XML)?

Or is there a tool that can extract it from the world.SAV file?

Thanks.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on May 07, 2016, 09:23:01 am
There isn't a 0.42.04-r1 DFHack release. What are you using? I remember testing that feature at some point in the 0.42 series and seeing it work, though.
Oh, silly me. That's the version number of LazyNewb I'm using. So the dfhack it has is 0.42.04-alpha2.
I can't reproduce the issue. Are you waiting for some time for the room to be reassigned? (It won't happen instantly, but it should happen within an in-game day or so.)

Edit: Also, is the noble in question a citizen?
Title: Re: DFHack 0.42.06-r1
Post by: milo christiansen on May 07, 2016, 12:28:52 pm
So looking at tasks that are hardcoded that can't be done with a custom reaction I have
Code: [Select]
Butcher a dead animal (maybe a script which enters arena mode and hits the butcher key?)
Extract from dead animal
Capture a live land animal
Milk Creature
Shear Creatue
Capture a live fish
Engrave memorial (not sure about this one)
Melt Item (can be done, but doesn't handle the fractional bars and such, script should be able to replicate)
Prepare meal (not sure about this one)
Collect Sand
Collect Webs
Collect Clay
Are there any other I am missing, or are there any I have that people think could be done with scripts? Obviously I think they could all be "done" with scripts, but I was thinking about replicating the exact features not just, sand bag is created, remove some sand from map.

I already have a powerful set of scripts that replicate melt item. The current version actually does a much better job than vanilla does, as it returns exactly the same number of bars/wafers as were used to make the item. Partial bars are handled globally, but that's because I was lazy, not because it isn't possible to do it per-workshop.

The latest version of these scripts are included with Rubble, see "Libs/Melt Item" and "User/Melt Item".
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on May 07, 2016, 01:25:31 pm
1. I'm pretty sure no.

2. No; in general, world site stuff is basically infeasible to mess with, and custom sites are probably the infeasible of anything.

3. I'm not sure it could be done on the current region if that region doesn't have an interaction already, but I haven't messed around with interaction instances.
Thanks!
to be honest this is my next project attempt figuring out how to copy and paste playerfort details to another site and or designing custom npc sites to replace the pregen ones.
hmm this is a weird bug but looks like line edit doesn't work with keybinding script some how skips the process.
Title: Re: DFHack 0.42.06-r1
Post by: indyofcomo on May 07, 2016, 09:45:03 pm
There isn't a 0.42.04-r1 DFHack release. What are you using? I remember testing that feature at some point in the 0.42 series and seeing it work, though.
Oh, silly me. That's the version number of LazyNewb I'm using. So the dfhack it has is 0.42.04-alpha2.
I can't reproduce the issue. Are you waiting for some time for the room to be reassigned? (It won't happen instantly, but it should happen within an in-game day or so.)

Edit: Also, is the noble in question a citizen?

It's for my mayor position, and yes they are citizens. I am not sure how much time happens between, it's not an announcement I notice.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on May 08, 2016, 06:48:11 am
There isn't a 0.42.04-r1 DFHack release. What are you using? I remember testing that feature at some point in the 0.42 series and seeing it work, though.
Oh, silly me. That's the version number of LazyNewb I'm using. So the dfhack it has is 0.42.04-alpha2.
I can't reproduce the issue. Are you waiting for some time for the room to be reassigned? (It won't happen instantly, but it should happen within an in-game day or so.)

Edit: Also, is the noble in question a citizen?

It's for my mayor position, and yes they are citizens. I am not sure how much time happens between, it's not an announcement I notice.

There, fixed for ya. Thanks for making me laugh though! Your comment being insides someone else's quote.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on May 08, 2016, 07:59:00 pm
I meant to comment on this before, but is there a reason you chose the falling/minecart projectile mechanics over the shooting mechanics? I currently split my projectile scripts allowing you to chose which one you want, but if falling/minecart is always better then I might just remove the choice to simplify the script.
Soft landings I think are the main reason. Not having thrown items destroyed automatically.
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on May 08, 2016, 10:19:04 pm
I meant to comment on this before, but is there a reason you chose the falling/minecart projectile mechanics over the shooting mechanics? I currently split my projectile scripts allowing you to chose which one you want, but if falling/minecart is always better then I might just remove the choice to simplify the script.
Soft landings I think are the main reason. Not having thrown items destroyed automatically.
just realized now you can sink a sword into a person 7 times, and have it visually look like the person got stab by 7 swords at the same time from 7 different directions.
Title: Re: DFHack 0.42.06-r1
Post by: scamtank on May 09, 2016, 12:10:28 am
just realized now you can sink a sword into a person 7 times, and have it visually look like the person got stab by 7 swords at the same time from 7 different directions.

you wouldn't happen to have a screencap? it's been a while since we've had a fanart-inducing headscratcher to inflict on the internet
Title: Re: DFHack 0.40.24-r5
Post by: zenos14 on May 09, 2016, 11:40:34 am
anyone else having difficulty with AutoChop in 42.x? I'm getting a weird thing where the woodcutter seems to get stuck repeatedly trying to chop down a tree that they already chopped down a while ago.  This is in alpha1 on Windows, haven't tried alpha2 yet.  I'll load that up and run some more tests, see if I can reproduce it in a different fort.

--nomad_delta
I'm getting the same issue Nomad here is, but I'm using the new release, anyone else seeing the same thing?
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on May 09, 2016, 12:21:37 pm
just realized now you can sink a sword into a person 7 times, and have it visually look like the person got stab by 7 swords at the same time from 7 different directions.

you wouldn't happen to have a screencap? it's been a while since we've had a fanart-inducing headscratcher to inflict on the internet

Oh yeah, I laughed just by reading!

Anyhow to stay on topic of DFhack(ing): I still need a full-heal command that doesn't get rid of my necromancy. Pretty please?
Title: Re: DFHack 0.42.06-r1
Post by: TheFlame52 on May 09, 2016, 01:42:48 pm
It doesn't come back the tick after? That's what it does to vampirism, at least.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on May 09, 2016, 01:45:06 pm
Huh, sounds like it's clearing curses. I could add a -keep-curses option or something, probably.
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on May 09, 2016, 01:55:44 pm
just realized now you can sink a sword into a person 7 times, and have it visually look like the person got stab by 7 swords at the same time from 7 different directions.

you wouldn't happen to have a screencap? it's been a while since we've had a fanart-inducing headscratcher to inflict on the internet
here's a gif of a spider corpse exploding into 7 clones
(http://www.truimagz.com/host/rumrusher/folder1/telekinesis-Corpse-explosion.gif)
I also just dump this gif on tumblr and more folks are amazed with spider web dropping than dfhacking a corpse into 7 projectiles
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on May 09, 2016, 02:36:27 pm
It doesn't come back the tick after? That's what it does to vampirism, at least.
Huh, sounds like it's clearing curses. I could add a -keep-curses option or something, probably.

From what I remember about a week or more ago when I tested it I intentionally jumped from a tree and broke a few things as a necromancer, I then of course went to 'z' screen/character stat screen to where I initiated the ritual of 'full-heal', alright good, damages healed/removed but minus being a necromancer. I then investigated a bit by walking around with my character a bit to see for real and make sure that my character wasn't a necromancer anymore and nope, she wasn't.

That was then, now I just booted up the game again to check even though my character currently has no injuries and yup, removes necromancy... but after 30-60 ticks in I'm back to being a necromancer so that's a big-arse relief for me.

Still though, wish there was a version of the script that didn't instantly cure necromancy/vampirism/weresomething.
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on May 09, 2016, 08:34:11 pm
It doesn't come back the tick after? That's what it does to vampirism, at least.
Huh, sounds like it's clearing curses. I could add a -keep-curses option or something, probably.

From what I remember about a week or more ago when I tested it I intentionally jumped from a tree and broke a few things as a necromancer, I then of course went to 'z' screen/character stat screen to where I initiated the ritual of 'full-heal', alright good, damages healed/removed but minus being a necromancer. I then investigated a bit by walking around with my character a bit to see for real and make sure that my character wasn't a necromancer anymore and nope, she wasn't.

That was then, now I just booted up the game again to check even though my character currently has no injuries and yup, removes necromancy... but after 30-60 ticks in I'm back to being a necromancer so that's a big-arse relief for me.

Still though, wish there was a version of the script that didn't instantly cure necromancy/vampirism/weresomething.
so here's the script I use for healing wounds on my adventurer.
 
Spoiler:  for draggarth (click to show/hide)
this script doesn't poke into syndromes and remove them.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 09, 2016, 08:38:01 pm
So, how many minutes was DFHack stable before a new major DF version was released?  :)
Title: Re: DFHack 0.42.06-r1
Post by: scamtank on May 09, 2016, 09:03:34 pm
So, how many minutes was DFHack stable before a new major DF version was released?  :)

Just over two weeks, not a bad result at all!
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on May 09, 2016, 09:24:39 pm
so here's the script I use for healing wounds on my adventurer.
 
Spoiler:  for draggarth (click to show/hide)
this script doesn't poke into syndromes and remove them.

Thanks! And derp, it looks like a slightly altered 'healunit' script which I was somehow completely unaware of until now as I named your script/code to 'heal-self.lua' and put it there in the scripts folder and had a facepalm moment. Makes me wonder what else have I been missing. *slaps self* Will test it later when I get back to DF, still.. thanks!

EDIT: Now I just need to know how safe it is to use DFhack as it currently is in DF version 0.43.01.
Title: Re: DFHack 0.42.06-r1
Post by: Bumber on May 10, 2016, 10:33:06 am
EDIT: Now I just need to know how safe it is to use DFhack as it currently is in DF version 0.43.01.
https://www.youtube.com/watch?v=FopyRHHlt3M

0.43.01 came out yesterday. DFHack typically lags about a month behind. In all likelihood, DFHack is going to skip 0.43.01 and go to whatever stable 0.43.0x version fixes a bunch of the new bugs.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on May 10, 2016, 10:51:42 am
EDIT: Now I just need to know how safe it is to use DFhack as it currently is in DF version 0.43.01.
https://www.youtube.com/watch?v=FopyRHHlt3M

0.43.01 came out yesterday. DFHack typically lags about a month behind. In all likelihood, DFHack is going to skip 0.43.01 and go to whatever stable 0.43.0x version fixes a bunch of the new bugs.

Heh, that's me that can't think straight anymore. Arghhh.. I give up with this waiting for something thing, I'm done. Too many times done that and too many times negative outcome. Here's me going.. whatever.

https://www.youtube.com/watch?v=RHTnaYO5WLg
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 10, 2016, 03:22:22 pm
Are there any anticipated design changes with DFHack this time around?  Or will 0.42 code simply run on 0.43 once all of the non-trivial memory mapping work is done?

While that work proceeds, is there anything that folks would like to see added to my simple accessibility (http://www.bay12forums.com/smf/index.php?topic=157631.0) tools for possible inclusion in the base distribution?
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on May 10, 2016, 05:59:28 pm
I imagine advfort is due for an overhaul, to see what sort of stuff we can improve from the interface it uses, it would be nice if we could merge it into the building interface for adventurer mode to some extent but that will probably require more capable gui wizardry.

Things like workflow and stocks will need a full overhaul I assume.
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 10, 2016, 11:52:04 pm
I imagine advfort is due for an overhaul, to see what sort of stuff we can improve from the interface it uses, it would be nice if we could merge it into the building interface for adventurer mode to some extent but that will probably require more capable gui wizardry.

Things like workflow and stocks will need a full overhaul I assume.
I was hoping to drop advfort support, but after playing some df it seems like I can't do it yet. However it's too soon to tell if merging would be possible. I would guess it's unlikely but we'll see.
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on May 10, 2016, 11:53:07 pm
What exactly's it missing? Digging?
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on May 11, 2016, 12:27:10 am
What exactly's it missing? Digging?
the fact you don't get lock out of construction because there a hostile in the area... I mean it's for safety reasons but damn it I wanna dig myself an early grave.
like fort mode jobs are still doable... to order other npcs than the player. so there hope for that code to be put to better use.
then you have the what if I just wanna steal supplies from a town and use that for my fort? advfort allows you to do this.
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 11, 2016, 12:33:19 am
What exactly's it missing? Digging?
It only has: construction (with only carpenters workshop), tree cutting, item-based buildings (e.g. coffin and coffers etc...)
I'm sure eventually we'll have everything else. And the dissapearing buildings and items are confirmed bug (each time you sleep time advanced by <your current world age> :D)
Title: Re: DFHack 0.42.06-r1
Post by: Deon on May 11, 2016, 05:28:46 pm
Hey DFHack gurus, how difficult would it be to unlock other buildings besides carpenter's workshop for the adventure mode building? I was highly dissapointed when I noticed that it's the only workshop you can create.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on May 11, 2016, 05:48:40 pm
Well, the menu's entirely new, and nobody's looked at it yet to figure out exactly. It might be possible.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 12, 2016, 12:19:28 am
What does the workflow tool do that seems to be not yet possible with the manager?  Would there be value in using the workflow UI to control the manager?

(I personally usually don't run a fort long enough for workflow to be relevant.)

For my own stuff, it doesn't sound like the map data, event triggers or create-unit stuff has changed... which means it should Just Work™ once the memory mapping is complete.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on May 12, 2016, 12:34:01 am
I imagine advfort is due for an overhaul, to see what sort of stuff we can improve from the interface it uses, it would be nice if we could merge it into the building interface for adventurer mode to some extent but that will probably require more capable gui wizardry.

Things like workflow and stocks will need a full overhaul I assume.
I was hoping to drop advfort support, but after playing some df it seems like I can't do it yet. However it's too soon to tell if merging would be possible. I would guess it's unlikely but we'll see.

I think there will still be a spot for advfort on spot stuff, but doing the great big constructions I've done with advfort and doing them like this... yeah, no question new way is best there. Being able to dig until Toady adds it in will be invauable as always, and being able to deconstruct/alter things outside of the current non-site/camp-site limitations will be nice to have back to play with.

I know I'm going to poke around and see just how hard and fast the non-site modification stuff is, like embark-everywhere for these constructions being a nice target.
Title: Re: DFHack 0.42.06-r1
Post by: necrotic on May 12, 2016, 01:07:22 pm
What does the workflow tool do that seems to be not yet possible with the manager?  Would there be value in using the workflow UI to control the manager?

I think workflow is entirely replaced with the new job controls; the new controls have even more flexibility (eg multiple conditions) than workflow did.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 13, 2016, 11:21:09 am

so here's the script I use for healing wounds on my adventurer.
this script doesn't poke into syndromes and remove them.

Hmm, it doesn't remove syndromes, but will it revive people who're dying of alcohol-induced suffocation?  I'm not sure if the problem there is just suffocating because of a blocked airway that they can't clear because they're unconscious (which your script definitely fixes) or if the unconsciousness is a symptom of the suffocation.

Speaking of, does anybody know if the severity of alcohol-induced illness is proportional to the value of the alcohol?  Because I've had a suspicious number of alcohol-related deaths, and also have a modded booze that's more valuable than sunshine.  It occurred to me that, if the "strength" of alcohol is determined by its value, nobody might've noticed before since the normal alcohol values are so close to each other (2, 3, and 5).
Title: Re: DFHack 0.42.06-r1
Post by: scamtank on May 13, 2016, 01:05:26 pm
Speaking of, does anybody know if the severity of alcohol-induced illness is proportional to the value of the alcohol?  Because I've had a suspicious number of alcohol-related deaths, and also have a modded booze that's more valuable than sunshine.  It occurred to me that, if the "strength" of alcohol is determined by its value, nobody might've noticed before since the normal alcohol values are so close to each other (2, 3, and 5).

Barring a completely bizarre moonshot of a bug, no. Syndromes are syndromes, and their behavior is dictated separately from start to finish.
Title: Re: DFHack 0.42.06-r1
Post by: zenos14 on May 13, 2016, 10:22:06 pm
What does the workflow tool do that seems to be not yet possible with the manager?  Would there be value in using the workflow UI to control the manager?

I think workflow is entirely replaced with the new job controls; the new controls have even more flexibility (eg multiple conditions) than workflow did.

One thing I really want though is workflow's (or the stockpile jobs's ability) to do stuff like "Keep making X until you have Y items of Z quality"
The new version doesn't seem to have it, unless I missed something
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on May 13, 2016, 11:55:15 pm

so here's the script I use for healing wounds on my adventurer.
this script doesn't poke into syndromes and remove them.

Hmm, it doesn't remove syndromes, but will it revive people who're dying of alcohol-induced suffocation?  I'm not sure if the problem there is just suffocating because of a blocked airway that they can't clear because they're unconscious (which your script definitely fixes) or if the unconsciousness is a symptom of the suffocation.

Speaking of, does anybody know if the severity of alcohol-induced illness is proportional to the value of the alcohol?  Because I've had a suspicious number of alcohol-related deaths, and also have a modded booze that's more valuable than sunshine.  It occurred to me that, if the "strength" of alcohol is determined by its value, nobody might've noticed before since the normal alcohol values are so close to each other (2, 3, and 5).
the script was posted for someone who didn't want their interactions removed since they are tied to Syndromes and the default dfhack heal script kinda deletes syndromes completely.

Title: Re: DFHack 0.42.06-r1
Post by: Silverybearded on May 14, 2016, 12:24:48 am
What does the workflow tool do that seems to be not yet possible with the manager?  Would there be value in using the workflow UI to control the manager?

I think workflow is entirely replaced with the new job controls; the new controls have even more flexibility (eg multiple conditions) than workflow did.

One thing I really want though is workflow's (or the stockpile jobs's ability) to do stuff like "Keep making X until you have Y items of Z quality"
The new version doesn't seem to have it, unless I missed something
You could enforce it by linking the job to a workshop which is limited to the corresponding minimum skill.
Title: Re: DFHack 0.42.06-r1
Post by: zenos14 on May 14, 2016, 12:44:12 am
What does the workflow tool do that seems to be not yet possible with the manager?  Would there be value in using the workflow UI to control the manager?

I think workflow is entirely replaced with the new job controls; the new controls have even more flexibility (eg multiple conditions) than workflow did.

One thing I really want though is workflow's (or the stockpile jobs's ability) to do stuff like "Keep making X until you have Y items of Z quality"
The new version doesn't seem to have it, unless I missed something
You could enforce it by linking the job to a workshop which is limited to the corresponding minimum skill.
...Well now I feel like an idiot, thanks for the tip though
Title: Re: DFHack 0.42.06-r1
Post by: expwnent on May 14, 2016, 04:35:20 am
It would help, but it wouldn't quite achieve the same functionality.
Title: Re: DFHack 0.42.06-r1
Post by: zenos14 on May 14, 2016, 06:35:03 pm
Another question,
Region-pops list POND says I still have 1125 turtles left in my map, but I just got the message that there is nothing left to fish
Am I misunderstanding that Region-pops is supposed to show you the surviving population of creatures your map has access to?
Are vermin handled differently or something?
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 14, 2016, 11:28:53 pm
Hey guys, I had a script for dfhack that I used to clear soil with. You run it from a workshop, and it creates an "open space" next to the workshop, and a 3x3 space underground. It only removes soil that way, no rock.

It worked fine, but when I try it with 42.06 -r1 it crashes the game.

Code: [Select]
    local pos=position or copyall(df.global.cursor)
    if pos.x==-30000 then
        qerror("Select a location")
    end
local x = 0
local y = 0
for x=pos.x-3,pos.x+3,1 do
for y=pos.y-3,pos.y+3,1 do
z=pos.z-1
while true do
local block = dfhack.maps.getTileBlock(x,y,z)
if block then
--print(x..","..y)
block.tiletype[x%16][y%16]=32
--z = z-1
else
--z = z+1
block = dfhack.maps.getTileBlock(x,y,z)
block.tiletype[x%16][y%16]=42
break
end

end
end
end

Any help with updating it?
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on May 15, 2016, 07:22:27 am
What are 32 and 42 supposed to be? You should be using df.tiletype.NAME instead, because the raw numbers can change between releases.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 15, 2016, 12:25:07 pm
What are 32 and 42 supposed to be? You should be using df.tiletype.NAME instead, because the raw numbers can change between releases.
Would very low-numbered jobs be likely to be in this group?  I have a script that watches for job completions from 3 to 7 inclusive (basically digging out a tile), and I was hoping it would just continue working in 0.43.  I suppose if jobs have a name attribute I can do it the right way.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on May 15, 2016, 12:45:47 pm
They do - look at df.job_type. I don't know if they've changed, though.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 15, 2016, 12:48:48 pm
They do - look at df.job_type. I don't know if they've changed, though.
Thanks!  It would have been a pain to chase down that bug if something did change.
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on May 16, 2016, 05:53:01 pm
How would I get something to go off on autosave? checking for df.global.ui.main.autosave_request every tick doesn't work.
Title: Re: DFHack 0.42.06-r1
Post by: expwnent on May 16, 2016, 10:21:41 pm
How would I get something to go off on autosave? checking for df.global.ui.main.autosave_request every tick doesn't work.

I did it by interposing df::historical_figure's write_to_file vmethod (not the real vmethod name, I forget the real one). I haven't committed it yet.

As I said in the other thread, I already have a working system that makes DFHack use json instead of histfigs across the board, and also has a hook that occurs just as the game begins saving while guaranteeing that if the game is exiting the hook fires before any game objects are deallocated. I just have to make json a shared library instead of a static library and make it still compile because I'm a perfectionist and I don't want 16 copies of the same code in memory even if it's not terribly much memory. And then make sure it compiles on Linux and OSX (especially OSX because it does linking in a weird way I don't understand).

It works correctly with autosaves and autosave backups, and is backwards compatible with persist-table, and makes persistent data in C++ about as easy as using persist-table in lua.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 17, 2016, 05:44:14 am
Hi all.

Found an issue with create-unit.lua.

EDIT: The problem is that I have an older version of create-unit in my Starter Pack.  I'm going to re-download and see if I messed it up, or the Pack reverted for some reason.

EDIT2: It's PE's pack, I'll let him know.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 17, 2016, 09:56:57 am
Okay this time an actual question.

I'm working on create-unit, and what instability I'm finding appears tied to world populations.  The current version of the script fakes a world population using world map position (1,1), index 1, depth 0. 

First, it turns out to be more stable if I use depth -1, and I have no idea why.

Second, I can pop out a whole new population with lpop=df.local_population:new() complete with its own blank-slate world_population record under lpop.population, but I am at a loss where to attach it.

World sites, including the active site, have an .animals array of world_population records, but not every site has these arrays populated.  And in particular I don't see any array elements for the active site despite having wild animals wandering around.  When I peek inside one of those wild animals, it has a world_population record under .animal.population, but there's no obvious way to see how it relates to any particular site's local populations... or if it does at all.

Also, each world_population record has a world-map position and an index that increments when a new type of animal spawns naturally.  I don't see any "next index" attribute, and #df.global.world.world_data.active_site[0].animals does not match what I'm seeing on actual units.

Does anyone know how these local and world populations are linked together?
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 17, 2016, 11:05:10 pm
Okay, I've made a bit of progress on these population links, but mostly for units that are associated with an official "map feature" (such as a river, cavern layer, or deep special tube).  "Not from a map feature" has its own population indexes that I can't find.  Caves might be a third system.

When it comes to the steep DF learning curve, things go deeper than just the UI.  It's turtles scaling learning cliffs all the way down.

We start with a unit u that is associated with some map feature.  You can get its associated region, feature and index (datatype world_population_ref) from

u.animal.population.
  region_x
  region_y
  feature_idx
  cave_id
  population_idx


That feature_idx should appear once as a value in the df.global.world.features.feature_local_idx array.*  You want the index f_i that has feature_idx as its value.  You'll also need the population index directly from the unit.

df.global.world.features.map_features[f_i].feature.population[u.animal.population.population_idx] will have a world_population record for your creature.

So far so good.  We could certainly augment create-unit.lua to append a new item into this feature's population list (with a bit of complication when a feature spans more than one depth level).  The real problem is that there is a flat array in df.global.world.populations of local_population records, each of which has a world_population_ref in it.  I have no idea how that list gets built, where its next_index hides, if feature-associated critters belong there, etc.  No combination of flags on create-unit seems to push its creature onto df.global.world.populations, but I've confirmed that any non-feature-related naturally occurring critters on the map are there.  I can't find anything that stores the associated index in the df.global.world.populations array.

Some arrays in DF's innards are self-maintaining, others need a global variable to hold the next index.  Appending a record onto df.global.world.populations can be done when spawning non-feature-related critters, but it seems like something somewhere ought to point to that record.  (In any case, the list should be scanned in case the spawned creature should be part of an existing population.)

Note that the spawned creature behaves just fine if the region_x and region_y are on the map, even with -1 for the population_idx.  A creature spawned with the marauder tag generated its own MarauderMill idle activity, attained a name when it killed someone, and everything.  I just don't know if a dangling population_idx of -1 is going to cause problems later.


* Items with a -1 here will have a valid entry in the .feature_global_idx array instead.  In this case I think you're looking for u.animal.population.cave_id as the value, but I didn't get a chance to verify that.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 17, 2016, 11:35:38 pm
I tried making a pop-up window with a little story in it, but I could not figure out the line-break. Then I made 5 pop-ups instead, but when the script runs now, the first time it runs, the pop-up has no text. If I run the script again, it does. Could anyone give it a bit... refinement?

Code: [Select]
local dlg = require ('gui.dialogs')
local dlg2 = require ('gui.dialogs')
local dlg3 = require ('gui.dialogs')
local dlg4 = require ('gui.dialogs')
local dlg5 = require ('gui.dialogs')

dlg5.showMessage("A chance encounter", msg5, color, nil)
msg5=("You decide to give the dwarves a proper burial; least they haunt you for using their equipment.")

dlg4.showMessage("A chance encounter", msg4, color, nil)
msg4=("The wagon now yours, you claim your price. The dead have no need for it; you on the other hand...")

dlg3.showMessage("A chance encounter", msg3, color, nil)
msg3=("The goods in the wagon seem intact; curiously enough 7 coffins are among the assorted items.")

dlg2.showMessage("A chance encounter", msg2, color, nil)
msg2=("With no attacker in sight and no trail to follow, you carefully decide to have a closer look.")

dlg.showMessage("A chance encounter", msg, color, nil)
msg=("You come upon a group of dead dwarves, horribly mauled, laying next to their abandoned wagon.")
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on May 17, 2016, 11:52:58 pm
Hoo boy. Okay, I can see what you mean by "not a programmer" lol. It's not that egregious, only about as bad as most raw modders I see starting out, which is to say better than most people start out programming lol.

1. You only need one dlg. You're making 5 copies of the exact same thing here. dlg is the library, not the dialogue--each call of showMessage() creates a new dialogue.

2. Any variables need to be declared before  they're used. I think you have the right idea with putting the dialogues in reverse order, yeah--that way they'll be shown to the player in the correct order. Still, msg needs to be declared before dlg.showMessage uses it.

3. color needs to be a proper variable. I think you can just replace it with COLOR_WHITE and be fine.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 18, 2016, 12:06:32 am
Thanks.

I thought dlg would be an ID, so I made them unique.

Code: [Select]
local dlg = require ('gui.dialogs')
msg5=("You decide to give the dwarves a proper burial; least they haunt you for using their equipment.")
msg4=("The wagon now yours, you claim your price. The dead have no need for it; you on the other hand...")
msg3=("The goods in the wagon seem intact; curiously enough 7 coffins are among the assorted items.")
msg2=("With no attacker in sight and no trail to follow, you carefully decide to have a closer look.")
msg=("You come upon a group of dead dwarves, horribly mauled, laying next to their abandoned wagon.")

dlg.showMessage("A chance encounter", msg5, COLOR_WHITE, nil)
dlg.showMessage("A chance encounter", msg4, COLOR_WHITE, nil)
dlg.showMessage("A chance encounter", msg3, COLOR_WHITE, nil)
dlg.showMessage("A chance encounter", msg2, COLOR_WHITE, nil)
dlg.showMessage("A chance encounter", msg, COLOR_WHITE, nil)
Better? (edit: mh, no, that just crashes the game. :/ )

Edit2: That one is fine.
Code: [Select]
local dlg = require ('gui.dialogs')

msg5=("You decide to give the dwarves a proper burial; least they haunt you for using their equipment.")
dlg.showMessage("A chance encounter", msg5, COLOR_WHITE, nil)
msg4=("The wagon now yours, you claim your price. The dead have no need for it; you on the other hand...")
dlg.showMessage("A chance encounter", msg4, COLOR_WHITE, nil)
msg3=("The goods in the wagon seem intact; curiously enough 7 coffins are among the assorted items.")
dlg.showMessage("A chance encounter", msg3, COLOR_WHITE, nil)
msg2=("With no attacker in sight and no trail to follow, you carefully decide to have a closer look.")
dlg.showMessage("A chance encounter", msg2, COLOR_WHITE, nil)
msg1=("You come upon a group of dead dwarves, horribly mauled, laying next to their abandoned wagon.")
dlg.showMessage("A chance encounter", msg1, COLOR_WHITE, nil)
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on May 18, 2016, 12:25:12 am
Can't see why that would crash the game, both seem fine.

Also, the parentheses around the quotes for the msg declarations are unnecessary.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 18, 2016, 12:30:17 am
You should probably put 'local ' before each of the msg variables, but it probably won't cause any problems the way it is.

Pretty grim embark scenario, there.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 18, 2016, 12:34:21 am
You should probably put 'local ' before each of the msg variables, but it probably won't cause any problems the way it is.

Pretty grim embark scenario, there.
Its for the hermit mode.

I made a workshop that chains three reaction: #1 spawns a unit (your hermit), #2 kills all dwarves and spawns 7 coffins, #3 gives that embark message and clears all stress from the hermit.

Since create-unit works so well, I want to make every intelligent creature a choice for your hermit. That means 200 reactions for all the animal-men. :D
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 18, 2016, 12:48:18 am
You should probably put 'local ' before each of the msg variables, but it probably won't cause any problems the way it is.

Pretty grim embark scenario, there.
Its for the hermit mode.

I made a workshop that chains three reaction: #1 spawns a unit (your hermit), #2 kills all dwarves and spawns 7 coffins, #3 gives that embark message and clears all stress from the hermit.

Since create-unit works so well, I want to make every intelligent creature a choice for your hermit. That means 200 reactions for all the animal-men. :D
Well if you are scripting. Maybe it would be easier to have one reaction that shows choice dialog?
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 18, 2016, 12:52:37 am
I'm not sure create-unit is quite up to making a citizen yet.  Check the thoughts and preferences screen to make sure there is a personality.

Even if that doesn't work, there's been science done on souls, not sure if it'd be better to yank one of the souls from the dwarves or create a whole new one.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 18, 2016, 01:44:39 am
Sure it makes citizens. Yesterday I wrote a system for orcs to buy captives at the blackmarket or capture them in raids, just to spawn them as civ--members.

I had a dwarf fort with ogre sheriff in one of my tests.

Quote
Well if you are scripting. Maybe it would be easier to have one reaction that shows choice dialog?
It would, if I could script. Now I have 400+ reactions that are finished, so... too late. Its maybe a bit clumsier, but at least I managed to do it on my own. I already asked for so much help with scripts lately, I thought it would be better if I do it that way.
Title: Re: DFHack 0.43.02-?
Post by: Thundercraft on May 18, 2016, 07:12:32 am
I'm a bit confused about the source available on GitHub. I can understand that the latest DFHack release was for 0.42.06-r1. But, I see that the "Latest commit" was "24 days ago".

Is a 0.43.02 release in the works?


Edit: Okay, I see (https://github.com/dfhack/dfhack/tree/develop) now.
Title: Re: DFHack 0.42.06-r1
Post by: Rose on May 18, 2016, 07:24:42 am
All dfhack development happens on the dev branch of dfhack, not the main one.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 18, 2016, 10:56:42 pm
Version 0.52 of create-unit.lua.  Can someone include this in the next distribution of DFHack?  BTW, are there any plans for a final 0.42.06 release, or is everything going to be 0.43?

This is still faking the local population data, but now it's doing a better job of faking it.  I'll try to improve on that as I have time.

Spoiler (click to show/hide)

For the moment, I'm going to include a copy of this with The Earth Strikes Back, but will take it out when DFHack updates.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on May 18, 2016, 11:45:13 pm
I think the 42.06 release was consistent enough that unless people use it enough and find a major bug or something gets passed back down from the 43.xx update process it'll remain as it is.

Also like the gm-editor changes in there, looks like it'll let us pick whether to put in stuff like df.something:new() or drop in ints and such? It was frustrating that I couldn't swap in an int with gm-editor and had to whip up a script or bit of lua (though the interpreter is still a bit of arcane wizardry) to insert it just so I could edit it to figure out what it did.
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 19, 2016, 12:01:58 am
I think the 42.06 release was consistent enough that unless people use it enough and find a major bug or something gets passed back down from the 43.xx update process it'll remain as it is.

Also like the gm-editor changes in there, looks like it'll let us pick whether to put in stuff like df.something:new() or drop in ints and such? It was frustrating that I couldn't swap in an int with gm-editor and had to whip up a script or bit of lua (though the interpreter is still a bit of arcane wizardry) to insert it just so I could edit it to figure out what it did.
Yeah i was annoyed with it too. I would really want to have some sort "put this item to lua interpreter as <variable>" too.
Next feature i want is general_ref handling.
Title: Re: DFHack 0.42.06-r1
Post by: thedonkified on May 22, 2016, 03:00:36 pm
I'm having trouble getting interaction-trigger to trigger anything at all in both arena mode and adventure mode.

It doesn't seem to be reading the attack string or defense string that I put for the trigger to activate, because I also put -suppressAttack and
-suppressDefense and I am still able to see the attack string in my combat logs.

Quote
modtools/interaction-trigger -onAttackStr "ORC_ATTACK_A" -onDefenseStr "ORC_DEFEND_D" -suppressAttack -suppressDefend -command [ item/projectile -unit_source \\ATTACKER_ID -unit_target \\DEFENDER_ID -item AMMO:ITEM_AMMO_BOLTS -mat INORGANIC:IRON -number 5 -maxrange 500 -hitchance 100 ]

Would there be any problems if the creature that could do the interaction didn't learn it but was spawned with the ability to do it?
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on May 22, 2016, 04:38:00 pm
None of the triggers work in arena mode AFAIK.

It only cares about interactions, how it's learned shouldn't matter at all.
Title: Re: DFHack 0.42.06-r1
Post by: thedonkified on May 23, 2016, 09:21:45 am
Are there factors in the interaction's raws that would cause it not to work in adventure mode? The interactions themselves do not actually work in adventure mode either.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 25, 2016, 02:10:18 pm
Hey guys, I just read about forceequip:
Quote
forceequip
Forceequip moves local items into a unit’s inventory. It is typically used to equip specific clothing/armor items onto a dwarf, but can also be used to put armor onto a war animal or to add unusual items (such as crowns) to any unit.

For more information run forceequip help. See also modtools/equip-item.

How could I use this to target a pet pastured on a workshop? As in:
1. Pasture pet on custom workshop.
2. Dwarf runs a reaction; reagent in reaction is the armor that will be put on the pet.
3. Pet now wears said armor.

I knew the syntax in the older dfhack scripts, but I'm not sure how to do this with the Onload.init. Can it even target units in workshops?
Title: Re: DFHack 0.42.06-r1
Post by: Roses on May 25, 2016, 03:11:47 pm
Hey guys, I just read about forceequip:
Quote
forceequip
Forceequip moves local items into a unit’s inventory. It is typically used to equip specific clothing/armor items onto a dwarf, but can also be used to put armor onto a war animal or to add unusual items (such as crowns) to any unit.

For more information run forceequip help. See also modtools/equip-item.

How could I use this to target a pet pastured on a workshop? As in:
1. Pasture pet on custom workshop.
2. Dwarf runs a reaction; reagent in reaction is the armor that will be put on the pet.
3. Pet now wears said armor.

I knew the syntax in the older dfhack scripts, but I'm not sure how to do this with the Onload.init. Can it even target units in workshops?

Currently I think the best you can do is
Code: [Select]
modtools/reaction-trigger -reactionName X -allowNonworkerTargets -command [ script here but make sure you use \\TARGET_ID instead of \\WORKER_ID ]
Haven't tested it myself, but if I am reading the script right it should work. Also, unlike reaction-product-trigger reaction-trigger doesn't need to create a product.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 25, 2016, 03:59:14 pm
Haven't tested it myself, but if I am reading the script right it should work. Also, unlike reaction-product-trigger reaction-trigger doesn't need to create a product.
Thanks... I get as far as "no unit found at cursor", so the script does run, but as always the script is not optimized for use in a workshop. It requires a cursor for the location. :/ I used the plugin forceequip. I couldnt get modtools/equip-items to work this way.
Title: Re: DFHack 0.42.06-r1
Post by: Roses on May 25, 2016, 05:49:43 pm
Haven't tested it myself, but if I am reading the script right it should work. Also, unlike reaction-product-trigger reaction-trigger doesn't need to create a product.
Thanks... I get as far as "no unit found at cursor", so the script does run, but as always the script is not optimized for use in a workshop. It requires a cursor for the location. :/ I used the plugin forceequip. I couldnt get modtools/equip-items to work this way.

Yeah, just looked at forceequip, that plugin isn't set up for use in reactions. What about this

Code: [Select]
modtools/reaction-product-trigger -reactionName "Equip Animal Armor" -allowNonworkerTargets -command [ modtools/equip-item -unit \\TARGET_ID -item \\INPUT_ITEMS -bodyPart UB -mode Worn ]
For the reaction you will want the armor you want to equip as the only reagent, and you will need one product. Conversely you could change \\INPUT_ITEMS to \\OUTPUT_ITEMS, have the reagents be whatever you want the armor to be made out of and then the product to be the armor itself.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 25, 2016, 07:01:11 pm
I get the error message about "cannot write field: item.find: Number expected".

I tried  \\INPUT_ITEMS, \\OUTPUT_ITEMS, both with \\\ and both with []. I also tried an item ID, like ARMOR:ITEM_ARMOR_BREASTPLATE:INORGANIC:STEEL. None of those help, same error message.
Title: Re: DFHack 0.42.06-r1
Post by: Roses on May 25, 2016, 07:13:06 pm
I get the error message about "cannot write field: item.find: Number expected".

I tried  \\INPUT_ITEMS, \\OUTPUT_ITEMS, both with \\\ and both with []. I also tried an item ID, like ARMOR:ITEM_ARMOR_BREASTPLATE:INORGANIC:STEEL. None of those help, same error message.

It must be because \\INPUT_ITEMS and \\OUTPUT_ITEMS are given you a table of values instead of an individual one. My last suggestion would be, if you make the piece of armor in the reaction so that it is the product you can replace \\OUTPUT_ITEMS with \\\LAST and that should work.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 25, 2016, 07:25:16 pm
My last try was \\LAST and \\\LAST
Code: [Select]
modtools/reaction-trigger -reactionName TEST_PET_ARMOR1 -allowNonworkerTargets -command [ modtools/equip-item -unit \\TARGET_ID -item \\\LAST -bodyPart UB -mode Worn ]
Thats it for now... same thing with the item error. I did use reaction-trigger, not reaction-product-trigger, which yet again doesnt want to trigger, no idea why.

Could I not hardcode the item into the script? Change these lines:
Code: [Select]
local itemId = tonumber(args.item) or ((args.item == '\\LAST') and (df.global.item_next_id-1))
local item = df.item.find(itemId)
if not item then
  error('invalid item!', args.item)
end
to include something like ARMOR:ITEM_ARMOR_ANIMAL:INORGANIC:STEEL ?
Title: Re: DFHack 0.42.06-r1
Post by: Roses on May 25, 2016, 07:52:35 pm
Yes you could, you could replace
Code: [Select]
itemId = tonumber(args.item) or ((args.item == '\\LAST') and (df.global.item_next_id-1))with
Code: [Select]
item = 'ARMOR:ITEM_ARMOR_ANIMAL'
mat = 'INORGANIC:STEEL'
itemId = dfhack.items.createItem(dfhack.items.findType(item), dfhack.items.findSubtype(item), dfhack.matinfo.find(mat)['type'], dfhack.matinfo.find(material).index, unit)

After you brought it up I decided that I wanted to expand that system so that you could give units special jewelry, armor to pets, various tools like smoke bombs and grappling hooks, etc... So I am planning on making it more robust, including auto forbidding items so dwarfs won't just take the items off, possibly also including adding ownership of items.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on May 25, 2016, 08:08:37 pm
Yes you could, you could replace
Code: [Select]
itemId = tonumber(args.item) or ((args.item == '\\LAST') and (df.global.item_next_id-1))with
Code: [Select]
item = 'ARMOR:ITEM_ARMOR_ANIMAL'
mat = 'INORGANIC:STEEL'
itemId = dfhack.items.createItem(dfhack.items.findType(item), dfhack.items.findSubtype(item), dfhack.matinfo.find(mat)['type'], dfhack.matinfo.find(material).index, unit)

After you brought it up I decided that I wanted to expand that system so that you could give units special jewelry, armor to pets, various tools like smoke bombs and grappling hooks, etc... So I am planning on making it more robust, including auto forbidding items so dwarfs won't just take the items off, possibly also including adding ownership of items.
The only problem here is that you are creating a new item from whole cloth, so any quality level of the reagent is lost.  As long as it's going to be a custom script, it might be easier to customize the \\INPUT_ITEMS to refer specifically to the first item.  That will retain quality levels, name, artifact status, etc.
Title: Re: DFHack 0.42.06-r1
Post by: expwnent on May 25, 2016, 10:09:58 pm
Dirst: Thanks for all your work on create-unit. I can't really help with it now but I'll include that version next chance I get.

I'm having trouble getting interaction-trigger to trigger anything at all in both arena mode and adventure mode.

It doesn't seem to be reading the attack string or defense string that I put for the trigger to activate, because I also put -suppressAttack and
-suppressDefense and I am still able to see the attack string in my combat logs.

Quote
modtools/interaction-trigger -onAttackStr "ORC_ATTACK_A" -onDefenseStr "ORC_DEFEND_D" -suppressAttack -suppressDefend -command [ item/projectile -unit_source \\ATTACKER_ID -unit_target \\DEFENDER_ID -item AMMO:ITEM_AMMO_BOLTS -mat INORGANIC:IRON -number 5 -maxrange 500 -hitchance 100 ]

Would there be any problems if the creature that could do the interaction didn't learn it but was spawned with the ability to do it?

It works by reading announcement logs, and those are slightly different in adventure mode / arena so it only works in fortress mode. It's harder than it sounds to fix it. Currently it does a lot of tricky things to cut down on ambiguity but can occasionally get confused if two units with the same name (as it shows up in the combat log) are in the same tile. Those things would have to be different in different modes.

Meph: currently modtools/equip-item is only designed for equipping one item at a time, so if you pass a list of item ids it won't know how to handle it. You'd need a wrapper script to equip items in this way, even if there's just one, because it's a *list* of one item id instead of just one item id.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on May 26, 2016, 03:19:02 am
Yes you could, you could replace
Code: [Select]
itemId = tonumber(args.item) or ((args.item == '\\LAST') and (df.global.item_next_id-1))with
Code: [Select]
item = 'ARMOR:ITEM_ARMOR_ANIMAL'
mat = 'INORGANIC:STEEL'
itemId = dfhack.items.createItem(dfhack.items.findType(item), dfhack.items.findSubtype(item), dfhack.matinfo.find(mat)['type'], dfhack.matinfo.find(material).index, unit)

After you brought it up I decided that I wanted to expand that system so that you could give units special jewelry, armor to pets, various tools like smoke bombs and grappling hooks, etc... So I am planning on making it more robust, including auto forbidding items so dwarfs won't just take the items off, possibly also including adding ownership of items.
Did that. Bad Argument at #1 to 'find' (string expcted, go nil) at line 78, the one I changed.

I tried:
Code: [Select]
modtools/reaction-trigger -reactionName TEST_PET_ARMOR2 -allowNonworkerTargets -command [ modtools/equip-item-animal -unit \\TARGET_ID -item ARMOR:ITEM_ARMOR_ANIMAL:INORGANIC:STEEL -bodyPart UB -mode Worn ]
modtools/reaction-trigger -reactionName TEST_PET_ARMOR1 -allowNonworkerTargets -command [ modtools/equip-item-animal -unit \\TARGET_ID -item ARMOR:ITEM_ARMOR_ANIMAL -bodyPart UB -mode Worn ]
Title: Re: DFHack 0.42.06-r1
Post by: jecowa on May 29, 2016, 10:20:51 am
Is it accurate to call DFHack a modding API that comes with a few built-in mods?
Title: Re: DFHack 0.42.06-r1
Post by: Rose on May 29, 2016, 10:24:59 am
Yes.
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on May 29, 2016, 04:09:17 pm
It's really more of a memory hacking API. Like cheat engine, but significantly more high-level due to most things already being mapped out.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 29, 2016, 10:29:49 pm
I'm guessing the answer is "no," but does DFHack expose any hardcoded variables, like the happiness bonuses for different positive emotions?  I imagine most of them are elided by the compiler, but I know I've, in the past, used vectors full of constants in my own games.

I'm curious about making dwarven moods more difficult to handle.  I've always considered it too easy to make dwarves happy by giving them large rooms.  What I actually think should happen is that dwarves should become inured to specific luxuries after a while, but that would require new mechanics on Tarn's part (or a really obnoxiously complicated plugin that shadows the entire mood system).  But, just making them less ecstatic about having a nice dining room would be a start.
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on May 29, 2016, 10:38:38 pm
It shows you them (in your example, by e.g. df.emotion_type.attrs['Joy'].divider) but you can't edit them for any effect.

It wouldn't be that obnoxiously complicated to shadow the mood system the way you're describing tbh. I already have an on-emotion event and persistent data is trivial.
Title: Re: DFHack 0.42.06-r1
Post by: expwnent on May 30, 2016, 05:27:28 am
Is it accurate to call DFHack a modding API that comes with a few built-in mods?

I'd say the scripts in the modtools folder are. DFHack in general is also a tool for end users for making the game easier, harder, or more convenient.

I'm guessing the answer is "no," but does DFHack expose any hardcoded variables, like the happiness bonuses for different positive emotions?  I imagine most of them are elided by the compiler, but I know I've, in the past, used vectors full of constants in my own games.

I'm curious about making dwarven moods more difficult to handle.  I've always considered it too easy to make dwarves happy by giving them large rooms.  What I actually think should happen is that dwarves should become inured to specific luxuries after a while, but that would require new mechanics on Tarn's part (or a really obnoxiously complicated plugin that shadows the entire mood system).  But, just making them less ecstatic about having a nice dining room would be a start.

It doesn't work anymore but I wrote a plugin several versions ago to intensify negative thoughts by duplicating them. You'd have to do it differently for the new emotion system but it shouldn't be too hard. I think plugins/misery.cpp is still in the github repository if you want to take a look.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 30, 2016, 08:09:15 am
Hmm, interesting.  It would be pretty easily, actually, to just store, in persist data, all the "amazing seat" thoughts the game wants each dwarf to have and only keep the best one, so there's no doubling-up of happiness bonuses.  It'd also make the thoughts screen a heck of a lot more readable.  I'll give that a shot and see if it has a good effect.  Cheers.

I could also, I suppose, manually calculate the values of owned rooms using my own algorithm and then modify the AdmireOwnBuilding thoughts as they appear.  Figuring out which tiles are part of a room looks like it'll be a pain, though, since the game doesn't actually store a list of the tiles that're part of a room.  Looks like the laziest way to roll my own flood-fill would be to just call buildings->containsTile() for each tile to find the adjacent tiles (starting with the centre).  Does that function work for non-rectangular rooms?
Title: Re: DFHack 0.42.06-r1
Post by: Rose on May 30, 2016, 09:41:42 am
The game does store which tiles are part of a room, though.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 30, 2016, 09:53:21 am
The game does store which tiles are part of a room, though.

Where?  As far as I can see, it only stores a rectangular building area (x and y coords, and a width and height).  Because rooms can be non-rectangular, that's presumably the bounding box that contains all of the tiles, but some tiles in the bounding box won't be part of the room.

EDIT: I did some looking around, and containsTile() does work for non-rectangular rooms, so I don't even need to flood-fill, I can just check every tile in the bounding box.  But, you might be right that it's storing all the tiles somewhere, because changing the internal/external status of doors doesn't change the size of the room, which it would if the game was redoing the flood-fill every time it needed the room size.  But that information doesn't seem to be stored anywhere in the building information, and I didn't see anything under df.global.world that looked like it would have it, either.

Not terribly important, since the brute force approach will work just fine, but I'm curious where it's storing that room information.
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 30, 2016, 11:09:27 am
There is building_extents (IIRC) they hold if cell of building WxH box is part of the building
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 30, 2016, 11:40:16 am
Nope.  It may be a bug in the current version of DFHack, but currently building_extents is the x, y, width, and height of the bounding box, and a single pointer to a uint8 that's just: "0 - not room; 1 in stockpile; 2 wall; 3 inner; 4 distance boundary" according to df-structures.

Maybe the pointer is supposed to be to an array of something like struct { uint8 extent_type; union { /* the different types of extent */ }; }; but that's gotten lost?

EDIT: Aha!  Sorry, I keep forgetting that the source of DFHack is just on Github.  Just looked at the code, and figured out what the problem is: the pointer is a pointer to a bare array, but both the Lua API and gui/gm-editor are only set up to access vectors.  So, from a plugin, I can just do a lookup into that array, I just won't be able to rely on bounds-checking to catch bugs.
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 30, 2016, 01:37:17 pm
Nope.  It may be a bug in the current version of DFHack, but currently building_extents is the x, y, width, and height of the bounding box, and a single pointer to a uint8 that's just: "0 - not room; 1 in stockpile; 2 wall; 3 inner; 4 distance boundary" according to df-structures.

Maybe the pointer is supposed to be to an array of something like struct { uint8 extent_type; union { /* the different types of extent */ }; }; but that's gotten lost?

EDIT: Aha!  Sorry, I keep forgetting that the source of DFHack is just on Github.  Just looked at the code, and figured out what the problem is: the pointer is a pointer to a bare array, but both the Lua API and gui/gm-editor are only set up to access vectors.  So, from a plugin, I can just do a lookup into that array, I just won't be able to rely on bounds-checking to catch bugs.

RTM :D Dynamic size arrays can not be nicely shown in gm-editor or lua. You need to index into them manually. Thus use ptr[x+y*w] or similar. In gm-editor there is "displace" or "offset" shortcut for that. For normal usage there is lua helpers (e.g. "dfhack.buildings.containsTile(building, x, y[, room])").
The same problem in C or C++ really. C type arrays when passed as an argument are turned into pointer thus loosing the size information.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 30, 2016, 02:13:28 pm
Well, to be fair, it's not really a "problem" in C/C++ because pointers are arrays and arrays are pointers.  That's why you can say 5[array] instead of array[5], if you want to be weird about it.  The subscript operator is just a bit of convenient syntactic sugar.  (And, for size information, you should also really never use sizeof() on an array.  It's the closest to undefined behaviour you can get without actually being undefined behaviour.  Personally, I don't think it should even be allowed, but there are legacy reasons for keeping it around, and frankly most compiler vendors would probably keep it as undefined behaviour even if the standard was changed.)

Good to know about that offset shortcut in gm-editor, though.  I've seen it in the help page, but there was nothing that indicated what that was supposed to do, and I haven't come across a bare array anywhere else in any of the data structures dfhack exposes, so I haven't had an opportunity to experiment with it.  Maybe adding a little note to the help page to clarify that it's for indexing bare arrays would be useful?

But, just out of curiosity, has it been determined that that particular variable is actually a bare array?  Is it possible that that's a vector and nobody's noticed yet?  I mean, everywhere else that I've seen, vectors are used, even in places where you could legitimately get away with even a statically-sized array, like the unit attributes and personality traits.
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on May 30, 2016, 03:00:13 pm
Well, to be fair, it's not really a "problem" in C/C++ because pointers are arrays and arrays are pointers.  That's why you can say 5[array] instead of array[5], if you want to be weird about it.  The subscript operator is just a bit of convenient syntactic sugar.  (And, for size information, you should also really never use sizeof() on an array.  It's the closest to undefined behaviour you can get without actually being undefined behaviour.  Personally, I don't think it should even be allowed, but there are legacy reasons for keeping it around, and frankly most compiler vendors would probably keep it as undefined behaviour even if the standard was changed.)

Good to know about that offset shortcut in gm-editor, though.  I've seen it in the help page, but there was nothing that indicated what that was supposed to do, and I haven't come across a bare array anywhere else in any of the data structures dfhack exposes, so I haven't had an opportunity to experiment with it.  Maybe adding a little note to the help page to clarify that it's for indexing bare arrays would be useful?

But, just out of curiosity, has it been determined that that particular variable is actually a bare array?  Is it possible that that's a vector and nobody's noticed yet?  I mean, everywhere else that I've seen, vectors are used, even in places where you could legitimately get away with even a statically-sized array, like the unit attributes and personality traits.
Short answer: no this can't be vector.
Long answer:
We mostly have the layouts from disassembly (and by we i mean other smarter people). This naked array is stored as an simple pointer (thing void* because in assembly every pointer is void*). Only the accessing code is reading e.g. by byte and checking nearby word or byte to stop or not the iteration. The vector on the other hand is totally different. It has three pointers. Each read is usually prefixed by size check which is read two pointers and shift/div/etc to figure out the item count, then compare to imput and sometimes jmp to exception or just jump to ret 0 part.
Statically sized arrays are also different thing. It's just like having a struct with N fields (e.g. {int x,y,z} is same as {int p[3]} but not {int* p} or {int p[] (is this valid at all?)}) So it looks totally different and the resulting size of struct is way bigger.
Then there is a HUGE magical thing that is lua wrapper. At the start i tried writing one but then angavrilov wrote the whole thing. There are some limitations like - you can't interpose vmethods from lua as it requires compiled code to replace the original (or doing automatic wrapper for EACH VMETHOD FOR ALL CLASSES - would be slow like hell) or like lua does not have "please list out all vmethods of this object with arguments" because nobody did need this bad enough to implement. Or in this case size for T* arrays. Although there are very few of them, and you could write out special handling for each of them - it's simpler to understand what is happening and have small snipped that does the same.
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 30, 2016, 03:26:27 pm
Haha, sorry, you don't need to go into that kind of CS 101 detail for me.  I've actually re-implemented the STL vector before because I was bored one day ;) (of course, I expected it to take an afternoon, and it ended up taking me a week, as is typical; in my defence, I spent most of that time doing something goofy with one of the insert range functions to see if I could beat the MSVC implementation, which is the best one I've seen thus far)

What I was asking, specifically, is whether maybe somebody initially put this in df-structures as an unsigned __int8* because they didn't know what it was, and then only later did someone figure out it was the array of tile information and incorporate it into dfhack.buildings, but nobody got around to looking to see if there were size and capacity pointers behind it that got missed.  It's just weird that this one variable is the only bare array, it seemed more likely to me that it just slipped through the cracks.

Looking in df-structures, though, it looks like there's no room for it, unless the way you folks auto-generate the headers automatically detects padding and missing fields, and it's auto-detecting the size and capacity pointers at the front of the building_extents as 8 bytes of padding, which seems unlikely.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on May 30, 2016, 03:45:25 pm
It does deal with padding. It's just that building_extents is a raw array. There could well be non-virtual methods that Toady uses to deal with it that we have no idea about, but we can't make it into a vector when it's not.

(Also, small nitpick: gm-editor doesn't do things any differently from the Lua API - it literally just calls pairs() and displays the result in a UI.)
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on May 31, 2016, 11:45:26 am
Fair enough, thanks!

One last question.  I found a bug in my combine-plants and combine-drinks scripts a while back--and have wanted to improve them for a while, anyway, especially since it turns out some people actually use them--so I'm going to rewrite them as a plugin that's a lot more robust.  Before I get started, is there a release somewhere of the auto-generated headers for any recent version of DFHack that I can use?  Or am I going to have to install Perl and generate them myself from df-structures?
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on May 31, 2016, 03:26:14 pm
You'll have to generate them anyway as part of the DFHack build process. There are a couple Windows releases for 0.42 that included them accidentally, if you want to look at examples - maybe alphas for versions around 0.42.04?
Title: Re: DFHack 0.42.06-r1
Post by: Urlance Woolsbane on June 04, 2016, 02:38:10 pm
In the 40.24 version of DFHack there was a plugin or script that allowed you to switch game-mode in game. Does anyone remember its name and whether or not it's available for 42.06?
Title: Re: DFHack 0.42.06-r1
Post by: jecowa on June 04, 2016, 02:40:57 pm
In the 40.24 version of DFHack there was a plugin or script that allowed you to switch game-mode in game. Does anyone remember its name and whether or not it's available for 42.06?

"Game mode" as in  "fortress mode" and "adventure mode"?
Title: Re: DFHack 0.42.06-r1
Post by: Urlance Woolsbane on June 04, 2016, 02:45:16 pm
In the 40.24 version of DFHack there was a plugin or script that allowed you to switch game-mode in game. Does anyone remember its name and whether or not it's available for 42.06?

"Game mode" as in  "fortress mode" and "adventure mode"?
Ja, as well as Arena Mode (which was, in fact, necessary for properly switching.)
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 04, 2016, 04:14:08 pm
"mode"
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on June 04, 2016, 08:31:12 pm
How far is the DFhack update progress anyway? The usual? 1-3 months?
Title: Re: DFHack 0.42.06-r1
Post by: Urlance Woolsbane on June 04, 2016, 08:33:10 pm
"mode"
Thanks!
Title: Re: DFHack 0.42.06-r1
Post by: Thundercraft on June 05, 2016, 08:34:57 am
This talk of mode (http://dfhack.readthedocs.io/en/stable/docs/Plugins.html#mode) reminds me:

What happened to DFusion? In case people have forgotten:
DFusion - a lua based plugin system (integrated into DFHack) (http://www.bay12forums.com/smf/index.php?topic=69682.0)

I can barely find DFusion mentioned on the DFHack documentation site (https://dfhack.readthedocs.io/en/stable/). About all I can find is a mention in NEWS: Changelog (http://dfhack.readthedocs.io/en/stable/NEWS.html?highlight=DFusion), where it says:
Quote
DFusion: legacy script system, obsolete or replaced by better alternatives

This was under the "DFHack future" heading and, from this, I can only assume that DFusion was removed after DFHack 0.40.24-r5 (the heading below it). Correct? I find this sad. :(

The "replaced by better alternatives" part suggests, to me, that DFHack still has alternatives to allow at least some of the same functionality as DFusion. Granted, there is mode (http://dfhack.readthedocs.io/en/stable/docs/Plugins.html#mode). But, I'm having trouble finding scripts or plugins to do some of the DFusion stuff I'd like to do.

Mostly, I'm interested in Rumrusher's "Adventure Tools" (aka, "adv_tools") for DFusion, as mentioned here (http://www.bay12forums.com/smf/index.php?topic=69682.msg2434706#msg2434706):
Quote
>> Change adventurer
>> Make creature follow
>> Toggle ghostliness
>> Toggle hostile
>> Wagon mode
>> Change flag
>> Teleport
>> Ressurection
>> Change Adv permenent

Also, these:
Quote
>> Impregnate
>> Change site type
>> Change site flags
>> Protect site from item scattering

I can find equivalents to some of these:
(Actually... Searching inside the files of dfhack-0.42.06-r1, I could not find any file with "adv-bodyswap" in the filename. And the only files which seem to mention "adv-bodyswap" are plugins.txt and plugins.html, which merely documents how it is used. Where can I find the actual code for the adv-bodyswap plugin? Or was it left out of that version and somebody forgot to edit the documentation to reflect this? :()

But, as far as I can tell, that's it. I can't find equivalents to Make creature follow, Toggle ghostliness, Toggle hostile, Wagon mode, or Change flag.

I also can't find an equivalent to DFusion's "Impregnate". I searched for "pregnant", but the closest I could find was petcapRemover, which can cause pregnancies in pets.

However, I did find some plugins and scripts which I think fit the spirit of the old DFusion Adventure Tools, namely:
Anyway, any info on what happened to DFusion and suggestions on how to achieve the same results as with "Adventure Tools" using existing scripts and plugins would be appreciated.
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on June 05, 2016, 08:39:39 am
The short version is that most of the DFusion-specific stuff hadn't been updated and was no longer compatible with recent DF versions, and for technical reasons (it was really old) further updates were unlikely (easier to start over).  So the removal was mostly to allow cleaner docs, instead of pretending that the whole system was still functional.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 05, 2016, 10:09:02 am
I'm not entirely sure what "wagon mode" is supposed to do.
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on June 05, 2016, 04:20:22 pm
"friendship" was made completely obsolete by 0.42.01.

"ectobiology" in Fortbent is basically impregnate.
Title: Re: DFHack 0.42.06-r1
Post by: Thundercraft on June 05, 2016, 06:20:43 pm
Thank you for the replies. It helps. And at least, now, I know.

But, I suppose I should have explained what the missing adv_tools did:

>> Make creature follow -- makes creature temporarily follow you
>> Toggle ghostliness -- can't hit anything but are sort of invulnerable & everyone ignores you
>> Toggle hostile -- changes creature hostility
>> Make creature follow -- makes creature follow (even after traveling)
>> Wagon mode -- turns you into a wagon

"ectobiology" in Fortbent is basically impregnate.

Hmm... Fortbent is a major mod, not a utility, correct? Looking at DFFD, the latest release (Fortbent 6) was for DF v0.34.11. And searching for "ectobiology", I find nothing on the DFHack GitHub or in DFHack documentation.
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on June 05, 2016, 06:30:53 pm
I don't release on DFFD anymore. Here's ectobiology. (https://github.com/Putnam3145/fortbent/blob/master/raw/scripts/fortbent/ectobiology.lua)
Title: Re: DFHack 0.42.06-r1
Post by: jecowa on June 05, 2016, 07:01:25 pm
I don't release on DFFD anymore. Here's ectobiology. (https://github.com/Putnam3145/fortbent/blob/master/raw/scripts/fortbent/ectobiology.lua)

Just curious, is there a problem with DFFD?
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on June 05, 2016, 07:28:05 pm
Github has a better API.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 05, 2016, 08:41:00 pm
It's also more convenient to post releases on GitHub for projects that are on GitHub, to keep things in one place.
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on June 06, 2016, 12:13:53 pm
-snip-
okay most of those were made back when DFUSION was all I had for modding Dwarf fortress also warmist was a great tutor for hacking and writing scripts in Dwarf fortress and I was mostly pushing around weird stuff.
I warmist made a script called spellbook which allowed me to dump future scripts into a gui run plugin before I used companion order to dump most of the good script commands.
adv-bodyswap and bodyswap are two different and similar things one being a plugin and the other being a txt function script that I copy and pasted.
you could harvest most of it from the recarnation script as that kinda puts you in the body of the killer and the coding needed to do that has the basic command needed to swap bodies.
lair plugin was made during the time I was using Retire method which save the fort back when saving the fort that way still scattered items and killed all the pets.
friendship is a whole different beast that kinda wish was updated, as toady still hasn't made that possible outside of a long grind, so friendship added different creatures from a list to pop up as migrants.
so you could end up with dragons, demons, what ever as fully citizen migrants of the fort. the issue with it being dub obsolete was toady version was playing paper please with a bunch of guests

wagonmode is doable in vanilla as wagons don't scuttle in adventure mode to the point of making an animalman version of one is possible.
impregnate was the one function I miss the most and should have made a backup via the dfhack folder in the dfhack plugin and scripts section


ghostliness is busted in the new version of Dwarf fortress as toady forgot about ghost folks not being able to continue moving in the air because they are missing the gaits needed so they just move up into the air then be lock out of any movement command like a spider not being able to swim and floating in the air. this only happens to creatures with no flying and works normally with birdfolk.
also Toady doesn't see this as a bug until someone finds a solution that doesn't use Dfhack.

the make creature follow script kinda got super improved when I found a bound person via talking to them option in the talk dialog and made a script for that.
and later realize you an just make an interaction that gives anyone you want to follow you HIGH Excitement seeking trait which works on talking animals so I have to test out how better is doing that than bounding folks against their will and other stuff.
all in all oh boy I think most of the stuff is on warmist  (https://gist.github.com/warmist)or my github gist (https://gist.github.com/Rumrusher) account.



Title: Re: DFHack 0.42.06-r1
Post by: Putnam on June 06, 2016, 05:14:13 pm
Okay, what was the exact user profile of impregnate? I.E. what were the arguments/GUI like? I can whip one up in a jiffy given that I already have ectobiology.
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on June 06, 2016, 06:28:25 pm
Ctrl-F "empregnate" here (https://github.com/DFHack/dfhack/pull/751/commits/80e4b8d3dfb351f58b05d2b1ba857e3226514d33)

It would be lovely if you could write a catsplosion script (https://github.com/DFHack/dfhack/issues/722), too ;)
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on June 06, 2016, 06:55:57 pm
Code: (impregnate.lua) [Select]
local function getFemaleCasteWithSameMaxAge(unit)
    local curCaste=df.creature_raw.find(unit.race).caste[unit.caste]
    for k,caste in ipairs(df.creature_raw.find(unit.race).caste) do
        if caste.gender==0 and caste.misc.maxage_min==curCaste.misc.maxage_min and caste.misc.maxage_max==curCaste.misc.maxage_max then return k end
    end
end

function impregnate(unit)
    local script=require('gui.script')
    script.start(function()
    unit=unit or dfhack.gui.getSelectedUnit(true)
    if not unit then
        error("Failed to impregnate. Unit not selected/valid")
    end
    if unit.curse then
        unit.curse.add_tags2.STERILE=false
    end
    local genes = unit.appearance.genes
    if unit.relations.pregnancy_genes == nil then
        unit.relations.pregnancy_genes = unit.appearance.genes:new()
    end
    local ngenes = unit.relations.pregnancy_genes
    unit.relations.pregnancy_timer=1
    unit.relations.pregnancy_caste=1
    if unit.sex==1 then
        local normal_caste=unit.enemy.normal_caste
        unit.enemy.normal_caste=getFemaleCasteWithSameMaxAge(unit)
        script.sleep(1,'ticks')
        unit.enemy.normal_caste=normal_caste
    end
    end)
end

impregnate()

This code will take the selected unit, impregnate him or her, if male turn him into a female so that he may give birth, then turn him back into a male immediately.

Code: (catsplosion.lua) [Select]
local function getSpecies(unit)
    return df.creature_raw.find(unit.race).creature_id
end

local function getFemaleCasteWithSameMaxAge(unit)
    local curCaste=df.creature_raw.find(unit.race).caste[unit.caste]
    for k,caste in ipairs(df.creature_raw.find(unit.race).caste) do
        if caste.gender==0 and caste.misc.maxage_min==curCaste.misc.maxage_min and caste.misc.maxage_max==curCaste.misc.maxage_max then return k end
    end
end

function impregnate(unit)
    local script=require('gui.script')
    script.start(function()
    unit=unit or dfhack.gui.getSelectedUnit(true)
    if not unit then
        error("Failed to impregnate. Unit not selected/valid")
    end
    if unit.curse then
        unit.curse.add_tags2.STERILE=false
    end
    local genes = unit.appearance.genes
    if unit.relations.pregnancy_genes == nil then
        unit.relations.pregnancy_genes = unit.appearance.genes:new()
    end
    local ngenes = unit.relations.pregnancy_genes
    local rng=dfhack.random.new()
    local timer=rng:random(100)+1
    unit.relations.pregnancy_timer=timer
    unit.relations.pregnancy_caste=1
    if unit.sex==1 then
        local normal_caste=unit.enemy.normal_caste
        unit.enemy.normal_caste=getFemaleCasteWithSameMaxAge(unit)
        script.sleep(timer+1,'ticks')
        unit.enemy.normal_caste=normal_caste
    end
    end)
end

for k,v in ipairs(df.global.world.units.active) do
    if getSpecies(v)=='CAT' then
        impregnate(v)
    end
end

and there's catsplosion
Title: Re: DFHack 0.42.06-r1
Post by: Roses on June 06, 2016, 07:13:00 pm
Code: (impregnate.lua) [Select]
local function getFemaleCasteWithSameMaxAge(unit)
    local curCaste=df.creature_raw.find(unit.race).caste[unit.caste]
    for k,caste in ipairs(df.creature_raw.find(unit.race).caste) do
        if caste.gender==0 and caste.misc.maxage_min==curCaste.misc.maxage_min and caste.misc.maxage_max==curCaste.misc.maxage_max then return k end
    end
end

function impregnate(unit)
    local script=require('gui.script')
    script.start(function()
    unit=unit or dfhack.gui.getSelectedUnit(true)
    if not unit then
        error("Failed to impregnate. Unit not selected/valid")
    end
    if unit.curse then
        unit.curse.add_tags2.STERILE=false
    end
    local genes = unit.appearance.genes
    if unit.relations.pregnancy_genes == nil then
        unit.relations.pregnancy_genes = unit.appearance.genes:new()
    end
    local ngenes = unit.relations.pregnancy_genes
    unit.relations.pregnancy_timer=1
    unit.relations.pregnancy_caste=1
    if unit.sex==1 then
        local normal_caste=unit.enemy.normal_caste
        unit.enemy.normal_caste=getFemaleCasteWithSameMaxAge(unit)
        script.sleep(1,'ticks')
        unit.enemy.normal_caste=normal_caste
    end
    end)
end

impregnate()

This code will take the selected unit, impregnate him or her, if male turn him into a female so that he may give birth, then turn him back into a male immediately.

Hmm, I wonder what would happen if you had a sieger give birth. Could make for a fun insectoid type race.
Title: Re: DFHack 0.42.06-r1
Post by: expwnent on June 06, 2016, 07:25:59 pm
I toyed with that idea as a way to create units but I never tried it. The unit would have to be added to the invasion for your case otherwise it wouldn't advance or retreat with the others.
Title: Re: DFHack 0.42.06-r1
Post by: SomeKif2.0 on June 06, 2016, 08:05:44 pm
I am having a bit of trouble installing dfhack 0.42.06-r1. So far I have downloaded it and unzipped it directly into my DF folder (and the contents look like the pre-installed version I was using before but is now outdated). When I launch DF the dfhack terminal doesn't open (clicking dfhack-run.rar while DF is running doesn't help). I have followed the directions on the OP and tried removing SDL.dll like README.html said to do (and then put it back when it didn't work). With the instructions so simple, I can't imagine having this much trouble.

For the record, I am on Windows.
Title: Re: DFHack 0.42.06-r1
Post by: scamtank on June 06, 2016, 08:26:20 pm
Is the SDL.dll getting overwritten when you extract the package?
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on June 06, 2016, 09:07:42 pm
and there's catsplosion

Awesome, I'll replace the plugin with this :)
Title: Re: DFHack 0.42.06-r1
Post by: Thundercraft on June 06, 2016, 09:32:22 pm
This code will take the selected unit, impregnate him or her, if male turn him into a female so that he may give birth, then turn him back into a male immediately.

Thank you kindly!
BTW: Will this be a part of a future release of DFHack?

adv-bodyswap and bodyswap are two different and similar things one being a plugin and the other being a txt function script that I copy and pasted.
you could harvest most of it from the recarnation script as that kinda puts you in the body of the killer and the coding needed to do that has the basic command needed to swap bodies.

Interesting. I may try to piddle around with the code to see if I can get something to work, because of all the missing DFusion and adv_tools, I think I'd miss some type of bodyswap the most. However, I never was familiar with Lua and my programming is extremely rusty ATM.

Wait... ??? Where is the "recarnation script" you mention?

[-snip-]
...wanna say sorry thundercraft for not releasing the big book of dumb spells I keep backup in case I need them and they get purged from Dfhack for reasons. Mostly because my 3 main folders I copy over when dfhack is updated...

It would be much appreciated if you did release some sort of script pack or mod or something. (Though, it would be very cool if you could get some of your scripts or plugins to be added to DFHack. 8) Just saying...)

Also, some of the stuff on your GitHub looks quite interesting. I'd love to try out Mount.lua and Mount-Order.lua. (A script to ride horses and other animals? :o Yes, please! I've really wanted mounts for years.) But, the script being 3 years old, I have to wonder if they would still work, as is.
Title: Re: DFHack 0.42.06-r1
Post by: Putnam on June 06, 2016, 09:41:21 pm
This code will take the selected unit, impregnate him or her, if male turn him into a female so that he may give birth, then turn him back into a male immediately.

Thank you kindly!
BTW: Will this be a part of a future release of DFHack?

i don't see a reason why not
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on June 06, 2016, 10:32:20 pm
The 0.43 version of DFHack isn't imminent, is it?  I'm still working out kinks in create-unit.lua but don't have a presence on GitHub or anything.
Title: Re: DFHack 0.42.06-r1
Post by: Probe1 on June 07, 2016, 08:04:37 am
On that note is there anything we can do to help?
Title: Re: DFHack 0.42.06-r1
Post by: SomeKif2.0 on June 07, 2016, 10:06:30 am
Is the SDL.dll getting overwritten when you extract the package?
I'm not sure. How would I check that?
Title: Re: DFHack 0.42.06-r1
Post by: expwnent on June 07, 2016, 11:00:26 am
The 0.43 version of DFHack isn't imminent, is it?  I'm still working out kinks in create-unit.lua but don't have a presence on GitHub or anything.

I don't think so but I haven't been on irc much the last two weeks.
Title: Re: DFHack 0.42.06-r1
Post by: expwnent on June 07, 2016, 11:01:51 am
Is the SDL.dll getting overwritten when you extract the package?
I'm not sure. How would I check that?

Try extracting SDL over what's there again.
Title: Re: DFHack 0.42.06-r1
Post by: scamtank on June 07, 2016, 12:58:52 pm
Is the SDL.dll getting overwritten when you extract the package?
I'm not sure. How would I check that?

7zip or whatever other archive software should prompt you to confirm any overwrites whenever you're extracting stuff. If there was nothing, you've been throwing files in the wrong place.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on June 07, 2016, 02:53:50 pm
Is the SDL.dll getting overwritten when you extract the package?
I'm not sure. How would I check that?

7zip or whatever other archive software should prompt you to confirm any overwrites whenever you're extracting stuff. If there was nothing, you've been throwing files in the wrong place.
Or somehow got the Legacy version of DF that doesn't have SDL.DLL.
Title: Re: DFHack 0.42.06-r1
Post by: cesarjunior233 on June 08, 2016, 01:01:15 pm
Update for 0.43.03
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 08, 2016, 01:06:27 pm
Is that supposed to be a question? If you're demanding that people do work on 0.43.03, that's not a good way to go about it. There are some issues we still have to work through, and people have been busy recently.
Title: Re: DFHack 0.42.06-r1
Post by: Sanctume on June 08, 2016, 01:22:42 pm
This code will take the selected unit, impregnate him or her, if male turn him into a female so that he may give birth, then turn him back into a male immediately.

Oh yes, I can't wait for a Hermit & Day Care Mode Challenge.
Title: Re: DFHack 0.42.06-r1
Post by: SomeKif2.0 on June 08, 2016, 01:48:22 pm
Is the SDL.dll getting overwritten when you extract the package?
I'm not sure. How would I check that?

7zip or whatever other archive software should prompt you to confirm any overwrites whenever you're extracting stuff. If there was nothing, you've been throwing files in the wrong place.
I'll try grabbing a fresh install of DF and then unzipping dfhack into the fresh install to see if that works.
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on June 12, 2016, 12:31:47 am
Just an update in case anyone else wants to take a look at this, here is v0.53 of create-unit.lua

This version appears to be stable even though it is still hacking the population info for wild animals.  One issue that I can't track down is that sometimes it will spawn immortal critters as already dead.  Might be because the year-in-which-to-die-of-old-age attribute for an immortal is -1, and the current year is higher than -1, but then you'd expect immortals to spawn dead every time which they don't.

Code: (create-unit.lua) [Select]
-- Creates a unit.  Beta; use at own risk.
-- Originally created by warmist, edited by Putnam for the dragon ball mod to be used in reactions, modified by Dirst for use in The Earth Strikes Back mod, incorporating fixes discovered by Boltgun then Mifiki wrote the bit where it switches to arena mode briefly to do some of the messy work, then Expwnent combined that with the old script to make it function for histfigs
-- version 0.53
-- This is a beta version. Use at your own risk.

-- Modifications from 0.5: civ -1 creates are NOT historical figures, mitigated screen-movement bug in createUnit()

--[[
  TODO
    children and babies: set child/baby job
    confirm body size is computed appropriately for different ages / life stages
    incarnate pre-existing historical figures
    some sort of invasion helper script
      set invasion_id, etc
    announcement for fake natural birth if appropriate
]]
--[[=begin

modtools/create-unit
====================
Creates a unit.  Use ``modtools/create-unit -help`` for more info.

=end]]

--[[
if dfhack.gui.getCurViewscreen()._type ~= df.viewscreen_dwarfmodest or df.global.ui.main.mode ~= df.ui_sidebar_mode.LookAround then
  print 'activate loo[k] mode'
  return
end
--]]

local utils=require 'utils'

function createUnit(race_id, caste_id)
  local view_x = df.global.window_x
  local view_y = df.global.window_y
  local view_z = df.global.window_z

  local curViewscreen = dfhack.gui.getCurViewscreen()
  local dwarfmodeScreen = df.viewscreen_dwarfmodest:new()
  curViewscreen.child = dwarfmodeScreen
  dwarfmodeScreen.parent = curViewscreen
  local oldMode = df.global.ui.main.mode
  df.global.ui.main.mode = df.ui_sidebar_mode.LookAround

  local gui = require 'gui'

  df.global.world.arena_spawn.race:resize(0)
  df.global.world.arena_spawn.race:insert(0,race_id) --df.global.ui.race_id)

  df.global.world.arena_spawn.caste:resize(0)
  df.global.world.arena_spawn.caste:insert(0,caste_id)

  df.global.world.arena_spawn.creature_cnt:resize(0)
  df.global.world.arena_spawn.creature_cnt:insert(0,0)

  --df.global.world.arena_spawn.equipment.skills:insert(0,99)
  --df.global.world.arena_spawn.equipment.skill_levels:insert(0,0)

  local old_gametype = df.global.gametype
  df.global.gametype = df.game_type.DWARF_ARENA

  gui.simulateInput(dfhack.gui.getCurViewscreen(), 'D_LOOK_ARENA_CREATURE')
  gui.simulateInput(dfhack.gui.getCurViewscreen(), 'SELECT')

  df.global.gametype = old_gametype

  curViewscreen.child = nil
  dwarfmodeScreen:delete()
  df.global.ui.main.mode = oldMode

  local id = df.global.unit_next_id-1
 
  df.global.window_x = view_x
  df.global.window_y = view_y
  df.global.window_z = view_z
 
  return id
end

--local u = df.unit.find(df.global.unit_next_id-1)
--u.civ_id = df.global.ui.civ_id
--u.population_id = df.historical_entity.find(df.global.ui.civ_id).populations[0]
--local group = df.global.ui.group_id

-- Picking a caste or gender at random
function getRandomCasteId(race_id)
  local cr = df.creature_raw.find(race_id)
  local caste_id, casteMax

  casteMax = #cr.caste - 1

  if casteMax > 0 then
    return math.random(0, casteMax)
  end

  return 0
end

local function  allocateNewChunk(hist_entity)
  hist_entity.save_file_id=df.global.unit_chunk_next_id
  df.global.unit_chunk_next_id=df.global.unit_chunk_next_id+1
  hist_entity.next_member_idx=0
  print("allocating chunk:",hist_entity.save_file_id)
end

local function allocateIds(nemesis_record,hist_entity)
  if hist_entity.next_member_idx==100 then
    allocateNewChunk(hist_entity)
  end
  nemesis_record.save_file_id=hist_entity.save_file_id
  nemesis_record.member_idx=hist_entity.next_member_idx
  hist_entity.next_member_idx=hist_entity.next_member_idx+1
end

function createFigure(trgunit,he,he_group)
  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
  -- ...
  -- note that innate skills are automaticaly set by DF
  hf.info.skills = {new=true}


  he.histfig_ids:insert('#', hf.id)
  he.hist_figures:insert('#', hf)
  if he_group then
    he_group.histfig_ids:insert('#', hf.id)
    he_group.hist_figures:insert('#', hf)
    hf.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=he_group.id,link_strength=100})
  end
  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,group_id)
  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(4)
  --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]]
  nem.unk10=-1
  nem.unk11=-1
  nem.unk12=-1
  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=-1

  local he=df.historical_entity.find(civ_id)
  he.nemesis_ids:insert("#",id)
  he.nemesis:insert("#",nem)
  local he_group
  if group_id and group_id~=-1 then
      he_group=df.historical_entity.find(group_id)
  end
  if he_group then
      he_group.nemesis_ids:insert("#",id)
      he_group.nemesis:insert("#",nem)
  end
  allocateIds(nem,he)
  nem.figure=createFigure(trgunit,he,he_group)
end

--createNemesis(u, u.civ_id,group)
function createUnitInCiv(race_id, caste_id, civ_id, group_id)
  local uid = createUnit(race_id, caste_id)
  local unit = df.unit.find(uid)
  if ( civ_id ) then
    createNemesis(unit, civ_id, group_id)
  end
  return uid
end

function createUnitInFortCiv(race_id, caste_id)
  return createUnitInCiv(race_id, caste_id, df.global.ui.civ_id)
end

function createUnitInFortCivAndGroup(race_id, caste_id)
  return createUnitInCiv(race_id, caste_id, df.global.ui.civ_id, df.global.ui.group_id)
end

function domesticate(uid, group_id)
  local u = df.unit.find(uid)
  group_id = group_id or df.global.ui.group_id
  -- If a friendly animal, make it domesticated.  From Boltgun & Dirst
  local caste=df.creature_raw.find(u.race).caste[u.caste]
  if not(caste.flags.CAN_SPEAK and caste.flags.CAN_LEARN) then
    -- Fix friendly animals (from Boltgun)
    u.flags2.resident = false;
    u.flags3.body_temp_in_range = true;
    u.population_id = -1
    u.status.current_soul.unit_id = u.id

    u.animal.population.region_x = -1
    u.animal.population.region_y = -1
    u.animal.population.unk_28 = -1
    u.animal.population.population_idx = -1
    u.animal.population.depth = -1

    u.counters.soldier_mood_countdown = -1
    u.counters.death_cause = -1

    u.enemy.anon_4 = -1
    u.enemy.anon_5 = -1
    u.enemy.anon_6 = -1

    -- And make them tame (from Dirst)
    u.flags1.tame = true
    u.training_level = 7
  end
end

function wild(uid)
  local u = df.unit.find(uid)
  local caste=df.creature_raw.find(u.race).caste[u.caste]
  if not(caste.flags.CAN_SPEAK and caste.flags.CAN_LEARN) then
    u.animal.population.region_x = df.global.world.world_data.active_site[0].pos.x
    u.animal.population.region_y = df.global.world.world_data.active_site[0].pos.y
    u.animal.population.unk_28 = -1
    u.animal.population.population_idx = -1  -- Eventually want to make a real population
    u.animal.population.depth = -1  -- Eventually this should be a parameter
u.animal.leave_countdown = 99999  -- Eventually this should be a parameter
u.flags2.roaming_wilderness_population_source = true
u.flags2.roaming_wilderness_population_source_not_a_map_feature = true
-- region = df.global.world.map.map_blocks[df.global.world.map.x_count_block*x+y]
  end
end


function nameUnit(id, entityRawName, civ_id)
  --pick a random appropriate name
  --choose three random words in the appropriate things
  local unit = df.unit.find(id)
  local entity_raw
  if entityRawName then
    for k,v in ipairs(df.global.world.raws.entities) do
      if v.code == entityRawName then
        entity_raw = v
        break
      end
    end
  else
    local entity = df.historical_entity.find(civ_id)
    entity_raw = entity.entity_raw
  end

  if not entity_raw then
    error('entity raw = nil: ', id, entityRawName, civ_id)
  end

  local translation = entity_raw.translation
  local translationIndex
  for k,v in ipairs(df.global.world.raws.language.translations) do
    if v.name == translation then
      translationIndex = k
      break
    end
  end
  --translation = df.language_translation.find(translation)
  local language_word_table = entity_raw.symbols.symbols1[0] --educated guess
  function randomWord()
    local index = math.random(0, #language_word_table.words[0] - 1)
    return index
  end
  local firstName = randomWord()
  local lastName1 = randomWord()
  local lastName2 = randomWord()
  local name = unit.status.current_soul.name
  name.words[0] = language_word_table.words[0][lastName1]
  name.parts_of_speech[0] = language_word_table.parts[0][lastName1]
  name.words[1] = language_word_table.words[0][lastName2]
  name.parts_of_speech[1] = language_word_table.parts[0][lastName2]
  name.first_name = df.language_word.find(language_word_table.words[0][firstName]).forms[language_word_table.parts[0][firstName]]
  name.has_name = true
  name.language = translationIndex
  name = unit.name
  name.words[0] = language_word_table.words[0][lastName1]
  name.parts_of_speech[0] = language_word_table.parts[0][lastName1]
  name.words[1] = language_word_table.words[0][lastName2]
  name.parts_of_speech[1] = language_word_table.parts[0][lastName2]
  name.first_name = df.language_word.find(language_word_table.words[0][firstName]).forms[language_word_table.parts[0][firstName]]
  name.has_name = true
  name.language = translationIndex
  if unit.hist_figure_id ~= -1 then
    local histfig = df.historical_figure.find(unit.hist_figure_id)
    name = histfig.name
    name.words[0] = language_word_table.words[0][lastName1]
    name.parts_of_speech[0] = language_word_table.parts[0][lastName1]
    name.words[1] = language_word_table.words[0][lastName2]
    name.parts_of_speech[1] = language_word_table.parts[0][lastName2]
    name.first_name = df.language_word.find(language_word_table.words[0][firstName]).forms[language_word_table.parts[0][firstName]]
    name.has_name = true
    name.language = translationIndex
  end
end

validArgs = --[[validArgs or]]utils.invert({
  'help',
  'race',
  'caste',
  'domesticate',
  'civId',
  'groupId',
  'flagSet',
  'flagClear',
  'name',
  'nick',
  'location',
  'age'
})

if moduleMode then
  return
end

local args = utils.processArgs({...}, validArgs)
if args.help then
  print(
[[scripts/modtools/create-unit.lua
arguments:
    -help
        print this help message
    -race raceName
        specify the race of the unit to be created
        examples:
            DWARF
            HUMAN
    -caste casteName
        specify the caste of the unit to be created
        examples:
            MALE
            FEMALE
    -domesticate
        if the unit can't learn or can't speak, then make it a friendly animal
    -civId id
        make the created unit a member of the specified civ (or none if id = -1)
        if id is \\LOCAL, then make it a member of the civ associated with the current fort
        otherwise id must be an integer
    -groupId id
        make the created unit a member of the specified group (or none if id = -1)
        if id is \\LOCAL, then make it a member of the group associated with the current fort
        otherwise id must be an integer
    -name entityRawName
        set the unit's name to be a random name appropriate for the given entity
        examples:
            MOUNTAIN
    -nick nickname
        set the unit's nickname directly
    -location [ x y z ]
        create the unit at the specified coordinates
    -age howOld
        set the birth date of the unit to the specified number of years ago
    -flagSet [ flag1 flag2 ... ]
        set the specified unit flags in the new unit to true
        flags may be selected from df.unit_flags1, df.unit_flags2, or df.unit_flags3
    -flagClear [ flag1 flag2 ... ]
        set the specified unit flags in the new unit to false
        flags may be selected from df.unit_flags1, df.unit_flags2, or df.unit_flags3
]])
  return
end

local race
local raceIndex
local casteIndex

if not args.race or not args.caste then
  error 'Specfiy a race and caste for the new unit.'
end

--find race
for i,v in ipairs(df.global.world.raws.creatures.all) do
  if v.creature_id == args.race then
    raceIndex = i
    race = v
    break
  end
end

if not race then
  error 'Invalid race.'
end

for i,v in ipairs(race.caste) do
  if v.caste_id == args.caste then
    casteIndex = i
    break
  end
end

if not casteIndex then
  error 'Invalid caste.'
end

local age
if args.age then
  age = tonumber(args.age)
  if not age and not age == 0 then
      error('Invalid age: ' .. args.age)
  end
end

local civ_id
if args.civId == '\\LOCAL' then
  civ_id = df.global.ui.civ_id
elseif args.civId and tonumber(args.civId) then
  civ_id = tonumber(args.civId)
end

local group_id
if args.groupId == '\\LOCAL' then
  group_id = df.global.ui.group_id
elseif args.groupId and tonumber(args.groupId) then
  group_id = tonumber(args.groupId)
end

local unitId
if civ_id == -1 then
    unitId = createUnit(raceIndex, casteIndex)
  else
    unitId = createUnitInCiv(raceIndex, casteIndex, civ_id, group_id)
end

if args.domesticate then
  domesticate(unitId, group_id)
 else
  wild(unitId)
end

--these flags are an educated guess of how to get the game to compute sizes correctly: use -flagSet and -flagClear arguments to override or supplement
local u = df.unit.find(unitId)
u.flags2.calculated_nerves = false
u.flags2.calculated_bodyparts = false
u.flags3.body_part_relsize_computed = false
u.flags3.size_modifier_computed = false
u.flags3.compute_health = true
u.flags3.weight_computed = false
--TODO: if the unit is a child or baby it will still behave like an adult

if age or age == 0 then
  if age == 0 then
    u.relations.birth_time = df.global.cur_year_tick
  end
  local oldYearDelta = u.relations.old_year - u.relations.birth_year
  u.relations.birth_year = df.global.cur_year - age
  if u.relations.old_year ~= -1 then
    u.relations.old_year = u.relations.birth_year + oldYearDelta
  end
  if u.flags1.important_historical_figure == true and u.flags2.important_historical_figure == true then
    local hf = df.global.history.figures.all[u.hist_figure_id]
    hf.born_year = u.relations.birth_year
    hf.born_seconds = u.relations.birth_time
    hf.old_year = u.relations.old_year
    hf.old_seconds = u.relations.old_time
  end
end

if args.flagSet or args.flagClear then
  local flagsToSet = {}
  local flagsToClear = {}
  for _,v in ipairs(args.flagSet or {}) do
    flagsToSet[v] = true
  end
  for _,v in ipairs(args.flagClear or {}) do
    flagsToClear[v] = true
  end
  for _,k in ipairs(df.unit_flags1) do
    if flagsToSet[k] then
      u.flags1[k] = true;
    elseif flagsToClear[k] then
      u.flags1[k] = false;
    end
  end
  for _,k in ipairs(df.unit_flags2) do
    if flagsToSet[k] then
      u.flags2[k] = true;
    elseif flagsToClear[k] then
      u.flags2[k] = false;
    end
  end
  for _,k in ipairs(df.unit_flags3) do
    if flagsToSet[k] then
      u.flags3[k] = true;
    elseif flagsToClear[k] then
      u.flags3[k] = false;
    end
  end
end

if args.name then
  nameUnit(unitId, args.name, civ_id)
else
  local unit = df.unit.find(unitId)
  unit.name.has_name = false
  if unit.status.current_soul then
    unit.status.current_soul.name.has_name = false
  end
  --[[if unit.hist_figure_id ~= -1 then
    local histfig = df.historical_figure.find(unit.hist_figure_id)
    histfig.name.has_name = false
  end--]]
end

if args.nick and type(args.nick) == 'string' then
  dfhack.units.setNickname(df.unit.find(unitId), args.nick)
end

if civ_id then
  local u = df.unit.find(unitId)
  u.civ_id = civ_id
end

if args.location then
  local u = df.unit.find(unitId)
  local pos = df.coord:new()
  pos.x = tonumber(args.location[1])
  pos.y = tonumber(args.location[2])
  pos.z = tonumber(args.location[3])
  local teleport = dfhack.script_environment('teleport')
  teleport.teleport(u, pos)
end

--[[if group_id then
  local u = df.unit.find(unitId)
  u.group_id = group_id
end--]]
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 14, 2016, 01:52:15 pm
Here's an alpha release for 0.43.03:
https://github.com/DFHack/dfhack/releases/tag/0.43.03-alpha1

It's probably unstable, but it's less unstable than it was yesterday, at least.
Title: Re: DFHack 0.42.06-r1
Post by: milo christiansen on June 14, 2016, 02:21:26 pm
(Does happy dance)
Title: Re: DFHack 0.42.06-r1
Post by: DaSwayza on June 14, 2016, 04:08:56 pm
Guys, I have to say how much good it does us all that you're working on this mod. So I just want to say thank you, and keep up the good work. Seriously I had to scrap one of my fortresses without it because the blood was keeping people away.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on June 14, 2016, 05:30:11 pm
YES!!! :D

I just need DFhack for spawning gauntlets, slabs, marring adventurers and most importantly: Instant skill/ability buff-up! Thank you!
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 14, 2016, 05:52:53 pm
Glad to hear that it's useful, but remember, the warning is there for a reason. We've ironed out most of the more obvious crashes, but there are probably issues we haven't caught, so don't rely on DFHack too heavily for normal gameplay at this point (although do feel free to test it out).
Title: Re: DFHack 0.42.06-r1
Post by: kane_t on June 14, 2016, 06:11:41 pm
Darn, a bit late.  I fixed the bug in combine_plants that caused it to not recurse properly into sub-containers, it's up on Github (https://github.com/kane-t/dfhack_scripts/blob/master/combine_plants.lua) if someone wants to merge it in.  (Or, I could do it; I'm not sure what the protocol is, here, since I wasn't the one who originally added it to DFHack.)

My plan is still to eventually rewrite both scripts as a single plugin that merges stacks of most item types, and does so in a way that conforms properly to the game mechanics (ie., correctly respecting the different capacities of barrels, bins, bags, and large pots), but it's hard to find the time.  The least I can do for now is make sure the original scripts are bug free!
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on June 14, 2016, 06:22:05 pm
The "gui/create-item" doesn't spawn left/right gauntlets, instead I only get a default gauntlet/glove/mitten with no left/right tags. I'm pretty sure in the last version it spawned a left and a right gauntlet at my character.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on June 14, 2016, 07:14:46 pm
I don't think create-item ever did, but createitem GLOVES:BLAH_BLAH did.
Title: Re: DFHack 0.42.06-r1
Post by: TheFlame52 on June 14, 2016, 07:23:26 pm
Woohoo! Reveal! Labors! Gm-editor! I love you!
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on June 14, 2016, 08:05:41 pm
I'm not sure what the protocol is, here, since I wasn't the one who originally added it to DFHack.

As of very recently, the protocol for anyone working with scripts is to fork https://github.com/DFHack/scripts and make pull requests.  Generally, it doesn't matter at all who added it; if you've made an improvement it's good to share that!
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on June 14, 2016, 08:26:38 pm
I don't think create-item ever did, but createitem GLOVES:BLAH_BLAH did.

Of course! derp. That function was the first thing I used to spawn gloves and gauntlets.. gonna try it later. I never did use gui/create-item to spawn gloves/gauntlets, I only used it to spawn a necromancer slab.

EDIT: Nevermind, got too curious so I tested it anyway, "createitem GLOVES:ITEM_GLOVES_GAUNTLETS ISCHRONITE" and "createitem GLOVES:ITEM_GLOVES_GLOVES ISCHRONITE" spawned a pair of left/right item for hands. Exceptional quality though but turned it to masterful with DFtool and thankfully manages to get the name of my character on them as if he/she had crafted/forged them. Awesome!
Title: Re: DFHack 0.42.06-r1
Post by: Witty on June 15, 2016, 09:55:28 am
First, I'd just like to thank the DFhack people for doing what they do. I don't think the community would be the same without your work.

I do have a bug to report though. I'm getting this error (http://i.imgur.com/ciWDiYu.png?1) when running exportlegends info
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 15, 2016, 10:13:59 am
Sigh...

Reminder to script authors: Do not use anon_X fields! They are temporary names and will disappear or point to something completely different if we figure out what the fields are. If you figure out what something is, tell us and we will name it.

Anyway, that should be a simple fix. Looking at it now.

Edit: It should be fixed now.
Title: Re: DFHack 0.42.06-r1
Post by: mifki on June 15, 2016, 04:11:30 pm
Reminder to script authors: Do not use anon_X fields! They are temporary names and will disappear or point to something completely different if we figure out what the fields are. If you figure out what something is, tell us and we will name it.

The worst thing is that they will change indices if any anon field above is renamed. (Right?) Why not automatically name anon fields based on offset, for example? Recommendation not to use them isn't very helpful when, well, you need to access those fields.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 15, 2016, 04:46:32 pm
Yep, their names change if anything above them is named. Regarding naming them based on offset:
Quote
11:22:46 AM <lethosor> angavrilov: would it be possible to give anon_ fields names based on their offsets?
11:22:55 AM <lethosor> like unk_f80 or whatever
11:23:05 AM <angavrilov> no, that's a bad idea
11:23:24 AM <angavrilov> any names must be in the xml, and any names not in xml should be regarded unstable
11:23:48 AM <angavrilov> i.e. for all intents and purposes anon fields should be considered to have no name
11:24:38 AM <Japa> call it use_this_if_you_are_and_idiot_29
11:24:55 AM <angavrilov> for one, that 'offset' would be different between windows and linux, even if you disregard the possibility of it changing between releases

I think the better option is to give fields which we have determined are the right type "unk" names, but, well, people haven't been doing that.
Title: Re: DFHack 0.42.06-r1
Post by: mifki on June 15, 2016, 05:11:55 pm
I think the better option is to give fields which we have determined are the right type "unk" names, but, well, people haven't been doing that.

Well, yes, that would help in most cases as completely wrong typing is rare. In this regard, I never understood difference between anon/unk - they're both temporary and will eventually be renamed, but anon will also change name if other fields named. So why not use [automatically] use unk everywhere. And by offset I meant just something unique, it doesn't matter offset on which platform to use because you will not translate the name back to offset and use it for anything.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 15, 2016, 05:32:33 pm
It's possible to misidentify pointers, int32_t's, groups of 2 int16_t's, etc.
anon names *are* automatic. Unk names usually have to be manually specified, although there is a way that angavrilov mentioned to use the lisp tool to generate unk names.
Title: Re: DFHack 0.42.06-r1
Post by: mifki on June 15, 2016, 05:40:26 pm
anon names *are* automatic.

I know. I was just proposing to automatically name them not sequentially but based on offset or something. I don't see how it's worse than sequential if all the same "we don't know what they are, use them carefully as they will be renamed" warnings remain.
Title: Re: DFHack 0.42.06-r1
Post by: Rose on June 16, 2016, 02:21:55 am
You're still not supposed to use them.

If you need to use them, then you know what they are.

If you know what they are, then you can give them a name.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 16, 2016, 07:23:09 am
There are some instances where you don't know what something is, but setting it to 0 or -1 keeps DF from crashing (for example). If those fields don't have names, "unk" names would be best.
Title: Re: DFHack 0.42.06-r1
Post by: Scoops Novel on June 16, 2016, 09:48:28 am
Has anyone found this data structure?

"DF certainly stores, somewhere in memory, a mapping between the RAW tags (NOSE/BROADNESS), the index into the bp_modifiers array, and the strings of descriptive text for each of the ranges (though, the latter could just be in a different, two-dimensional array, using the same indices as bp_modifiers)."

We're looking for the raw values for different appearances in general. We know that values are stored in "appearance>bp_modifiers", but they seem to be interdependent on each other when it comes to generating appearances. For example, an extremely short nose can not be narrow (indicated by bp_modifiers[10] which contains nose width), if bp_modifiers[11] (which contains nose length) indicates it's also very short.

If you've got that kicking about let me know. On a final note, does anyone have a complete list of the physical descriptions?
Title: Re: DFHack 0.42.06-r1
Post by: Mokkun on June 16, 2016, 03:42:54 pm
Had no problems whit that alpha release yet. Thanks for your hard work.
Small sugestion, migrants-now could it get a added where you add a number behind and that amount of migrants arive?
Would it be possible to make a guests-now?
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on June 16, 2016, 07:04:41 pm
Had no problems whit that alpha release yet. Thanks for your hard work.
Small sugestion, migrants-now could it get a added where you add a number behind and that amount of migrants arive?
Would it be possible to make a guests-now?
I thought guests flood in if you are near local civilization not a timer that spawns more folks wonder how the script would work when you are on a isolated island with no life near you in sight?
and which guests would it pull?
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on June 16, 2016, 08:05:08 pm
Had no problems whit that alpha release yet. Thanks for your hard work.
Small sugestion, migrants-now could it get a added where you add a number behind and that amount of migrants arive?
Would it be possible to make a guests-now?
I thought guests flood in if you are near local civilization not a timer that spawns more folks wonder how the script would work when you are on a isolated island with no life near you in sight?
and which guests would it pull?
If the fort has been really, really isolated for a really, really long time... perhaps imaginary ones :)
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 16, 2016, 10:02:36 pm
The way migrants-now works is that it schedules a migrant wave for the next tick, and DF handles the rest. Among other things, this means that running it multiple times results in progressively-smaller waves, and eventually none at all. Also, if your home civ is dead, I don't think it will work either. If you really need more citizens, you could try spawnunit (or modtools/create-unit), although I'm not sure what its limitations are in the current version.

It's possible that guests are also a timed event, like migrants, just with a different type ID. I'm not sure if anyone has investigated that yet.
Title: Re: DFHack 0.42.06-r1
Post by: Mokkun on June 17, 2016, 01:01:02 am
Had no problems whit that alpha release yet. Thanks for your hard work.
Small sugestion, migrants-now could it get a added where you add a number behind and that amount of migrants arive?
Would it be possible to make a guests-now?
I thought guests flood in if you are near local civilization not a timer that spawns more folks wonder how the script would work when you are on a isolated island with no life near you in sight?
and which guests would it pull?
I managed to put myself inrange of human trading, but it seems I managed to put myself outside of visitor range.. or the humans might be so desimated they do not have any to send as visitors..

The way migrants-now works is that it schedules a migrant wave for the next tick, and DF handles the rest. Among other things, this means that running it multiple times results in progressively-smaller waves, and eventually none at all. Also, if your home civ is dead, I don't think it will work either. If you really need more citizens, you could try spawnunit (or modtools/create-unit), although I'm not sure what its limitations are in the current version.

It's possible that guests are also a timed event, like migrants, just with a different type ID. I'm not sure if anyone has investigated that yet.
I guess that also takes into account things like deaths from rampaging FB near water source when I had run out of alcohol and not noticed.. And thats why I need more of the dwarves.. Ill test the spawnunit and see if it can help out.
Title: Re: DFHack 0.42.06-r1
Post by: Scoops Novel on June 17, 2016, 01:47:45 pm
Pls ignore
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on June 17, 2016, 01:51:10 pm
All I've seen are shaven/combed/braided/double braided/pony tail/messy and very short/short/medium/long/very long/extremely long variations on facial and head hair, yes all of it, yes, I've played around and gotten someone who wore his moustache in a pony tail.
Title: Re: DFHack 0.42.06-r1
Post by: Scoops Novel on June 17, 2016, 01:55:34 pm
All I've seen are shaven/combed/braided/double braided/pony tail/messy and very short/short/medium/long/very long/extremely long variations on facial and head hair, yes all of it, yes, I've played around and gotten someone who wore his moustache in a pony tail.

Yeah your right, and i found the list to verify!
Title: Re: DFHack 0.42.06-r1
Post by: Mokkun on June 19, 2016, 01:35:25 pm
The way migrants-now works is that it schedules a migrant wave for the next tick, and DF handles the rest. Among other things, this means that running it multiple times results in progressively-smaller waves, and eventually none at all. Also, if your home civ is dead, I don't think it will work either. If you really need more citizens, you could try spawnunit (or modtools/create-unit), although I'm not sure what its limitations are in the current version.

It's possible that guests are also a timed event, like migrants, just with a different type ID. I'm not sure if anyone has investigated that yet.

Sorry to bugger you about this again, but ehh, seems I just cant figure out the commands for after spawnunit to make them belong to my civ.
Tried spawnunit DWARF MALE (and some name here) and they apear as friendlys, and just mill about spawned point, nothing happened for ingame years, some of them I tried tweak make-own, they ran to the inn, but can not be given labors, and have not petitioned me..

Any idea? as the moodtools one whit added commands as -civId \\LOCAL do not seem to work.
Title: Re: DFHack 0.42.06-r1
Post by: Thundercraft on June 19, 2016, 02:52:08 pm
...Any idea? as the moodtools one whit added commands as -civId \\LOCAL do not seem to work.

What you're describing sounds like what DFusion's "Friendship" plugin was for. (Which is gone now.) Have you tried makeown, part of the tweak plugin? That's what I would try.

The makeown part of the tweak (http://dfhack.readthedocs.io/en/stable/docs/Plugins.html#tweak) plugin can "Force selected unit to become a member of your fort." This sounds reminiscent of Friendship...
Title: Re: DFHack 0.42.06-r1
Post by: Mokkun on June 19, 2016, 03:13:19 pm
...Any idea? as the moodtools one whit added commands as -civId \\LOCAL do not seem to work.

What you're describing sounds like what DFusion's "Friendship" plugin was for. (Which is gone now.) Have you tried makeown, part of the tweak plugin? That's what I would try.

The makeown part of the tweak (http://dfhack.readthedocs.io/en/stable/docs/Plugins.html#tweak) plugin can "Force selected unit to become a member of your fort." This sounds reminiscent of Friendship...
Yes, this is the one who lets them run to the tavern instead of milling where spawned. they do claim a bed in one of the rooms "given" to the tavern. they just do not petition to join me so I can give jobs.

Just remembered something. I had some stuck Humans from a caravan, whit the tweak makeown, they ran to the tavern, and a month or so (ingame) later they petitioned to join, so technically it should work..
Title: Re: DFHack 0.42.06-r1
Post by: Vitellus on June 19, 2016, 04:39:16 pm
Thanks for all the hard work you folks do!
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on June 19, 2016, 11:21:54 pm
...Any idea? as the moodtools one whit added commands as -civId \\LOCAL do not seem to work.

What you're describing sounds like what DFusion's "Friendship" plugin was for. (Which is gone now.) Have you tried makeown, part of the tweak plugin? That's what I would try.

The makeown part of the tweak (http://dfhack.readthedocs.io/en/stable/docs/Plugins.html#tweak) plugin can "Force selected unit to become a member of your fort." This sounds reminiscent of Friendship...
dfusion friendship was that and Migrants come in variation of races also minor bug of giving everyone dragon breath.
...still wish for that different race migrants to comeback.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on June 20, 2016, 03:02:30 am
Hah, dfhack pre-release for 43.03 hits, today we get word that Toady was intending to release but had a couple problems so it should be out tomorrow, gotta love it.
Title: Re: DFHack 0.42.06-r1
Post by: Williham on June 20, 2016, 04:55:06 am
Hah, dfhack pre-release for 43.03 hits, today we get word that Toady was intending to release but had a couple problems so it should be out tomorrow, gotta love it.

Every Armok damned time.
Title: Re: DFHack 0.42.06-r1
Post by: Rose on June 20, 2016, 11:01:55 pm
Will we get another release before we start working on the new version?
Title: Re: DFHack 0.42.06-r1
Post by: Warmist on June 20, 2016, 11:41:22 pm
Will we get another release before we start working on the new version?
The compiler changed so it's very possible.
Title: Re: DFHack 0.42.06-r1
Post by: Bumber on June 21, 2016, 09:52:41 pm
0.43.03-alpha1
DFHack seems to think it's always raining. This affects soundsense and the dwarfmonitor weather indicator.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 21, 2016, 10:11:10 pm
What platform?
Title: Re: DFHack 0.42.06-r1
Post by: Bumber on June 21, 2016, 11:06:44 pm
What platform?
Windows 7
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on June 24, 2016, 04:05:17 pm
Meph ran into an error in the create-unit I sent over.  It should be:

Code: (create-unit.lua) [Select]
-- Creates a unit.  Beta; use at own risk.
-- Originally created by warmist, edited by Putnam for the dragon ball mod to be used in reactions, modified by Dirst for use in The Earth Strikes Back mod, incorporating fixes discovered by Boltgun then Mifiki wrote the bit where it switches to arena mode briefly to do some of the messy work, then Expwnent combined that with the old script to make it function for histfigs
-- version 0.54
-- This is a beta version. Use at your own risk.

-- Modifications from 0.5: civ -1 creates are NOT historical figures, mitigated screen-movement bug in createUnit()

--[[
  TODO
    children and babies: set child/baby job
    confirm body size is computed appropriately for different ages / life stages
    incarnate pre-existing historical figures
    some sort of invasion helper script
      set invasion_id, etc
    announcement for fake natural birth if appropriate
]]
--[[=begin

modtools/create-unit
====================
Creates a unit.  Use ``modtools/create-unit -help`` for more info.

=end]]

--[[
if dfhack.gui.getCurViewscreen()._type ~= df.viewscreen_dwarfmodest or df.global.ui.main.mode ~= df.ui_sidebar_mode.LookAround then
  print 'activate loo[k] mode'
  return
end
--]]

local utils=require 'utils'

function createUnit(race_id, caste_id)
  local view_x = df.global.window_x
  local view_y = df.global.window_y
  local view_z = df.global.window_z

  local curViewscreen = dfhack.gui.getCurViewscreen()
  local dwarfmodeScreen = df.viewscreen_dwarfmodest:new()
  curViewscreen.child = dwarfmodeScreen
  dwarfmodeScreen.parent = curViewscreen
  local oldMode = df.global.ui.main.mode
  df.global.ui.main.mode = df.ui_sidebar_mode.LookAround

  local gui = require 'gui'

  df.global.world.arena_spawn.race:resize(0)
  df.global.world.arena_spawn.race:insert(0,race_id) --df.global.ui.race_id)

  df.global.world.arena_spawn.caste:resize(0)
  df.global.world.arena_spawn.caste:insert(0,caste_id)

  df.global.world.arena_spawn.creature_cnt:resize(0)
  df.global.world.arena_spawn.creature_cnt:insert(0,0)

  --df.global.world.arena_spawn.equipment.skills:insert(0,99)
  --df.global.world.arena_spawn.equipment.skill_levels:insert(0,0)

  local old_gametype = df.global.gametype
  df.global.gametype = df.game_type.DWARF_ARENA

  gui.simulateInput(dfhack.gui.getCurViewscreen(), 'D_LOOK_ARENA_CREATURE')
  gui.simulateInput(dfhack.gui.getCurViewscreen(), 'SELECT')

  df.global.gametype = old_gametype

  curViewscreen.child = nil
  dwarfmodeScreen:delete()
  df.global.ui.main.mode = oldMode

  local id = df.global.unit_next_id-1
 
  df.global.window_x = view_x
  df.global.window_y = view_y
  df.global.window_z = view_z
 
  return id
end

--local u = df.unit.find(df.global.unit_next_id-1)
--u.civ_id = df.global.ui.civ_id
--u.population_id = df.historical_entity.find(df.global.ui.civ_id).populations[0]
--local group = df.global.ui.group_id

-- Picking a caste or gender at random
function getRandomCasteId(race_id)
  local cr = df.creature_raw.find(race_id)
  local caste_id, casteMax

  casteMax = #cr.caste - 1

  if casteMax > 0 then
    return math.random(0, casteMax)
  end

  return 0
end

local function  allocateNewChunk(hist_entity)
  hist_entity.save_file_id=df.global.unit_chunk_next_id
  df.global.unit_chunk_next_id=df.global.unit_chunk_next_id+1
  hist_entity.next_member_idx=0
  print("allocating chunk:",hist_entity.save_file_id)
end

local function allocateIds(nemesis_record,hist_entity)
  if hist_entity.next_member_idx==100 then
    allocateNewChunk(hist_entity)
  end
  nemesis_record.save_file_id=hist_entity.save_file_id
  nemesis_record.member_idx=hist_entity.next_member_idx
  hist_entity.next_member_idx=hist_entity.next_member_idx+1
end

function createFigure(trgunit,he,he_group)
  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
  -- ...
  -- note that innate skills are automaticaly set by DF
  hf.info.skills = {new=true}


  he.histfig_ids:insert('#', hf.id)
  he.hist_figures:insert('#', hf)
  if he_group then
    he_group.histfig_ids:insert('#', hf.id)
    he_group.hist_figures:insert('#', hf)
    hf.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=he_group.id,link_strength=100})
  end
  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,group_id)
  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(4)
  --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]]
  nem.unk10=-1
  nem.unk11=-1
  nem.unk12=-1
  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=-1

  local he=df.historical_entity.find(civ_id)
  he.nemesis_ids:insert("#",id)
  he.nemesis:insert("#",nem)
  local he_group
  if group_id and group_id~=-1 then
      he_group=df.historical_entity.find(group_id)
  end
  if he_group then
      he_group.nemesis_ids:insert("#",id)
      he_group.nemesis:insert("#",nem)
  end
  allocateIds(nem,he)
  nem.figure=createFigure(trgunit,he,he_group)
end

--createNemesis(u, u.civ_id,group)
function createUnitInCiv(race_id, caste_id, civ_id, group_id)
  local uid = createUnit(race_id, caste_id)
  local unit = df.unit.find(uid)
  if ( civ_id ) then
    createNemesis(unit, civ_id, group_id)
  end
  return uid
end

function createUnitInFortCiv(race_id, caste_id)
  return createUnitInCiv(race_id, caste_id, df.global.ui.civ_id)
end

function createUnitInFortCivAndGroup(race_id, caste_id)
  return createUnitInCiv(race_id, caste_id, df.global.ui.civ_id, df.global.ui.group_id)
end

function domesticate(uid, group_id)
  local u = df.unit.find(uid)
  group_id = group_id or df.global.ui.group_id
  -- If a friendly animal, make it domesticated.  From Boltgun & Dirst
  local caste=df.creature_raw.find(u.race).caste[u.caste]
  if not(caste.flags.CAN_SPEAK and caste.flags.CAN_LEARN) then
    -- Fix friendly animals (from Boltgun)
    u.flags2.resident = false;
    u.flags3.body_temp_in_range = true;
    u.population_id = -1
    u.status.current_soul.unit_id = u.id

    u.animal.population.region_x = -1
    u.animal.population.region_y = -1
    u.animal.population.unk_28 = -1
    u.animal.population.population_idx = -1
    u.animal.population.depth = -1

    u.counters.soldier_mood_countdown = -1
    u.counters.death_cause = -1

    u.enemy.anon_4 = -1
    u.enemy.anon_5 = -1
    u.enemy.anon_6 = -1

    -- And make them tame (from Dirst)
    u.flags1.tame = true
    u.training_level = 7
  end
end

function wild(uid)
  local u = df.unit.find(uid)
  local caste=df.creature_raw.find(u.race).caste[u.caste]
  if not(caste.flags.CAN_SPEAK and caste.flags.CAN_LEARN) then
    u.animal.population.region_x = df.global.world.world_data.active_site[0].pos.x
    u.animal.population.region_y = df.global.world.world_data.active_site[0].pos.y
    u.animal.population.unk_28 = -1
    u.animal.population.population_idx = -1  -- Eventually want to make a real population
    u.animal.population.depth = -1  -- Eventually this should be a parameter
u.animal.leave_countdown = 99999  -- Eventually this should be a parameter
u.flags2.roaming_wilderness_population_source = true
u.flags2.roaming_wilderness_population_source_not_a_map_feature = true
-- region = df.global.world.map.map_blocks[df.global.world.map.x_count_block*x+y]
  end
end


function nameUnit(id, entityRawName, civ_id)
  --pick a random appropriate name
  --choose three random words in the appropriate things
  local unit = df.unit.find(id)
  local entity_raw
  if entityRawName then
    for k,v in ipairs(df.global.world.raws.entities) do
      if v.code == entityRawName then
        entity_raw = v
        break
      end
    end
  else
    local entity = df.historical_entity.find(civ_id)
    entity_raw = entity.entity_raw
  end

  if not entity_raw then
    error('entity raw = nil: ', id, entityRawName, civ_id)
  end

  local translation = entity_raw.translation
  local translationIndex
  for k,v in ipairs(df.global.world.raws.language.translations) do
    if v.name == translation then
      translationIndex = k
      break
    end
  end
  --translation = df.language_translation.find(translation)
  local language_word_table = entity_raw.symbols.symbols1[0] --educated guess
  function randomWord()
    local index = math.random(0, #language_word_table.words[0] - 1)
    return index
  end
  local firstName = randomWord()
  local lastName1 = randomWord()
  local lastName2 = randomWord()
  local name = unit.status.current_soul.name
  name.words[0] = language_word_table.words[0][lastName1]
  name.parts_of_speech[0] = language_word_table.parts[0][lastName1]
  name.words[1] = language_word_table.words[0][lastName2]
  name.parts_of_speech[1] = language_word_table.parts[0][lastName2]
  name.first_name = df.language_word.find(language_word_table.words[0][firstName]).forms[language_word_table.parts[0][firstName]]
  name.has_name = true
  name.language = translationIndex
  name = unit.name
  name.words[0] = language_word_table.words[0][lastName1]
  name.parts_of_speech[0] = language_word_table.parts[0][lastName1]
  name.words[1] = language_word_table.words[0][lastName2]
  name.parts_of_speech[1] = language_word_table.parts[0][lastName2]
  name.first_name = df.language_word.find(language_word_table.words[0][firstName]).forms[language_word_table.parts[0][firstName]]
  name.has_name = true
  name.language = translationIndex
  if unit.hist_figure_id ~= -1 then
    local histfig = df.historical_figure.find(unit.hist_figure_id)
    name = histfig.name
    name.words[0] = language_word_table.words[0][lastName1]
    name.parts_of_speech[0] = language_word_table.parts[0][lastName1]
    name.words[1] = language_word_table.words[0][lastName2]
    name.parts_of_speech[1] = language_word_table.parts[0][lastName2]
    name.first_name = df.language_word.find(language_word_table.words[0][firstName]).forms[language_word_table.parts[0][firstName]]
    name.has_name = true
    name.language = translationIndex
  end
end

validArgs = --[[validArgs or]]utils.invert({
  'help',
  'race',
  'caste',
  'domesticate',
  'civId',
  'groupId',
  'flagSet',
  'flagClear',
  'name',
  'nick',
  'location',
  'age'
})

if moduleMode then
  return
end

local args = utils.processArgs({...}, validArgs)
if args.help then
  print(
[[scripts/modtools/create-unit.lua
arguments:
    -help
        print this help message
    -race raceName
        specify the race of the unit to be created
        examples:
            DWARF
            HUMAN
    -caste casteName
        specify the caste of the unit to be created
        examples:
            MALE
            FEMALE
    -domesticate
        if the unit can't learn or can't speak, then make it a friendly animal
    -civId id
        make the created unit a member of the specified civ (or none if id = -1)
        if id is \\LOCAL, then make it a member of the civ associated with the current fort
        otherwise id must be an integer
    -groupId id
        make the created unit a member of the specified group (or none if id = -1)
        if id is \\LOCAL, then make it a member of the group associated with the current fort
        otherwise id must be an integer
    -name entityRawName
        set the unit's name to be a random name appropriate for the given entity
        examples:
            MOUNTAIN
    -nick nickname
        set the unit's nickname directly
    -location [ x y z ]
        create the unit at the specified coordinates
    -age howOld
        set the birth date of the unit to the specified number of years ago
    -flagSet [ flag1 flag2 ... ]
        set the specified unit flags in the new unit to true
        flags may be selected from df.unit_flags1, df.unit_flags2, or df.unit_flags3
    -flagClear [ flag1 flag2 ... ]
        set the specified unit flags in the new unit to false
        flags may be selected from df.unit_flags1, df.unit_flags2, or df.unit_flags3
]])
  return
end

local race
local raceIndex
local casteIndex

if not args.race or not args.caste then
  error 'Specfiy a race and caste for the new unit.'
end

--find race
for i,v in ipairs(df.global.world.raws.creatures.all) do
  if v.creature_id == args.race then
    raceIndex = i
    race = v
    break
  end
end

if not race then
  error 'Invalid race.'
end

for i,v in ipairs(race.caste) do
  if v.caste_id == args.caste then
    casteIndex = i
    break
  end
end

if not casteIndex then
  error 'Invalid caste.'
end

local age
if args.age then
  age = tonumber(args.age)
  if not age and not age == 0 then
      error('Invalid age: ' .. args.age)
  end
end

local civ_id
if args.civId == '\\LOCAL' then
  civ_id = df.global.ui.civ_id
elseif args.civId and tonumber(args.civId) then
  civ_id = tonumber(args.civId)
end

local group_id
if args.groupId == '\\LOCAL' then
  group_id = df.global.ui.group_id
elseif args.groupId and tonumber(args.groupId) then
  group_id = tonumber(args.groupId)
end

local unitId
if civ_id == -1 then
    unitId = createUnit(raceIndex, casteIndex)
  else
    unitId = createUnitInCiv(raceIndex, casteIndex, civ_id, group_id)
end

if args.domesticate then
  domesticate(unitId, group_id)
 else
  wild(unitId)
end

--these flags are an educated guess of how to get the game to compute sizes correctly: use -flagSet and -flagClear arguments to override or supplement
local u = df.unit.find(unitId)
u.flags2.calculated_nerves = false
u.flags2.calculated_bodyparts = false
u.flags3.body_part_relsize_computed = false
u.flags3.size_modifier_computed = false
u.flags3.compute_health = true
u.flags3.weight_computed = false
--TODO: if the unit is a child or baby it will still behave like an adult

if age or age == 0 then
  if age == 0 then
    u.relations.birth_time = df.global.cur_year_tick
  end
  local oldYearDelta = u.relations.old_year - u.relations.birth_year
  u.relations.birth_year = df.global.cur_year - age
  if u.relations.old_year ~= -1 then
    u.relations.old_year = u.relations.birth_year + oldYearDelta
  end
  if u.flags1.important_historical_figure == true and u.flags2.important_historical_figure == true then
    local hf = df.global.world.history.figures.all[u.hist_figure_id]
    hf.born_year = u.relations.birth_year
    hf.born_seconds = u.relations.birth_time
    hf.old_year = u.relations.old_year
    hf.old_seconds = u.relations.old_time
  end
end

if args.flagSet or args.flagClear then
  local flagsToSet = {}
  local flagsToClear = {}
  for _,v in ipairs(args.flagSet or {}) do
    flagsToSet[v] = true
  end
  for _,v in ipairs(args.flagClear or {}) do
    flagsToClear[v] = true
  end
  for _,k in ipairs(df.unit_flags1) do
    if flagsToSet[k] then
      u.flags1[k] = true;
    elseif flagsToClear[k] then
      u.flags1[k] = false;
    end
  end
  for _,k in ipairs(df.unit_flags2) do
    if flagsToSet[k] then
      u.flags2[k] = true;
    elseif flagsToClear[k] then
      u.flags2[k] = false;
    end
  end
  for _,k in ipairs(df.unit_flags3) do
    if flagsToSet[k] then
      u.flags3[k] = true;
    elseif flagsToClear[k] then
      u.flags3[k] = false;
    end
  end
end

if args.name then
  nameUnit(unitId, args.name, civ_id)
else
  local unit = df.unit.find(unitId)
  unit.name.has_name = false
  if unit.status.current_soul then
    unit.status.current_soul.name.has_name = false
  end
  --[[if unit.hist_figure_id ~= -1 then
    local histfig = df.historical_figure.find(unit.hist_figure_id)
    histfig.name.has_name = false
  end--]]
end

if args.nick and type(args.nick) == 'string' then
  dfhack.units.setNickname(df.unit.find(unitId), args.nick)
end

if civ_id then
  local u = df.unit.find(unitId)
  u.civ_id = civ_id
end

if args.location then
  local u = df.unit.find(unitId)
  local pos = df.coord:new()
  pos.x = tonumber(args.location[1])
  pos.y = tonumber(args.location[2])
  pos.z = tonumber(args.location[3])
  local teleport = dfhack.script_environment('teleport')
  teleport.teleport(u, pos)
end

--[[if group_id then
  local u = df.unit.find(unitId)
  u.group_id = group_id
end--]]

It only comes up if you assign an age to a unit that is supposed to spawn as a historical figure.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 24, 2016, 10:01:44 pm
What platform?
Windows 7
What does running "weather" give you?
Title: Re: DFHack 0.42.06-r1
Post by: Bumber on June 25, 2016, 06:05:32 am
What does running "weather" give you?
Code: [Select]
C C C C C
C C C C C
C C C C C
C C C C C
R R R R R
I checked the entire surface and there's no rain.

(Is there some way to copy-paste the console's output?)
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 25, 2016, 11:25:37 am
That looks like rain on the south side of the map to me. The chances of that being incorrect are pretty low, since anything other than 0, 1 (rain), or 2 in the weather map would be displayed as a raw number, instead of a letter.

If you're on Windows, there's an edit menu if you right-click the title bar.
Title: Re: DFHack 0.42.06-r1
Post by: Urlance Woolsbane on June 25, 2016, 06:19:24 pm
Apologies for the broadness of this question, but how much of the structure of the save-files has been mapped-out?
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 25, 2016, 07:29:31 pm
DFHack pretty much just works with the contents of the game's memory. There's some save file research on the wiki, though:
http://dwarffortresswiki.org/index.php/User:Rick/Save_research
http://dwarffortresswiki.org/index.php/User:Andux/Format_research
http://dwarffortresswiki.org/index.php/User:Andux/Format_research/WORLD.SAV
Title: Re: DFHack 0.42.06-r1
Post by: Urlance Woolsbane on June 25, 2016, 08:38:10 pm
DFHack pretty much just works with the contents of the game's memory. There's some save file research on the wiki, though:
http://dwarffortresswiki.org/index.php/User:Rick/Save_research
http://dwarffortresswiki.org/index.php/User:Andux/Format_research
http://dwarffortresswiki.org/index.php/User:Andux/Format_research/WORLD.SAV
Thanks!
Title: Re: DFHack 0.42.06-r1
Post by: Bumber on June 25, 2016, 10:24:44 pm
That looks like rain on the south side of the map to me. The chances of that being incorrect are pretty low, since anything other than 0, 1 (rain), or 2 in the weather map would be displayed as a raw number, instead of a letter.
Well, it certainly isn't raining there. I checked all the above ground z-levels.

Here's my save, dfhack-config folder, and dfhack.init: http://dffd.bay12games.com/file.php?id=12193

Edit: I tried "weather clear" and the indicator disappeared for about a minute before the reappearing without a "started raining" announcement. R's in the same place as usual, no rain.
Title: Re: DFHack 0.42.06-r1
Post by: gchristopher on June 26, 2016, 12:13:41 am
Apologies for the broadness of this question, but how much of the structure of the save-files has been mapped-out?
I put a couple months of my life into that project back during 34.11, but didn't publish anything. I got most of the world map data. (So maybe a quarter-ish of a typical world.dat.) It was good enough to get all the generated raws/interactions/etc (which are easy), all the region and subregion data. I didn't get mappings for entities or sites, which is a lot to be missing.

If you really really care, I could make the code available, but I consider it low-value. I used those wiki pages as a starting point and I did get significantly farther than them, at least.

Ultimately I abandoned the project because:
- Dfhack memory mappings are so far ahead of save file research, and can accomplish almost any desirable edit.
- I didn't think my made-up XML schema for describing a world.dat file was going to be flexible enough to describe the whole file.
- It was a tremendous amount of work that it seemed like only I cared about.

Let me know if you'd like the unfinished project. It's in C++ using Boost and will produce a text file dump of the portions of an uncompressed 34.11 save that it can interpret.
Title: Re: DFHack 0.42.06-r1
Post by: KillzEmAllGod on June 26, 2016, 09:17:08 am
So what does 64 bit DF mean for DFHACK?
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on June 26, 2016, 09:44:14 am
So what does 64 bit DF mean for DFHACK?
DFHack needs to be compiled with the same compiler that DF is, and I think it needs most if not all compiler flags set the same as well.

But ideally no code changes to make it run, and it might be best not to make any 64-bit specific code changes until 32-bit is retired.  Maybe.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 26, 2016, 10:14:56 am
There are changes that need to be made to make DFHack work with the new compiler, and more changes to add 64-bit support, but the majority of the work is probably related to df-structures (e.g. how to handle things that are different sizes between builds, hopefully not many, and updating the layouts of things like strings that could have changed in MSVC 2015).
Title: Re: DFHack 0.42.06-r1
Post by: Thundercraft on June 26, 2016, 07:29:20 pm
There are changes that need to be made...

But it sounds like almost half of the stuff you mentioned needs to be done, anyway, to release another DFHack for the next x86 (32-bit) DF release. I mean, regardless of whether or not x64 DF is supported, there's still a need to make DFHack work with the new compiler.

Though, I do understand that this could be much more work than usual and that it will take longer. I'd imagine that support for x64 DF probably isn't a priority, either.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 26, 2016, 08:49:36 pm
It depends on whether Toady keeps distributing 32-bit builds of DF - it sounds like he is, given that he's building both on Windows and Linux so far, but if not, we obviously can't have a 32-bit-only DFHack and a 64-bit-only DF.

I don't know how the Windows side of things with MSVC 2015 is coming along, being mostly a Mac/Linux person. I think most of the research involves figuring out how to analyze changed structures from outside DF, since DFHack should be compatible with DF if it's compiled with the same compiler.

Toady said he uses fixed-width types in some places, so a 64-bit transition could be easier than we expected, although it could also be a disaster (there's at least one file that I know won't compile under MSVC 2015 for x64). If there are integers that vary in size between builds, we'll have to come up with a new way to describe them in df-structures and possibly check a *lot* of things (but hopefully that won't be the case very often).
Title: Re: DFHack 0.42.06-r1
Post by: Urlance Woolsbane on June 28, 2016, 02:02:36 am
Apologies for the broadness of this question, but how much of the structure of the save-files has been mapped-out?
I put a couple months of my life into that project back during 34.11, but didn't publish anything. I got most of the world map data. (So maybe a quarter-ish of a typical world.dat.) It was good enough to get all the generated raws/interactions/etc (which are easy), all the region and subregion data. I didn't get mappings for entities or sites, which is a lot to be missing.

If you really really care, I could make the code available, but I consider it low-value. I used those wiki pages as a starting point and I did get significantly farther than them, at least.

Ultimately I abandoned the project because:
- Dfhack memory mappings are so far ahead of save file research, and can accomplish almost any desirable edit.
- I didn't think my made-up XML schema for describing a world.dat file was going to be flexible enough to describe the whole file.
- It was a tremendous amount of work that it seemed like only I cared about.

Let me know if you'd like the unfinished project. It's in C++ using Boost and will produce a text file dump of the portions of an uncompressed 34.11 save that it can interpret.
If it's not too much trouble, I'd appreciate it. Having a handle on the region and subregion data would be wonderful, seeing as they're probably the most difficult aspect of the file-structure.
Title: Re: DFHack 0.42.06-r1
Post by: Repseki on June 28, 2016, 04:49:48 am
Any chance either of these will work with current versions of DFHack/DF. Not really sure where I picked them up, but had them sitting around and thought they might be useful for some generational fort messing about.

Spoiler (click to show/hide)
Title: Re: DFHack 0.42.06-r1
Post by: Meph on June 28, 2016, 08:11:44 am
Excuse me, I have a question about the four scripts that omniclasm wrote that help FPS, namely deterioratefood, corpses, clothing and starvingdead.rb.

They work way too quickly, with food and clothing rotting away in 1-2 months, while undead sieges barely reach the fortress before the undead crumble to dust. I need to make it work much slower, but I dont know which numbers to change in the scripts.

Here is the starvingdead.rb example:
Code: [Select]
# Weaken and eventually destroy undead over time
=begin

starvingdead
============
Somewhere between a "mod" and a "fps booster", with a small impact on
vanilla gameplay. It mostly helps prevent undead cascades in the caverns,
where constant combat leads to hundreds of undead roaming the
caverns and destroying your FPS.

With this script running, all undead that have been on the map for
one month gradually decay, losing strength, speed, and toughness.
After six months, they collapse upon themselves, never to be reanimated.

Usage: ``starvingdead (start|stop)``

=end

class StarvingDead

    def initialize
        @threshold = 1
        @die_threshold = 6
    end

    def process
        return false unless @running
        month_length = 67200
        if (@undead_count >= 25)
            month_length *= 25 / @undead_count
        end

        @undead_count = 0
        df.world.units.active.each { |u|
            if (u.enemy.undead and not u.flags1.dead)
                @undead_count += 1
                if (u.curse.time_on_site > month_length * @threshold)
                    u.body.physical_attrs.each { |att|
                        att.value = att.value - (att.value * 0.02)
                    }
                end

                if (u.curse.time_on_site > month_length * @die_threshold)
                    u.flags1.dead = true
                    u.curse.rem_tags2.FIT_FOR_ANIMATION = true
                end
            end
        }
    end

    def start
        @onupdate = df.onupdate_register('starvingdead', 1200, 1200) { process }
        @running = true
        @undead_count = 0

        if ($script_args[1] and $script_args[1].gsub(/[^0-9\.]/,'').to_f > 0)
            @threshold = $script_args[1].gsub(/[^0-9\.]/,'').to_f
        end

        if ($script_args[2] and $script_args[2].gsub(/[^0-9\.]/,'').to_f > 0)
            @die_threshold = $script_args[2].gsub(/[^0-9\.]/,'').to_f
        end

        puts "Starving Dead starting...weakness starts at #{@threshold} months, true death at #{@die_threshold} months"
    end

    def stop
        df.onupdate_unregister(@onupdate)
        @running = false
    end
    def status
        @running ? 'Running.' : 'Stopped.'
    end
end

case $script_args[0]
when 'start'
    if ($StarvingDead)
        $StarvingDead.stop
    end
    $StarvingDead = StarvingDead.new
    $StarvingDead.start

when 'end', 'stop'
    $StarvingDead.stop
else
    if $StarvingDead
        puts $StarvingDead.status
    else
        puts 'Not loaded.'
    end
end
Title: Re: DFHack 0.42.06-r1
Post by: Thundercraft on June 28, 2016, 08:47:56 am
Any chance either of these will work with current versions of DFHack/DF. Not really sure where I picked them up, but had them sitting around and thought they might be useful for some generational fort messing about...

I have no idea whether or not those scripts would still work. However, I do know that the current DFHack already has this functionality. Check the DFHack documentation for gui/family-affairs (http://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-family-affairs): "view, add, remove, or otherwise change romantic relationships". This includes a user-friendly interface and, among other things, it allows the user to force a marriage or divorce.
Title: Re: DFHack 0.42.06-r1
Post by: Repseki on June 28, 2016, 08:56:59 am
Well then nevermind and thank you, I had completely glossed over the "gui" portion of what was in there.
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on June 28, 2016, 09:22:12 am
Excuse me, I have a question about the four scripts that omniclasm wrote that help FPS, namely deterioratefood, corpses, clothing and starvingdead.rb.

They work way too quickly, with food and clothing rotting away in 1-2 months, while undead sieges barely reach the fortress before the undead crumble to dust. I need to make it work much slower, but I dont know which numbers to change in the scripts.

Here is the starvingdead.rb example:
Code: [Select]
# Weaken and eventually destroy undead over time
class StarvingDead

    def initialize
        # number of months before undead start to weaken
        @threshold = 1

        # number of months before they crumble completely
        @die_threshold = 6
    end

Annotated the relevant numbers :)
Title: Re: DFHack 0.42.06-r1
Post by: pikachu17 on June 28, 2016, 09:24:51 am
Why was Dfusion removed? it was one of my favorite scripts(unless I'm wrong and just forgot the name of it)! if it was in fact removed, how do I re-add it?
Title: Re: DFHack 0.42.06-r1
Post by: Thundercraft on June 28, 2016, 12:25:43 pm
Why was Dfusion removed? it was one of my favorite scripts(unless I'm wrong and just forgot the name of it)! if it was in fact removed, how do I re-add it?

DFusion wasn't a single script. It used to be a separate collection of plugins, until it was merged into DFHack. Check out this post (http://www.bay12forums.com/smf/index.php?topic=139553.msg7034131#msg7034131) I made a few pages back, where I ask about DFusion and describe part of it. I also listed some of the current DFHack plugins and scripts that has similar functionality as certain DFusion plugins that I missed.

You would probably be interested in reading the posts that immediately follow mine, which explain why it was removed. Basically, DFusion is too old to work anymore and there doesn't seem to be much interest in updating it. But, at least, there are some alternatives or workarounds for some of what's missing.

Also, in this post (http://www.bay12forums.com/smf/index.php?topic=139553.msg7036221#msg7036221) Putnam shares an impregnate.lua script he wrote, which replaces the one that used to come with DFusion.
Title: Re: DFHack 0.42.06-r1
Post by: Meph on June 29, 2016, 09:00:16 am
I played around a bit with spawn-flow today and noticed two things:
1. Spawned webs do not stick around.
2. It has no direction... It seems to fire towards the wester side, sometimes a bit north/south, but never east. It would be more useful if you could give the flow a direction. Or make it radial.

I initially tried the script because I was expecting water/magma sources, but that doesnt work with it... sadly source.rb doesnt allow me to use a location, it only runs with a cursor, so I cant trigger it from a workshop. Any chance for an update in that regard?

The source rb script has this for position:
Code: [Select]
    :pos => [df.cursor.x, df.cursor.y, df.cursor.z]
While the other scripts in lua that I can call from workshops look like this:
Code: [Select]
if args.location then
  local u = df.unit.find(unitId)
  local pos = df.coord:new()
  pos.x = tonumber(args.location[1])
  pos.y = tonumber(args.location[2])
  pos.z = tonumber(args.location[3])
  local teleport = dfhack.script_environment('teleport')
  teleport.teleport(u, pos)
end
Title: Re: DFHack 0.42.06-r1
Post by: Bumber on June 30, 2016, 04:51:01 am
--Rain issues--
Update on this. I got some proper rain and the weather output became:
Code: [Select]
R R R R R
C R C R R
R R R C C
C C R C C
R R R R R
After it stopped raining, the output went back to the usual:
Code: [Select]
C C C C C
C C C C C
C C C C C
C C C C C
R R R R R

I don't know how rain is supposed to work, but from what probing I've done the pseudo-rain area doesn't seem to correlate to any biome boundaries.
Spoiler: Here's a biome map: (click to show/hide)
I can't remember exactly how they interact in my fort, but the shrubland continues all the way up the west side of the map.
Title: Re: DFHack 0.42.06-r1
Post by: Thundercraft on June 30, 2016, 05:37:54 am
Q: Is there a relatively painless way to stop an NPC in Adventure Mode from being hostile? That is, to permanently convert a unit from hostile to neutral? Would this involve changing a flag on the unit, perhaps using the gui/gm-editor (http://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-gm-editor)?
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on June 30, 2016, 08:29:07 am
Q: Is there a relatively painless way to stop an NPC in Adventure Mode from being hostile? That is, to permanently convert a unit from hostile to neutral? Would this involve changing a flag on the unit, perhaps using the gui/gm-editor (http://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-gm-editor)?
you can bound them against their will. which turns them into a companion you do have to talk to them to get this to work so,  guess turning them ghostly.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on June 30, 2016, 08:04:55 pm
Bumber: do you remember how many tiles on the local map your embark was (when embarking)?
Title: Re: DFHack 0.42.06-r1
Post by: Bumber on July 02, 2016, 03:23:26 am
Bumber: do you remember how many tiles on the local map your embark was (when embarking)?
I thought it was 3x3 or 4x4, but Legends Viewer says "Size: 2 x 2". I'm not sure if that translates to 2x2 on the local map. Looks like 3x3 on the reclaim, which is my preferred size, so I'll assume that's the correct one.
Title: Re: DFHack 0.42.06-r1
Post by: Thundercraft on July 02, 2016, 05:53:29 am
Q: Is there a relatively painless way to stop an NPC in Adventure Mode from being hostile? That is, to permanently convert a unit from hostile to neutral? Would this involve changing a flag on the unit, perhaps using the gui/gm-editor (http://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-gm-editor)?
you can bound them against their will. which turns them into a companion you do have to talk to them to get this to work so,  guess turning them ghostly.

I meant... Is there a way to use DFHack to make a hostile NPC no longer hostile? Would the makeown part of the tweak (http://dfhack.readthedocs.io/en/stable/docs/Plugins.html#tweak) plugin work in Adventure Mode? Could that turn a hostile NPC into an ally? (The docs make it sound like it's meant exclusively for Fort Mode.)

If not, would it be possible to write a script to change hostility? Is there a flag for hostility which could merely be turned off? Or must it be more complicated than that, such as hacking the NPC's ethics or your character's list of kills or something?

If changing the NPC's state of hostility is rather complicated, would it be easier to create a non-hostile clone of the NPC or reset the NPC's history or something? (I could have sworn that DFusion had a way to change hostility...)
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on July 02, 2016, 01:41:01 pm
Bumber: do you remember how many tiles on the local map your embark was (when embarking)?
I thought it was 3x3 or 4x4, but Legends Viewer says "Size: 2 x 2". I'm not sure if that translates to 2x2 on the local map. Looks like 3x3 on the reclaim, which is my preferred size, so I'll assume that's the correct one.
I'm honestly not sure what the issue is. Toady says the weather map is still 5x5, and the way we find it is by saving a special weather pattern in an older DF version, then searching for it after loading the save in a newer version. I'm seeing the exact same behavior on OS X, so it's really unlikely that someone messed up the step on both platforms. (Even if the address we had was wrong in the old version, DF would save from the correct address, then load part (or none) of our weather pattern into the correct address in the newer version, which should cause the weather scan to fail.)

In the meantime, you can run "weather clear" to get rid of the rain indicator. If more weather shows up later, it would be nice if you could run "weather" again to see what it looks like.
Title: Re: DFHack 0.42.06-r1
Post by: Bumber on July 02, 2016, 01:54:12 pm
I'm honestly not sure what the issue is. Toady says the weather map is still 5x5, and the way we find it is by saving a special weather pattern in an older DF version, then searching for it after loading the save in a newer version.
How is that 5x5 map translated to the embark map? Does that mean it could be reading rain from outside my map, or is it scaled down to fit? I would still find it unlikely that the rain would never stop, however.

In the meantime, you can run "weather clear" to get rid of the rain indicator. If more weather shows up later, it would be nice if you could run "weather" again to see what it looks like.
Edit: I tried "weather clear" and the indicator disappeared for about a minute before the reappearing without a "started raining" announcement. R's in the same place as usual, no rain.
I already did. A minute of relief, followed by the usual pattern.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on July 02, 2016, 02:05:06 pm
I'm honestly not sure what the issue is. Toady says the weather map is still 5x5, and the way we find it is by saving a special weather pattern in an older DF version, then searching for it after loading the save in a newer version.
How is that 5x5 map translated to the embark map? Does that mean it could be reading rain from outside my map, or is it scaled down to fit? I would still find it unlikely that the rain would never stop, however.
It's always 5x5, so it has to be scaled up or down.
Quote
In the meantime, you can run "weather clear" to get rid of the rain indicator. If more weather shows up later, it would be nice if you could run "weather" again to see what it looks like.
Edit: I tried "weather clear" and the indicator disappeared for about a minute before the reappearing without a "started raining" announcement. R's in the same place as usual, no rain.
I already did. A minute of relief, followed by the usual pattern.
So four rows of "C", and one row of "R"?
Title: Re: DFHack 0.42.06-r1
Post by: Weaselcake on July 03, 2016, 12:06:43 am
Any time estimate on the DFhack update for 43.04?
Title: Re: DFHack 0.42.06-r1
Post by: Teneb on July 03, 2016, 10:27:37 am
Any time estimate on the DFhack update for 43.04?
Though I'm not a wizard, the usual answer is "it's done when it is done". I've been hearing that the 64-bit release has been making things difficult, however.
Title: Re: DFHack 0.42.06-r1
Post by: nordak on July 03, 2016, 10:37:16 am
It will arrive after you finish an apprenticeship under a owl man necromancer...  Also, by then you may also have wizards in the vanilla game, :p
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on July 03, 2016, 10:59:44 am
Any time estimate on the DFhack update for 43.04?
Though I'm not a wizard, the usual answer is "it's done when it is done". I've been hearing that the 64-bit release has been making things difficult, however.
It's the new Windows compiler making things difficult. The 64-bit release hasn't been too bad, actually, although we have to update many of the automatic tools to support it as well.
Title: Re: DFHack 0.42.06-r1
Post by: pikachu17 on July 05, 2016, 01:53:44 pm
Ok, either someone please tell me about a replacement to Dfusion's freaky Friday-like change adventurer script or just tell me how to re-add Dfusion.
Title: Re: DFHack 0.42.06-r1
Post by: Bumber on July 05, 2016, 06:51:14 pm
It's always 5x5, so it has to be scaled up or down.
I wonder how it works in adventure mode. I can hear rain from a very far distance. I moved for a while on the travel map, and the weather map (not the problem one) didn't change at all.
Quote
So four rows of "C", and one row of "R"?
Yeah.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on July 05, 2016, 06:54:16 pm
Adventure mode weather is different. We should probably make "weather" give an error message in adventure mode unless someone knows how it should work there. Still no idea on the weather issue in fortress mode, though.

Ok, either someone please tell me about a replacement to Dfusion's freaky Friday-like change adventurer script or just tell me how to re-add Dfusion.
It's pretty difficult to re-add (you'd have to compile DFHack yourself). I wasn't familiar with DFusion myself, but going by https://github.com/DFHack/dfhack/pull/751, PeridexisErrant and Warmist might be able to help.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on July 05, 2016, 07:30:50 pm
Have there been any updates to the recent DFhack alpha1 for 0.43.03? So many pages to go through to find the link if that's the case.

Will be fun once 0.43.05-whatever version comes next and DFhack finally gets updated to the newest version with 64-bit support. For now, ye can take your time with it as I like to take time with my current modded adventure in 0.43.03.
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on July 05, 2016, 08:04:36 pm
You could also check https://github.com/dfhack/dfhack/releases. The status of another 0.43.03 release is iffy, but not impossible.
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on July 06, 2016, 07:09:23 am
You could also check https://github.com/dfhack/dfhack/releases. The status of another 0.43.03 release is iffy, but not impossible.

I for one would really like a full release for 43.03 so I can release a stable pack for it :)
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on July 06, 2016, 07:34:08 am
Ok, either someone please tell me about a replacement to Dfusion's freaky Friday-like change adventurer script or just tell me how to re-add Dfusion.
Well, the easy part is set a target grab (dfhackgetselectedunit or whatnot) and grab hist_id, pass it to the find command (what was the dfhack one? not the df.global.find(k) one or whatnot) and it'll pull up the df.global.world.history.hist_figs[k] for you, then have it set flags[0] to true, which should add that unit to the Specific Person part of the adventurer selection screen, I've gm-editor'D a bodyswitch but it was all sorts of slapdash, it should just be a matter of unlinking your unit from df.global.world.units.active[0] and setting your new adventurer target in there, plus tracking down any hanging links left in the hist_fig part I think?
Title: Re: DFHack 0.42.06-r1
Post by: Meph on July 06, 2016, 08:30:04 am
You could also check https://github.com/dfhack/dfhack/releases. The status of another 0.43.03 release is iffy, but not impossible.

I for one would really like a full release for 43.03 so I can release a stable pack for it :)
I released a test-version with the 43-03 dfhack alpha two weeks ago, I got no negative feedback.
Title: Re: DFHack 0.42.06-r1
Post by: PeridexisErrant on July 06, 2016, 12:02:04 pm
Same! (test version is on Dropbox and linked in the thread)

I consider that for a newb pack, I need stable dfhack to release a stable pack. The situation may be different for mods.
Title: Re: DFHack 0.42.06-r1
Post by: snjwffl on July 06, 2016, 04:17:48 pm
Not sure if this is the right thread (it has to do with the 0.43.03 alpha), but I can't find a better one.  This is a (potential*) bug report regarding "cursecheck" not recognizing/reporting untransformed werebeasts.  I used cursecheck** after a werebeast attack and it reported that no one was cursed (using "cursecheck all" it only reported the dead guy who just attacked).  Next full moon he transformed and my population dropped by 2/3.  While he was turned, cursecheck correctly reported him.

Summary: it appears "cursecheck" only reports those infected by werebeasts while they're in their werebeast form.


*There was an autosave during the initial attack, and when I reload it to test, the RNG decides to kill everyone who gets bitten (I've tried three times to get a survivor; I guess I was lucky the first time), so I don't have any possible werebeasts to test.

**I know I'm using a modding utility--and, in fact, tons of the even-more-cheaty features at that--but for some reason I feel the need for this disclaimer ???: After reading the combat log there was one dwarf I was unsure about, sincehe was bitten but then immediately shaken and the bitten part flew off.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on July 06, 2016, 08:39:20 pm
You could also check https://github.com/dfhack/dfhack/releases. The status of another 0.43.03 release is iffy, but not impossible.

I for one would really like a full release for 43.03 so I can release a stable pack for it :)
I released a test-version with the 43-03 dfhack alpha two weeks ago, I got no negative feedback.

Ah, good to know. Also, for what I've been using DFhack alpha for in 0.43.03 so far hasn't screwed up things, except that one crash but that was my own modding thing when I removed "insta-make-me-a-paladin" from Draenei raws after using the custom interaction, guess when too many of your own kind are around it tends to crash but I got around the issue by going into travel map and traveling a square and then dropping out and that fixed the "walk-one-tile-then-crash" issue that I got myself into.

I have this modpack along with minor mods of my own: http://www.bay12forums.com/smf/index.php?topic=158898.0
Title: Re: DFHack 0.42.06-r1
Post by: lethosor on July 06, 2016, 08:51:56 pm
There is indeed a stable release coming up, once we can get all the builds done and uploaded (2/3 so far - Windows is in progress, and hopefully a Linux+GCC 4.5 one is on the way too).

Edit: and here it is: https://github.com/dfhack/dfhack/releases/tag/0.43.03-r1
Title: Re: DFHack 0.42.06-r1
Post by: Dirst on July 07, 2016, 12:47:36 am
There is indeed a stable release coming up, once we can get all the builds done and uploaded (2/3 so far - Windows is in progress, and hopefully a Linux+GCC 4.5 one is on the way too).

Edit: and here it is: https://github.com/dfhack/dfhack/releases/tag/0.43.03-r1
Huzzah!
Title: Re: DFHack 0.42.06-r1
Post by: snjwffl on July 07, 2016, 06:04:49 pm
Thanks for the realease!

And an update to my previous post:  I can confirm that (even in 0.43.03-r1) cursecheck is not recognizing dwarves infected with a werebeast syndrome when they are not transform.  I have one that transforms every month but cursecheck reports there are none.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on July 07, 2016, 11:13:05 pm
There is indeed a stable release coming up, once we can get all the builds done and uploaded (2/3 so far - Windows is in progress, and hopefully a Linux+GCC 4.5 one is on the way too).

Edit: and here it is: https://github.com/dfhack/dfhack/releases/tag/0.43.03-r1

Woah. Awesome. Much appreciated!

EDIT: Now that the stable release has come. I've been meaning to ask: How does one alter the body size of an adventure with DFhack? I've tried editing the values with gui/gm-editor before but they revert and the histfig side of the gui/gm-editor doesn't seem to have entries for that.. that or I'm missing something obvious.

It's just that my succubus adventurer has been bugged by the false body descriptions and instead of just "incredibly muscular" it should say "she has loaded a thin but tall/lengthy body with incredible muscles" going by the raw data of my adventurer here and because of those raw values on my character, in the "z" screen it says "small for a succubus". had my head scratching for quite a while.

Anyhow, is there a trick to perma-changing the body size values?
Title: Re: DFHack 0.42.06-r1
Post by: Rose on July 08, 2016, 12:42:07 am
There is indeed a stable release coming up, once we can get all the builds done and uploaded (2/3 so far - Windows is in progress, and hopefully a Linux+GCC 4.5 one is on the way too).

Edit: and here it is: https://github.com/dfhack/dfhack/releases/tag/0.43.03-r1

Woah. Awesome. Much appreciated!

EDIT: Now that the stable release has come. I've been meaning to ask: How does one alter the body size of an adventure with DFhack? I've tried editing the values with gui/gm-editor before but they revert and the histfig side of the gui/gm-editor doesn't seem to have entries for that.. that or I'm missing something obvious.

It's just that my succubus adventurer has been bugged by the false body descriptions and instead of just "incredibly muscular" it should say "she has loaded a thin but tall/lengthy body with incredible muscles" going by the raw data of my adventurer here and because of those raw values on my character, in the "z" screen it says "small for a succubus". had my head scratching for quite a while.

Anyhow, is there a trick to perma-changing the body size values?

Body size is, I think, calculated from a combination of the height and broadness modifiers, so you should be able to change those to get what you need.
Title: Re: DFHack 0.42.06-r1
Post by: Max™ on July 08, 2016, 02:25:23 am
Yeah, it's under appearance rather than body itself.
Title: Re: DFHack 0.42.06-r1
Post by: Rose on July 08, 2016, 02:27:19 am
I did some tests. I could make my dwarf appear very tall or short, or very broad, or

Quote
She has an incredibly broad body hung with curtains of lard
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on July 08, 2016, 03:20:34 am
Yeah, it's under appearance rather than body itself.

What about the blood count? the body menu stays the same with same values. At least I now know how to alter a character, right now testing if my punches are more powerful or not.

EDIT: I don't get it. Why aren't the body values changing with the appearance. I'd like to know what data I get after modifying an adventurer's appearance. Damnit.. this is exactly why I hate that randomization function during character creation. I'd rather have a manual customization not dozens of minutes of skimming through randomized values and still ending up with something I didn't really want.

HAVE MANUAL ADVENTURER CUSTOMIZATION IN THE GAME!!!

EDIT2: Sorry.. that latter had nothing to do with DFhack but the game itself. I apologize.

EDIT3: No answer? Okay, no answer as per frickin' usual when I really need an answer. Final comment: Gonna take a long break. People... annoying. Must. Rest.
Title: Re: DFHack 0.42.06-r1
Post by: Rumrusher on July 10, 2016, 03:41:50 am
Yeah, it's under appearance rather than body itself.

What about the blood count? the body menu stays the same with same values. At least I now know how to alter a character, right now testing if my punches are more powerful or not.

EDIT: I don't get it. Why aren't the body values changing with the appearance. I'd like to know what data I get after modifying an adventurer's appearance. Damnit.. this is exactly why I hate that randomization function during character creation. I'd rather have a manual customization not dozens of minutes of skimming through randomized values and still ending up with something I didn't really want.

HAVE MANUAL ADVENTURER CUSTOMIZATION IN THE GAME!!!

EDIT2: Sorry.. that latter had nothing to do with DFhack but the game itself. I apologize.

EDIT3: No answer? Okay, no answer as per frickin' usual when I really need an answer. Final comment: Gonna take a long break. People... annoying. Must. Rest.
blood count? might be in the wounds section. though I don't know if that has anything to do with punching good.
Title: Re: DFHack 0.42.06-r1
Post by: Droggarth on July 10, 2016, 07:40:30 am
blood count? might be in the wounds section. though I don't know if that has anything to do with punching good.

*Robotic mode enabled*

Negative. The answers I seek. Not in wounds section. Require data to change. Accordingly in: "body". After changing the values in: "appearance". Accurate data after values are made bigger or smaller in: "appearance" are required to see in: "body":

Spoiler (click to show/hide)
Need to see new values. Old values in: "body" are inaccurate to the new body that was made bigger in: "appearance".
Blood count is part of the values that is required. To change.

New data is required. New data is required. New data is required. Ne- *Robotic mode off... signing out...*
Title: Re: DFHack 0.43.03-r1
Post by: Meph on July 10, 2016, 08:07:11 am
Does anyone have the updated version of 'startdwarf.rb' for 43.03? It states "patch address not available" atm.

Code: [Select]
# patch start dwarf count
=begin

startdwarf
==========
Use at the embark screen to embark with the specified number of dwarves.  Eg.
``startdwarf 500`` would lead to a severe food shortage and FPS issues, while
``startdwarf 10`` would just allow a few more warm bodies to dig in.
The number must be 7 or greater.

=end

nr = $script_args[0].to_i

raise 'too low' if nr < 7

addr = df.get_global_address('start_dwarf_count')
raise 'patch address not available' if addr == 0
df.memory_patch(addr, [nr].pack('L'))
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 10, 2016, 08:39:45 am
It's not the script that needs updating (the script hasn't changed in a long time), it's the offset that's missing. I guess nobody remembered to find it. I think the script to find it is working again, though, so it shouldn't be too hard.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on July 11, 2016, 12:26:31 pm
So while looking through the entity tables I came across unknown1b.diplomacy and I am wondering if anyone has done any research on these values. It appears that there is(are) value(s) that determine how two entities feel about eachother. I was hoping to be able to use this to create more indepth diplomacy, but I don't know how to check what effect changing these has on the game. Anyone have any experience?

Code: [Select]
[lua]# ~df.global.world.entities.all[22].unknown1b.diplomacy[3]
<historical_entity.T_unknown1b.T_diplomacy: 0x0d31f1c8>
group_id                 = 18
relation                 = 1
anon_1                   = 174
historic_events          = <vector<int32_t>: 0x0d31f1d4>
historic_events_collection       = <vector<int32_t>: 0x0d31f1e4>
anon_2                   = 0
Title: Re: DFHack 0.43.03-r1
Post by: wickys on July 11, 2016, 02:00:46 pm
Has anyone found a way to make shells / horns / pearls / bones / skulls from certain creatures with the createitem command? Embarked on a barren embark without any creatures or fish and I wanna make bone/shell stuff.

Or even spawn animals itself.

I can't seem to use the spawnunit command because I don't know what caste is and anything I type in is invalid.
Title: Re: DFHack 0.43.03-r1
Post by: Alluvian_Est-Endrati on July 11, 2016, 02:35:44 pm
Has anyone found a way to make shells / horns / pearls / bones / skulls from certain creatures with the createitem command? Embarked on a barren embark without any creatures or fish and I wanna make bone/shell stuff.

Or even spawn animals itself.

I can't seem to use the spawnunit command because I don't know what caste is and anything I type in is invalid.

createitem should be able to produce creature-specific items. Have you checked the wiki for the command syntax: http://dwarffortresswiki.org/index.php/Utility:DFHack/createitem#Animal_products

For spawnunit (assuming the script is working properly) the caste is usually the gender. For example, the two castes for a pond turtle are MALE and FEMALE.
Title: Re: DFHack 0.43.03-r1
Post by: wickys on July 11, 2016, 04:09:13 pm
Yeah I did but the command is unclear to me.

item CREATURE_MAT:creature:material

It says.

What do I fill in item?

I know creature is CREATURE:COW for instance and material is BONE. But what is item?

I tried CORPSEPIECE but it said 'cannot create that type of item'.

I got to spawning animals now luckily but I'd rather get bones instead of animals who I then have to kill and butcher
Title: Re: DFHack 0.43.03-r1
Post by: Alluvian_Est-Endrati on July 11, 2016, 06:24:12 pm
My mistake, individual creature body parts cannot be created with createitem; such as if you wanted some quick bones for a strange mood. I thought you were aiming for items made out of specific creature materials. At the moment the best scenario would be to use spawnunit I believe.
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on July 12, 2016, 12:02:51 am
So I found the code responsible for parsing keybindings:
Code: (dfhack/library/Core.cpp) [Select]
if (keyspec.size() == 1 && keyspec[0] >= 'A' && keyspec[0] <= 'Z') {
        *psym = SDL::K_a + (keyspec[0]-'A');
        return true;
    } else if (keyspec.size() == 1 && keyspec[0] >= '0' && keyspec[0] <= '9') {
        *psym = SDL::K_0 + (keyspec[0]-'0');
        return true;
    } else if (keyspec.size() == 2 && keyspec[0] == 'F' && keyspec[1] >= '1' && keyspec[1] <= '9') {
        *psym = SDL::K_F1 + (keyspec[1]-'1');
        return true;
    } else if (keyspec.size() == 3 && keyspec.substr(0, 2) == "F1" && keyspec[2] >= '0' && keyspec[2] <= '2') {
        *psym = SDL::K_F10 + (keyspec[2]-'0');
        return true;
    } else if (keyspec == "Enter") {
        *psym = SDL::K_RETURN;
        return true;
    } else
return false;
Looks like it only takes alphanumerics, function keys, and enter. How hard would it be to extend this to, let's say, all these SDL-supported keys (https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlkey.html)?

Are there a lot of assumptions in the other code, or should any SDL key be handled just fine?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on July 14, 2016, 04:41:27 pm
I'm looking for a way to specify not just an x,y,z in a given fort, but an x,y,z in the given world (basically I want to be able to check if a spot is the correct spot across the whole world, not just an embark site). I know there is df.global.world.map.region_x(y,z), but is that what I want to reference?
Title: Re: DFHack 0.43.03-r1
Post by: mifki on July 14, 2016, 07:14:36 pm
I'm looking for a way to specify not just an x,y,z in a given fort, but an x,y,z in the given world (basically I want to be able to check if a spot is the correct spot across the whole world, not just an embark site). I know there is df.global.world.map.region_x(y,z), but is that what I want to reference?

What do you mean "correct spot"?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 14, 2016, 09:31:29 pm
So I found the code responsible for parsing keybindings:
Code: (dfhack/library/Core.cpp) [Select]
if (keyspec.size() == 1 && keyspec[0] >= 'A' && keyspec[0] <= 'Z') {
        *psym = SDL::K_a + (keyspec[0]-'A');
        return true;
    } else if (keyspec.size() == 1 && keyspec[0] >= '0' && keyspec[0] <= '9') {
        *psym = SDL::K_0 + (keyspec[0]-'0');
        return true;
    } else if (keyspec.size() == 2 && keyspec[0] == 'F' && keyspec[1] >= '1' && keyspec[1] <= '9') {
        *psym = SDL::K_F1 + (keyspec[1]-'1');
        return true;
    } else if (keyspec.size() == 3 && keyspec.substr(0, 2) == "F1" && keyspec[2] >= '0' && keyspec[2] <= '2') {
        *psym = SDL::K_F10 + (keyspec[2]-'0');
        return true;
    } else if (keyspec == "Enter") {
        *psym = SDL::K_RETURN;
        return true;
    } else
return false;
Looks like it only takes alphanumerics, function keys, and enter. How hard would it be to extend this to, let's say, all these SDL-supported keys (https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlkey.html)?

Are there a lot of assumptions in the other code, or should any SDL key be handled just fine?
Coming up with names and translating them all would be tedious. There's probably some way we could make it easier, though, but relying on stuff like SysRq, Help, and Pause to be available probably isn't a good idea.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on July 14, 2016, 09:44:28 pm
I'm looking for a way to specify not just an x,y,z in a given fort, but an x,y,z in the given world (basically I want to be able to check if a spot is the correct spot across the whole world, not just an embark site). I know there is df.global.world.map.region_x(y,z), but is that what I want to reference?

What do you mean "correct spot"?

Like imagine you have a spot in an embark at x,y,z. You then retire the fort and start an adventurer. How can you find that exact spot?
Title: Re: DFHack 0.43.03-r1
Post by: John D on July 14, 2016, 10:57:24 pm
It's not the script that needs updating (the script hasn't changed in a long time), it's the offset that's missing. I guess nobody remembered to find it. I think the script to find it is working again, though, so it shouldn't be too hard.

Has anybody who knows what script to use to find the offset looked that up yet?
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on July 14, 2016, 11:20:44 pm
Coming up with names and translating them all would be tedious. There's probably some way we could make it easier, though, but relying on stuff like SysRq, Help, and Pause to be available probably isn't a good idea.
I was thinking of making a pair of arrays and using the names as shown on the page. The init would remain the same, except that "Enter" refers to numpad enter, not return. It's not a very long list with what's already handled.

Well, then only the ones on the page that intersect with DF.

Already handled keys omitted. We can remove entries as we confirm DF doesn't support them. (I probably spent way longer making this table that it would've taken to code..)
Title: Re: DFHack 0.43.03-r1
Post by: Thundercraft on July 15, 2016, 12:44:11 am
What do you mean "correct spot"?

Like imagine you have a spot in an embark at x,y,z. You then retire the fort and start an adventurer. How can you find that exact spot?

If all you need is to find out the exact x,y,z of your embark site (or any other location, really), then why not use the Whereami script from Dirst's Accessibility Utility (http://www.bay12forums.com/smf/index.php?topic=157631.0)?

Quote:
whereami.lua
This script reports your current location as X, Y, Z coordinates and a very terse description of the tile such as "SOIL WALL" or "POOL FLOOR".
whereami will also report if the current location is recorded as a bookmark.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on July 15, 2016, 01:51:44 am
If that returns a tile, then it's obviously not what's being asked for, which is world coordinates.

The problem with that is that world coordinates are rather inconsistent; there are three granularities in the various structures. An old attempt at recreating siege forcing that may be around on my gist explains it
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on July 15, 2016, 08:24:13 am
Yeah, there's also the problem where the xyz for your unit position seems to get updated for where you are on the map and which screen chunk you loaded last.

I can teleport myself around with gm-editor in travel mode pretty reliably, but it just drops you on a given embark tile, no way to specify from the travel map which local tile you want to drop on. Though I'm curious where the campstruction interface stuff was, I didn't play on a version with dfhack long enough that I remembered to poke around and look through it, but it does add a specific level of position exactness which I don't think existed in adventurer mode before.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 15, 2016, 10:39:29 am
Sorry I couldn't find what you were talking about, Putnam.  All I know about world-scale coordinates is from trying to work out animal populations.  A fort is nominally located at

df.global.world.world_data.active_site[0].pos.x
df.global.world.world_data.active_site[0].pos.y


but I don't know if that's the top-left embark square, or what.

Edit: Milo also had something here (http://www.bay12forums.com/smf/index.php?topic=150776), but it seems to identify the tile's biome ID rather than its "global coordinates."
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on July 15, 2016, 01:18:03 pm
Frankly I have no idea how that code works anymore. It was poorly understood black magic when I wrote it, and I have since forgotten anything I figured out... It doesn't seem to have anything that would be of use to identifying your fort location though.

The easy way to find a spot as an adventurer is to export the info from legends mode first, then look the site up in a legends browser.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on July 16, 2016, 05:00:34 pm
Hmm, well the first granularity in world coordinates is pretty easy to figure out, the map block gotten from dfhack.maps.getTileBlock(coords) has a region_pos.x and region_pos.y that coorespond with the x and y location on the big world map. Next I think you can check the df.global.world.map.region_x and df.global.world.map.region_y for the second granularity. And then the local x,y,z for the final step.

But a single point can have multiple combinations of the second and third groups in adventure mode. It appears there is some sort of map overlap depending on the previous movement, so that doesn't really work. There is a region_offset table in the map_block, it has 9 numbers in it, but I have no idea what the numbers represent. You would think it wouldn't be so difficult to determine an exact location. I mean, how does the game know where an item is when it isn't on a map?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on July 16, 2016, 05:57:42 pm
The items store it and a pointer to the map blocks I think.

The uh, column index and row index I think are where I figured out how to screw around with directly designating squares for tasks, and there is a lot of data in there, I think it was under map, but it might have been map_extra?
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 19, 2016, 02:37:39 pm
Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on July 19, 2016, 04:43:54 pm
Isn't there a specific history event for that?
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 19, 2016, 09:55:10 pm
Isn't there a specific history event for that?
Okay... does anyone know a simplish way in Lua to check for a specific historical event? :)
Title: Re: DFHack 0.43.03-r1
Post by: mifki on July 19, 2016, 10:17:37 pm
Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.

Won't excavated_tiles in entity.activity_stats do?
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 19, 2016, 10:39:14 pm
Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.

Won't excavated_tiles in entity.activity_stats do?
I'm only counting tiles from 24 layer stones that could have spawned a creature, but if this turns out to be intractable I might bump up the grace period and just let soil count towards it.  Thanks for the great fallback idea.
Title: Re: DFHack 0.43.03-r1
Post by: expwnent on July 20, 2016, 02:14:53 am
Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.

There's no builtin way to do it but that sounds interesting.

I think iterating through all history once on load is probably your safest bet. Check if the fort was founded at the current time. It might trigger multiple times if you save without advancing at least one frame then reload though, so be careful about that corner case. You may or may not want it to retrigger when that happens.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 20, 2016, 02:20:19 am
Is there a trick I can use from Lua to detect when a fort is first embarked/reclaimed, rather than just loaded?  It would trigger again if the player savescummed before saving, but not if there was at least one save for that fort (even the automatic autosave).

Something silly like dfhack.newfort() would be ideal, but I doubt it will be that simple.

I have an idea for a persistent counter to give a TESB player about a 250-mined-tile grace period before creatures start spawning (hidden gems are scaled down during this time as well to discourage setting the value sky-high).  The issue is that the persistent table is world-specific, not fort-specific.  I can't even embed the fort name or site number into the key because people might reclaim.  I can't use the unit id of the first dwarf because those are re-used if you savescum.

There's no builtin way to do it but that sounds interesting.

I think iterating through all history once on load is probably your safest bet. Check if the fort was founded at the current time. It might trigger multiple times if you save without advancing at least one frame then reload though, so be careful about that corner case. You may or may not want it to retrigger when that happens.
Operationally it is just resetting a counter to zero, so if the trigger is found it can just break.  Would be a lot faster to go backwards if I can work that out.  In this particular case, though, maybe even checking that excavated tiles is zero would do the trick.  Yes, you can do a lot before digging anything, but this is a counter for certain kinds of digging... No harm resetting a zero back to zero.

Thanks everyone, I'll throw some stuff at the wall and see what sticks.

Edit: about using the first dwarf's unit ID as a fortress ID, savescumming would not actually be a problem, but having that guy die would be.
Title: Re: DFHack 0.43.03-r1
Post by: expwnent on July 20, 2016, 02:34:54 am
Are excavated tiles set to zero on a reclaim?

What do you mean by "go backwards"?
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 20, 2016, 09:32:36 am
Are excavated tiles set to zero on a reclaim?

What do you mean by "go backwards"?
Just meant going from most recent backward toward earliest.  And I'll have to check about resetting on a reclaim.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 21, 2016, 08:00:47 am
A brief 0.43.05 update:

DFHack is getting to the point where it can be compiled as 64-bit and run with a 64-bit DF without dying completely. Finding offsets so it can actually do useful things with DF is a bit harder, since jjyg's scripts choke on some changes brought around by MSVC 2015 and GCC 4.8, and most don't work at all with 64-bit DF, and he's away for another week or so. Mifki has been working on more scripts to locate things for 64-bit DF (many thanks there), and NCommander got 32-bit Linux working, from what I remember.

Note: If you've been using the "world.cur_savegame" structure in any personal scripts, it turns out that it has probably never existed - all of those fields (save_dir, save_version, etc.) are world fields instead. Mifki should have fixed occurrences of these in DFHack, but for anyone else using that structure, plan to make changes there.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 21, 2016, 02:28:42 pm
Thanks for the update lethosor!

As for my detecting embark, the onload.init runs just before the embark screen loads rather than just before the fort loads... which means unfortunately rummaging through history won't work, but fortunately I only need to detect the embark screen.

For a new fort the onload.init runs while df.global.gps.screen.value is 0, and then it becomes 219 when the embark screen is ready for user input.  It is also 219 in fort mode and arena mode and while a saved game is reloading, so I'm not sure what that value is really supposed to represent.  But, since you can't get to "screen 0" in an active fort it's good enough for my purposes.

This is good luck, because I can't make heads or tails out of the .events in the entity, nor can I find the .activities.
Title: Re: DFHack 0.43.03-r1
Post by: Snafu on July 22, 2016, 04:30:48 pm
Can any DFH dev (or appropriate scripter) say if a command to copy orders in the new (0.43.x) management screen (similar to military screen) is being worked upon?

Initially placing orders is very useful, but when you want to have pretty much the same order conditions for thread, cloth, (individual) clothes/armour pieces etc etc it can quickly become a timewasting PITA :(

I guess I'm asking for /user-defined/ order templates.. (preferably independently saved so they can be used across embarks/worlds, but the initial ability to do the above would help immensely!)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 22, 2016, 08:33:20 pm
We've been mostly working on 0.43.05 support, not features. We're also not very psychic and don't usually work on suggestions without them being suggested first. :)
(I've added that on the issue tracker (https://github.com/DFHack/dfhack/issues/965), which is a good place to suggest things, since they're less easily-buried there than here.)
Title: Re: DFHack 0.43.03-r1
Post by: Snafu on July 22, 2016, 09:30:45 pm
Tks Leth; I wasn't aware of a suitable place to add requests, that's why I posted here. I'll use the tracker in future, when I remember :)

Perhaps amend the first post to include that link for suggestions rather than only bugs, or will that overwhelm you?
Title: Re: DFHack 0.43.03-r1
Post by: Teneb on July 23, 2016, 03:55:38 pm
I got a question about item-trigger: does -onStrike also work for ammo?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on July 23, 2016, 07:12:18 pm
I got a question about item-trigger: does -onStrike also work for ammo?

Don't think so, but there is projectile-trigger for ammo
Title: Re: DFHack 0.43.03-r1
Post by: Teneb on July 23, 2016, 09:19:35 pm
I got a question about item-trigger: does -onStrike also work for ammo?
Don't think so, but there is projectile-trigger for ammo
Oh, thanks.

By the way, I'm trying to use create-unit and reaction-trigger to spawn a creature, but it's not working (but isn't spitting an error in the dfhack window either). Here's the code:
Code: [Select]
modtools/reaction-trigger -reactionName SPAWN_DEBUG -command [ modtools/create-unit -race GOLD_HOUND -caste DEFAULT -civ_id \\LOCAL -group_id \\LOCAL -domesticate -location [ \\LOCATION ] -age 1 ]
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 23, 2016, 10:50:26 pm
On a phone at the moment so I can't check, but make sure the parameters are right.  Might be civId and groupId.  In any case, it ought to throw an error unless reaction-trigger suppresses that for some reason.
Title: Re: DFHack 0.43.03-r1
Post by: Teneb on July 25, 2016, 01:36:48 pm
On a phone at the moment so I can't check, but make sure the parameters are right.  Might be civId and groupId.  In any case, it ought to throw an error unless reaction-trigger suppresses that for some reason.
Well, it was part of the problem. changing civ_id to civID spits this out:
(http://i.imgur.com/5XZlCN2.png)

While I'm at it, when using create-unit with interaction-trigger, how do I make it so that the created creature is of the same group as the unit performing the interaction?

EDIT: Changing -civ_id \\LOCAL -group_id \\LOCAL to -civ_id a -group_id a made them spawn. But now I'm running into some weirdness. Sometimes, it spawns a single one, but others it spawns multiple. I've noticed a few things about this: if I repeat the reaction, it will always spawn the same number every time. The number change when I close DF and open it again. The multiplied creatures will fight each other, and only each other. If I spawn two groups of two creatures, each will only fight it's own pair.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 25, 2016, 02:22:14 pm
Well, it is definitely -civId and -groupId (note the camelCaseCapitalization), and \\LOCAL will make them aligned with the player's fort which ought to be aligned with the person performing the reaction.
Title: Re: DFHack 0.43.03-r1
Post by: Teneb on July 25, 2016, 02:29:46 pm
Well, it is definitely -civId and -groupId (note the camelCaseCapitalization), and \\LOCAL will make them aligned with the player's fort which ought to be aligned with the person performing the reaction.
\\LOCAL is simply not working for me, instead getting me the error I pasted above. Anyway, it's mostly working now, just have no idea why it's sometimes spawning multiple creatures who then proceed to try to murder each other. Any idea why that's happening?

On an unrelated note, are the any plan to allow for projectile-trigger to, well, trigger based on the item type of the projectile rather than its material?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on July 25, 2016, 02:57:10 pm
When using it in interaction-tigger you need to add an extra \
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on July 25, 2016, 03:27:21 pm
I have a feeling once this updates something will break
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on July 26, 2016, 03:47:50 am

For a new fort the onload.init runs while df.global.gps.screen.value is 0, and then it becomes 219 when the embark screen is ready for user input.  It is also 219 in fort mode and arena mode and while a saved game is reloading, so I'm not sure what that value is really supposed to represent.  But, since you can't get to "screen 0" in an active fort it's good enough for my purposes.
The gps.screen.value iš the first tiles ( upper left corner) character. So it might fail with fps display on ( or off)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 26, 2016, 11:17:53 am
I have a feeling once this updates something will break
Not quite sure what this is supposed to mean.
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on July 26, 2016, 01:32:29 pm
something like the website or the download thing idk it was a dumb joke to start with
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 26, 2016, 02:35:23 pm
Oh, I thought you meant something in DFHack (which is already pretty broken). We host downloads on GitHub now, so hopefully that doesn't go down because of us. :)
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 26, 2016, 03:12:14 pm
Oh, I thought you meant something in DFHack (which is already pretty broken). We host downloads on GitHub now, so hopefully that doesn't go down because of us. :)
"Thank you for calling Infrastructure Services, I'm showing an alarm in the server room HVAC.  Are you calling about that?"
"Yeah... looks like it's snowing frozen elf blood in there."
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on July 26, 2016, 04:08:44 pm
Oh, I thought you meant something in DFHack (which is already pretty broken). We host downloads on GitHub now, so hopefully that doesn't go down because of us. :)

Yeah, you're very unlikely to hit extremes like that lol. This is the most extreme thing I've seen happen when it comes to Github-as-CDN and that's a hilariously ludicrous edge case involving over 16,000 subdirectories and content distribution being done primarily through shallow git clone. (https://github.com/CocoaPods/CocoaPods/issues/4989#issuecomment-193772935) It's seriously doubtful that anything you do with zips and tarballs will get you in trouble, heh.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on July 26, 2016, 09:26:40 pm
Question about dfhack.timeout(). The whole callback function thing kind of confuses me, will something like this work?
Code: [Select]
dfhack.timeout(ticks+1,'ticks',dfhack.script_environment('functions/event').queueCheck(id,'WEEKLY',true))I can't open DF on this computer so I can't test it out. Do I instead need
Code: [Select]
dfhack.timeout(ticks+1,'ticks',function ()
                                  dfhack.script_environment('functions/event').queueCheck(id,'WEEKLY',true)
                                end)
?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 26, 2016, 09:40:48 pm
You should definitely use the second instead of the first. The first will call "dfhack.script_environment('functions/event').queueCheck(id,'WEEKLY',true)" exactly once, then pass whatever that returns to dfhack.timeout, which will then try to call it as a function and probably fail.

Also, I'm not quite sure why you're passing ticks+1 as the first argument - that argument is basically "number of ticks later" in this case, so you may as well make ticks whatever you want and use that as the first argument instead (unless I'm misunderstanding something).
Title: Re: DFHack 0.43.03-r1
Post by: Roses on July 27, 2016, 09:21:54 am
You should definitely use the second instead of the first. The first will call "dfhack.script_environment('functions/event').queueCheck(id,'WEEKLY',true)" exactly once, then pass whatever that returns to dfhack.timeout, which will then try to call it as a function and probably fail.

Also, I'm not quite sure why you're passing ticks+1 as the first argument - that argument is basically "number of ticks later" in this case, so you may as well make ticks whatever you want and use that as the first argument instead (unless I'm misunderstanding something).

Thanks, ticks is defined earlier in the code (number of ticks before next week in this case) and is used for another timeout call, I wanted this one to happen the tick after the other one.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 27, 2016, 09:38:47 am
Just out of curiosity, has anyone looked into how boogeymen, demons and normal animal clusters get spawned by the game?  The current version of create-unit uses a trick mifki figured out to use Arena Mode momentarily, but there is still some instability which says to me that at least some of the data structures used in Fort Mode are uninitialized.

Boogeymen appear out of nowhere; animals and demons appear out of nowhere but pulling from abstract populations.  The Starting Seven and the initial migrants might call the same function, or might be completely different because they're built from the ground up to be citizens.  Getting access to that method from DFHack would be the holy grail of spawning creatures, or even just the constructor for a unit would ensure that we don't miss something that might have evaded DF Structures.
Title: Re: DFHack 0.43.03-r1
Post by: Meph on July 27, 2016, 09:59:52 am
I have a question. Can I somehow set a required class, creature or caste for transform-unit? Like "run reaction, transform unit only if its caste X".

In older version that was possible because it used the DF interaction system, with SYN_AFFECTED_CREATURE.

I would use a workaround by using add-syndrome to add a self-targetted interaction, but creatures in DF2016 dont use interactions outside of combat anymore. :/

EDIT:
Oh, and this crashes the game:
Code: [Select]
modtools/reaction-trigger -reactionName MUTATE_RAT -allowNonworkerTargets -command [ modtools/transform-unit -unit \\TARGET_ID -race RAT_GIANT -caste MALE -suppressAnnouncement ] ]
It should target a creature pastured on a workshop and turn it into a giant rat. The creature itself is fine, I can buy giant rats at embark, the game has no issues with them in usual circumstances.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 27, 2016, 01:20:03 pm
Is that crashing when you run modtools/reaction-trigger or when modtools/transform-unit gets run?

Just out of curiosity, has anyone looked into how boogeymen, demons and normal animal clusters get spawned by the game?  The current version of create-unit uses a trick mifki figured out to use Arena Mode momentarily, but there is still some instability which says to me that at least some of the data structures used in Fort Mode are uninitialized.

Boogeymen appear out of nowhere; animals and demons appear out of nowhere but pulling from abstract populations.  The Starting Seven and the initial migrants might call the same function, or might be completely different because they're built from the ground up to be citizens.  Getting access to that method from DFHack would be the holy grail of spawning creatures, or even just the constructor for a unit would ensure that we don't miss something that might have evaded DF Structures.
What kind of instability?

There probably aren't entirely separate constructors for citizens and non-citizens. There's probably some method(s) DF uses to turn units into citizens, but unit doesn't have any virtual methods, so finding those methods would require a lot more disassembly and manual searching for each build of DF.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on July 27, 2016, 01:20:35 pm
Just FYI: In the prepared meal ingredient struct, unk10 (I think it was unk10) is the ingredient quality. A few seconds with the gm editor and a prepared meal will confirm which it was exactly.
Title: Re: DFHack 0.43.03-r1
Post by: Meph on July 27, 2016, 01:48:01 pm
Lethosor:
Quote
Is that crashing when you run modtools/reaction-trigger or when modtools/transform-unit gets run?
Neither. I can run both.

It crashes when I use transform-unit with reaction-trigger AND -allowNonworkerTargets. Aka when the worker that does the reaction is not the creature that is transformed.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 27, 2016, 02:14:06 pm
Neither. I can run both.
I'm confused. Is DF actually crashing?

Maybe I should be clearer: Does the crash occur immediately when you run the entire command, or does it occur when (as a result of running that command) modtools/reaction-trigger gets called (not directly by you) at a later point in time?

I'm not really that familiar with the modding scripts, but if you think it should be possible to prevent the crash, a minimal save with a reaction and call to reaction-trigger that triggers the crash would be helpful. I can't guarantee that we'll get to it quickly, though, because of the 0.43.05 updates and all.
Title: Re: DFHack 0.43.03-r1
Post by: Meph on July 27, 2016, 02:21:25 pm
Neither. I can run both.
I'm confused. Is DF actually crashing?

Maybe I should be clearer: Does the crash occur immediately when you run the entire command, or does it occur when (as a result of running that command) modtools/reaction-trigger gets called (not directly by you) at a later point in time?
DF crashes to desktop.

I dont know how to distinguish between the two options you mention.

I tried using add-syndrome as a workaround, but no dice so far.
Code: [Select]
modtools/reaction-trigger -reactionName MUTATE_RAT_TO_GIANT -allowNonworkerTargets -command [ modtools/add-syndrome -syndrome "transform_rat_giant" -target \\TARGET_ID ]
Code: [Select]
[SYNDROME]
[SYN_NAME:transform_rat_giant]
[SYN_AFFECTED_CREATURE:SKAVEN_RAT:ALL]
[CE_BODY_TRANSFORMATION:START:0][CE:CREATURE:WOLFRAT:MALE]

The thing I'm trying to do is run a script through a reaction that targets a pet pastured on the workshop. In the past I've been doing a lot with this... you can feed pets, armor them, train their combat skills, transform them... but after the dfhack update from 34.11 to future version I've never been able to replicate this.

I'll create a save for you to test.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on July 27, 2016, 02:25:24 pm
reaction-trigger is really nice for some things, but the good old auto-syndrome can't be beat for others.

I wonder how hard it would be to make a modern version... I'm a little busy right now, but I may have time to play with it some in a week or so.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 27, 2016, 02:39:34 pm
Just out of curiosity, has anyone looked into how boogeymen, demons and normal animal clusters get spawned by the game?  The current version of create-unit uses a trick mifki figured out to use Arena Mode momentarily, but there is still some instability which says to me that at least some of the data structures used in Fort Mode are uninitialized.

Boogeymen appear out of nowhere; animals and demons appear out of nowhere but pulling from abstract populations.  The Starting Seven and the initial migrants might call the same function, or might be completely different because they're built from the ground up to be citizens.  Getting access to that method from DFHack would be the holy grail of spawning creatures, or even just the constructor for a unit would ensure that we don't miss something that might have evaded DF Structures.
What kind of instability?

There probably aren't entirely separate constructors for citizens and non-citizens. There's probably some method(s) DF uses to turn units into citizens, but unit doesn't have any virtual methods, so finding those methods would require a lot more disassembly and manual searching for each build of DF.
It crashes fairly regularly if Roses' attack.lua is used on a spawned creature in 0.43.  I circumvented the need for that script in my mod and things seem better, but I still get the occasional crash a few seconds after a creature is spawned.  The attack issue might be an anon that changed between 0.42 and 0.43, but the remaining crashes sound to me like an uninitialized value somewhere that is only relevant sometimes.  Unfortunately it's a crash-to-desktop so it doesn't leave behind much to troubleshoot.  There is nothing in stderr.log after the call to create-unit.
Title: Re: DFHack 0.43.03-r1
Post by: Meph on July 27, 2016, 02:49:25 pm
reaction-trigger is really nice for some things, but the good old auto-syndrome can't be beat for others.

I wonder how hard it would be to make a modern version... I'm a little busy right now, but I may have time to play with it some in a week or so.
You have no idea how I feel right now. The lack of autosyndrome is the reason I could not update MasterworkDF and almost gave up modding. Took a break for over a year and then came back, put in over two-hundred hours of work to slowly and painstakingly update the mod... still not done...

Lethosor: Here the save. https://www.dropbox.com/s/j529lbe1vgc2kpn/Dwarf%20Fortress%20-%20Meph%20Edition.rar?dl=0

I added the entire game folder, because everything is heavily modded. Its the newest dfhack release. Just open the Onload.ini in the raw folder, I made comments at the top.

tl;dr:
- Embark, look at the kitchen. It has 4 test reactions, 3 to armor an animal, 1 to transform it. The one that transforms it will crash the game. I already pastured a rat on the workshop.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on July 27, 2016, 02:52:14 pm
Be happy! You have piqued my interest, and I will work on it just as soon as I have Underhive Settlement done. :)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 27, 2016, 05:14:33 pm
I don't know how to distinguish between the two options you mention.

Option 1:
- You run the command
- DF crashes immediately

Option 2:
- You run the command
- DF does not crash immediately
- Later, maybe when the MUTATE_RAT_TO_GIANT reaction occurs, DF crashes

The difference is that in the first case, modtools/reaction-trigger is crashing, and in the second, modtools/add-syndrome is crashing.

Anyway, thanks for the save - hopefully it'll help us fix the issue. I've reported it on the tracker, although 0.43.05 is taking priority for now.


It crashes fairly regularly if Roses' attack.lua is used on a spawned creature in 0.43.  I circumvented the need for that script in my mod and things seem better, but I still get the occasional crash a few seconds after a creature is spawned.  The attack issue might be an anon that changed between 0.42 and 0.43, but the remaining crashes sound to me like an uninitialized value somewhere that is only relevant sometimes.  Unfortunately it's a crash-to-desktop so it doesn't leave behind much to troubleshoot.  There is nothing in stderr.log after the call to create-unit.
Does attack.lua succeed on non-spawned creatures? And are you saying create-unit crashes even without attack.lua?

No script should be touching anon fields (although apparently create-unit is one of the few that does). Is attack.lua on Github anywhere? It could be an issue with either script, or both.

(Also, information about crashes in stderr.log is very rare. The last command you ran is probably there, and relevant, but of course you would know that already.)
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 27, 2016, 10:51:35 pm
It crashes fairly regularly if Roses' attack.lua is used on a spawned creature in 0.43.  I circumvented the need for that script in my mod and things seem better, but I still get the occasional crash a few seconds after a creature is spawned.  The attack issue might be an anon that changed between 0.42 and 0.43, but the remaining crashes sound to me like an uninitialized value somewhere that is only relevant sometimes.  Unfortunately it's a crash-to-desktop so it doesn't leave behind much to troubleshoot.  There is nothing in stderr.log after the call to create-unit.
Does attack.lua succeed on non-spawned creatures? And are you saying create-unit crashes even without attack.lua?

No script should be touching anon fields (although apparently create-unit is one of the few that does). Is attack.lua on Github anywhere? It could be an issue with either script, or both.

(Also, information about crashes in stderr.log is very rare. The last command you ran is probably there, and relevant, but of course you would know that already.)
Oh I understand that the stderr.log isn't going to have Null pointer in .enemy structure... scrawled by a bloody finger.  Was just pointing out that no other script had run since.

I'll need to check attack on normal units, as I said I just worked around it.  attack.lua is included with Masterwork under raw/scripts/unit, I don't know where the original repository is.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on July 28, 2016, 01:19:41 am
reaction-trigger is really nice for some things, but the good old auto-syndrome can't be beat for others.

I wonder how hard it would be to make a modern version... I'm a little busy right now, but I may have time to play with it some in a week or so.
You have no idea how I feel right now. The lack of autosyndrome is the reason I could not update MasterworkDF and almost gave up modding. Took a break for over a year and then came back, put in over two-hundred hours of work to slowly and painstakingly update the mod... still not done...

Lethosor: Here the save. https://www.dropbox.com/s/j529lbe1vgc2kpn/Dwarf%20Fortress%20-%20Meph%20Edition.rar?dl=0

I added the entire game folder, because everything is heavily modded. Its the newest dfhack release. Just open the Onload.ini in the raw folder, I made comments at the top.

tl;dr:
- Embark, look at the kitchen. It has 4 test reactions, 3 to armor an animal, 1 to transform it. The one that transforms it will crash the game. I already pastured a rat on the workshop.

Hopefully my finishing up of my wrapper script will alleviate all of your concerns. It is only in a semi-usable state at the moment, but it does allow for all of the functionality that auto-syndrome had plus so so much more. I currently use it to select specific castes and genders for interactions and to keep genders across transformations with a single command. Honestly, I can't think of a single thing that auto-syndrome did that scripts don't do currently. And if there is, that functionality should be added to existing scripts. For instance
Code: [Select]
modtools/reaction-trigger -reactionName MUTATE_RAT -allowNonworkerTargets -command [ wrapper -unitSource \\TARGET_ID -unitTarget \\TARGET_ID -aclass CLASS_NAME -script [ modtools/transform-unit -unit \\TARGET-race RAT_GIANT -caste MALE -suppressAnnouncement ]  ] ]Would only target a creature if it has CLASS_NAME as a specific creature class (note that it may require an extra \ or two, I can't test at the moment, but I know checking for creature classes and syndrome classes is something the script does correctly). And in fact there are better ways with the wrapper script than declaring unitSource and unitTarget including choosing creatures within a certain radius of the initiating worker. For example, I think the best way to do it would be,
Code: [Select]
modtools/reaction-trigger -reactionName MUTATE_RAT -allowNonworkerTargets -command [ wrapper -unitSource \\WORKER_ID -target civ -radius [ 10 10 2 ] -maxtargets 1 -aclass CLASS_NAME -script [ modtools/transform-unit -unit \\TARGET-race RAT_GIANT -caste MALE -suppressAnnouncement ]  ] ]That will do a single target within 10x10x2 of the workshop and transform them only if they have the creature class CLASS_NAME

As for attack.lua, that script comes from my repository and is in raw/scripts/unit/attack.lua. I see no reason that a spawned creature should be any different than a non-spawned creature since attack.lua only influenced the actions of a unit. If there is indeed a difference between the actions of a spawned creature and a normal creature that really needs to be worked out in create-unit.lua. Please let me know if how and when attack.lua is crashing, as that is one of the few scripts that I have thoroughly tested in Arena, Fortress, and Adventure mode. Note that between the last version and this version certain anon fields were given names (particularly attack velocity and attack hit chance). If the script hasn't been correctly updated it may still be trying to access anon fields that are actually named fields.
Title: Re: DFHack 0.43.03-r1
Post by: Hetairos on July 29, 2016, 07:15:50 am
Is there a way to make the teleport.lua script run with DFHack 0.34.11-r5? I'm trying to apply this fix (http://www.bay12forums.com/smf/index.php?topic=159297.0), but if I just drop the script into the scripts folder all I get is the following syntax error.

(http://i66.tinypic.com/6oq2z7.jpg)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 29, 2016, 09:44:14 am
For one thing, the error message would be more readable if you could actually copy and paste the text. Assuming the reason you didn't is because you're on Windows, you can do it by right-clicking in the console and/or right-clicking the console title bar.

Anyway, is line 15 "]====]"?  Is line 4 "--[====["? Where did you get the script from? If you got it from https://github.com/DFHack/scripts/blob/master/teleport.lua, did you make sure to click "Raw" and download that?
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on July 29, 2016, 11:46:20 am
As for attack.lua, that script comes from my repository and is in raw/scripts/unit/attack.lua. I see no reason that a spawned creature should be any different than a non-spawned creature since attack.lua only influenced the actions of a unit. If there is indeed a difference between the actions of a spawned creature and a normal creature that really needs to be worked out in create-unit.lua. Please let me know if how and when attack.lua is crashing, as that is one of the few scripts that I have thoroughly tested in Arena, Fortress, and Adventure mode. Note that between the last version and this version certain anon fields were given names (particularly attack velocity and attack hit chance). If the script hasn't been correctly updated it may still be trying to access anon fields that are actually named fields.
I was referring to the attack.lua packaged with Masterwork (since that's what these particular end-users would be using), and I agree the fault is probably in create-unit.  That attack script does not touch any anon fields.  Just hoping that working under 0.42 and broken in 0.43 turns out to be a decent clue in fixing create-unit, since I'm not the only person who pokes at it.
Title: Re: DFHack 0.43.03-r1
Post by: Hetairos on July 29, 2016, 12:14:59 pm
For one thing, the error message would be more readable if you could actually copy and paste the text. Assuming the reason you didn't is because you're on Windows, you can do it by right-clicking in the console and/or right-clicking the console title bar.

Anyway, is line 15 "]====]"?  Is line 4 "--[====["? Where did you get the script from? If you got it from https://github.com/DFHack/scripts/blob/master/teleport.lua, did you make sure to click "Raw" and download that?

No, I got it from here (https://gist.github.com/Putnam3145/7243759). The one you posted gives me this:

Code: [Select]
G:\Gry\df_34_11_win\hack\scripts/teleport.lua:31: attempt to call field 'invert' (a nil value)
stack traceback:
        G:\Gry\df_34_11_win\hack\scripts/teleport.lua:31: in main chunk
        (...tail calls...)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on July 29, 2016, 12:51:51 pm
There's no way that script you linked to could possibly have worked, ever. You could try changing "==tonumber" to "=tonumber" on lines 15, 16, and 17, but there could be other issues too.

The one in the DFHack/scripts repo was added in 2014, so it's not too surprising that it wouldn't work with 0.34.11. It looks like it relies on a few features for argument processing that were added in 2014, too.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on July 29, 2016, 12:54:51 pm
The one in the DFHack/scripts repo was added in 2014, so it's not too surprising that it wouldn't work with 0.34.11. It looks like it relies on a few features for argument processing that were added in 2014, too.

Replace the argument processing and that script will probably work. AFAIK teleporting is a fairly simple matter of changing the creature's position (unit.pos).
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on July 29, 2016, 01:09:13 pm
The one in the DFHack/scripts repo was added in 2014, so it's not too surprising that it wouldn't work with 0.34.11. It looks like it relies on a few features for argument processing that were added in 2014, too.

Replace the argument processing and that script will probably work. AFAIK teleporting is a fairly simple matter of changing the creature's position (unit.pos).

Just doing that will cause horrible issues down the road, since every single pos that a unit's teleported from while standing will be permanently inaccessible unless actions are taken to prevent that or fixes are done down the road (the former, naturally, being preferable, though I think DFHack currently comes with an occupancy fix script). teleport.lua included in DFHack already does this.
Title: Re: DFHack 0.43.03-r1
Post by: Hetairos on July 29, 2016, 06:03:37 pm
Considering I'm going to savescum anyway and the ony units I really need to teleport are outside the map, that might not be a problem.

But I'd rather be careful and not have it mess up caravans or something again. Too bad I have no clue how to Lua.
Title: Re: DFHack 0.43.03-r1
Post by: ldog on August 01, 2016, 11:19:52 am
I haven't seen this mentioned (did a quick keyword search through the thread) but a request for the autogem cutting plugin:
Have it respect new workshop profile setting.

So I keep 2 gemshops, 1 set for cutting gems, 1 for encrusting furniture. Mechanixm's QSP setup. I have the workshops locked down to the job types, and I'd like to have the gems autocut, but it gives jobs to both shops.
Title: Re: DFHack 0.43.03-r1
Post by: breadman on August 01, 2016, 01:48:38 pm
I haven't seen this mentioned (did a quick keyword search through the thread) but a request for the autogem cutting plugin:
Have it respect new workshop profile setting.
I'll take a look.  Meanwhile, it already respects stockpile links, in case that helps.
Title: Re: DFHack 0.43.03-r1
Post by: ldog on August 01, 2016, 01:55:40 pm
I haven't seen this mentioned (did a quick keyword search through the thread) but a request for the autogem cutting plugin:
Have it respect new workshop profile setting.
I'll take a look.  Meanwhile, it already respects stockpile links, in case that helps.

Thanks.

I'd need to re-engineer stockpiles (I use 1 for both rough & finished gems), but it's an option at least. It's not like I don't have all kinds of segregated QSPs already anyway, so what's 1 more. Convenience of autogem is hard to beat, manager would require 1 job per gem.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 01, 2016, 04:44:06 pm
Couldn't you create a stockpile that accepts nothing and link it to the workshop?
Title: Re: DFHack 0.43.03-r1
Post by: ldog on August 01, 2016, 04:48:41 pm
Couldn't you create a stockpile that accepts nothing and link it to the workshop?

Well then the workshop wouldn't be good for anything?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on August 01, 2016, 06:19:11 pm
Is there an eventful event for sieges or traders arriving? Not a huge deal as I can just check if there is one every so often, just wondering if it's already been done.

EDIT: I'll piggy back another question. Is it possible to have two separate onLoad.init, one for fort mode and one for adventure mode?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 01, 2016, 06:57:52 pm
Couldn't you create a stockpile that accepts nothing and link it to the workshop?

Well then the workshop wouldn't be good for anything?
Oh, sorry. I thought you had a walled-off workshop that was accepting gem-cutting jobs, or something like that. (These forums aren't the most mobile-friendly...)
Title: Re: DFHack 0.43.03-r1
Post by: ldog on August 01, 2016, 07:57:23 pm
Couldn't you create a stockpile that accepts nothing and link it to the workshop?

Well then the workshop wouldn't be good for anything?
Oh, sorry. I thought you had a walled-off workshop that was accepting gem-cutting jobs, or something like that. (These forums aren't the most mobile-friendly...)

LOL, I thought maybe you knew something I don't (well I'm sure you know a lot about DF that I don't) but no worries, Breadman said he'd look at it, and he gave me a workable solution otherwise.
Title: Re: DFHack 0.43.03-r1
Post by: Lamandus on August 04, 2016, 11:49:07 pm
Couldn't you create a stockpile that accepts nothing and link it to the workshop?

Well then the workshop wouldn't be good for anything?
Oh, sorry. I thought you had a walled-off workshop that was accepting gem-cutting jobs, or something like that. (These forums aren't the most mobile-friendly...)

LOL, I thought maybe you knew something I don't (well I'm sure you know a lot about DF that I don't) but no worries, Breadman said he'd look at it, and he gave me a workable solution otherwise.
My solution is to clutter the workorder with either duplicates or specifying them for different furniture. So if I want only gem encrusted statues, I tell to use "any material" for the gems and use it on input item statue. So now every statue will be encrusted by any gem lying around.

Or: you can switch off auto-cutting gems. Give the one workshop the order: Cut xy (it has to be a gem, not a stone!), and also change the material to any material. You can even make a workflow job, specifying how  many cut gems should be there (regardless which kind). So it will always automatically switch on, when you need more cut gems.
Like this: workflow amount SMALLGEM 30 10
Title: Re: DFHack 0.43.03-r1
Post by: Algorithman on August 10, 2016, 04:34:35 am
Would it be possible to write the outside temperature to the game log on weather changes?
I'm tryin to improve the ambient sounds, which would be season and temperature dependent.
Any clues how to do that?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 10, 2016, 06:55:52 am
It's pretty easy to detect weather changes by registering an event that gets triggered on new reports (which include announcements) and looking for announcements of type WEATHER_BECOMES_CLEAR, WEATHER_BECOMES_SNOW, or WEATHER_BECOMES_RAIN. devel/annc-monitor.lua (https://github.com/DFHack/scripts/blob/master/devel/annc-monitor.lua) may be a useful example.

I've never really worked with temperature, though, but see if df.global.world.arena_spawn.temperature works.
Title: Re: DFHack 0.43.03-r1
Post by: Algorithman on August 10, 2016, 10:20:50 am
Thx lethosor, i'll try that.
Title: Re: DFHack 0.43.03-r1
Post by: Heretic on August 17, 2016, 11:36:44 am
For on of masters of this thread  :)
Can someone told me short story of DFHack creation, and probadly give some linkes to first discussions about it? I really need it. Thanks.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on August 17, 2016, 11:58:36 am
Peterix is the one to ask.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on August 17, 2016, 02:19:56 pm
For on of masters of this thread  :)
Can someone told me short story of DFHack creation, and probadly give some linkes to first discussions about it? I really need it. Thanks.
At first there was chaos. Many young hackers did the same and did it differently. It was good time, because df was stuck in one version.

But soon one of those hackers has risen. He chose the hard path: to join everyone under a dfhack banner (and the nice performance gain by being in same address space) and that person was Peterix. And thus the Dfhack has risen from the chaos and is thriving since that day.

The second big revolution was "Lua". From the depths of internet came a person named "ag" (in these forums). He took the idea i toyed around and made it beautiful and powerful. And thus we could do anything (well almost) without any recompile.

The third big revolution was "Vmethod interposing". Again big thanks to "ag". This allowed us to do "MAGIC" with dfhack. Like catch when df calls some functions and replace them VERY EASILY. And also the gui was born.

Though this is only one half of it. During all that time there were many people - Like Peterix and Quietust - that worked on very important systems. Like the dfhack architecture itself and reversing the df.

Some links:  old dfhack thread  (http://www.bay12forums.com/smf/index.php?topic=91166.0)

Spoiler (click to show/hide)

Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on August 17, 2016, 08:29:04 pm
Really really old thread (http://www.bay12forums.com/smf/index.php?topic=58809), ancient code. (https://github.com/DFHack/dfhack/tree/legacy)
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on August 17, 2016, 09:40:55 pm
I am very amused by that depiction of dfhack as Der Nibelung of some sort.
Title: Re: DFHack 0.43.03-r1
Post by: Abadrausar on August 18, 2016, 11:33:16 am
... At first there was chaos. Many young hackers did the same and did it differently. It was good time, because df was stuck in one version.

But soon one of those hackers has risen. He chose the hard path: to join everyone under a dfhack banner (and the nice performance gain by being in same address space) and that person was Peterix. And thus the Dfhack has risen from the chaos and is thriving since that day.

The second big revolution was "Lua". From the depths of internet came a person named "ag" (in these forums). He took the idea i toyed around and made it beautiful and powerful. And thus we could do anything (well almost) without any recompile.

The third big revolution was "Vmethod interposing". Again big thanks to "ag". This allowed us to do "MAGIC" with dfhack. Like catch when df calls some functions and replace them VERY EASILY. And also the gui was born.

Though this is only one half of it. During all that time there were many people - Like Peterix and Quietust - that worked on very important systems. Like the dfhack architecture itself and reversing the df...
Very good lyrics! I almost can feel the Iluvatar music weaving into the shining reality of today DFHACK  ;)
You must have a poet soul to transform a relevant bunch of boring and precise technical jargon into an interesting saga song  ;D
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on August 18, 2016, 11:45:23 am
Very good lyrics! I almost can feel the Iluvatar music weaving into the shining reality of today DFHACK  ;)
You must have a poet soul to transform a relevant bunch of boring and precise technical jargon into an interesting saga song  ;D

Thanks, on a rare full moon i try to bard things up :D
Title: Re: DFHack 0.43.03-r1
Post by: Roses on August 18, 2016, 01:15:15 pm
Has anyone managed to figure out how to get two entities to go to war with eachother, or declare peace if they are already at war, or just to change their diplomatic standing with each other at all? I've been looking through everything I could think of but haven't really found anything useful.

EDIT: Follow up question, does anyone have a script that reads what the name of something is? Whether a unit or entity or region or anything that has the name vector with words, parts of speech, and language?
Title: Re: DFHack 0.43.03-r1
Post by: mifki on August 18, 2016, 05:17:11 pm
EDIT: Follow up question, does anyone have a script that reads what the name of something is? Whether a unit or entity or region or anything that has the name vector with words, parts of speech, and language?

dfhack.TranslateName(something.name, true)

true - to translate to English, if you want that
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 18, 2016, 08:22:40 pm
Also, if you decide to print the result of that to the console (or any other CP437-encoded text from DF), use
Code: [Select]
print(dfhack.df2console(dfhack.TranslateName(...)))
If you don't pass it through df2console, special characters won't be displayed correctly on all platforms.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on August 19, 2016, 08:32:30 am
Also, if you decide to print the result of that to the console (or any other CP437-encoded text from DF), use
Code: [Select]
print(dfhack.df2console(dfhack.TranslateName(...)))
If you don't pass it through df2console, special characters won't be displayed correctly on all platforms.
Thanks for that tip, echoing civ names to the console worked just fine under Windows.  Didn't realize that would not be the case everywhere.
Title: Re: DFHack 0.43.03-r1
Post by: HavingPhun on August 19, 2016, 03:24:53 pm
So I started reading a book on reverse engineering software and I couldn't help but think of DFHack. I've come up with a few questions:

-Beyond the custom DLL, how does DFHack work? How is the DLL used to add DFHack's functionality?
-Can something like DFHack be made for any game/program?
-Is there a term for what DFHack does? Would it be DLL or Code Injection perhaps?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 19, 2016, 04:37:26 pm
The way DFHack hooks in is a bit different on the three platforms, but basically, we hook into four core SDL functions:

- SDL_Init: DF calls this on startup, so we implement our own version that does any initialization work we need and then calls the "original" SDL_Init
- SDL_Quit: similar, but called when DF exits cleanly, so we handle any necessary cleanup here and call the original SDL_Quit
- SDL_PollEvent: used to implement keybindings. We call the original function, then check for any keypress events that match DFHack keybindings. If any do match, the DFHack keybindings are invoked; otherwise, the event is passed on to DF.
- SDL_NumJoysticks: probably the most important one. DF calls this every game tick (simulation tick, not graphical frame), so we can essentially pause DF briefly and allow anything to modify DF data safely.

On OS X and Linux, it's fairly simple to make a library that just intercepts these four functions, and doesn't interfere with any other SDL functions at all. However, on Windows, we have to make a new SDL.dll that implements every SDL function DF needs and call the corresponding function in SDLreal.dll (which is just a copy of the original SDL.dll).

There are some parts of DFHack that would be easy to make work with other programs, and some that would be very hard (e.g. the hooks above). I think Peterix was wanting to make DFHack work with other games at some point, but I'm not sure how much progress was made there.

I'm not really sure what a proper term is, but I suppose "DLL injection" fits.
Title: Re: DFHack 0.43.03-r1
Post by: HavingPhun on August 19, 2016, 06:15:12 pm
The way DFHack hooks in is a bit different on the three platforms, but basically, we hook into four core SDL functions:

- SDL_Init: DF calls this on startup, so we implement our own version that does any initialization work we need and then calls the "original" SDL_Init
- SDL_Quit: similar, but called when DF exits cleanly, so we handle any necessary cleanup here and call the original SDL_Quit
- SDL_PollEvent: used to implement keybindings. We call the original function, then check for any keypress events that match DFHack keybindings. If any do match, the DFHack keybindings are invoked; otherwise, the event is passed on to DF.
- SDL_NumJoysticks: probably the most important one. DF calls this every game tick (simulation tick, not graphical frame), so we can essentially pause DF briefly and allow anything to modify DF data safely.

On OS X and Linux, it's fairly simple to make a library that just intercepts these four functions, and doesn't interfere with any other SDL functions at all. However, on Windows, we have to make a new SDL.dll that implements every SDL function DF needs and call the corresponding function in SDLreal.dll (which is just a copy of the original SDL.dll).

There are some parts of DFHack that would be easy to make work with other programs, and some that would be very hard (e.g. the hooks above). I think Peterix was wanting to make DFHack work with other games at some point, but I'm not sure how much progress was made there.

I'm not really sure what a proper term is, but I suppose "DLL injection" fits.
Thanks for the explanation, it was very informative. You can easily modify those functions and createa modified DLL because SDL is open source, right? If one were to do the same with a closed source library would they have to search through the assembly version of it and modify it or do you know of any other ways?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 19, 2016, 07:06:16 pm
We're not actually modifying the functions - we're just making our own versions that do their own thing, then call the actual SDL functions. The SDL headers are enough for that. (And we actually don't use the SDL headers for the functions we need to call - we just check the SDL headers for those functions' signatures, then put them in our own header.)

Of course, if SDL weren't open-source, that could potentially lead to licensing issues, but that's not the case.
Title: Re: DFHack 0.43.03-r1
Post by: figment on August 19, 2016, 07:46:54 pm
In theory one could use something like detours [1] to do the same thing that DFHack does.  It wouldn't really require the dll to be open source.  You just intercept the function and replace it with something that calls the original function.   This alternate approach is sometimes called API Hooking but DLL injection is probably more common.  Detours used to be free and 2.0 may still be for win32 but they charge and unreasonable amount for Win64 support. 

The real issue tends to be that you need your code to be loaded in the host process.   Having the process load your dll instead of having to attach to the process like a debugger is simpler in many cases especially for something like dfhack.

[1] http://www.microsoft.com/en-us/research/project/detours/
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 19, 2016, 10:29:39 pm
To Iri from freenode: yes, we are working on 64-bit DFHack. You would have found this out if you had stayed around for more than 78 seconds. (For anyone else who asks a question on IRC - yes, there are around 70 people in the channel, but spread across many timezones, and among those that are awake, not many actively watch the channel. If you wait around for a while, chances are someone will see your question.)

It looks to me like Detours is doing some kind of code injection, which isn't at all how DFHack's SDL hooks work. (You could argue that DFHack's virtual method hooks do some, but even those don't rewrite code in memory, at least as far as I'm aware.) It  seems kind of Win32-API-specific too, although I could be wrong about that.

Anyway, 64-bit Linux has made some progress yesterday and today (from "nothing at all" to "some useful stuff"), although there are issues with getting some globals and vtables located.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on August 20, 2016, 08:00:43 am
Quick summary of DFHack history:

It started out as a memory I/O library - you loaded a DLL and it gave you functions for retrieving the addresses of important variables (from a "memory.xml" file, whose contents were very similar to what Dwarf Therapist currently contains in its INI files) and other functions to read/write them, and over time it got extended to add high-level functionality to make utilities simpler. It worked sort of like a debugger, reading and modifying DF's memory from outside the process, making it rather slow (a Reveal on a full-sized map could take several seconds) and error-prone (if something went wrong, it could leave DF stuck in a "suspended" state, requiring a secondary utility to unlock it). It also had a history of setting off virus scanners. However, it had the benefit that you could update a utility to work with a newer version of DF just by editing memory.xml.

Later, after it was observed that certain operations like figuring out item types and materials was decidedly non-trivial (some values were at different addresses based on item type, and some could only be determined by executing code), we came up with the idea of injecting a DLL into DF's address space - with this, we could not only directly modify its internal memory as if it were our own (making certain operations massively faster, especially Reveal), but we could even execute DF's own code in order to perform complex operations that were otherwise very difficult (such as formatting item names exactly the same as they appear in-game). When this happened, we abandoned the idea of having offsets to individual fields and reverse-engineered all of the game's data structures (so we could access them in C++ as structs and classes), memory.xml became "symbols.xml" (containing only the locations of global variables), and the utilities all became "plugins" that were invoked from within the game from a special console window. This made some things a lot simpler, but it also meant that when newer versions of DF came out, DFHack and all of its plugins needed to be recompiled in order to handle new structure layouts (i.e. if new fields were added or old ones were removed).

The rest (Lua scripting, vtable interposing, etc.) has already been covered above.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on August 20, 2016, 08:31:34 pm
This has been your first class of Wizardry 101, you'll need to pay the tuition for additional courses, blood sacrifice or high quality Ukrainian porn being the standard methods as I recall.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 20, 2016, 09:57:36 pm
DFHack uses SDL? The way the tiles rescale when the window is resized, it seems like Dwarf Fortress uses OpenGL instead of SDL when DFHack is enabled.

Edit: Nevermind, I had Print Mode set to "Standard".
Title: Re: DFHack 0.43.03-r1
Post by: peterix on August 21, 2016, 12:55:04 am
History of DFHack...

Is long. I really don't remember a lot of the details. It's been 7 years? I'll just try to fill in the blanks that people missed.

It started as a part of Khazad - a DF visualizer which I ported to linux:
https://github.com/ImpalerWrG/Khazad/commit/c5b21a2479926d03e5cdc20ced5f5c10a38d5d3a
https://github.com/ImpalerWrG/Khazad/commits/master?page=17

Over time, it turned into a separate project, used in Khazad:
https://github.com/ImpalerWrG/Khazad/commits/master?page=13
https://github.com/DFHack/dfhack/commit/fac88478bd72056e4043e73ff1e8832ce1474a63

At this point, it was structured as a library (common functionality) and a bunch of executables (the actual tools like `reveal`). It worked sort of like a debugger - stopping the main process, making its changes and then letting it run again.

Then ImpalerWrG (http://www.bay12forums.com/smf/index.php?action=profile;area=summary;u=14109) made some comments on here that weren't well received and got driven away by the locals (Toady included). I got caught up in that and was forced to completely abandon Khazad. After the dust settled, DFHack continued as an entirely separate project.

It expanded, and over time, I tried improving how it worked. One of the big problems was performance. Stopping and starting the DF process alone was slow. On linux, it could also only write 4 bytes at a time to memory. It had to ask the OS to do everything and it simply wasn't good.

My first attempt at fixing the performance was sort of silly. It involved injecting code into DF (that part survived until now) and then setting up a shared memory area that was used to push data through. It was very new to me, and I made plenty of mistakes... like trying to use a busy loop in order to speed up pushing of data through this window... It only worked well on dual core CPUs, when nothing else was running:
https://github.com/DFHack/dfhack/commit/efce0ab21b34085a76fd9e7b4d58166e114dca04

That obviously couldn't work, and I don't think many people used it (if anyone).

I think the suggestion to move more things into the DF process came from Baughn (but I'm not really sure). Also, some (bad) antivirus software started to detect the DFHack tools as viruses. So, I simply had to change it to how it works now:
https://github.com/DFHack/dfhack/commit/81d648dfa73f1a3b1b62039c1277bd38c9414347

I had a video of the first running DFHack console inside DF... but I can't find it. It was basically printing the game cursor coords to the console :D

The rest of the DFHack APIs and tools got ported to the new layout.
I added plugins and a RPC interface based on sockets and Google protobuf.
Support for scripting in Lua and Ruby got added (actually, the old dfhack had python scripting support, but that died a long time before this).
The old APIs were superseded by df-structures, which got split off at some point (I think):
https://github.com/DFHack/dfhack/commit/f2a69188ea3fc100662bb334664f7223cbfe5049

... and the rest of it was a lot of work. After several years of maintenance, I left the project for others to worry about :)
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 21, 2016, 02:35:19 am
Looking through the Khazad commits:

Impalerwrg initialized Khazad on 2009-04-09 at 04:55:56.
Peterix made his first commit on 2009-06-18 at 23:17:39.
"DFHack" was first mentioned on 2009-08-25 at 22:46:29.
DFHack was birthed from Khazad on 2009-09-14.
Impalerwrg and Peterix worked together on the Khazad until 2010-02-16.
Impalerwrg moved the project to GitHub and began working alone on his new Ogre engine 2010-05-21. I think this is the point that Khazad became its own game.
Title: Re: DFHack 0.43.03-r1
Post by: mifki on August 21, 2016, 03:02:56 am
... and the rest of it was a lot of work. After several years of maintenance, I left the project for others to worry about :)

Although not being involved in development, are you still playing DF? Were you playing it a lot back then (for example, I must admit, I am developing much more than playing, which is a problem sometimes as I just don't know some gameplay stuff well)?

It's just interesting why people suddenly lose interest in their projects (I'm not saying I don't do that sometimes myself). Back in good old OSx86 days, there was a guy, Maxxus, who first hacked first versions of OS X 10.4 to run on non-Apple hardware and documented the process of binary patching the kernel. And then he disappeared. We had to use his old kernel with new OS X versions until.. um.. I was able to build a new one from sources. And we didn't, and still don't (AFAIK) know, who he was and why he abandoned the project.

Here, GavJ disappeared after starting to work on a very interesting geological project, fricy disappeared...
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on August 21, 2016, 03:30:55 am
... and the rest of it was a lot of work. After several years of maintenance, I left the project for others to worry about :)

Although not being involved in development, are you still playing DF? Were you playing it a lot back then (for example, I must admit, I am developing much more than playing, which is a problem sometimes as I just don't know some gameplay stuff well)?

It's just interesting why people suddenly lose interest in their projects (I'm not saying I don't do that sometimes myself). Back in good old OSx86 days, there was a guy, Maxxus, who first hacked first versions of OS X 10.4 to run on non-Apple hardware and documented the process of binary patching to the kernel. And then he disappeared. We had to use his old kernel with new OS X versions until.. um.. I was able to build a new one from sources. And we didn't, and still don't (AFAIK) know, who he was and why he abandoned the project.

Here, GavJ disappeared after starting to work on a very interesting geological project, fricy disappeared...
Yeah it's the natural order of things. E.g. currently i don't play because anything i try gets fps death. Next step for that is 1x1 fort with 20 dwarf limit (+20 children +20 visitors). Maybe that could work for some time...
Title: Re: DFHack 0.43.03-r1
Post by: Rose on August 21, 2016, 03:32:17 am
Yeah, TheWonderIdiot stopped development of Overseer, so I had to make Armok Vision
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on August 21, 2016, 04:35:12 am
LucasUP vanished and I took over the LNP...

(@MaxTM - what kind of blood did you use to draw Peterix back???)
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 21, 2016, 05:10:12 am
(@MaxTM - what kind of blood did you use to draw Peterix back???)

I'm interested in this too. Maybe it will work for fricy.
Title: Re: DFHack 0.43.03-r1
Post by: peterix on August 21, 2016, 05:45:31 am
Blood?

There was blood?

... that would explain things :)

I think I stopped playing years before I stopped being involved... it's kinda natural for me. If the game is good, I mess with it in some way.

I spent thousands of hours in some games... which is why I generally don't play them anymore. I know Half-life inside-out. Same for DF... although there, Toady adds more stuff all the time. And Minecraft has an active modding community, which makes it interesting to revisit every few months/years when an interesting new concept shows up.

I messed with Half-Life before, making a mod for it. You won't find it though, because I never released it. Basically, it was meant to be a total conversion into a MMORPG game - multiple connected servers you would freely go between, each running an instance of a map of the game. It was bigger than what I could manage.

Now I'm doing the same with Minecraft, except with a very limited scope - just a launcher. You wouldn't believe how difficult did Sun/Oracle/Microsoft/AMD/Intel/nVidia make it to launch Java programs on Windows properly.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on August 21, 2016, 07:01:59 am
Now I'm doing the same with Minecraft, except with a very limited scope - just a launcher. You wouldn't believe how difficult did Sun/Oracle/Microsoft/AMD/Intel/nVidia make it to launch Java programs on Windows properly.

Oh, right, aren't you one of the MultiMC devs or something like that?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 21, 2016, 08:02:14 am
LucasUP vanished and I took over the LNP...

(@MaxTM - what kind of blood did you use to draw Peterix back???)
He has shown up in this thread a few times, and he's actually around the IRC channel quite a bit (not active, but responsive to mentions). It's not quite the same situation as other people who have disappeared.

Oh, right, aren't you one of the MultiMC devs or something like that?
Yep. (https://github.com/MultiMC)
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on August 21, 2016, 11:28:29 pm
It's hard to maintain active playing and coding and such with the same drives, I find when dfhack isn't caught up I do a lot more playing around in adventurer mode in the newest version, then once it does catch up I like to poke around at things that I have been recently wondering about, plus play with some of my favorite old toys/make sure they work to some extent.

Later I'll get the bug to go in and fix a few scripts I have that were broken by structures being renamed, some different calls being used, and in the process try to improve things by making use of new features (totally gonna see if I can use the symbol/figurine/etc image selection for a new artifake/names type script if it isn't done before I get there) and see whatever else pops into my head. I gotta get back in lua-mode first before it all starts to click again.
LucasUP vanished and I took over the LNP...

(@MaxTM - what kind of blood did you use to draw Peterix back???)
Funny story, the missus just hit... that time of the month, and I... used some to draw a dorf on the wall, though I'm not sure why as it was actually after Peterix popped back up... less a funny story, really, more of a mess.
Title: Re: DFHack 0.43.03-r1
Post by: peterix on August 22, 2016, 02:09:18 pm
I think you just killed the thread dude :P
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on August 22, 2016, 06:33:25 pm
I think you just killed the thread dude :P
Max's punishment is that he must debate GoblinCookie, on a topic of his choosing, for at least ten pages.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on August 22, 2016, 07:43:57 pm
T.T too much 4chan for Max I guess.
Title: Re: DFHack 0.43.03-r1
Post by: Ghills on August 22, 2016, 09:05:21 pm
I can safely say that is something I never expected to hear a grown adult doing.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on August 22, 2016, 09:15:40 pm
Note to self: next time source kitten blood for wall art.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on August 23, 2016, 01:04:39 pm
Back to the proper topic:

I identified the three unknown fields in the totem item: The first is the creature race ID, the second is the caste index, and the third is the body part index.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 23, 2016, 01:07:44 pm
It's really better to report that sort of thing on Github. I'll add names for those, but it would have been easy for that to get buried here.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on August 23, 2016, 01:10:32 pm
I usually don't have anything to do with github, so I kinda forget it exists...

I guess I'll go report that unk10 in the prepared food ingredient struct is the ingredient quality there then...

BTW: Could items that have received names be listed in the changelog or something, sometimes scripts break for no apparent reason, only to find that something finally got a name...

EDIT: Where should I report identified fields? The bug tracker?

EDIT2: Apparently such things are done in the df-structures bug tracker, and there is already an issue for the totem fields... Opened on april 30?! WTF?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 23, 2016, 01:23:05 pm
Issues and/or pull requests at https://github.com/dfhack/df-structures/ would be best for structures research.

I'm honestly not sure what a good solution for summarizing structure changes is. I guess listing simple name additions/changes wouldn't be too hard, but there are some things that are difficult to summarize in a changelog. I think Expwnent tried to come up with a full list of changes between 0.34.11-r4 and r5, and it was a lot of work. I think one of the least error-prone ways would be to come up with a diff of just XML files in df-structures between two versions, but I don't think it's possible to exclude non-XML files (where there are often many more changes).

Edit: regarding the "WTF", unk_a2 was undetermined and there were no field names, so presumably the issue was left open to allow kane-t a chance to continue researching.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on August 23, 2016, 01:30:50 pm
OK, issue for the prepared meal ingredient quality field has been filed, I checked my code and it is definitely unk_10.

EDTI: And I am bookmarking the df-structures issues page, because sometimes I identify fields, and I really should remember to report them.
Title: Re: DFHack 0.43.03-r1
Post by: kane_t on August 23, 2016, 02:01:49 pm
Edit: regarding the "WTF", unk_a2 was undetermined and there were no field names, so presumably the issue was left open to allow kane-t a chance to continue researching.

Haha, sorry, I wasn't quite comfortable at that time with proposing names, so I figured I'd just post the information so that someone else could verify it and do something with it.  I should've been more clear about that.

I remember being really sure that a2 was some sort of left/right side thing, but after testing it again it clearly isn't.  Guess it's a good thing I didn't propose a name for that one!
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 27, 2016, 02:48:51 pm
Some recent development updates:

Lua was updated to Lua 5.3 (actually some time ago, but nobody seems to have mentioned it here yet). This was necessary to support 64-bit integers properly, since Lua 5.2 didn't support those. Unfortunately, this will cause a few things to fail that used to work before:


Basically, strings and integers can be converted to floating point numbers automatically, but not to integers. If your scripts do any of those things above, you'll need to update them. In most cases, "math.floor()" should be enough to convert anything to an integer, and it should be consistent with the previous behavior.

DFHack changes:


Structures:


(Also, I recently discovered that [x] can be used for bulleted lists.)
Title: Re: DFHack 0.43.03-r1
Post by: Roses on August 27, 2016, 02:51:22 pm
Does anyone know if you can find out the wealth of an npc fortress or civilization?
Title: Re: DFHack 0.43.03-r1
Post by: TheFlame52 on August 27, 2016, 03:02:27 pm
That sounds like something that isn't tracked, but what do I know.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 27, 2016, 04:49:53 pm
Some recent development updates:

Lua was updated to Lua 5.3 (actually some time ago, but nobody seems to have mentioned it here yet). This was necessary to support 64-bit integers properly, since Lua 5.2 didn't support those. Unfortunately, this will cause a few things to fail that used to work before:
  • Assigning a floating-point number to a DF field that is an integer
  • Assigning a string to a DF integer field
  • Passing a floating-point number to a C function (DF/DFHack) that expects an integer


Basically, strings and integers can be converted to floating point numbers automatically, but not to integers. If your scripts do any of those things above, you'll need to update them. In most cases, "math.floor()" should be enough to convert anything to an integer, and it should be consistent with the previous behavior.

DFHack changes:
  • The manager-quantity script was re-added as gui/manager-quantity after Enay pointed out that it's still useful for changing work order quantities (oops).
  • The lua interpreter (both the interactive and single-expression uses) and gui/gm-editor now support exactly the same "shortcuts" - e.g. scr, screen, world, building, bld, enabler, unit, etc.. These have been moved to utils.lua, so it should be easy for other scripts to use them too.


Structures:
  • The viewscreen_setupadventurest layout has been incorrect for a long time, but I finally managed to get it mostly aligned properly and identified a bunch of new fields. (Having both 32 and 64-bit support was really helpful here, incidentally.)
  • enabler was incorrect on x64 due to the "flags" bitfield varying in size, which was just fixed. This bitfield will have 32 flags or 64 flags on OS X/Linux depending on the architecture, but only the first two are used regardless of the platform/build.


(Also, I recently discovered that [x] can be used for bulleted lists.)

That floating point and double float stuff sounds like the type of errors I was getting when trying to compile DFHack. Maybe I need to install Lua.
Spoiler (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on August 28, 2016, 06:50:48 am
Some recent development updates:

Great to have this in the thread, but shouldn't it also go in NEWS.rst (the changelog file)?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 28, 2016, 04:51:16 pm
That floating point and double float stuff sounds like the type of errors I was getting when trying to compile DFHack. Maybe I need to install Lua.
No, you don't need to install Lua. Lua is included in the DFHack tree. I'm not really sure what the issue is there, but it looks like you're using one of my GCC builds :/ . Someone here (http://stackoverflow.com/questions/29380046) ran into a similar issue when using a version of GCC built on a newer OS X version, so that could be it. I suppose if you don't want to compile GCC, you could try removing the occurrences of "__header_always_inline" from /gcc/4.8.5p/lib/gcc/x86_64-apple-darwin13.4.0/4.8.5/include-fixed/math.h (make a backup!), but otherwise, I think you'd get better results with a native GCC (one you build on your OS).

Great to have this in the thread, but shouldn't it also go in NEWS.rst (the changelog file)?
I put it in this thread because people kept getting directed to here, where there weren't any recent updates. Of course it'll go in NEWS.rst when I get around to updating it (or someone else does), which I always do at least before releases, if not more often. (I won't be copying it verbatim, though, to keep the size reasonable.)
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 28, 2016, 05:11:59 pm
Thanks for the help.

I was getting those errors both with your GCC 4.8p running on my 10.6 Snow Leopard machine and with GCC compiled by Brew on my 10.10 Yosemite machine.

What version do you use for compiling DFHack? Maybe 10.7 Lion?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 28, 2016, 05:39:08 pm
I've compiled it successfully with GCC 4.5 and 4.8 on OS X 10.9, and GCC 4.8 on OS X 10.10. Are you sure you're using the homebrew-compiled GCC on 10.10?
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 28, 2016, 06:08:10 pm
Sorry, I got confused. Just tested it again, and it works just fine on Mac OS X 10.10 Yosemite. It turns out I was having a different problem related to the library files of Dwarf Fortress v0.43.03. After replacing those with better versions it works fine. Thanks for the help!

Now I just need to get Dwarf Therapist and PyLNP to compile.

Edit: Spent all day trying to get it to compile a second time. Looks like my problem this time was leaving "export MACOSX_DEPLOYMENT_TARGET=10.9" out of my build script.

Posting build script here, so I don't lose it.

Spoiler: part 1 (click to show/hide)

part 1a - Place a "df_osx_v0.43.03" at ~/Desktop/dfhack_comptile/df_osx_v0.43.03/ if there isn't one already.

Spoiler: part 2 (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 30, 2016, 11:09:15 pm
Odd, I've never had to set MACOSX_DEPLOYMENT_TARGET on 10.10 or 10.11 with GCC 4.8, although I haven't tested those builds elsewhere. Was it failing to build for you without it, or failing to run on older systems? I suppose GCC 4.5 could be the reason too, but I'm not sure why that would be it.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 31, 2016, 12:32:37 am
If I used GCC 4.8, it would cmake fine without the deployment target, but then it wouldn't make. Using deployment target 10.9 with GCC 4.5 let it both cmake and make.

It looks like the DFHack I built the first time actually doesn't run, but the last two I built work (both vanilla DFHack and Japa's fork of it).
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 31, 2016, 07:08:49 am
It should compile with GCC 4.8. Do you have any specific error messages? What DFHack version/commit are you building?
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 31, 2016, 07:33:41 am
I'm using DFHack 0.43.03-r1.
Code: [Select]
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
Spoiler: .git/FETCH_HEAD (click to show/hide)

Spoiler: Output (click to show/hide)

This is with GCC 4.8 and export MACOSX_DEPLOYMENT_TARGET=10.9.
Title: Re: DFHack 0.43.03-r1
Post by: Blaze on August 31, 2016, 08:31:31 am
Anyone know the correct offset for the startdwarf plugin? All the ones I've tried appear to be outdated.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 31, 2016, 08:36:47 am
...
Wow, I've never seen that before. What GCC 4.8 is that from - Homebrew, self-compiled, MacPorts, something else?

Anyone know the correct offset for the startdwarf plugin? All the ones I've tried appear to be outdated.
Do you mean start_dwarf_count? That changes with pretty much every DF version, as do all of the other offsets (except in rare cases/coincidences), so anything in older versions is likely not right in whatever version you're using.
Title: Re: DFHack 0.43.03-r1
Post by: mifki on August 31, 2016, 08:41:07 am
...
Wow, I've never seen that before. What GCC 4.8 is that from - Homebrew, self-compiled, MacPorts, something else?

Something is wrong with Xcode I think.
Title: Re: DFHack 0.43.03-r1
Post by: Blaze on August 31, 2016, 08:42:35 am
Do you mean start_dwarf_count? That changes with pretty much every DF version, as do all of the other offsets (except in rare cases/coincidences), so anything in older versions is likely not right in whatever version you're using.
I'm using 43.03. It's not just outdated, symbols.xml shows that it doesn't even exist.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 31, 2016, 08:46:11 am
Do you mean start_dwarf_count? That changes with pretty much every DF version, as do all of the other offsets (except in rare cases/coincidences), so anything in older versions is likely not right in whatever version you're using.
I'm using 43.03. It's not just outdated, symbols.xml shows that it doesn't even exist.
No, symbols.xml isn't showing that it doesn't exist. It exists, and likely will exist until Toady scraps the 7-dwarf default. The fact that it's missing from symbols.xml simply means that nobody has found it.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 31, 2016, 08:52:32 am
...
Wow, I've never seen that before. What GCC 4.8 is that from - Homebrew, self-compiled, MacPorts, something else?

Something is wrong with Xcode I think.

Homebrew/gcc48-4.8.5.yosemite.bottle.1.tar.gz

XCode 6.4. I might be able to switch to XCode 5 or XCode 7.
Title: Re: DFHack 0.43.03-r1
Post by: mifki on August 31, 2016, 09:06:13 am
6 should be fine, don't know then.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 31, 2016, 09:30:01 am
I just had 5 on it originally, but I installed 6 while trying to get this or something else to work. I still have 5 on it too, but I think 6 seems to have taken over.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on August 31, 2016, 12:30:39 pm
What does "xcode-select -p" give you?
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on August 31, 2016, 03:40:23 pm
What does "xcode-select -p" give you?

It gives me a link to the "/Contents/Developer" internal folder of my Xcode 6.4 app.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on September 05, 2016, 08:33:56 pm
Is there a way to get unambiguous global coordinates for a tile?  The current XYZ coordinate objects depend on the top-left corner or the embark site, and I'm not sure how it works in adventure mode at all.

I'd like the Accessibility Utility to handle intelligently when there are multiple player forts in the same world, and be consistent when used in Adventure mode.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on September 06, 2016, 01:14:38 am
you can get the global coordinates of the top-left corner of the embark site in embark tiles, which you can multiply by 16 to get the coordinates in map tiles.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on September 06, 2016, 07:43:43 am
How difficult is it to turn constructions into natual stone?

I want to make a plugin that allows you to make dirt walls. (Any dirt, because specifying isn't possible)
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on September 06, 2016, 08:04:39 am
How difficult is it to turn constructions into natual stone?

I want to make a plugin that allows you to make dirt walls. (Any dirt, because specifying isn't possible)

Short answer: yes
Long answer: no

J.k...

There is a question of "natural" and "stone". You say you want to make dirt walls, which is different from "stone". In DF there is such thing as "layers" and "regions" and so on. Thus "natural" tiles get to be fixed (e.g. you can't have dirt in lower levels (note: not sure how cave-ins do it though) ). And the second thing is "unnatural" - i.e. vein materials.
So if you want to have fullproof script/plugin it needs to:
So it's not trivial but not very hard either.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on September 06, 2016, 08:14:45 am
I did do some experiments with the tiletypes command, which let me put dirt walls anywhere except constructions.

What I didn't test, but what I would want this for, was see if trees grow on the resulting dirt.

I want hanging gardens.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on September 06, 2016, 08:37:58 am
I did do some experiments with the tiletypes command, which let me put dirt walls anywhere except constructions.

What I didn't test, but what I would want this for, was see if trees grow on the resulting dirt.

I want hanging gardens.
Ah yes i forgot. Also there is layers and soil-layers. So soil is a bit of special thing.

Edit: now i also want that... Maybe some other method? e.g designate farm, plant "special" plant -> turn into dirt. This way you could ask players to engineer the pumping and etc. because imho the replace construction part is the harder one
Title: Re: DFHack 0.43.03-r1
Post by: Meph on September 06, 2016, 10:12:46 am
I've been away for a month... how has the progress for a dfhack 43.05 been?
Title: Re: DFHack 0.43.03-r1
Post by: pikachu17 on September 06, 2016, 10:18:39 am
I was trying to make a speed boot. you know, a speed boot, like in Nethack well I made the following item
[ITEM_SHOES:ITEM_SHOES_SPEED]
[NAME:speed boot:speed boots]
[ARMORLEVEL:1]
[UPSTEP:1]
[METAL_ARMOR_LEVELS]
[LAYER:OVER]
[COVERAGE:100]
[LAYER_SIZE:25]
[LAYER_PERMIT:15]
[MATERIAL_SIZE:2]
[METAL]
[LEATHER]
[HARD]
and the following creature[CREATURE:ARTIFACT]
           [ARENA_RESTRICTED]
              [DOES_NOT_EXIST]
[NAME:::][CASTE_NAME:::]
   [USE_MATERIAL_TEMPLATE:SPEED_BOOT:STONE_TEMPLATE]
      [DISPLAY_COLOR:3:0:1]
      [STATE_NAME:ALL_SOLID:speed boot]
      [MELTING_POINT:5]
      [BOILING_POINT:9509]
         [SYNDROME]      
         [SYN_NAME:speed_boot]
         [CE_SPEED_CHANGE:SPEED_PERC:250:START:0:END:10000]
and I used the following scripts in onLoad.init
modtools/item-trigger -itemType ITEM_SHOES_SPEED -onEquip -command [ modtools/add-syndrome -syndrome "speed_boot" -resetPolicy ResetDuration -target \\UNIT_ID ]
modtools/item-trigger -itemType ITEM_HELM_SPEED -onUnequip -command [ modtools/add-syndrome -erase -syndrome "speed_boot" -resetPolicy ResetDuration -target \\UNIT_ID ]
and while it does seem to work to equip the boots(although it seems work simply by picking them up. is there a way to fix that too), when I take the boots off it does erase the the syndrome, but the charecter is still extra speedy. how do I fix it?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 06, 2016, 10:46:31 am
I did do some experiments with the tiletypes command, which let me put dirt walls anywhere except constructions.

What I didn't test, but what I would want this for, was see if trees grow on the resulting dirt.

I want hanging gardens.
Hmmm, I think you need to clear the construction tile first, like tiletypes paint m air s empty > construction tiles > paint m soil s wall > the new open spaces
I was playing with this while fiddling with engraving constructions before discovering I can just change advfort to let me engrave them directly.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on September 06, 2016, 11:47:39 am
(note: not sure how cave-ins do it though)

When I was writing my Lua library for determining a tile's material I experimented with cave-ins. It turns out the game creates mineral veins for them, most of the time... Sometimes it fails to create the veins (for no apparent reason), which is why sometimes the cave-in aquifer piercing method fails.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 06, 2016, 11:56:53 am
Hmmm, I was doing different cave-in experiments with ice and obsidian and constructions in adventurer mode, it's how I clear magma and such for constructions in a lot of areas, and I've used it to punch through the floors of cavern lakes as well.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on September 06, 2016, 12:50:19 pm
Hmmm, I was doing different cave-in experiments with ice and obsidian and constructions in adventurer mode, it's how I clear magma and such for constructions in a lot of areas, and I've used it to punch through the floors of cavern lakes as well.
Actually obsidian is yet another special case. Because of that you can only have one "obsidian" per DF (sadly).
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on September 06, 2016, 12:55:18 pm
Isn't the "LAVA" stone a per-region setting? AFAIK if you define more than one you can get a mix in one world, but only one per embark.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 06, 2016, 02:11:29 pm
Hmmm, I was doing different cave-in experiments with ice and obsidian and constructions in adventurer mode, it's how I clear magma and such for constructions in a lot of areas, and I've used it to punch through the floors of cavern lakes as well.
Actually obsidian is yet another special case. Because of that you can only have one "obsidian" per DF (sadly).
I think it's similar to the way ice works except you can't produce just an obsidian floor but 1/7 water will make a sheet of ice when exposed to freezing skies, even if you're in mid-air with no supports around it.

Similar problems emerge if you try to dump water out of a minecart while submerged in magma, you can do the opposite with magma in water and suicide as I recall, but water just crashes the game unless you're standing on a flow tile.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on September 07, 2016, 04:21:25 pm
Doe anyone know if there is a flag or some sort of check to see if a unit is fleeing? I know interactions can be configured to only be usable when fleeing, but I want to be able to target fleeing units as an option in my wrapper script.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 07, 2016, 05:16:39 pm
Isn't one of the meeting path things that?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on September 08, 2016, 08:03:10 pm
Isn't one of the meeting path things that?

Hmm, I didn't see anything about fleeing. I saw destination, opponent, and idle. And there is no fleeing action. Do you have any idea where you might have seen that?

On a side note, does anyone know if changing the gait values in unit.enemy.gait_index is enough to speed up and slow down a unit? Or what even those indexes mean?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 09, 2016, 06:23:07 pm
Crap I don't have a working install with dfhack, wait, was it idle area or goal or something? There is one of those that has a big long list of entries, like 100+ which I could swear had "flee area" or something similar.

Ah, these: https://github.com/DFHack/df-structures/blob/master/df.pathfinding.xml
Title: Re: DFHack 0.43.03-r1
Post by: TechnoScrabble on September 10, 2016, 01:45:26 pm
I've been over the documentation for it time and time again, but I still can't get spawnunit to work, and the red text error message it gives me is partial and tells me nothing. Can someone please show me an example of input for it that would work? spawnunit CREATURE:RABBIT 0, spawnunit RABBIT 0, spawnunit CREATURE:RABBIT CASTE:0, etc are failing me, I must have misread the doc.

EDIT: I've since figured out that I need to use the actual caste name. Is there a way to make the animal tame, or spawn it in a cage? Spawning on top of a cage trap does not work.

EDIT EDIT: Now any items I place with createitem disappear when I unpause the game. I'm trying to make a cool tomb for my friend to explore in adventure mode, and need a specific block that I was unfortunate enough not to embark on. Anyone know how to fix the disappearances?
Title: Re: DFHack 0.43.03-r1
Post by: Hesperid on September 11, 2016, 06:57:34 pm
EDIT EDIT: Now any items I place with createitem disappear when I unpause the game. I'm trying to make a cool tomb for my friend to explore in adventure mode, and need a specific block that I was unfortunate enough not to embark on. Anyone know how to fix the disappearances?

This sounds like what happens when the garbage collect flag is set on an item. They'll sit there until the game is unpaused and then they're immediately cleaned up from the game. Can you use gm-editor and confirm that that's not happening?
Title: Re: DFHack 0.43.03-r1
Post by: TechnoScrabble on September 11, 2016, 08:19:26 pm
EDIT EDIT: Now any items I place with createitem disappear when I unpause the game. I'm trying to make a cool tomb for my friend to explore in adventure mode, and need a specific block that I was unfortunate enough not to embark on. Anyone know how to fix the disappearances?

This sounds like what happens when the garbage collect flag is set on an item. They'll sit there until the game is unpaused and then they're immediately cleaned up from the game. Can you use gm-editor and confirm that that's not happening?

I haven't toyed with gm-editor yet, how would I do this?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 12, 2016, 12:43:59 am
Select an item, run "gui/gm-editor", and look for "garbage_collect" under "flags".

Alternatively, you could run ":lua print(dfhack.gui.getSelectedItem().flags.garbage_collect)".
Title: Re: DFHack 0.43.03-r1
Post by: TechnoScrabble on September 12, 2016, 09:32:21 am
Select an item, run "gui/gm-editor", and look for "garbage_collect" under "flags".

Alternatively, you could run ":lua print(dfhack.gui.getSelectedItem().flags.garbage_collect)".

Thank you. I ran through that, and garbage_collect is set as false.
Title: Re: DFHack 0.43.03-r1
Post by: Hesperid on September 12, 2016, 11:26:03 am
All right, what are the other flags set to?
Title: Re: DFHack 0.43.03-r1
Post by: TechnoScrabble on September 12, 2016, 12:40:46 pm
All right, what are the other flags set to?
On Ground and In Job are set to true, all other flags are false. Flags 2 are all false.
Title: Re: DFHack 0.43.03-r1
Post by: Hesperid on September 12, 2016, 01:24:30 pm
Wait, they're "in job" directly after you've created them? Or did you let some time pass so they get a stockpile task assigned?
Title: Re: DFHack 0.43.03-r1
Post by: TechnoScrabble on September 12, 2016, 04:56:55 pm
Wait, they're "in job" directly after you've created them? Or did you let some time pass so they get a stockpile task assigned?

Immediately after. And I watch when I unpause, nobody's grabbing the items, they just disappear.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 12, 2016, 06:53:33 pm
Can you check an item's ID after you create it (the "id" field), unpause, wait for it to disappear, and run ":lua ~df.item.find(ITEM_ID)"? (Replace ITEM_ID with the ID of the item you found earlier.)
Title: Re: DFHack 0.43.03-r1
Post by: TechnoScrabble on September 12, 2016, 11:15:53 pm
Can you check an item's ID after you create it (the "id" field), unpause, wait for it to disappear, and run ":lua ~df.item.find(ITEM_ID)"? (Replace ITEM_ID with the ID of the item you found earlier.)

That brought up a whole mess of stuff into the dfHack window, which I think is mostly the same things that I saw in gm-editor? Which bits of information do I need to keep an eye on?

Spoiler (click to show/hide)

Thank you for the help and patience with this, I haven't played DF since 2012 and I'm new to DFHack and the LNP.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 13, 2016, 12:58:22 am
Okay, so the item still exists. Try checking the pos field (":lua ~df.item.find(ITEM_ID).pos"). Then you can move the cursor to where the item is by setting the three fields of df.global.cursor (e.g. run "lua", then at the lua prompt, run "df.global.cursor.x = df.item.find(ITEM_ID).pos.x", then again with y and z). You might need to press up/down in DF after doing that to get the window to recenter properly.

Also, you can copy text from the console on Windows by right-clicking the title bar, or right-clicking in the console, depending on your system. It's a lot easier for us to read than full screenshots.
Title: Re: DFHack 0.43.03-r1
Post by: TechnoScrabble on September 13, 2016, 01:45:21 pm
Okay, so the item still exists. Try checking the pos field (":lua ~df.item.find(ITEM_ID).pos"). Then you can move the cursor to where the item is by setting the three fields of df.global.cursor (e.g. run "lua", then at the lua prompt, run "df.global.cursor.x = df.item.find(ITEM_ID).pos.x", then again with y and z). You might need to press up/down in DF after doing that to get the window to recenter properly.

Also, you can copy text from the console on Windows by right-clicking the title bar, or right-clicking in the console, depending on your system. It's a lot easier for us to read than full screenshots.

That took me deep underground, to an area I have not dug to yet. So, we know they're teleporting down for some reason on unpause (skip a step does not teleport), but we don't know why or how...
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 13, 2016, 02:17:49 pm
It wasn't x/y/z = -30000 was it? That's the default cursor location when it isn't present, I discovered that when I ran launch without a target the first time, since I aimed it at the cursor to give a speed/direction control via in-game methods, this meant I hurled myself at the lower northwest corner of the map at light speed and blew up.
Title: Re: DFHack 0.43.03-r1
Post by: malvado on September 13, 2016, 02:19:24 pm
How is the project going?
I've usually been running Dfhack through Lazy and can't say I've used a lot of time trying to configure what is beeing run as default through Dfhack , will there ever been some sort of manageable gui where we could dump / add things we want dfhack to run?
Title: Re: DFHack 0.43.03-r1
Post by: TechnoScrabble on September 13, 2016, 02:26:44 pm
It wasn't x/y/z = -30000 was it? That's the default cursor location when it isn't present, I discovered that when I ran launch without a target the first time, since I aimed it at the cursor to give a speed/direction control via in-game methods, this meant I hurled myself at the lower northwest corner of the map at light speed and blew up.

Nope!

[DFHack]# createitem BLOCKS INORGANIC:OLIVINE 50
[DFHack]# gui/gm-editor
[DFHack]# :lua ~df.item.find(13001).pos
<coord: 0x08fe4f04>
x                        = 36
y                        = 60
z                        = 103

EDIT: That's the position BEFORE it moves. Afterwards, it becomes:
x                        = 36
y                        = 60
z                        = 76
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 13, 2016, 02:30:02 pm
I've usually been running Dfhack through Lazy and can't say I've used a lot of time trying to configure what is beeing run as default through Dfhack , will there ever been some sort of manageable gui where we could dump / add things we want dfhack to run?
Well, there's dfhack.init, where you can specify whatever you want to run on startup, plus a variety of other options for running things when a world or map is (un)loaded. Some LNP launchers have a tab that lets you configure specific DFHack tools, but those are typically limited. The most powerful option for now is editing dfhack.init. I guess a GUI in DF would be possible, but it could be tricky to re-run things as they're changed (without restarting DF, which isn't really desirable).
Title: Re: DFHack 0.43.03-r1
Post by: malvado on September 13, 2016, 07:20:34 pm
I've usually been running Dfhack through Lazy and can't say I've used a lot of time trying to configure what is beeing run as default through Dfhack , will there ever been some sort of manageable gui where we could dump / add things we want dfhack to run?
Well, there's dfhack.init, where you can specify whatever you want to run on startup, plus a variety of other options for running things when a world or map is (un)loaded. Some LNP launchers have a tab that lets you configure specific DFHack tools, but those are typically limited. The most powerful option for now is editing dfhack.init. I guess a GUI in DF would be possible, but it could be tricky to re-run things as they're changed (without restarting DF, which isn't really desirable).

Thanks! Will definitely try to understand the .ini later on when it works with 05 or later. Kids keeping me busy lately so I can wait for new version of dfhack :)
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on September 13, 2016, 07:26:23 pm
I've usually been running Dfhack through Lazy and can't say I've used a lot of time trying to configure what is being run as default through Dfhack , will there ever been some sort of manageable gui where we could dump / add things we want dfhack to run?

https://dfhack.readthedocs.io/en/stable/docs/Core.html#init-files
Title: Re: DFHack 0.43.03-r1
Post by: malvado on September 14, 2016, 07:05:22 am
I've usually been running Dfhack through Lazy and can't say I've used a lot of time trying to configure what is being run as default through Dfhack , will there ever been some sort of manageable gui where we could dump / add things we want dfhack to run?

https://dfhack.readthedocs.io/en/stable/docs/Core.html#init-files

Thank you, that should help me understand a little better how things work :)
Title: Re: DFHack 0.43.03-r1
Post by: Hesperid on September 14, 2016, 09:54:56 am
It wasn't x/y/z = -30000 was it? That's the default cursor location when it isn't present, I discovered that when I ran launch without a target the first time, since I aimed it at the cursor to give a speed/direction control via in-game methods, this meant I hurled myself at the lower northwest corner of the map at light speed and blew up.

Nope!

[DFHack]# createitem BLOCKS INORGANIC:OLIVINE 50
[DFHack]# gui/gm-editor
[DFHack]# :lua ~df.item.find(13001).pos
<coord: 0x08fe4f04>
x                        = 36
y                        = 60
z                        = 103

EDIT: That's the position BEFORE it moves. Afterwards, it becomes:
x                        = 36
y                        = 60
z                        = 76

So it falls a bunch of Z-levels and stops. After it falls no further, what happens if you set its position back to the surface? Note that just adjusting the Z value for an item's position is not the correct way to move items because it leaves other flags and data structures un-updated, but works for this one experiment. I just want to see if it starts falling again after you bring it to the surface.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on September 14, 2016, 10:00:02 am
There is a bit of a disconnect between cursor coordinates and the "real" coordinates used by the game.

Your map will have a value in df.global.world.map.region_z that works as an offset.  My guess is that you'll find it holds 27 (i.e., 103 - 76).  Depending on what you're trying to do, you may need to add that offset to your z-coordinate.
Title: Re: DFHack 0.43.03-r1
Post by: Hesperid on September 14, 2016, 12:16:55 pm
He already has a valid Z-coordinate from before the object falls, why would he need to do this arithmetic you're talking about instead of just using that?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 14, 2016, 12:25:29 pm
For teleporting units and items, the cursor coordinates have always worked for me.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on September 14, 2016, 12:57:04 pm
I said the offset may be needed, I haven't noticed a real pattern of what is in "cursor space" and what is in "map space".

Try adding that term and see if things show up where they are supposed to.  If not, then obviously it's something else.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 14, 2016, 02:08:50 pm
Everything in the local map, as far as I can tell, uses the same coordinate system.

Anyway, I'm not sure you understood the issue. The issue is that TechnoScrabble is creating an item, whose coordinates after creation are (36, 60, 103). After unpausing, the item moves to (36, 60, 76) in the same coordinate system.

TechnoScrabble: this is probably a dumb question, but are you sure you aren't creating these items in midair or over open space?
Title: Re: DFHack 0.43.03-r1
Post by: TechnoScrabble on September 14, 2016, 04:14:38 pm
It wasn't x/y/z = -30000 was it? That's the default cursor location when it isn't present, I discovered that when I ran launch without a target the first time, since I aimed it at the cursor to give a speed/direction control via in-game methods, this meant I hurled myself at the lower northwest corner of the map at light speed and blew up.

Nope!

[DFHack]# createitem BLOCKS INORGANIC:OLIVINE 50
[DFHack]# gui/gm-editor
[DFHack]# :lua ~df.item.find(13001).pos
<coord: 0x08fe4f04>
x                        = 36
y                        = 60
z                        = 103

EDIT: That's the position BEFORE it moves. Afterwards, it becomes:
x                        = 36
y                        = 60
z                        = 76

So it falls a bunch of Z-levels and stops. After it falls no further, what happens if you set its position back to the surface? Note that just adjusting the Z value for an item's position is not the correct way to move items because it leaves other flags and data structures un-updated, but works for this one experiment. I just want to see if it starts falling again after you bring it to the surface.

It brings me to the position, but doesn't reveal it (it might even be solid stone), so I can't select the olivine blocks with the cursor to use gm-editor on them again.

EDIT: My first concern was that, too, but they disappear no matter what tile I spawn them in.

EDIT EDIT: Spawning the item a few z-levels above where I want it makes it fall down and stay there, it seems. Maybe it was registering the floor as air, and falling to the unrevealed caverns?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 14, 2016, 08:29:35 pm
Have you tried checking with "reveal"? You can save and then load the save from scratch (and exit with "die" afterward) if you want to be really safe, since running "unreveal" after unpausing can cause issues sometimes.

Also, could you try following the item (k-F) right after creating it to see what exactly happens? Check the z-level indicator on the side of the screen to see if it's falling, teleporting, etc.

createitem just creates items at the feet of units (or in buildings, I guess, but using it with units is most common). It doesn't care what the terrain there is, and it has no idea, so it can't possibly, say, forget that ground is there and let the item fall through it.
Title: Re: DFHack 0.43.03-r1
Post by: flyteofheart on September 18, 2016, 01:35:51 am
Having some issues with fix/dead-units

I had undead attack of all dwarf corpses and for some reason they are all stuck in the dead units list even after running the script. Its causing some problems in my super old fort. Its all named dwarf corpses which is I think the problem? "Omuvulo, Dwarf Hammerdwarf Corpse". Is there any way I could set it to just totally clear the dead list? Will that cause problems?

edit:

Nevermind, edited the Lua to this:

http://www.bay12forums.com/smf/index.php?topic=91166.msg4339870#msg4339870

fixed it. maybe consider making this default? either way my problem is solved :D

------------------------------------------------------------

Another issue though:

In the pref-adjust script, ( https://dfhack.readthedocs.io/en/stable/docs/_auto/base.html#pref-adjust )

It says it does all this stuff in the documentation but it actually only changes it to this

https://i.imgur.com/ImKOGIE.png

it doesnt give them a food preference. It only gives them a drink preference. This is an issue because drinking a preferred drink does NOT fix their focus for "not having a decent meal" which is the entire reason anyone would use this script in the first place.

Ideally it would do what it says it does in the documentation, giving them a wide array of food and furniture preferences so that we can use what we have and preventing them from getting "same old booze" thoughts if they always go for the dwarven wine.

https://dfhack.readthedocs.io/en/stable/docs/_auto/base.html#prefchange

The Prefchange script documentation encourages you to adjust it as you see fit, but does not really give you any way to do so via the console. I assume its asking you to go edit the script itself? Which is fine but I sorta wish there was a tutorial for that.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 18, 2016, 09:09:10 pm
Yeah, prefchange I wrote to clear the annoying food needs but I haven't redone those to deal with the need changes yet. To get rid of the food thoughts you'd want to prefchange c to clear them, but then if they mood you get random stuff, I wrote it mostly for mooding anyways. I intend to rewrite a lot of scripts to work with the new structures and such but last time I tried to get a dev build working it wouldn't even compile so I haven't messed with it much more than that.
Title: Re: DFHack 0.43.03-r1
Post by: flyteofheart on September 19, 2016, 01:29:16 am
Ill try to figure it out myself for a bit. Thanks for replying, I don't know what we would do without DFhack haha. I didnt expect to get the original writer of the pref-change script.

I don't know what im doing but I figure I can edit the lua and try to get them to prefer to consume plump helmets at the least.

Actually is there any kind of info about what values do what in the scripts? I can copy things from other sections but that takes forever. Like what are the IDs you guys use for items and whatnot? something in the wiki?
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on September 19, 2016, 01:47:39 am
You basically have to go through the raws to figure out IDs. I've memorized one or two, but the value of that is extremely limited--any changes to the raws will break them. The only ones I can think of off the top of my head are: toads are creature ID 0; dwarves are creature ID 465 (may not be true anymore); iron is inorganic 0. I would not use those, I'd do a proper search.
Title: Re: DFHack 0.43.03-r1
Post by: Zammer990 on September 19, 2016, 08:15:55 am
Anyone know how to input commands do dfhack's console through SSH; I have the game running on a linux server wit ascii printout, and dfhack's in-game menus etc. are working fine, but I can't find a way to input commands. Mostly I want to do workflow so I can make the game mostly run autonomously
Title: Re: DFHack 0.43.03-r1
Post by: Hesperid on September 19, 2016, 08:46:23 am
DFhack comes with a console program specifically for this: dfhack-run.

Just use your alternate tty to browse into your dfhack folder while your dfhacked game is running, and type ./dfhack-run <command>
Title: Re: DFHack 0.43.03-r1
Post by: Zammer990 on September 19, 2016, 09:02:06 am
DFhack comes with a console program specifically for this: dfhack-run.

Just use your alternate tty to browse into your dfhack folder while your dfhacked game is running, and type ./dfhack-run <command>
ty :)
Title: Re: DFHack 0.43.03-r1
Post by: flyteofheart on September 19, 2016, 05:43:36 pm
Can someone ELI5 why half the scripts are in Lua and half in Ruby? What can one do that the other cant in the dfhack scripts?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 19, 2016, 05:49:32 pm
Some of it is preference, some of it is happenstance, I don't know as many people writing in ruby since lua got incorporated into dfhack, but from what I can tell (which may be totally wrong!) ruby was in a similar position as a friendlier script language.
Title: Re: DFHack 0.43.03-r1
Post by: flyteofheart on September 19, 2016, 07:13:03 pm
we shall see if im able to figure either of those out LOL. All i know is 1 semester of python, 3 years ago

thanks.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 19, 2016, 07:15:54 pm
More of the DFHack API is exposed to Lua than to Ruby, generally. I also wouldn't call Ruby friendlier, myself, but it could be easier if you know it well and don't know Lua.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on September 19, 2016, 07:21:34 pm
I think LUA is easier because I already have experience with it from ComputerCraft. All I know about Ruby is that it has a 'Rails' library.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on September 19, 2016, 08:58:20 pm
I'd also note that there are decent API docs for Lua, and none at all for Ruby.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on September 19, 2016, 09:56:33 pm
I'd also note that there are decent API docs for Lua, and none at all for Ruby.
Do I hear PE volunteering to take on a side project? :)

Just kidding!
Title: Re: DFHack 0.43.03-r1
Post by: grendelfreak on September 19, 2016, 10:39:36 pm
I'm looking for a script/plugin (I don't know the difference) that allows Dwarves to get pregnant. Catsplosion does work but it is a bit too indiscriminate for my liking, being that allows babies to have their own babies - I would prefer it to be restricted to married Dwarves or at least adult.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on September 19, 2016, 11:08:34 pm
I'd also note that there are decent API docs for Lua, and none at all for Ruby.
Do I hear PE volunteering to take on a side project? :)

What gave you that idea? (https://github.com/DFHack/dfhack/issues?q=author%3Aperidexiserrant+label%3Adocumentation)

But seriously, no.  I don't know Ruby at all, and honestly I think Ruby support should be dropped in favor of improving Lua which is already much better.  Python was dropped years ago, and it's my favorite language!
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on September 19, 2016, 11:25:37 pm
Did DFHack used to have plugins written in Python?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 20, 2016, 12:18:52 am
Scripts, yes. Back when it was out-of-process and really slow (using any language). Python support was lost with the transition to DFHack being in-process. It's not impossible to embed, as far as I know - I managed to get some simple I/O working with an embedded Python interpreter - but it's a lot of work to get to anything close to the Lua/Ruby APIs.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 20, 2016, 04:08:12 am
I meant ruby is friendlier than C++, not lua, lua is cuddly.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on September 20, 2016, 05:11:48 am
I meant ruby is friendlier than C++, not lua, lua is cuddly.
Well at least C++ is !!FUN!!
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on September 20, 2016, 12:51:10 pm
As an interesting side note, I wrote a Lua compiler a while ago that used syntax much closer to C or Go. It used curly brackets for blocks (curly brackets for tables still worked, the compiler can tell the difference), "&&" instead of "and", "!=" instead of "~=", it even had a "continue" keyword. All this and it still produced bytecode that would run on the standard Lua VM. Code quality generally exactly matched that produced by the standard Lua compiler, but there were a few cases where it was slightly worse due to me being lazy...

Unfortunately it was written in Go, so it would not be possible to use it with standard Lua without a total rewrite or using it as a stand-alone tool (not to mention the fact that the "load" function was something of an issue, as it still used standard Lua syntax).

The idea of the new syntax was to make it easier to work with for a programmer used to C/C++, C#, Java, Go, etc. It worked great, but I never bothered to write a C version and publish it...
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 20, 2016, 04:02:00 pm
I've heard of people adding operators to the lua interpreter before, so I imagine it wouldn't be too difficult to add those. Not sure about braces or "continue", though.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on September 20, 2016, 04:20:48 pm
Continue was trivial. All you needed to do was keep track of the end of the loop (which you need to do for "break" anyway). "continue" then becomes a jump to just before the end of loop instructions instead of "break"'s jump to just after. This has minor issues with variable scoping in one certain kind of loop, but there are solutions to that that I could have implemented if I had wanted something other than a toy. (my continue was basically a "goto" targeted at the end of the loop)

Braces were also easy, just replace "end" with "}" and consolidate all the block begin keywords ("then", "do", ect) to one, "{".

Mind this was an all new compiler, trying to modify the default Lua compiler would probably also work, but I am not terribly familiar with its internals.

Frankly it took me ~10 minutes to get braces and new operators working, continue was already implemented (but left unused) at the same time I wrote the code for break. C style comments were a little harder, as was a different syntax for multiline strings. I never bothered with ++ and --, but they would have been fairly easy.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 20, 2016, 04:28:23 pm
Oh, something I just realized is that we use the system Lua in Travis (mainly for syntax checks - yes, some scripts have actually failed those). We'd have to make a standalone interpreter as well if we wanted to make syntax changes. That's definitely possible, though - I tried doing that once, and the only issue I had was linking against and loading libdfhack successfully.
Title: Re: DFHack 0.43.03-r1
Post by: mifki on September 20, 2016, 04:30:25 pm
As an interesting side note, I wrote a Lua compiler a while ago that used syntax much closer to C or Go. It used curly brackets for blocks (curly brackets for tables still worked, the compiler can tell the difference), "&&" instead of "and", "!=" instead of "~=", it even had a "continue" keyword. All this and it still produced bytecode that would run on the standard Lua VM. Code quality generally exactly matched that produced by the standard Lua compiler, but there were a few cases where it was slightly worse due to me being lazy...

Unfortunately it was written in Go, so it would not be possible to use it with standard Lua without a total rewrite or using it as a stand-alone tool (not to mention the fact that the "load" function was something of an issue, as it still used standard Lua syntax).

The idea of the new syntax was to make it easier to work with for a programmer used to C/C++, C#, Java, Go, etc. It worked great, but I never bothered to write a C version and publish it...

What makes people write compiler for one non-standard (i.e. runtime not available by default) language in another one... :)
Other than that, it's very interesting, and I thought it was possible to make standalone binaries with Go, at least I've seen some tools distributed that way.

As for me, the main problem of Lua is still 1-based numbering which, when porting more or less complex algorithms, makes it easier to rewrite them from scratch to avoid mistakes than to simply change syntax as between other languages.
Title: Re: DFHack 0.43.03-r1
Post by: mifki on September 20, 2016, 04:36:27 pm
Continue was trivial. All you needed to do was keep track of the end of the loop (which you need to do for "break" anyway). "continue" then becomes a jump to just before the end of loop instructions instead of "break"'s jump to just after. This has minor issues with variable scoping in one certain kind of loop, but there are solutions to that that I could have implemented if I had wanted something other than a toy. (my continue was basically a "goto" targeted at the end of the loop)

What about this? http://stackoverflow.com/a/3526946/991806
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on September 20, 2016, 04:43:23 pm
Oh, I have a standalone compiler, but do you really want to have to compile your scripts before you can use them? Anyway, the compiler was to support the Go Lua VM I wrote for Rubble, so it made sense to write it in Go at the time :P

As for me, the main problem of Lua is still 1-based numbering which, for more or less complex algorithms, makes it easier to rewrite them from scratch to avoid mistakes than to simply change syntax as between other languages.

1 based indexing is an obvious example of massive brain damage... Hmmm... Maybe I should brush up my C skills some and write a language that takes all the best parts of Lua, but use C-like syntax, 0 based indexing, etc. The problem is, I already have too many projects.

What about this? http://stackoverflow.com/a/3526946/991806

Ironically I read that a few minutes before posting :) Look at the accepted workaround, goto a label named "continue", which is literally exactly what my compiler does. There are still problems with out of scope variables in poorly written repeat-until loops, but a simple compile-time check (the same one goto makes if I remember correctly) makes that an error.
Title: Re: DFHack 0.43.03-r1
Post by: Hesperid on September 20, 2016, 09:34:46 pm
1 based indexing is an obvious example of massive brain damage... Hmmm... Maybe I should brush up my C skills some and write a language that takes all the best parts of Lua, but use C-like syntax, 0 based indexing, etc. The problem is, I already have too many projects.

I think we've all had that idea once or twice whenever we stumble on Lua's many oddities. Lua's strengths are very impressive, and the clumsy and verbose syntax is the price you must pay for it. The real problem in writing your own Lualike language, because it applies even to people that don't have too many projects, is this: see you in 20 years when your single-developer language is mature and doesn't randomly glitch out/segfault. Oh you're finished? Well Lua's dead and now we're all using MontyPython, because all the VR devices have an integrated bytecode VM for it. There's your next homemade language dupe project. :P
Title: Re: DFHack 0.43.03-r1
Post by: heydude6 on September 21, 2016, 12:51:16 am
Just a quick question about the exterminate him command, but is there a way to make it select a target by receiving map coordinates rather than having to move my cursor over it? I kind of want to create a syndrome that automatically exterminates a unit after it gets infected with it and I can't have players willingly initiating the process.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on September 21, 2016, 02:26:40 am
Exterminate just removes all blood from the creature's system and makes them disappear in two ticks. Make a CE_BLEEDING syndrome with extremely high severity on all parts, that should be enough.
Title: Re: DFHack 0.43.03-r1
Post by: Williham on September 21, 2016, 08:17:31 am
1 based indexing is an obvious example of massive brain damage... Hmmm... Maybe I should brush up my C skills some and write a language that takes all the best parts of Lua, but use C-like syntax, 0 based indexing, etc. The problem is, I already have too many projects.

I think we've all had that idea once or twice whenever we stumble on Lua's many oddities. Lua's strengths are very impressive, and the clumsy and verbose syntax is the price you must pay for it. The real problem in writing your own Lualike language, because it applies even to people that don't have too many projects, is this: see you in 20 years when your single-developer language is mature and doesn't randomly glitch out/segfault. Oh you're finished? Well Lua's dead and now we're all using MontyPython, because all the VR devices have an integrated bytecode VM for it. There's your next homemade language dupe project. :P

Also, the language already exists:

They call it Squrrel. (http://"http://www.squirrel-lang.org/")
Title: Re: DFHack 0.43.03-r1
Post by: expwnent on September 21, 2016, 08:54:28 am
That looks great but in terms of how much good we can do for the project per hour of free time it's probably not worth it.
Title: Re: DFHack 0.43.03-r1
Post by: gchristopher on September 21, 2016, 04:54:30 pm
I'm investigating writing a script that calculates a artificial running "score" of a game as it progresses. I'd like it to display periodic updates on the current score, and persist a cumulative total for an in-game year across save/loads. So far I've got:

- I can start a script from onMapLoad*.init and do any needed cleanup from onMapUnload*.init. (That's the safest place to put something that should only run in Fortress mode?)
- I can use repeat to schedule a command to examine the site map/logs and calculate/report a score daily.

So far, so good. Is there any convenient way to save a value (like "current total score") that will persist across save/loads of a game?

I imagine that writing a value to an arbitrary file would be a gigantic security hole, but maybe it's possible anyway? I see there's a stockpiles plugin that (I think) delivers a .dll to deliver the file access functionality. I'd rather not get that fancy.

Failing that, I guess there's a lot of places in a saved game where you could stash a value somewhere it wouldn't hurt a running game. Maybe in some stat for a historical figure, or somewhere in the game raws as a non []-enclosed value that would be interpreted as a comment?

Does anyone have any advice on how to best save arbitrary data across game saves so the script can retrieve it on the next onMapLoad?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 21, 2016, 06:11:34 pm
onMapLoad*.init will run whenever any map is loaded, including in adventure mode. If you want your script to only work in fortress mode, you have to handle that in your script (e.g. check "dfhack.world.isFortressMode()").

The stockpiles plugin is self-contained. It doesn't distribute any other libraries. Perhaps you're thinking of protobuf, but that's included in DFHack, and DFHack uses it for most remote communication. Lua has decent enough file support for the kind of data you want to save, and there's also a Lua JSON library if you want that.

There's also the persistent storage API. I'm not too familiar with it, but it should be documented in the Lua API docs: http://dfhack.readthedocs.io/en/latest/docs/Lua%20API.html
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on September 21, 2016, 09:13:22 pm
I would personally just use the JSON API and use the site index as a key. There are some minor problems with saving (autosaves won't work), but that can be handled by just storing the scores by dates, saving the file whenever they're stored, then deleting any that happen after the current date. Make sure to store any keys as strings rather than integers, storing as integers will make the JSON API store it as an array even where that makes no sense (e.g. you're tracking units 2703 and 2704, so your JSON table has 2702 empty indices listed out before 2703).
Title: Re: DFHack 0.43.03-r1
Post by: TheKaspa on September 24, 2016, 02:43:45 am
Is there a pre-alpha for 43.05?
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on September 24, 2016, 11:47:34 am
Is there a pre-alpha for 43.05?
We've tried doubling the volunteers' pay ($0x2=$0), but it turns out that no one is slacking and it's just taking a long time.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 24, 2016, 12:02:28 pm
I've also been busier than normal and haven't had as much time to work on DFHack as I would've liked.

Part of the issue is that some offsets still aren't located (partly because there are 6 builds now instead of 3, although the real issue is that finding 64-bit offsets is harder since we have to update some tools we were using). That would definitely block a stable release, but I guess it's not too bad for an alpha release. We've released early builds without some offsets before, anyway.

Title: Re: DFHack 0.43.03-r1
Post by: Quietust on September 24, 2016, 01:12:28 pm
finding 64-bit offsets is harder since we have to update some tools we were using
In some cases, that isn't even possible - for example, I've been using IDA demo/free versions on Windows for 32-bit DF, but the only versions of IDA that support 64-bit binaries cost over $1000 for a single license, and most other tools don't even come anywhere close in terms of functionality and usability.
Title: Re: DFHack 0.43.03-r1
Post by: SalmonGod on September 25, 2016, 03:28:16 pm
This is super sad, and I would donate money to the cause if I could.  It's very difficult to go back to playing DF without the basic set of DFHack and Therapist tools.
Title: Re: DFHack 0.43.03-r1
Post by: zeves on September 25, 2016, 06:33:08 pm
yes it wouldnt be so bad if we only had 50 dwarves, but with new hardware in place and the map bigger than ever, 200 dwarves seem quite difficult  to manage manually.
Title: Re: DFHack 0.43.03-r1
Post by: nuker22110 on September 25, 2016, 07:51:21 pm
when using catsplosion list, the command shows animals that have already been slaughtered. When does the count reset? Also, I penned my falcons into a room with nestboxes and ran the catsplosion bird_falcon_peregrine and it just says pregnancies accelerated or something, but nothing happens? they dont immediately lay more eggs
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on September 25, 2016, 07:54:48 pm
when using catsplosion list, the command shows animals that have already been slaughtered. When does the count reset? Also, I penned my falcons into a room with nestboxes and ran the catsplosion bird_falcon_peregrine and it just says pregnancies accelerated or something, but nothing happens? they dont immediately lay more eggs
I don't think egg layers are ever really pregnant, in that they have a separate egg timer.  Fiddling with the pregnancy flags probably won't work, and if it did it might lead to live birth.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 25, 2016, 08:43:54 pm
finding 64-bit offsets is harder since we have to update some tools we were using
In some cases, that isn't even possible - for example, I've been using IDA demo/free versions on Windows for 32-bit DF, but the only versions of IDA that support 64-bit binaries cost over $1000 for a single license, and most other tools don't even come anywhere close in terms of functionality and usability.
I assume you may already know about: https://github.com/radare/radare2 but it has no gui or anything, though it does have some documentation: https://radare.gitbooks.io/radare2book/content/ it seems.

Hopper seems to have several people saying it is a close runner up to IDA, and is like 1/10th the price: https://www.hopperapp.com/ though weirdly I only see linux/osx versions?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 25, 2016, 10:34:17 pm
Regarding Hopper, that would be because it's described as "The OS X and Linux Disassembler".

I've tried using radare2, but haven't been very successful with it, partly because I'm not really familiar with disassembly. (There's not that much you strictly need it for, besides finding globals and a few other things, but it can be really helpful for things like tracking down structure changes by analyzing save/load code.)
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 26, 2016, 12:51:21 am
Yeah, and IDA is a much broader tool than just a disassembler. Anybody wanna throw money at a license who isn't broke as a joke?
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on September 26, 2016, 12:57:31 am
We've tried doubling the volunteers' pay ($0x2=$0), but it turns out that no one is slacking and it's just taking a long time.
My brain parses this as:
Code: (MIPS Assembly) [Select]
addi $2,$0,0                                               # Register2 = 0
(You probably can't use hexadecimal for registers, I assume.)

I think I've gone too far down the rabbit hole.
Title: Re: DFHack 0.43.03-r1
Post by: nuker22110 on September 26, 2016, 01:15:41 am
when using catsplosion list, the command shows animals that have already been slaughtered. When does the count reset? Also, I penned my falcons into a room with nestboxes and ran the catsplosion bird_falcon_peregrine and it just says pregnancies accelerated or something, but nothing happens? they dont immediately lay more eggs
I don't think egg layers are ever really pregnant, in that they have a separate egg timer.  Fiddling with the pregnancy flags probably won't work, and if it did it might lead to live birth.

is there a way then to use dfhack to make egg layers instant lay and instant hatch?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 26, 2016, 01:23:08 pm
Progress! Quietust figured out why DFHack was crashing on startup with 64-bit Windows DF (I'm not quite sure how it was working before), so now it's not completely broken there anymore. Basically, vmethod interposing was failing to handle a certain case new to x64 and calling abort() before DFHack had a chance to set up stderr.log, so the error message wasn't visible.

If anyone wants to test 64-bit DFHack on Windows, it should at least be possible now. (It's been working for me on OS X/Linux, for anyone who's wondering, and I expect 32-bit Windows is okay too.)
Title: Re: DFHack 0.43.03-r1
Post by: Greiger on September 26, 2016, 01:24:12 pm
Woooooooooooooooooooooooo!

That is excellent news!  Good job Quietust!  I will name my next adventurer after you!
Title: Re: DFHack 0.43.03-r1
Post by: gchristopher on September 26, 2016, 01:44:10 pm
Has Toady ever expressed interest in making it somehow easier to maintain the offsets for tools like this? (Ignorant speculation: it seems like if the main goal is to know where in memory a bunch of structures are, it wouldn't be that hard for him to put in a [PRINTOFFSETS] in an init file and then have DF spit out the & memory addresses of the data structures of interest?)

DF isn't nearly as a viable game without the third party tools. The conversation of begging Toady for help must have already happened?
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on September 26, 2016, 01:56:27 pm
(Ignorant speculation: it seems like if the main goal is to know where in memory a bunch of structures are, it wouldn't be that hard for him to put in a [PRINTOFFSETS] in an init file and then have DF spit out the & memory addresses of the data structures of interest?)
It probably wouldn't be an init setting - more likely, it would be a command-line parameter, and it would actually be quite simple to write (something like printf("gps: %x\n", &gps + base_addr); for each global variable we care about, and we currently track just over 120, and most of them can be found automatically). Whether or not it will actually happen, though, is entirely up to Toady, and I don't believe any of us have directly asked for that sort of functionality simply because our own tools were good enough to do it without his help.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on September 26, 2016, 02:14:01 pm
So is the develop branch of DFhack mostly working with v0.43.05 of Dwarf Fortress now? Is all that's left to do to test it for bugs?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 26, 2016, 02:20:22 pm
(Ignorant speculation: it seems like if the main goal is to know where in memory a bunch of structures are, it wouldn't be that hard for him to put in a [PRINTOFFSETS] in an init file and then have DF spit out the & memory addresses of the data structures of interest?)
In addition to what Quietust said, some of our tools can work on all DF binaries without having to run them, which is nice for people that can't run all of them (although there are also scans for some globals that do require running DF already, so it wouldn't really add extra requirements).
Title: Re: DFHack 0.43.03-r1
Post by: userpay on September 26, 2016, 02:40:15 pm
I probably wouldn't mind testing if someone sent me a precompiled new version and a list of what is wanted to be testing...
Title: Re: DFHack 0.43.03-r1
Post by: Cruxador on September 26, 2016, 03:05:29 pm
There's a decent availability of IDA Pro copies fallen off the back of a truck. Seems like the problem isn't too hard to solve if you're not overly burdened by moral compunctions.
Has Toady ever expressed interest in making it somehow easier to maintain the offsets for tools like this? (Ignorant speculation: it seems like if the main goal is to know where in memory a bunch of structures are, it wouldn't be that hard for him to put in a [PRINTOFFSETS] in an init file and then have DF spit out the & memory addresses of the data structures of interest?)
His initial reaction when DFhack first was created was to get upset and try to shut it down. Since then he's realized it's not really such a problem, but Toady is not very comfortable with giving other people increased access to his codebase.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 26, 2016, 11:28:17 pm
Another announcement of sorts:

It turns out Ruby 1.8 (which we use) doesn't actually compile for 64-bit Windows, at least not without techniques that nobody has investigated. Ruby 2+ would compile, but I don't know if it would work, so I'm waiting on jjyg for that.

Besides that, I can't think of any major blockers for a pre-release (there are some for a stable release). Do note that if we did put up a build now, no ruby scripts would work at all in the 64-bit Windows build. (I suppose now would be a good time to convert "multicmd" to a built-in command, before that becomes an issue.)
Title: Re: DFHack 0.43.03-r1
Post by: SalmonGod on September 26, 2016, 11:59:50 pm
I really just need prospect and therapist before I can play again without it feeling like a chore.  Never really messed with anything else much, except for cleanmap on occasion for FPS reasons... that shouldn't be as much of an issue with 64-bit, I think?
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on September 27, 2016, 12:21:42 am
For FPS reasons, it's still important.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 27, 2016, 01:21:45 am
64-bit builds don't magically make performance issues go away. A new compiler with different settings might, which could be what people are talking about on the forums, and there could be slight speed improvements with a 64-bit build, but generally not significant ones compared to what could be done by rewriting bits of DF (in cases where that could help).
Title: Re: DFHack 0.43.03-r1
Post by: SalmonGod on September 27, 2016, 01:34:30 am
Hmm... haven't been looking recently, but when 64-bit was first released, I thought I saw reports of much better performance on larger embarks or world histories.  I thought that would likely expand to an older fortress' accumulated junk.
Title: Re: DFHack 0.43.03-r1
Post by: userpay on September 27, 2016, 01:46:51 am
I'm curious how many of the scripts/utilities for DFHack are Ruby based? Mostly ever used DFHack for Therapist but then that was also quite a few years back (recently came back around) and I get the feeling there's all kinds of new goodies to explore with DFHack.
Title: Re: DFHack 0.43.03-r1
Post by: expwnent on September 27, 2016, 01:54:48 am
There's a decent availability of IDA Pro copies fallen off the back of a truck. Seems like the problem isn't too hard to solve if you're not overly burdened by moral compunctions.

I believe the last time it was brought up Quietust was concerned about viruses.
Title: Re: DFHack 0.43.03-r1
Post by: expwnent on September 27, 2016, 01:58:32 am
His initial reaction when DFhack first was created was to get upset and try to shut it down. Since then he's realized it's not really such a problem, but Toady is not very comfortable with giving other people increased access to his codebase.

That was splash damage when someone was working on a "visualizer" for DF who intended to reverse-engineer it and make his own version. He contacted Peterix and Toady banned both, then unbanned Peterix after they talked about it. Nobody smart enough to reverse-engineer Dwarf Fortress is dumb enough to think they can out DF Toady. I don't have a link but someone else might.
Title: Re: DFHack 0.43.03-r1
Post by: riffraffselbow on September 27, 2016, 02:12:31 am
Is there a pre-alpha for 43.05?
We've tried doubling the volunteers' pay ($0x2=$0), but it turns out that no one is slacking and it's just taking a long time.
I wonder if a paypal bounty fund would help or hurt the process; competitive secrecy vs motivation.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on September 27, 2016, 02:20:41 am
His initial reaction when DFhack first was created was to get upset and try to shut it down. Since then he's realized it's not really such a problem, but Toady is not very comfortable with giving other people increased access to his codebase.

That was splash damage when someone was working on a "visualizer" for DF who intended to reverse-engineer it and make his own version. He contacted Peterix and Toady banned both, then unbanned Peterix after they talked about it. Nobody smart enough to reverse-engineer Dwarf Fortress is dumb enough to think they can out DF Toady. I don't have a link but someone else might.

http://www.bay12forums.com/smf/index.php?topic=58796.0

I think I picked up some lingering discomfort regarding the nature of DFHack; I remember the phrase "slippery slope" coming up in conversation at Dwarfmoot? DFHack as it is now he's fine with, certainly (otherwise it wouldn't be here).

Is there a pre-alpha for 43.05?
We've tried doubling the volunteers' pay ($0x2=$0), but it turns out that no one is slacking and it's just taking a long time.
I wonder if a paypal bounty fund would help or hurt the process; competitive secrecy vs motivation.

The hell is "competitive secrecy"?
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on September 27, 2016, 02:26:12 am
Does "visualizer" mean things like Stonesense and Armok Vision?
Title: Re: DFHack 0.43.03-r1
Post by: Hesperid on September 27, 2016, 02:31:10 am
Is there a pre-alpha for 43.05?
We've tried doubling the volunteers' pay ($0x2=$0), but it turns out that no one is slacking and it's just taking a long time.
I wonder if a paypal bounty fund would help or hurt the process; competitive secrecy vs motivation.

It would probably "help" to achieve something but not necessarily what you're aiming for. Who would it pay out to and upon what conditions?
Title: Re: DFHack 0.43.03-r1
Post by: Rose on September 27, 2016, 02:41:22 am
Does "visualizer" mean things like Stonesense and Armok Vision?

He and peterix were working on Khazad, which was a very early visualizer, similar to Armok Vision.

Then he decided to start his own project, an open-source DF, that will be better in every way, and everybody should join the project and leave DF, and anybody who continues to support a closed-source DF is stupid and yadda yadda.

That's when he got banned.

He still occasionally tries to recruit me over skype.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on September 27, 2016, 02:52:04 am
That was splash damage when someone was working on a "visualizer" for DF who intended to reverse-engineer it and make his own version. He contacted Peterix and Toady banned both, then unbanned Peterix after they talked about it. Nobody smart enough to reverse-engineer Dwarf Fortress is dumb enough to think they can out DF Toady. I don't have a link but someone else might.

http://www.bay12forums.com/smf/index.php?topic=58796.0

I think I picked up some lingering discomfort regarding the nature of DFHack; I remember the phrase "slippery slope" coming up in conversation at Dwarfmoot? DFHack as it is now he's fine with, certainly (otherwise it wouldn't be here).

Wow, that's a really old thread. I'm glad they decided to let Peterix back in.

I wonder if a paypal bounty fund would help or hurt the process; competitive secrecy vs motivation.

The hell is "competitive secrecy"?

If there are bounties on the DFHack bugs, then DFHack devs might stop collaborating with each other so that they can be the first to solve the bugs.


He and peterix were working on Khazad, which was a very early visualizer, similar to Armok Vision.

Then he decided to start his own project, an open-source DF, that will be better in every way, and everybody should join the project and leave DF, and anybody who continues to support a closed-source DF is stupid and yadda yadda.

That's when he got banned.

He still occasionally tries to recruit me over skype.

I remember Peterix talking about Khazad. http://www.bay12forums.com/smf/index.php?topic=139553.msg7143260#msg7143260
Title: Re: DFHack 0.43.03-r1
Post by: expwnent on September 27, 2016, 03:49:57 am
It would also be unclear how to split the money if there's a collaborative effort.
Title: Re: DFHack 0.43.03-r1
Post by: mifki on September 27, 2016, 05:06:51 am
I believe at this point the reason for the absence of a release is that the team is being cautious and not willing to make a release until all platforms are equally supported.

Indeed, there are some difficulties because of the new compiler and 64 bits - old tools are not working, some people are away and could not fix them (the ones that are fixable). I made some scripts to find offsets for osx and win64, and then we were fixing issues with data structures, and as I understand, they should be more or less ok. However offsets for some other platforms/bitnesses are less complete. I can probably write scripts for linux64 if needed, but I'm not interested in doing any 32bit work (my opinion is that we should drop 32bit support to make our lives easier). As I understand, scripts that allowed to automatically check data structures are not working anymore as well, so we don't know if the structures are ok until some plugin crashes. Also, it would be good to understand whether we're waiting for jj to fix Ruby scripts, or willing to move on with something else.

Anyway, I personally think some alpha version for osx/win64 could be released now. Or are there are any specific (missing/broken) things that holding off the release?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 27, 2016, 06:03:54 am
God damn I am sharp as a brick sometimes.

So, ccmake specifically has an option to pick which arch you are building for, I looked at it and saw it said 32, but didn't realize I should change it to 64 until after getting linux successfully built and seeing "hack/libdfhack.so wrong ELFCLASS" pop up.

Double edit: it works! Still missing certain addresses (df.global.ui_advmode among them) but hey!
Hmm... haven't been looking recently, but when 64-bit was first released, I thought I saw reports of much better performance on larger embarks or world histories.  I thought that would likely expand to an older fortress' accumulated junk.
That was me. I tested the same exact world-gen/seed/everything except on 32 and 64 bit.

I ran them both for three minutes and tracked info about their progress.
Code: [Select]
32 bit started: 11:21:30, hit stop 11:24:30, finished 11:24:45 on year 184.
32 bit pops:
>56349 Dwarves
>30427 Humans
>48514 Elves
>11572 Goblins
>3913 Kobolds
>Total: 150775

64 bit started: 11:27:30, hit stop 11:30:30, finished 11:30:36 on year 186.
64 bit pops:
>59593 Dwarves
>33106 Humans
>42689 Elves
>12330 Goblins
>10884 Kobolds
>Total: 158602

Then I did two runs for 300 years and checked how long it took them.
Code: [Select]
test64 start: 10:38:30, stop: 10:54:01, finished: 10:54:34 (year 300), 16:04 total worldgen
64 bit pops:
>60553 Dwarves
>32485 Humans
>51199 Elves
>36119 Goblins
>5738 Kobolds
>Total: 186094

test32 start: 10:56:30, target: 11:12:01 (year 286),stop: 11:13:24, finish: 11:14:05 (year 300), 18:05 total worldgen
32 bit pops:
>54795 Dwarves
>28097 Humans
>45384 Elves
>27181 Goblins
>8280 Kobolds
>Total: 163737
So in summary, 64 bit world-gen reaches the same year earlier, despite having significantly higher populations (23k+ in the 300 year test), responds faster to the stop signal, and takes longer to slow down as badly as the 32 bit world-gen.

This isn't directly applicable to fort mode, but world-gen is one of the most extreme examples of lag you usually encounter outside of like century old megaproject forts or 10k+ goblins and 100k trolls/beak dogs in a dark fort while you collapse it in adventurer mode, and it was easier to quantify the difference due to the bitness change.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 27, 2016, 08:12:46 am
Anyway, I personally think some alpha version for osx/win64 could be released now. Or are there are any specific (missing/broken) things that holding off the release?
Mainly offsets (different ones on different platforms, but I think all of them are missing debug flags, and 64-bit Linux and Windows are missing more). It's not a deal-breaker for an alpha release, probably, as long as people realize what's missing.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 27, 2016, 08:47:39 am
Yeah, the unit all/active/bad lists aren't populated yet, ui_advmode isn't known, cur_season, created_item_* globals, various others.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on September 27, 2016, 11:28:14 am
That was me. I tested the same exact world-gen/seed/everything except on 32 and 64 bit.

Max™, your tests were done with the 32-bit and 64-bit builds of Dwarf Fortress v0.43.05, right? You weren't using Dwarf Fortress v0.43.03 as the 32-bit version, were you?


I'm not interested in doing any 32bit work (my opinion is that we should drop 32bit support to make our lives easier).uld be released now. Or are there are any specific (missing/broken) things that holding off the release?

Yeah, keeping DFHack up-to-date seems like enough work as it is without having to support double versions. The legacy version of Dwarf Fortress isn't supported by DFHack either, so there's precedence for not supporting everything. I'm kind of surprised that new machines are still being shipped with 32-bit Windows, though. Someone had trouble getting Dwarf Fortress running on his Windows 8.1 tablet (https://www.reddit.com/r/dwarffortress/comments/52z8n0/biweekly_df_questions_thread/d7s7hx9), and it turned out he needed the 32-bit version of Dwarf Fortress.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 27, 2016, 12:17:50 pm
It was the same versions, 43.04/43.04 for both and I've had similar results but didn't do exactly the same tests with 43.05.


Hmmm, I was able to get edb running with df and poked around trying to figure out what the hell all this stuff is.

Code: [Select]
[Analyzer] determining function types...
[Analyzer] complete
[Analyzer] elapsed: 830 ms
[Analyzer] region unchanged, using previous analysis
[Analyzer] elapsed: 2 ms
[Analyzer] region unchanged, using previous analysis
[Analyzer] elapsed: 1 ms
[Analyzer] identifying executable headers...
[Analyzer] adding entry points to the list...
[Analyzer] found entry point: 0x408ef6
[Analyzer] attempting to add 'main' to the list...
No main symbol found, calculated it to be  "00000000004050c0"  using heuristic
[Analyzer] attempting to add functions with symbols to the list...
[Analyzer] attempting to add marked functions to the list...
[Analyzer] attempting to collect functions with fuzzy analysis...
I couldn't find 0x408ef6 in https://github.com/DFHack/df-structures/blob/master/symbols.xml but I have no idea if that means anything unfortunately, just going by the stuff that I could figure out, I tried to point it at something in the stack which mentioned the keybind for move cursor left, and trace that back to the start of the function a couple times after hitting said key but it froze up when I was trying to analyze the parent I think.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 27, 2016, 03:01:49 pm
We will not drop 32-bit support. It's really, really, really useful for memory research. Yes, once 64-bit support is entirely stable, 32-bit support will probably be a lower priority, and might not be complete in later releases, but taking it out is just asking for trouble. Example: we ran into difficult-to-diagnose issues in both the DFHack core and structures because people decided to start developing right away with 64-bit DF only.

Yeah, the unit all/active/bad lists aren't populated yet, ui_advmode isn't known, cur_season, created_item_* globals, various others.
On what build and OS? Those are part of world, so if they're empty and shouldn't be, that's an issue with world's address or layout.

The legacy version of Dwarf Fortress isn't supported by DFHack either, so there's precedence for not supporting everything.
Yeah, but that's not the same thing at all. The legacy version does not use SDL, which DFHack requires in order to hook in. Also, the legacy and SDL versions are otherwise identical besides the rendering engine they use, which isn't true of the 32/64-bit difference.

Edit: That is, barring weird hardware issues, people should be able to run the SDL and legacy builds on the same machine+OS, which isn't true of the 32 and 64-bit builds.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 27, 2016, 03:09:38 pm
Oh, sorry, Arch Linux, df 43.05 dfhack dev branch.
Code: [Select]
Plugin isoworldremote is missing required globals: cur_season
Plugin strangemood is missing required globals: created_item_count, created_item_type, created_item_subtype, created_item_mattype, created_item_matindex
Plugin sort is missing required globals: ui_building_assign_type, ui_building_assign_is_marked, ui_building_assign_units, ui_building_assign_items
Plugin search is missing required globals: ui_building_assign_units, ui_look_list
Plugin rendermax is missing required globals: cur_year_tick
Plugin zone is missing required globals: cur_year_tick, ui_building_assign_type, ui_building_assign_is_marked, ui_building_assign_units, ui_building_assign_items
Plugin jobutils is missing required globals: job_next_id
Plugin workflow is missing required globals: job_next_id
Could not activate tweak fast-heat (fast_heat_hook::updateTempFromMap)
Could not activate tweak fast-heat (fast_heat_hook::updateTemperature)
Could not activate tweak fast-heat (fast_heat_hook::adjustTemperature)
Cannot enable plugin: search
multilevel is not a recognized command.
DFHack is ready. Have a nice day!
DFHack version 0.43.05-alpha0 (development build 0.43.03-r1-160-g714ba1a)
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]
# gui/gm-editor df.global.ui_advmode
[string "expression"]:1: Cannot read field global.ui_advmode: global address not known.
stack traceback:
        [C]: in metamethod '__index'
        [string "expression"]:1: in main chunk
        (...tail calls...)
        /home/thefunk/.df/hack/scripts/gui/gm-editor.lua:535: in local 'f'
        ./hack/lua/dfhack.lua:562: in function 'dfhack.run_script_with_env'
        (...tail calls...)
[DFHack]#

I could pull up gui/gm-editor df.ui_advmode but not df.global.ui_advmode, was it moved above the global table or something?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 27, 2016, 03:14:23 pm
df.ui_advmode is the type, df.global.ui_advmode is the instance.

Strange, I'm pretty sure world.units was working for me on OS X (both builds), which should be the same layout-wise as Linux.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 27, 2016, 03:17:02 pm
Just posted the output, and world.units itself is there, but none of the entries were populated, but it might have been my error, I just checked and cleaned everything out to make sure it was all fresh from the dev branch and whatnot and now units is populated right, but the ui_advmode is still not known.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 27, 2016, 04:04:37 pm
Okay, glad to hear units looks okay. ui_advmode is missing because nobody has located it.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 27, 2016, 04:05:25 pm
Yar, also, what is that animal hospitals thing? I can't find it anywhere to kill the message.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 27, 2016, 04:12:51 pm
dwarfvet? What is "the" message?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on September 27, 2016, 04:23:49 pm
Every time you enter or leave travel mode: 'Clearing all animal hospitals' pops up, yeah, that fixed it.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on September 28, 2016, 03:14:14 am
Another announcement of sorts:

It turns out Ruby 1.8 (which we use) doesn't actually compile for 64-bit Windows, at least not without techniques that nobody has investigated. Ruby 2+ would compile, but I don't know if it would work, so I'm waiting on jjyg for that.

Besides that, I can't think of any major blockers for a pre-release (there are some for a stable release). Do note that if we did put up a build now, no ruby scripts would work at all in the 64-bit Windows build. (I suppose now would be a good time to convert "multicmd" to a built-in command, before that becomes an issue.)

Hmm.  Just to float the idea, what are the arguments for and against dropping Ruby support?

Keep Ruby:  seriously, it's fine.  Why break what works?  People actually do use it!

Drop Ruby:
To be clear, I'm not proposing that we should drop Ruby support because it's run into a problem here - it's because Ruby has been a second-class scripting language in DFHack for some time now, the total absence of documentation is annoying me, and it makes supporting other things (eg unifying in-console help) more difficult.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on September 28, 2016, 03:42:19 am
Another announcement of sorts:

It turns out Ruby 1.8 (which we use) doesn't actually compile for 64-bit Windows, at least not without techniques that nobody has investigated. Ruby 2+ would compile, but I don't know if it would work, so I'm waiting on jjyg for that.

Besides that, I can't think of any major blockers for a pre-release (there are some for a stable release). Do note that if we did put up a build now, no ruby scripts would work at all in the 64-bit Windows build. (I suppose now would be a good time to convert "multicmd" to a built-in command, before that becomes an issue.)

Hmm.  Just to float the idea, what are the arguments for and against dropping Ruby support?

Keep Ruby:  seriously, it's fine.  Why break what works?  People actually do use it!

Drop Ruby:
  • No API documentation at all
  • Relatively poor structures API (I think?  Hard to tell when there's no docs...)
  • Standardising on Lua would free up developer resources
  • Fewer scripts - there are 190 .lua and 38 .rb files in the dfhack repo; 147 to 28 in the scripts repo.
  • Fixing and maintaining Ruby support might be a similar amount of work to dropping it and a one-off porting effort; especially if fixing it involves a useful degree of documentation.
  • It makes tooling more difficult (number of languages installed, cases for build systems, docs support, etc) for developers and deters new contributors.
To be clear, I'm not proposing that we should drop Ruby support because it's run into a problem here - it's because Ruby has been a second-class scripting language in DFHack for some time now, the total absence of documentation is annoying me, and it makes supporting other things (eg unifying in-console help) more difficult.
The biggest issue (at least as i understand it) is that the wrapper for lua is mostly automatically generated from layouts. While the ruby wrapper is handcrafted to some extent. Ideal case would be extending lua wrapper generation to support other languages.
That being said - never liked ruby :D (well except those few experimentation weeks long time ago, but we all were young... :D )
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on September 28, 2016, 03:44:56 am
Hmm.  Just to float the idea, what are the arguments for and against dropping Ruby support?
Is it Ruby support that's keeping us back on VS2010 for Windows? Edit: Or is the compile page (https://dfhack.readthedocs.io/en/latest/docs/Compile.html#windows) just out of date with respect to 64-bit DF?

I've been meaning to try my hand at compiling DFHack (and possibly finding offsets,) but I don't really want to deal with any issues installing VS2010 over VS2013.
Title: Re: DFHack 0.43.03-r1
Post by: mifki on September 28, 2016, 03:52:00 am
Hmm.  Just to float the idea, what are the arguments for and against dropping Ruby support?
Is it Ruby support that's keeping us back on VS2010 for Windows? Edit: Or is the compile page (https://dfhack.readthedocs.io/en/latest/docs/Compile.html#windows) just out of date with respect to 64-bit DF?

I've been meaning to try my hand at compiling DFHack (and possibly finding offsets,) but I don't really want to deal with any issues installing VS2010 over VS2013.

43.05 requires VS2015 - not 2010 and not 2013. It's not related to Ruby support. The problem with Ruby is that the code contains some assembly language parts which are not supported by VS compiler on 64bit.
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on September 28, 2016, 04:17:52 am
The problem with Ruby is that the code contains some assembly language parts which are not supported by VS compiler on 64bit.
The only assembly code I see in plugins/ruby is in ruby.cpp:
Code: [Select]
#ifdef WIN32
__declspec(naked) static int raw_vcall(void *that, void *fptr, unsigned long a0,
        unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5)
{
    // __thiscall requires that the callee cleans up the stack
    // here we dont know how many arguments it will take, so
    // we simply fix esp across the funcall
    __asm {
        push ebp
        mov ebp, esp

        push a5
        push a4
        push a3
        push a2
        push a1
        push a0

        mov ecx, that

        call fptr

        mov esp, ebp
        pop ebp
        ret
    }
}

Which (I think) we would just add:
Code: [Select]
#else
#ifdef WIN64
__declspec(naked) static int raw_vcall(void *that, void *fptr, unsigned long a0,
        unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5)
{
    // __thiscall requires that the callee cleans up the stack
    // here we dont know how many arguments it will take, so
    // we simply fix rsp across the funcall
    __asm {
        push rbp
        mov rbp, rsp

        push a5
        push a4
        push a3
        push a2
        push a1
        push a0

        mov rcx, that

        call fptr

        mov rsp, rbp
        pop rbp
        ret
    }
}
Although, I'm not really sure what this function "raw_vcall" is doing, or why the function at fptr wants a pointer to "that" in the CX register (conventionally the 4th parameter, after DI, SI, DX.)
That means we'd be calling fptr(void *that, void *fptr, unsigned long a0, void *that, ...) if fptr were a C function (which I'm now doubting.)
Should the 64-bit version be using unsigned long long ints? Are long ints upgraded automatically on the 64-bit compiler?
Title: Re: DFHack 0.43.03-r1
Post by: mifki on September 28, 2016, 05:10:59 am
Which (I think) we would just add:

MSVC compiler does not support __asm when compiling for 64bit.
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on September 28, 2016, 05:51:55 am
Which (I think) we would just add:
MSVC compiler does not support __asm when compiling for 64bit.
So you'd have to assemble separately and use extern, if that's even possible with DF?

Or could you use these: https://msdn.microsoft.com/en-us/library/hh977022.aspx (https://msdn.microsoft.com/en-us/library/hh977022.aspx)?
Title: Re: DFHack 0.43.03-r1
Post by: mifki on September 28, 2016, 06:28:21 am
Which (I think) we would just add:
MSVC compiler does not support __asm when compiling for 64bit.
So you'd have to assemble separately and use extern, if that's even possible with DF?

Or could you use these: https://msdn.microsoft.com/en-us/library/hh977022.aspx (https://msdn.microsoft.com/en-us/library/hh977022.aspx)?

Yep, it's not a real inline assembly, but just a naked fn, so should be possible to move it to external source.

However, I just noticed lethosor mentioned compiling Ruby itself 1.8 vs 2 for 64bit, I don't know what problems there.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 28, 2016, 05:39:51 pm
The ruby plugin should compile on 64-bit Windows since this change: https://github.com/DFHack/dfhack/commit/9da2dcb8a26f7d953ea73a0c0e85ed370f900c8e

Bumber: you're obviously looking at the master branch, while you should be looking at the develop branch. Specifically, the existing "#else" clause should work on Win64, according to Qartar.

The problem is that Ruby itself (before version 2) did not support 64-bit Windows at all. Even if the ruby plugin works, the interpreter will not, so the plugin is useless until we can get Ruby 2 working (possibly not too hard) or Ruby 1.8 working (which could be impossible).

Hmm.  Just to float the idea, what are the arguments for and against dropping Ruby support?

Keep Ruby:  seriously, it's fine.  Why break what works?  People actually do use it!

Drop Ruby:
  • No API documentation at all
  • Relatively poor structures API (I think?  Hard to tell when there's no docs...)
The structures API is just as good as Lua's (otherwise it would be pretty useless). The way it's implemented makes it somewhat slower when you try to do certain things, from what I remember from BenLubar's projects, but that's not something that would be explained in detail in the API docs anyway.
Quote
  • Standardising on Lua would free up developer resources
Yes, once we rewrite everything in Ruby, which is not a small task.
Quote
  • Fewer scripts - there are 190 .lua and 38 .rb files in the dfhack repo; 147 to 28 in the scripts repo.
I got 42 to 11 on the develop branch (https://github.com/DFHack/dfhack/find/develop). It's worth noting that those are all libraries, so all that means is that the parts of the Lua API written in Lua are more comprehensive and/or split into more files.

Yes, Ruby scripts outnumber Lua scripts, but C++ plugin files (244) outnumber both of them combined.
Quote
  • Fixing and maintaining Ruby support might be a similar amount of work to dropping it and a one-off porting effort; especially if fixing it involves a useful degree of documentation.
Ruby 2 shouldn't be too much harder to get working. It just requires enough familiarity with the Ruby interpreter to fix whatever issues come up, which I don't have.
Quote
  • It makes tooling more difficult (number of languages installed, cases for build systems, docs support, etc) for developers and deters new contributors.
Developers do not have to install Ruby, or Lua, at all. Both of those interpreters are bundled with DFHack.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 28, 2016, 06:17:00 pm
Well, I dropped in the system Ruby 2 library on OS X, made a change from https://github.com/DFHack/dfhack/issues/271#issuecomment-152553877, and "multicmd" works now. "exterminate" crashes on the title screen in 64-bit DF, though, but not in 32-bit DF, which is a bit promising.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on September 28, 2016, 08:38:12 pm
Cool, thanks for the detailed response.  Let's keep Ruby!

(you *do* need Ruby and Lua to run the complete test suite, for syntax checking)
Title: Re: DFHack 0.43.03-r1
Post by: gchristopher on September 29, 2016, 06:44:36 pm
FWIW, Toady had a pretty friendly response to a question that (as a non-contributor to DFHack or Therapist) was really none of my business.

Quote from: gchristopher
Would you consider making the lives of the DFHack and other tool creators easier somehow? It seems like if Dwarf Fortress had an init or command line option where it would print out the memory address/offsets of all the key structures, then the community would be on much easier footing to quickly catch up to DF releases. That wouldn't expose any proprietary code or be nearly the effort of implementing a full mod API, since all you'd need to add is print statements for requested structure memory addresses, right?

There have been conversations along these lines over the years, though it has been a while on this particular matter.  Utility people can and do PM me.  I really don't recall where it was left last time it came up, or if it was decided that finding memory addresses was the fun part?

Title: Re: DFHack 0.43.03-r1
Post by: mifki on September 29, 2016, 06:56:38 pm
FWIW, Toady had a pretty friendly response to a question that (as a non-contributor to DFHack or Therapist) was really none of my business.

Quote from: gchristopher
Would you consider making the lives of the DFHack and other tool creators easier somehow? It seems like if Dwarf Fortress had an init or command line option where it would print out the memory address/offsets of all the key structures, then the community would be on much easier footing to quickly catch up to DF releases. That wouldn't expose any proprietary code or be nearly the effort of implementing a full mod API, since all you'd need to add is print statements for requested structure memory addresses, right?

There have been conversations along these lines over the years, though it has been a while on this particular matter.  Utility people can and do PM me.  I really don't recall where it was left last time it came up, or if it was decided that finding memory addresses was the fun part?

That's interesting. I asked Toady some questions via PM, including one like this, some time ago, but at some point he didn't answer and I decided that reminding again was a bad idea. I will reconsider.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on September 30, 2016, 11:32:36 am
"finding memory addresses was the fun part"? What planet does he live on?

In other news: I have discovered that "dfhack.gui.makeAnnouncement" (and a few related functions) do not work. The problem is that no matter what you pass for the position argument it will be the wrong type. I have implemented this function completely in Lua as a workaround, so a fix is no big deal for me, but others may want to use this function someday... Anyway, I'm off to file a bug report so this won't be forgotten.

For reference, this is my replacement:
Code: [Select]
-- dfhack.gui.makeAnnouncement does not work. The problem lies in assigning the position, no matter what you pass
-- for the position it fails to work.
--dfhack.gui.makeAnnouncement(df.announcement_type.CANCEL_JOB, df.announcement_flags.D_DISPLAY, unit.pos, msg, COLOR_LIGHTRED)

-- The following is the above function reimplemented (more-or-less faithfully) in Lua

local msg = strings.replace(hook.msg, "%name", dfhack.TranslateName(dfhack.units.getVisibleName(unit)))
dfhack.gui.writeToGamelog(msg)

local continued = false
while msg ~= "" do
local new_rep = df.report:new()

new_rep.type = df.announcement_type.CANCEL_JOB

-- new_rep.pos = unit.pos will fail with an error. This is why dfhack.gui.makeAnnouncement fails.
new_rep.pos.x = unit.pos.x
new_rep.pos.y = unit.pos.y
new_rep.pos.z = unit.pos.z

new_rep.color = COLOR_LIGHTRED
new_rep.year = df.global.cur_year
new_rep.time = df.global.cur_year_tick

new_rep.flags.continuation = continued
new_rep.flags.announcement = true

local nmsg = ""
if #msg > 73 then
nmsg = string.sub(msg, 1, 73)
msg = string.sub(msg, 74)
else
nmsg = msg
msg = ""
end
new_rep.text = nmsg
continued = true

new_rep.id = df.global.world.status.next_report_id
df.global.world.status.next_report_id = df.global.world.status.next_report_id + 1

df.global.world.status.reports:insert('#', new_rep)
df.global.world.status.announcements:insert('#', new_rep)
df.global.world.status.display_timer = 2000
end
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on September 30, 2016, 11:54:35 am
"finding memory addresses was the fun part"? What planet does he live on?

Maybe he meant that it's more fun for him.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on September 30, 2016, 01:00:58 pm
"finding memory addresses was the fun part"? What planet does he live on?

Maybe he meant that it's more fun for him.
The statement makes a lot more sense when you put the ‼ symbols on the fun.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on September 30, 2016, 01:03:39 pm
I have long believed that if Toady would just release the header files for DF the world would be a much nicer place...

The statement makes a lot more sense when you put the ‼ symbols on the fun.

I knew something was missing :P
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on September 30, 2016, 01:18:11 pm
I have long believed that if Toady would just release the header files for DF the world would be a much nicer place...

The statement makes a lot more sense when you put the ‼ symbols on the fun.

I knew something was missing :P
I kinda found discovering the how stuff worked in this game Fun. led to some fun discoveries and dfhack scripts/plugins
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on September 30, 2016, 01:22:37 pm
Reverse engineering something is an interesting intellectual exercise... The first time you do it. Maybe even the second time. When it needs to be done periodically for every new version of something it just becomes a chore.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on September 30, 2016, 01:57:51 pm
In other news: I have discovered that "dfhack.gui.makeAnnouncement" (and a few related functions) do not work. The problem is that no matter what you pass for the position argument it will be the wrong type. (...)
This was already discussed on Github (https://github.com/DFHack/dfhack/issues/999), but for anyone who didn't check, the problem was with the second argument (flags):
Quote
df.announcement_flags.D_DISPLAY

It should be {D_DISPLAY=true} or {[df.announcement_flags.D_DISPLAY]=true}.
Title: Re: DFHack 0.40.13-r1
Post by: zenos14 on September 30, 2016, 04:28:32 pm

Thanks. I had to dig around for how to access some of the relevant data, but this was enough for me to put together a toggleaquifer script that suits my purposes. It seems that the rock/soil type does not in fact need to be tagged as aquifer for this to work, and in particular the veins and inclusions can be made into aquifer. So, it was necessary to test that the tiletype is not MineralWall. I also added checks for surrounding open blocks, so that exposed edges don't begin to leak. (Though it is amusing for a slope to just start leaking all over the landscape.)

This was years ago but does anyone have something similar?
Tiletypes can remove the aquifer flag but when you try to create on it just seems to make a damp wall
I got a project I want to try to work on, but I'll need an actual aquifer for it

Title: Re: DFHack 0.43.03-r1
Post by: mross on October 03, 2016, 10:21:21 pm
Where's the version for 40.05?
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on October 03, 2016, 10:48:57 pm
There isn't one. It wasn't until v0.40.13 that they got it working with DF v0.40.

If you want DFHack for Dwarf Fortress v0.43.05, then you will need to compile it from the develop branch located here: https://github.com/DFHack/dfhack/tree/develop

There's instructions on compiling here: https://dfhack.readthedocs.io/en/stable/docs/Compile.html
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 03, 2016, 11:19:34 pm
It was 0.40.08, actually: https://github.com/DFHack/dfhack/releases/tag/0.40.08-r2

We just didn't start uploading builds to Github until 0.40.13.

Also, for compiling the develop branch, you want https://dfhack.readthedocs.io/en/latest/docs/Compile.html instead. The "stable" branch in the docs corresponds to the master branch of the repo, which is still for 0.43.03, and the build system changed substantially between 0.43.03 and 0.43.05.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on October 04, 2016, 12:30:44 am
Linux is nice and easy, git clone *dfhack addy*, cd dfhack, git checkout develop, git submodule --init, cd build, ccmake .., configure it for 64 bit architecture, generate and exit, make install, wait.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on October 04, 2016, 12:44:55 am
Linux is nice and easy, git clone *dfhack addy*, cd dfhack, git checkout develop, git submodule --init, cd build, ccmake .., configure it for 64 bit architecture, generate and exit, make install, wait.
Linux is nice and easy*

* easy when it works
* nice when you are used to building stuff for yourself
* when it does not break in some arcane way

:D
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 04, 2016, 01:19:45 am
Linux is nice and easy, git clone *dfhack addy*, cd dfhack, git checkout develop, git submodule --init, cd build, ccmake .., configure it for 64 bit architecture, generate and exit, make install, wait.
If this was a reply to me, the Linux build instructions changed too. It's mostly just recommending GCC 4.8 instead of 4.5 now, but there are a couple other changes that could cause people issues if they try using old instructions to build DFHack for 0.43.05.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on October 04, 2016, 02:15:45 am
Yar, the gcc changes are quite welcome too. I was trying to get edb working to poke at some of the missing symbols but it's too far into eldritch territory still.
Linux is nice and easy, git clone *dfhack addy*, cd dfhack, git checkout develop, git submodule --init, cd build, ccmake .., configure it for 64 bit architecture, generate and exit, make install, wait.
Linux is nice and easy*

* easy when it works
* nice when you are used to building stuff for yourself
* when it does not break in some arcane way

:D
Well, as I say, if you can play df, you can install linux... though I don't remember how I installed arch anymore, but just from checking the latest and stable docs both have the same info, clone > checkout dev > cmake/ccmake > build. Same info in the compile.rst on github.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on October 04, 2016, 12:38:17 pm
So with one of the more recent game updates the option for stacking syndromes became available. I was wondering if anyone has looked into adding that functionality into modtools/add-syndrome?
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on October 05, 2016, 04:14:01 pm
Is the workflow / work flow plugin being phased out now that vanilla has something similar?

I thought this had been mentioned before but couldn't find anything in the last 2 dozen pages of this thread. Then I checked PE's thread, which is pretty much general DF chat, and found some discussion related to this. (attached below)

Looks like the Workflow plugin isn't working either. I'm messing with the new manager jobs and conditions system thats new in 43.xx, which pretty much replaces Workflow anyway (or would if i could work the darn thing out), so all good.

Workflow plugin has been removed for exactly that reason, actually.
It wasn't removed - PE just took out the keybindings for it.
Actually the keybindings were removed upstream, by the DFHack maintainers.  The plugin still exists. I will however remove the launcher option for Workflow to prevent further confusion.

Oh, yeah, that was Eswald that removed the bindings. I don't know if anyone has done a full analysis of whether workflow/stockflow can be removed entirely or not yet.

If I could figure out how to use the new management system to enable limits I'd happily give up on workflow.. in the meantime, for those happy with the constant log spam when workers run out of resources, here's how to enable it (with thanks to the poster in the dfhack thread):

Spoiler (click to show/hide)

The Starter Pack has updated to 0.43.03-r03!
As usual, you can get it here. (http://dffd.bay12games.com/file.php?id=7622)

This update checks off a range of new and old bugs, along with some new bugs caused by old bugs.  Fun all round.
Hopefully I won't find anything else that needs fixing before a 64bit pack is ready with 43.05... or perhaps a later version.  Time to strike the earth!

0.43.03-r03
 - DungeonSet: can select in launcher, change on saves correctly, better text tileset
 - updated Armok Vision (bugfix)
 - added Therapist config (absent due to subtle old bug)
 - fixed SoundSense log config
 - removed Workflow option in launcher (replaced by vanilla manager upgrade)

SHA256:  e2de47c4ec181ad3de39ab403bd6354c3a92e394273cb34bd0f231205ddfb956

If you want to say thanks, check out Toady's Patreon (https://www.patreon.com/bay12games), or even mine! (https://www.patreon.com/PeridexisErrant)  ;D

Thanks PE, as always you're amazing

EDIT: Now that i've got the manager stuff working nicely with repeatable jobs and conditions, i haven't found any uses yet for needing Workflow at all so far, so more than happy to use the built in one

It's still useful for somethings the new work order conditions can't seem to handle like milling plants or processing into bags of leaves (although I don't think even workflow can deal with leaves). Dumping filled buckets doesn't hurt either.

No reason for it to be up front and center though.

Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on October 05, 2016, 05:07:23 pm
Short summary: 

Most of the functions of the Workflow plugin can now be accomplished by the vanilla manager.  Everyone is therefore trying to strike a balance between keep it available for crusty old players (eg me), while encouraging new players to use the manager and old players to switch.  I imagine workflow will be kept until it breaks in a particularly annoying way, and then it'll be easy to delete.

- DFHack kept Workflow, but removed the keybindings
- I removed the GUI option to enable workflow (so you need the console now), but kept the keybinds so it's easy once enabled.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on October 05, 2016, 05:35:01 pm
Thank you! That's very helpful.
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on October 06, 2016, 02:30:16 am
I don't think gui/workshop-job (http://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-workshop-job) can be used automated without workflow.

The job gets removed once completed, and the work orders system doesn't work by suspending a repeating job like workflow does.

The job details system supported by work orders only filters by output. It doesn't allow control of inputs.
Title: Re: DFHack 0.43.03-r1
Post by: OnyxIdol on October 06, 2016, 11:15:38 am
PTW.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 06, 2016, 01:43:50 pm
I don't think gui/workshop-job (http://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-workshop-job) can be used without workflow.
It definitely can.

The other two points were why I was against removing workflow entirely. I'm not familiar enough with it to know exactly how it compares to vanilla features, but I was worried that it would break in 0.43 due to changes in DF. If it definitely still works in 0.43, I'd be fine with adding the keybindings back, but I haven't heard much from anyone who's tried to use it (which could be good, I guess, or it could be due to people not using it at all).
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on October 06, 2016, 03:48:29 pm
People are definitely still using workflow. I haven't seen any complaints about its functionality; I've only seen people wondering how to turn it back on.

Is anyone familiar with stockflow? I haven't heard anyone bring it up since it was disabled by default in May. But maybe all the users who were missing the main workflow plugin workflow were able to figure out on their own that they needed to also re-enable the addon stockflow plugin.

Will users accustomed to workflow also want to have stockflow re-enabled too?
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on October 06, 2016, 06:39:22 pm
I don't think gui/workshop-job (http://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-workshop-job) can be used without workflow.
It definitely can.
I mean you can't automate it using work orders. It works for a single job or a repeat (until failure) job.

I think the manager/job details is going to need to be hacked to issue these custom jobs to workshops.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on October 09, 2016, 10:41:06 am
Technical comment:
I would say there's a good chance the df.world.xml file field worldgen.worldgen_parms "<int32_t comment='v0.40.01'/>" corresponds to the world_gen.txt file entry "[GENERATE_DIVINE_MATERIALS:1]".
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 09, 2016, 11:21:15 am
That would be a good thing to post on the df-structures issue tracker so it doesn't get forgotten.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on October 09, 2016, 11:56:42 am
Thanks lethosor.
My next question is then: where do I find this tracker?
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on October 09, 2016, 03:29:18 pm
https://github.com/DFHack/df-structures/issues
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 09, 2016, 03:40:07 pm
I opened a ticket: https://github.com/DFHack/df-structures/issues/163 (I was in a hurry earlier, otherwise I would've done that before).

Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on October 09, 2016, 03:41:53 pm
Thanks both of you.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on October 09, 2016, 08:09:18 pm
Maybe someone misses stockflow? https://www.reddit.com/r/dwarffortress/comments/56paut/workflow_based_on_raw_materials/
Title: Re: DFHack 0.43.03-r1
Post by: zwei on October 11, 2016, 05:43:17 am
I have issue with using third party LUA library. Basically, I want to be able to send data to serial port from withing DFhack scripts.

Console says this:

Code: [Select]
[DFHack]# ambidwarf
error loading module 'luars232' from file 'C:\dfhack\luars232.dll':
        Uvedenř modul nebyl nalezen.

stack traceback:
        [C]: in ?
        [C]: in function 'require'
        C:\dfhack/hack/scripts/ambidwarf.lua:1: in function 'f'
        C:\dfhack\hack\lua\dfhack.lua:562: in function <C:\dfhack\hack\lua\dfhack.lua:503>
        (...tail calls...)

Only setup I have made is copying luars232.dll file to C:\dfhack directory (it comes from project here: https://github.com/ynezz/librs232/downloads )

Script is so far just renamed example for library from here: https://github.com/ynezz/librs232/blob/master/doc/example.lua

I am sure I am doing something wrong, but i have too litle experience with lua to know what :-)
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on October 11, 2016, 05:51:28 am
I have issue with using third party LUA library. Basically, I want to be able to send data to serial port from withing DFhack scripts.

Console says this:

Code: [Select]
[DFHack]# ambidwarf
error loading module 'luars232' from file 'C:\dfhack\luars232.dll':
        Uvedenř modul nebyl nalezen.

stack traceback:
        [C]: in ?
        [C]: in function 'require'
        C:\dfhack/hack/scripts/ambidwarf.lua:1: in function 'f'
        C:\dfhack\hack\lua\dfhack.lua:562: in function <C:\dfhack\hack\lua\dfhack.lua:503>
        (...tail calls...)

Only setup I have made is copying luars232.dll file to C:\dfhack directory (it comes from project here: https://github.com/ynezz/librs232/downloads )

Script is so far just renamed example for library from here: https://github.com/ynezz/librs232/blob/master/doc/example.lua

I am sure I am doing something wrong, but i have too litle experience with lua to know what :-)
In cases like these it really helps if you translate the error message into english. However my guess is that it says "Could not load the module"

As for the problem itself - my guess is that dfhack does not export/include the required lua lib(s)? or they are of incorrect version. Rebuilding the lib with same lua might help.
Title: Re: DFHack 0.43.03-r1
Post by: zwei on October 11, 2016, 06:52:26 am
I have issue with using third party LUA library. Basically, I want to be able to send data to serial port from withing DFhack scripts.

Console says this:

Code: [Select]
[DFHack]# ambidwarf
error loading module 'luars232' from file 'C:\dfhack\luars232.dll':
        Uvedenř modul nebyl nalezen.

stack traceback:
        [C]: in ?
        [C]: in function 'require'
        C:\dfhack/hack/scripts/ambidwarf.lua:1: in function 'f'
        C:\dfhack\hack\lua\dfhack.lua:562: in function <C:\dfhack\hack\lua\dfhack.lua:503>
        (...tail calls...)

Only setup I have made is copying luars232.dll file to C:\dfhack directory (it comes from project here: https://github.com/ynezz/librs232/downloads )

Script is so far just renamed example for library from here: https://github.com/ynezz/librs232/blob/master/doc/example.lua

I am sure I am doing something wrong, but i have too litle experience with lua to know what :-)
In cases like these it really helps if you translate the error message into english. However my guess is that it says "Could not load the module"

As for the problem itself - my guess is that dfhack does not export/include the required lua lib(s)? or they are of incorrect version. Rebuilding the lib with same lua might help.

It says "Given module was not found".

Anyway, I should basically learn to rebuild this library + dfhack using same version of lua? Hmm, Lets me see about ruby scripts and ruby rs232 library.
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on October 12, 2016, 01:48:24 am
How complete is the current progress on 64-bit? I was thinking about attempting to compile on Windows when I have some free time.

Are there just a few issues, or does it still need a bunch of work to even run?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 12, 2016, 01:35:43 pm
It runs pretty well. There are some offsets missing, but not too many.

If people don't mind about a lack of 64-bit ruby support and some missing offsets, it might be possible to make an alpha release (with "alpha" in this case meaning incomplete but possible to test with).
Title: Re: DFHack 0.43.03-r1
Post by: NonconsensualSurgery on October 12, 2016, 09:16:33 pm
It runs pretty well. There are some offsets missing, but not too many.

If people don't mind about a lack of 64-bit ruby support and some missing offsets, it might be possible to make an alpha release (with "alpha" in this case meaning incomplete but possible to test with).

DFHack is beloved enough that you'd have testers despite the risks. What offsets and features will be missing?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 12, 2016, 09:40:20 pm
Lack of ruby scripts with 64-bit DFHack is the main one right now. A low risk of incorrect structures and crashes is also lacking, if you consider that a feature. As for offsets, I can tell you what ones we do have pretty easily (there are a lot), but since our format doesn't require the ones that are missing to be listed, I can't easily tell you all of the ones that are missing.

Here are some that are missing:

Spoiler (click to show/hide)

(There may be some missing from those lists. Sorry about the formatting.)
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on October 12, 2016, 10:47:53 pm
So, of the stuff I actually use, create-unit.lua won't run on linux64 with the -age parameter.  And... that's pretty much it; this is way more progress than I expected, kudos and dwarven wine for the whole dev team!!!

Is there a simple way to detect linux64 so I could make a temp version to run for the alpha?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 12, 2016, 11:50:44 pm
Can you post the error message? It looks like it relies on cur_year_tick (which is unavailable) if age is 0, and cur_year (which is available) if age is specified. I'm not sure what else the issue would be, so if it's something else, that would be nice to know. Detecting the specific DFHack build is not the way to go - if anything, use dfhack.internal.getAddress('cur_year_whatever'), which returns nil for missing offsets.

(Come to think of it, I'm not sure if there is a way to detect the DF platform/architecture in Lua without manually parsing the version string from symbols.xml, i.e. dfhack.getDFVersion().)
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on October 13, 2016, 01:45:57 am
I think the viewscreen offsets are missing too at least on linux64, I use a few scripts and some diagnosis methods involving checking gview.(child...child).df_viewscreen_* stuff so that stood out to me.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on October 13, 2016, 05:51:24 am
Can you post the error message? It looks like it relies on cur_year_tick (which is unavailable) if age is 0, and cur_year (which is available) if age is specified. I'm not sure what else the issue would be, so if it's something else, that would be nice to know. Detecting the specific DFHack build is not the way to go - if anything, use dfhack.internal.getAddress('cur_year_whatever'), which returns nil for missing offsets.

(Come to think of it, I'm not sure if there is a way to detect the DF platform/architecture in Lua without manually parsing the version string from symbols.xml, i.e. dfhack.getDFVersion().)
I didn't actually build from source or anything, just know what create-unit needs.  That .internal.getAddress idea is really powerful.  Might actually be able to wrap that in a sort of safe-access function that allows some error handling.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 13, 2016, 08:03:24 am
I think the viewscreen offsets are missing too at least on linux64, I use a few scripts and some diagnosis methods involving checking gview.(child...child).df_viewscreen_* stuff so that stood out to me.
Are you using the latest df-structures commit? The viewscreenst vtable was one that failed, but I checked it manually, so gview should be located now too. viewscreen_layerst is still missing, but I don't think that's ever instantiated directly by DF.
Title: Re: DFHack 0.43.03-r1
Post by: Poldon on October 13, 2016, 08:25:42 am
I've never compiled anything or anything, but I'd be pretty happy with a DFHack for 43.05 that had that unit labor manager (I love the fact I don't have to use a seperate window like DT, and so very useful!) and a reveal-unreveal so I can build projects without accidentally hitting the caves with the blueprints and having plans ruined. It sounds like those may be done? I'm really not entirely sure I'm understanding what's going on, but I'd be happy with a download if it had those.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 13, 2016, 08:27:16 am
Yeah, those work. I'll probably be too busy to make builds until Saturday, though.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on October 13, 2016, 04:28:12 pm
I think the viewscreen offsets are missing too at least on linux64, I use a few scripts and some diagnosis methods involving checking gview.(child...child).df_viewscreen_* stuff so that stood out to me.
Are you using the latest df-structures commit? The viewscreenst vtable was one that failed, but I checked it manually, so gview should be located now too. viewscreen_layerst is still missing, but I don't think that's ever instantiated directly by DF.
I'll get the structures fixed once I get woken up abit more, but for what it's worth here's the malloc from running valgrind with dfhack to figure out why loading armok vision triggers a memory leak that eats all the ramz.
Code: [Select]
DFHack version 0.43.05-alpha0 (development build 0.43.03-r1-161-ga5338d2)
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]# die

==17690==
==17690== HEAP SUMMARY:
==17690==     in use at exit: 30,685 bytes in 822 blocks
==17690==   total heap usage: 4,890 allocs, 4,068 frees, 212,579 bytes allocated
==17690==
==17690== 12 bytes in 1 blocks are definitely lost in loss record 100 of 314
==17690==    at 0x4C29BBE: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17690==    by 0x46B16F: xmalloc (in /usr/bin/bash)
==17690==    by 0x465068: set_default_locale (in /usr/bin/bash)
==17690==    by 0x418688: main (in /usr/bin/bash)
==17690==
==17690== LEAK SUMMARY:
==17690==    definitely lost: 12 bytes in 1 blocks
==17690==    indirectly lost: 0 bytes in 0 blocks
==17690==      possibly lost: 0 bytes in 0 blocks
==17690==    still reachable: 30,673 bytes in 821 blocks
==17690==         suppressed: 0 bytes in 0 blocks
==17690== Reachable blocks (those to which a pointer was found) are not shown.
==17690== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==17690==
==17690== For counts of detected and suppressed errors, rerun with: -v
==17690== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Title: Re: DFHack 0.43.03-r1
Post by: Heretic on October 14, 2016, 03:25:54 am
As for me I'm really looking for alpha version. For me - the only thing I need from dfhack is remotefortressreader for AV.
Title: Re: DFHack 0.43.03-r1
Post by: Codician on October 14, 2016, 07:57:20 am
DFHack seems to be having a problem with Windows 10.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on October 14, 2016, 08:32:43 am
@Codician: Are you sure it's DFHack and Windows 10, rather than attempting to use DFHack with an as yet unsupported version of DF (such as 0.43.04 or 0.43.05)? The LNP (which includes DFHack) works fine for the latest supported version of DF (0.43.03) for me, and I haven't seen the wave on complaints from others expected from such a problem.
Apart from that, "seems to have a problem with" is a rather unhelpful problem description. It would help in the determination of what's wrong if you stated in which way it fails. Error messages in particular can contain useful info.
Title: Re: DFHack 0.43.03-r1
Post by: Codician on October 14, 2016, 11:21:57 am
@Codician: Are you sure it's DFHack and Windows 10, rather than attempting to use DFHack with an as yet unsupported version of DF (such as 0.43.04 or 0.43.05)? The LNP (which includes DFHack) works fine for the latest supported version of DF (0.43.03) for me, and I haven't seen the wave on complaints from others expected from such a problem.
Apart from that, "seems to have a problem with" is a rather unhelpful problem description. It would help in the determination of what's wrong if you stated in which way it fails. Error messages in particular can contain useful info.

The error message I was getting is about as useful: "The application was unable to start correctly (0xc000007b)"

This was trying LazyNewbPack. I'm gonna have a go at reinstalling .NET and see if that helps.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on October 14, 2016, 12:05:13 pm
OK, so you're using the LNP (and I assume it's the r07 version for 0.43.03), that's useful info, since the LNP usually works. I'd try to re-download the LNP and reinstall it. Note that you shouldn't reinstall the LNP over the top of a previous installation, but rather create a new folder or you may end up with old things screwing things up. Since the LNP contains DF there's no need to install that one separately or on top of LNP (and doing that can break things since you'd overwrite configurations tweaked by LNP).
While the error message doesn't tell either me or you much, others may get something out of it, and it definitely tells anyone DF didn't e.g. just fail to try to start.

If it still fails after re-installation, I'd first try to use the UI to disable DFHack to see if DF starts without it, and if doesn't, I'd try to start it manually (go down into the "Dwarf Fortress 0.32.03" subfolder and double click on "Dwarf Fortress.exe"). If that works, I'd shut down DF, go back to the UI and re-enable DFHack, but not start DF from there, but rather start DF from the subfolder again. Enabling DFHack replaces a .dll that is going to be used by the "raw" DF as well.
Basically, you want to figure out whether the issue is with DF, DFHack, or the LNP (for each of them it's likely to be in conjunction with your particular computer and/or configuration).
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 14, 2016, 01:14:02 pm
I'm not sure why a recent PyLNP-based pack would require .NET, except maybe for external utilities that shouldn't be relevant to the issue you're having.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on October 14, 2016, 02:04:04 pm
http://dffd.bay12games.com/file.php?id=12504

Here's a pre-alpha for DFHack windows 43.05 x64. I mainly built it so people can use Armok Vision, but other things might also work.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on October 14, 2016, 02:22:42 pm
DFHack seems to be having a problem with Windows 10.

Have you tried opening up the Dwarf Fortress folder and double-clicking "dfhack-run.exe" "Dwarf Fortress.exe?" (I think that's the DFHack launch script, anyway.)
The Lazy Newb Pack was having issues with launching DFHack earlier, so maybe if you try to launch it manually it will work.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on October 14, 2016, 02:24:45 pm
Dfhack doesn't have a launch script on Windows.

Dfhack - run does something else completely.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on October 14, 2016, 02:28:52 pm
How do you launch DFHack without the Lazy Newb Pack on Windows?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 14, 2016, 02:46:34 pm
Start DF normally.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on October 14, 2016, 03:08:37 pm
DFHack works by replacing the game's SDL.dll with its own version; the game reads SDL.dll on startup, so it runs when the game starts.

dfhack-run is a command-line program that allows the running of DFHack commands... through the command-line.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 14, 2016, 03:56:34 pm
DFHack works by replacing the game's SDL.dll with its own version
on Windows only. I suspect the confusion here was partly due to the fact that it doesn't do this on OS X and Linux, but uses a separate launcher script instead.
Title: Re: DFHack 0.43.03-r1
Post by: Poldon on October 15, 2016, 08:18:43 am
Thank you so much, Japa! It's working great so far, and it has everything I wanted! I am very satisfied. ^.^
Title: Re: DFHack 0.43.03-r1
Post by: scamtank on October 15, 2016, 03:39:55 pm
http://dffd.bay12games.com/file.php?id=12504

Here's a pre-alpha for DFHack windows 43.05 x64. I mainly built it so people can use Armok Vision, but other things might also work.

How did you manage this? The old batch file setup in \dfhack\build seems to be all sorts of busted.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on October 15, 2016, 04:09:16 pm
http://dffd.bay12games.com/file.php?id=12504

Here's a pre-alpha for DFHack windows 43.05 x64. I mainly built it so people can use Armok Vision, but other things might also work.

How did you manage this? The old batch file setup in \dfhack\build seems to be all sorts of busted.
You're looking at the wrong branch - "master" is only for the last official release (which was quite a while ago), while "develop" has up-to-date stuff for 0.43.05.
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on October 15, 2016, 05:58:06 pm
I'm using develop branch and having issues building for x64.

I did:
Code: [Select]
.\build\win64\generate-MSVC-gui.bat
Configure->Use default native compilers
Open dfhack.sln in VS2015
Build->Configuration manager
New x64 from win32 settings
Switch to Release configuration
Right-click INSTALL -> Build

I get a bunch of:
Code: [Select]
fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
Edit: Using Windows 7 64-bit. I might be way behind on Windows Updates since I reformatted the machine. Going to try updating.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on October 15, 2016, 06:38:00 pm
I did:
Code: [Select]
Build->Configuration manager
New x64 from win32 settings
You did something wrong, then - there should only be an "x64" build configuration. Perhaps your version of CMake is out of date? I've got 3.6.1 and it works fine.
Title: Re: DFHack 0.43.03-r1
Post by: scamtank on October 15, 2016, 06:54:49 pm
You're looking at the wrong branch - "master" is only for the last official release (which was quite a while ago), while "develop" has up-to-date stuff for 0.43.05.

No, I'm deffo pulling the development branch, the one with the x64-specific stuff. Running the generate-* batch files complains about not being able to find a CMakeLists.txt in the next folder up, like the old arrangement was. If I kick the .bat pile back to the \build folder like they used to be, it cannot find C/CXX compilers (line 22).

The whole process hasn't changed drastically from version 0.42 days, has it? With my level of skill, I'm reading compile.rst more like a spellbook than a manfile.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 15, 2016, 07:24:41 pm
Running the generate-* batch files complains about not being able to find a CMakeLists.txt in the next folder up, like the old arrangement was.

You must not be on the latest commit of the develop branch. Have you tried pulling again? What remote URL are you using? All of the .bat files should contain "cmake ..\..", i.e. two folders up. Check the file you're using to make sure that's the case.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on October 15, 2016, 07:37:28 pm
No, he's right, the bat files were moved one folder down, but not modified to reflect the change. I'll upload a fixed version. +

I checked again, they're fine.

They were not. I have fixed them, they should be fine now.

I'm using develop branch and having issues building for x64.

I did:
Code: [Select]
.\build\win64generate-MSVC-gui.bat
Configure->Use default native compilers
Open dfhack.sln in VS2015
Build->Configuration manager
New x64 from win32 settings
Switch to Release configuration
Right-click INSTALL -> Build

I get a bunch of:
Code: [Select]
fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
Edit: Using Windows 7 64-bit. I might be way behind on Windows Updates since I reformatted the machine. Going to try updating.

There is no "win64generate-MSVC-gui.bat" in the build folder. If you have that, then you have the wrong branch of DFHack.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 15, 2016, 08:11:07 pm
Oh, I missed that they create a separate folder. I assumed it was "cmake .." before, like the others, but apparently not.

Anyway, here's an alpha release (https://github.com/DFHack/dfhack/releases/tag/0.43.05-alpha1). It's not as stable as usual, and Ruby and Stonesense are missing (in at least some builds), but enough of it works that it's not entirely unusable.

If you're expecting DFHack to be stable for everyday use and don't want to (or know how to) provide helpful-enough feedback to fix issues, I wouldn't recommend using this build. I also don't recommend encouraging everyone else to use it, including it in packs, etc.. I know I say something like this with a lot of alpha builds, but I have less confidence with this one. Maybe it'll turn out to be somewhat stable, but there are many more opportunities for crashes that we haven't found yet, so don't count on it.

Also, back up your saves if you care about them! DFHack probably won't corrupt them even if it crashes, but don't count on it. (If you stick to exiting without saving with "die", though, it should be fine. Probably.)
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on October 15, 2016, 08:53:23 pm
You did something wrong, then - there should only be an "x64" build configuration. Perhaps your version of CMake is out of date? I've got 3.6.1 and it works fine.
It's 3.6.1. Edit: Issue was out-of-date Windows.

There is no "win64generate-MSVC-gui.bat" in the build folder. If you have that, then you have the wrong branch of DFHack.
Just a typo. Should be "win64\generate-MSVC-gui.bat".

No, I'm deffo pulling the development branch, the one with the x64-specific stuff. Running the generate-* batch files complains about not being able to find a CMakeLists.txt in the next folder up, like the old arrangement was. If I kick the .bat pile back to the \build folder like they used to be, it cannot find C/CXX compilers (line 22).
I got that to work by running it from a cmd prompt sitting in the \dfhack directory. E.g., "C:\dfhack>.\build\win64\generate-MSVC-gui.bat". Then you can just select "\dfhack" as the source code directory (CMakeLists.txt is located here) from the GUI.
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on October 16, 2016, 01:14:11 pm
After catching up on several Windows Updates, I now have a bunch of options for CMake configuration (including "Visual Studio 14 2015 Win64",) which weren't there before. This looks promising.

Edit: Seems to be working.
Title: Re: DFHack 0.43.03-r1
Post by: Grax on October 19, 2016, 06:18:52 am
So now we have working DFHack for x64 and DT for x32 ;-)

I hope 43.05 x64 and x32 saves are 100% compatible.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on October 19, 2016, 06:25:07 am
They should be compatible. No one has reported any problems so far. If the saves from the 32- and 64-bit versions ever become incompatible with each other, it would probably be because of a weird bug or something.
Title: Re: DFHack 0.43.03-r1
Post by: Dirst on October 19, 2016, 06:41:45 am
They should be compatible. No one has reported any problems so far. If the saves from the 32- and 64-bit versions ever become incompatible with each other, it would probably be because of a weird bug or something.
...and then weaponized.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 19, 2016, 01:18:47 pm
So now we have working DFHack for x64 and DT for x32 ;-)
And 32-bit DFHack...
Title: Re: DFHack 0.43.03-r1
Post by: Grax on October 19, 2016, 01:24:31 pm
So now we have working DFHack for x64 and DT for x32 ;-)
And 32-bit DFHack...
32x dfhack?! Who does have it? I see here only 64x.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 19, 2016, 01:26:08 pm
https://github.com/dfhack/dfhack/releases
Title: Re: DFHack 0.43.03-r1
Post by: Rose on October 19, 2016, 09:51:39 pm
Is there a simple way to cancel jobs from within dfhack?

I'm working on editing dig designations from within Armok Vision, but I need to be able to cancel ones that have already been converted into jobs.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on October 19, 2016, 10:05:56 pm
Depending on the type of job, it might be possible to set the "item_lost" flag, which would cause it to cancel with "Job item lost or destroyed" - that's how the game handles (f)orbidding job items.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on October 19, 2016, 10:30:56 pm
It's a digging job, so there's no item.

Could I set the job type to nothing?
Title: Re: DFHack 0.43.03-r1
Post by: Grax on October 19, 2016, 11:30:03 pm
Can we somehaow change environment savagery and evilness?
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on October 19, 2016, 11:55:18 pm
Is there a simple way to cancel jobs from within dfhack?

I'm working on editing dig designations from within Armok Vision, but I need to be able to cancel ones that have already been converted into jobs.
We should add cancel function to dfhack job module
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on October 20, 2016, 01:26:16 am
Can we somehaow change environment savagery and evilness?
Not easily.

gui/gm-editor df.global.world.world_data has a region entry, if you [i]nsert new values you can open up all regions besides the ones shown, but you would want to write a script because it's annoying doing it by hand.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 21, 2016, 10:59:53 am
Development update:

JJ has fixed a lot of ruby issues (and I fixed one, somehow) and now exterminate actually works! I might try putting together another release in a couple days for anyone who wants to test that, assuming nothing breaks horribly as a result. (That was with Ruby 2, by the way, which could mean a working ruby plugin on Win64 if it also works there.)

Quietust fixed a bunch of broken viewscreens, and I fixed an abstract_building issue (https://github.com/DFHack/dfhack/issues/1005) that was causing crashes on x64.
Title: Re: DFHack 0.43.03-r1
Post by: Meph on October 21, 2016, 11:34:37 am
I'd like to build a test-version of Masterwork for 43.05 with all the utilities that I can get for next friday.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on October 21, 2016, 12:42:51 pm
Does anyone know how to kill a sapling via DFHack? I don't mind if it's tricky or difficult, I just want something that works.

I have a script that is supposed to kill a certain percentage of all saplings in an effort to make tree growth less enthusiastic, I just can't seem to figure out a way to actually kill the saplings...
Title: Re: DFHack 0.43.03-r1
Post by: Rose on October 21, 2016, 12:48:28 pm
What happens if you just change the tile type?
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on October 21, 2016, 12:55:24 pm
I didn't try that, but I suspect it wouldn't work quite right... I'll have to do some experimentation with already dead saplings to see how the game sees them I guess.

I just hoped that there was something like the old extripate (sp?) command avalible.
Title: Re: DFHack 0.43.03-r1
Post by: Hesperid on October 21, 2016, 02:12:40 pm
If it hasn't grown into a multi-tile tree yet, you can just delete the plant data structures and then update the tile type to be normal floor, and it will work just like that. I don't think the necessary symbols exist for 0.43.05 yet, though.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 21, 2016, 02:19:27 pm
I don't think the necessary symbols exist for 0.43.05 yet, though.
What? What symbols are those? All I can think of is "world", which should definitely be there.

Maybe the necessary structures haven't been researched yet, but that would affect every version before 0.43.05 too.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on October 21, 2016, 03:40:32 pm
Try finding find the sapling's "plant" structure and setting its hitpoints to zero.

If you want to be dramatic, you could also set it on fire and make it instantly turn into ashes in a puff of smoke (and possibly also give it exactly 1 hitpoint so it handles the transition properly), but that might have the risk of starting a forest fire.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on October 21, 2016, 04:33:58 pm
Finding the "plant" structure is easy, that how I am finding the saplings in the first place (iterating all plants on the map), if setting their hitpoints to zero works then that would be the simplest thing to do.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on October 21, 2016, 11:17:57 pm
okay so poking around advmode ui's and found out anon 46 and 47 control how long you can work on building
46 being the number you put in and
47 the cap

testing to see if it's possible to work either a whole week or a year on a camp project and the possibilities of using that to pass time.
it still possible to be ambushed and folks probably don't want to do this with a character who isn't immortal and or that needs to eat sleep or drink.
there also a small chance of melancholy from untreated needs pushing your adventurer past the point of insanity, but that only takes affect if you put them into fort mode.

Title: Re: DFHack 0.43.03-r1
Post by: The13thRonin on October 22, 2016, 02:23:27 am
Apologies as I'm sure you get this question a lot but I haven't been round these parts in a long time.

Is a DF Hack for 43.05 (x64) close to release?
Title: Re: DFHack 0.43.03-r1
Post by: Rose on October 22, 2016, 03:52:50 am
There's already an alpha release.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on October 22, 2016, 07:01:09 am
so future studies show that with dfhacking you can work on a project for around under 30 hours. the accurate time Might be a lil more than that but the game will cancel the construction if you put in 42 hours in.
Spoiler (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 22, 2016, 09:48:57 am
Do you mean in-game hours (i.e. messing with the fields you were talking about)?
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on October 22, 2016, 03:58:01 pm
Do you mean in-game hours (i.e. messing with the fields you were talking about)?
in game hours for building stuff in adventure mode.
(http://www.truimagz.com/host/rumrusher/folder2/46-n-47-anons.png)
anon_46 is the hours the player going to work and
anon_47 is the hours cap which rises and lowers depending on anon_45, but it's capped at 16 hours.
messing with 47 allows you to increase the cap limit and then set the hours as you wish, messing with 46 changes the hours planned and probably go over the cap, I haven't testing this.
there also anon_45 which is the print total for how man hours needed to complete the project and probably affects anon_47 until it goes past 16 which by that point it just a total.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on October 23, 2016, 12:33:24 am
What changes when you have companions?
Title: Re: DFHack 0.43.03-r1
Post by: xordae on October 23, 2016, 02:58:44 am
Been using the 32-bit version of DFHack for 0.43.05 for a couple of days now. No crashes and no weirdness so far, the save seems fine.

I miss 'fixdiplomats' though.. have a sneaking suspicion that the Elves have stopped visiting.

A bit of weirdness I noticed. When using the (e)nhanced stocks screen, the selections seem a little inconsistent. I can for example input a search term for 'silver', select to modify the whole list and do (M)elt, but I can't reverse that order. I have to select to modify one item at a time and un-check each one.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on October 23, 2016, 08:09:19 am
I miss 'fixdiplomats' though.. have a sneaking suspicion that the Elves have stopped visiting.
There are two problems with that statement:
1. Fixdiplomats still exists, just under the new name "fix/diplomats" because it was converted from a plugin to a Lua script
2. Elves already have diplomats, so even if you run "fix/diplomats", it won't actually do anything.

If you're not seeing their diplomats, you either haven't met the criteria (having a Baron) or there's a bug preventing them from arriving.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on October 23, 2016, 11:02:47 am
What changes when you have companions?
companions just divide the time it takes for you to build stuff, I haven't found a way to quickly build stuff yet as I was working on passing the time through construction manipulation.
I guess there might be a way to pump the number high enough.
at this point I'm kinda focused on night trolls and if resurrection would cure a mate's curse or not.
Title: Re: DFHack 0.43.03-r1
Post by: Heretic on October 23, 2016, 01:32:07 pm
I'm embarked in goblin camp. Where are some campfires and they are killing my FPS! How I can destroy them(with DFHack or not no matter).
Please! It's really good embark and I don't want to loose it to FPS!
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on October 23, 2016, 05:17:45 pm
gui/gm-editor df.global.world.fires then go into uh, I assume it's an all entry, then delete the campfire entries, 0, 1, 2, etc. Then use tiletypes paint s floor to remove the ashes tile.
What changes when you have companions?
companions just divide the time it takes for you to build stuff, I haven't found a way to quickly build stuff yet as I was working on passing the time through construction manipulation.
I guess there might be a way to pump the number high enough.
at this point I'm kinda focused on night trolls and if resurrection would cure a mate's curse or not.
I'd check myself but I don't see linux 64 bit ui_advmode symbols yet.
Title: Re: DFHack 0.43.03-r1
Post by: redsector on October 25, 2016, 05:45:46 am
Hey,

apologies if this is the wrong place to report/ask, not sure if it's a bug, but I ran into a problem with the teleport script in the DFhack 0.43.05 alpha release, Windows build, both x32 and x64 versions.

* first of all, the showpos and showunitid args work fine.
* specifying teleport coords without a unit Id does nothing, there's no error, but no actual teleporting of the unit under the cursor either
* providing a unit ID (with or without coordinates, doesn't matter) results in the following error:

Invoking: teleport -unit 7911 -x 142 -y 43 -z 162
...43_05_win_64-bit_(recommended)/hack/scripts/teleport.lua:53: Cannot write field unit.find(): integer expected.
stack traceback:
   [C]: in field 'find'
   ...43_05_win_64-bit_(recommended)/hack/scripts/teleport.lua:53: in local 'f'
   ...5-\df_43_05_win_64-bit_(recommended)\hack\lua\dfhack.lua:562: in function 'dfhack.run_script_with_env'
   (...tail calls...)


I'm kinda puzzled and would appreciate any help. Despite being a long-time player (just returned after a 2 years pause to try the new DF release), I've actually never used DFhack before, so feel free to tell me in case I was simply too dumb to use it correctly.

(FYI, I want to use the teleport script to fix the invisible caravan bug using this workaround: http://www.bay12forums.com/smf/index.php?topic=159297.0)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 25, 2016, 07:52:28 am
Try replacing hack/scripts/teleport.lua with the latest script from https://github.com/DFHack/scripts/blob/master/teleport.lua
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on October 25, 2016, 12:13:46 pm
I finally got sapling deletion working, here is what I ended up with:

Code: [Select]
-- Install a periodic ticker that kills saplings over a certain count.

do return end -- Remove this once I figure out a good way to calculate a sapling limit.

-- TODO: Change the way this works:
-- Rather than set a sapling limit set a tree limit. At the game start get a tree count, then use that
-- (plus a few) as the tree cap. Then if there are more trees than the limit delete all saplings, else
-- allow saplings to grow as they will. This will preserve the relative amount of trees on the map at
-- all times. If you embark in a heavily forested biome it will always be heavily forested, while grass
-- lands will remain mostly grass.

-- How many saplings to leave alive on the surface.
local livecount = 25

local function treeTicker()
-- Get a list of all the saplings on the map.
local plants = df.global.world.plants.all
local saplings = {}
for i = 0, #plants - 1, 1 do
local plant = plants[i]
local ttype = dfhack.map.getTileType(plant.pos)
if not plant.flags.is_shrub and df.tiletype.attrs[ttype].shape == df.tiletype_shape["SAPLING"] and df.tiletype.attrs[ttype].special ~= df.tiletype_special["DEAD"] then
-- plant is a live sapling...
if df.tiletype.attrs[dfhack.map.getTileType(plant.pos.x, plant.pos.y, plant.pos.z-1)].material == df.tiletype_material["SOIL"] then
-- ...growing in a soil layer (probably the surface).
table.insert(saplings, {i = i, ref = plant})
end
end
end

-- Choose random saplings to delete...
local del = {}
for #saplings > livecount do
local i = math.random(1, #saplings)
local plant = saplings[i]
table.insert(del, plant)
table.remove(saplings, i)
end

-- ...and sort the list in reverse order by index in plants.all
table.sort(del, function(a, b)
return a.i > b.i
end)

-- Finally delete the selected saplings.
for _, plant in ipairs(del) do
local block = dfhack.maps.ensureTileBlock(plant.pos.x, plant.pos.y, plant.pos.z)
block.tiletype[plant.pos.x%16][plant.pos.y%16] = df.tiletype["SoilFloor1"]

-- The list is high indexes to low indexes, so we can just delete from the list without fear of messing up later indexes.
df.global.world.plants.all:erase(plant.i)

-- Plants do not have an ID number, so we need to compare them based on location.

for j = 0, #df.global.world.plants.tree_dry - 1, 1 do
if same_xyz(df.global.world.plants.tree_dry[j].pos, plant.ref.pos) then
df.global.world.plants.tree_dry:erase(j)
break
end
end

for j = 0, #df.global.world.plants.tree_wet - 1, 1 do
if same_xyz(df.global.world.plants.tree_wet[j].pos, plant.ref.pos) then
df.global.world.plants.tree_wet:erase(j)
break
end
end

plant.ref:delete()
end

-- Every 60 seconds (at 100 FPS) should be fast enough.
    dfhack.timeout(6000, 'ticks', treeTicker)
end
treeTicker()

Obviously I am still not done with it yet, but the "delete sapling" part seems to work correctly.
Title: Re: DFHack 0.43.03-r1
Post by: redsector on October 25, 2016, 06:26:58 pm
Try replacing hack/scripts/teleport.lua with the latest script from https://github.com/DFHack/scripts/blob/master/teleport.lua

Yep, that one works! Now I just hope that I actually fixed my invisible caravan problem, preferably without messing up anything else.

Thank you very much for your help!
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 29, 2016, 06:10:43 pm
Good news: Ruby should finally work on 64-bit Windows now! Also, a lot of Ruby issues have been fixed recently, so it should be more stable, particularly in the 64-bit build on all platforms. Hopefully there can be a release up in the next couple of days, but feel free to test the current develop branch in the meantime if you like.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on October 29, 2016, 10:07:29 pm
Gotta love it when you can do the full git clone/checkout/build/make chain from memory at this point.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on October 29, 2016, 10:30:43 pm
You shouldn't have to do the full thing more than once. My clone is at least two years old (although I don't know exactly how old, because I migrated to a new system a couple months ago). You might need a new build folder if you screw something up, but I reuse my build folders. I did have to make multiple folders when DFHack started supporting x64, but I haven't had to recreate them since.

Windows is another story, but you ought to still be able to keep at least your clone around between builds. There are a couple issues related to Visual Studio deciding to rebuild a large part of DFHack, maybe due to protobuf, and maybe fixed with recent commits, but that's mainly an annoyance.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on October 29, 2016, 11:06:18 pm
Well I was screwing around trying to see if I could find some of the last symbols (my kingdom for linux 64 bit ui_advmode) so I had moved folders around to access them with edb and figured a clean rm -r before a new build wouldn't hurt.
Title: Re: DFHack 0.43.03-r1
Post by: Goatmaan on November 01, 2016, 11:05:37 am
Can someone please tell me dfhack command to clear the dead missing list?
I'm still on 40.19 (r2 lnp).
2 game years after enabling Large Address Aware I've ran into the "Nemisis unit load failure" and I'm pretty sure Anvillocked is doomed.
I'm open to ANY suggestions at this point.
There is no backup.
I do have another retired fort, but retirement/ unretire of Anvillocked will be a nasty thing.

  Goatmaan
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 01, 2016, 02:39:11 pm
I think that error is due to missing or corrupted unit files, which probably wouldn't be fixed by clearing the dead list (since I can't think of much reason for the game to load dead units), but I could be wrong.

The command appears to be fix/dead-units.
Title: Re: DFHack 0.43.03-r1
Post by: Goatmaan on November 01, 2016, 11:04:53 pm
From what I've read, Anvillocked is doomed.  Seven days after the save point, on 1114/00//12 BOOM!!!! Nemisis load fail.
42 years game time.
22 months realtime, almost 1 year at 3 fps, killed by a corrupt save!? Well...hmn.
No time to train the 50 more squads, 10 will have to do.
75 miners will be ordered to dig down.
No time left to spiral them(GRRRR!!!! Was wanting to watch THAT!!
.), the clowns will get the job.
 Dammit. 2X.
Always planned on killimg them all, just thought I'd have more time.
Guess the dead is dead part is over, time to make a backup to post.
Then I kill them. All 938 of them. (836 adults, 99 children, 3 babes)
So close to 1000 adults, yet so far!!!!
Baa, stupid bugs.

   *Extremely frustrated*,
      XXGoatmaanXX

Ps. lethosor thanks for the command, I have to try it (or anything else!) I'm pretty sure it's the Elvan diplomat who needs to enter, but he got FUBAR'd last visit!!  I have 1 dead elven merchant on the dead missing list....after I copy the save, I'll try EVERYTHING anyone can think of, but hope is slim, very slim. GRRRRRRRRR!!!!!
Who's got the sewer brew ??!! I need a drink!! Just leave the barrel, please.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on November 02, 2016, 07:43:36 am
It might be possible to find the matching historical figure / nemesis record and alter it so maybe the game doesn't try to load the unit record (which is what generates the error), though determining exactly which one (assuming it's only one) is at fault would require careful analysis of your save file - upload a copy to DFFD and someone here might be able to help you.
Title: Re: DFHack 0.43.03-r1
Post by: Goatmaan on November 02, 2016, 12:00:43 pm
Thanks Quietust, I'm officially boned.  :'(

What file specifically do I need to upload?
Region1 uncompressed is 1.3 GB.
World.sav uncompressed is 791 MB.

I've never compressed a file. Guess I'll have to now!
I also don't have net access at home so I'll have to take a flashdrive to the library. Hopefully they'll let me upload the monster.
Anything else?

I'm seriously considering retiring/unretiring to see if I can jump past the elves (invasions are off, gotta be them. Caverns unbreached) but Anvillocked has very high item counts, if they scatter...

Thanks for the help,
  Goatmaan
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on November 02, 2016, 06:17:30 pm
Quote from: Toady One in response to an offset export flag
Global variables can work like that, and we should have something there for next time.
Is good?
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on November 02, 2016, 06:25:59 pm
What file specifically do I need to upload?
Region1 uncompressed is 1.3 GB.
World.sav uncompressed is 791 MB.
The entire region1 folder. Compress it with 7-Zip (http://www.7-zip.org/) (make a ".7z" file, not a ".zip" file) and it'll take a lot less time to upload to DFFD.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on November 04, 2016, 03:48:53 am
I believe there should be an RNG seed controlling how each region is generated somewhere in the structures but I've been unable to locate it. Does anyone know if it's known and where to find it?

I'm trying to find the seed to manipulate it into generating a region map for an intended embark such that the biomes of each of the surrounding world map tiles plus the embark world map tile can be found officially within a single 3*3 embark area somewhere in that 16*16 embark tile region.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on November 04, 2016, 03:53:11 am
df.global.world.worldgen_parms.seed
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on November 04, 2016, 06:36:37 am
df.global.world.worldgen_parms.seed
That's for the entire world - if you want seeds for each region tile, you probably want world_region_details.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on November 04, 2016, 08:05:20 am
Thanks for the suggestions, but neither is what I'm after. I'm looking for the step in between, i.e. the region, rather than the world or the region tile.
As far as I've seen, the world_region_details structure contains the info for the currently selected (pre embark, embarked at, or, at a guess, the corresponding thing in adventure mode) world region, but the data doesn't exist in this structure when focus is elsewhere (it's populated by what's in that focus). Thus, my conclusion is that this structure is generated from a mid level seed for each world tile tucked away somewhere (or this structure is loaded from a store somewhere else, but that doesn't match the generation pattern I believe I see in DF). If I mess with the region parameters and change focus back and forth, the region is back to the way it was before I manipulated it. Embarking in a manipulated region will retain the manipulations at the embark level (specifying which biomes each of the 9 embark tiles of a 3*3 should have), but retiring and reclaiming shows the world region as it was before I manipulated it (but the reclaimed embark remain as it it was, i.e. affected by the manipulation).

Edit: I tried Putnam's approach to see if the region seeds were somehow derived from the world main seed, but it had no effect on region generation.
Title: Re: DFHack 0.43.03-r1
Post by: Aelius51 on November 05, 2016, 04:30:44 pm
Getting a crash with Stonesense enabled. I uploaded the save on DFFD (http://dffd.bay12games.com/file.php?id=12546) and in the description I elaborated on the nature of the crash.
Title: Re: DFHack 0.43.03-r1
Post by: pikachu17 on November 09, 2016, 02:04:05 pm
I was trying to make a artifact mod, with weapons and armor that can only be created with a mood, and that said artifacts are magical, but there were problems
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on November 09, 2016, 04:33:42 pm
I was trying to make a artifact mod, with weapons and armor that can only be created with a mood, and that said artifacts are magical, but there were problems
  • it seems to work when the items are picked up, not actually wielded or worn

Picking an item up is wielding it; you want to use \\MODE 1 if you want it to only work on weapons and \\MODE 2 if you want it to only work on armor.

  • it seems to stop working when the items are put down, but it doesn't end the syndromes. the speed boots continued to speed up people after they put it down

You're going to have to create a separate -onUnequip for that.

  • the weapons that are supposed to put syndromes on hit enemies don't work

Not specific enough for me to actually answer. What are you using to add the syndromes and what do the arguments look like if it's a DFHack script?

  • none of the things that would require locations work(the hellhammer can't create a hfs-pit on a hit enemy, or create a summoned demon)

Again, post the arguments for the command that you expect to do this.
Title: Re: DFHack 0.43.03-r1
Post by: pikachu17 on November 11, 2016, 03:36:06 pm
[CREATURE:ARTIFACT]
           [ARENA_RESTRICTED]
              [DOES_NOT_EXIST]
[NAME:::][CASTE_NAME:::]
   [USE_MATERIAL_TEMPLATE:SPEED_BOOT:STONE_TEMPLATE]
      [DISPLAY_COLOR:3:0:1]
      [STATE_NAME:ALL_SOLID:speed boot]
      [MELTING_POINT:5]
      [BOILING_POINT:9509]
         [SYNDROME]      
         [SYN_NAME:speed_boot]
         [CE_SPEED_CHANGE:SPEED_PERC:250:START:0:END:10000]
and I used the following scripts in onLoad.init
modtools/item-trigger -itemType ITEM_SHOES_SPEED -onEquip -command [ modtools/add-syndrome -syndrome "speed_boot" -resetPolicy ResetDuration -target \\UNIT_ID ]
modtools/item-trigger -itemType ITEM_SHOES_SPEED -onUnequip -command [ modtools/add-syndrome -erase -syndrome "speed_boot" -resetPolicy ResetDuration -target \\UNIT_ID ]

I don't know how to make hfs-pit work on a strike, I'm asking you how to do it.
Quote
You're going to have to create a separate -onUnequip for that.
I did as you can see. But while the syndrome was removed, the creature was still speeded up. then a adventurer who never got anywhere near a speedboot suddenly got very fast, which I used to good to use to retrieve the luckblade

Title: Re: DFHack 0.43.03-r1
Post by: Fleeting Frames on November 14, 2016, 12:31:54 am
Dunno if this is the proper place for it (did a brief search on exportlegends, saw nothing), but

Spoiler: exportlegends segfault (click to show/hide)

With dfhack-0.43.05-alpha1-Linux-64-gcc-4.8.1.tar.bz2
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 14, 2016, 01:06:18 am
I ran it with a random world on my end and didn't get a crash. It could be world-specific - can you provide the save? Any other details?
Title: Re: DFHack 0.43.03-r1
Post by: Fleeting Frames on November 14, 2016, 01:14:31 am
Aye, might be world-specific. Very young world, currently in 3rd year limestone as of save:
Download Link. (http://dffd.bay12games.com/file.php?id=12556)
Vanilla export worked, though.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 14, 2016, 02:22:20 am
Yeah, "Extra legends_plus xml" is a DFHack-specific stage. Will investigate tomorrow (ideally).
Title: Re: DFHack 0.43.03-r1
Post by: Fleeting Frames on November 14, 2016, 06:23:22 am
Another interesting bit, possibly related to steel jackal's mentioned v-g segfault: I had that crash twice, after saving from in-game game menu, then restarting that same save AND looking at dwarf with v-g right after.

Spoiler: last few messages (click to show/hide)

The save is successful, and restarting and repeating same actions doesn't cause segfault - I'd guess there's a problem of cleanup (I usually don't use the in-game menu anyway, preferring quicksave, but alpha).



Sometimes attempting to trade through inventory does nothing, and sometimes...It crashes. Demonstration:

Empty minecart in a stockpile
(https://i.imgur.com/NrS0suL.png)

q-i
(https://i.imgur.com/cF8QFyj.png)

selecting minecart
(https://i.imgur.com/iQd3JeE.png)

Shift-T:
Quote
[DFHack]# Segmentation fault (core dumped)

Happens regardless of the minecart being routed or not.
Save if needed. (https://mega.nz/#!E0IlCJLb!9soWankMNFluYY2U4ZIVsoQppdt1wvDOnuUXUy56tc0)
Title: Re: DFHack 0.43.03-r1
Post by: jimboo on November 16, 2016, 09:04:01 am
unit-info-viewer. 

Last searchable mention of this within thread was two years ago, older version/release.  Currently in a community fort w/ 0.43.43-r1 and unit-info-viewer.lua is in the proper hack subdirectory (Masterwork, v. 43.43, Nov 4, 2016) but isn't recognized as a loadable command.  So, how does it work now?  Anybody?   :)     
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 16, 2016, 02:37:59 pm
In the default DFHack installation, it's in:

hack/scripts/gui/unit-info-viewer.lua

This means you need to invoke it as "gui/unit-info-viewer", not "unit-info-viewer".
Title: Re: DFHack 0.43.03-r1
Post by: jimboo on November 16, 2016, 04:57:38 pm
OK, thanks but I read that back in the thread, is what I've been trying to ... wait, scanned up the file and yeah, I'm one of those that type much better with SpellChecker...  so, Thanks -- 
Title: Re: DFHack 0.43.03-r1
Post by: LordKnows on November 17, 2016, 10:21:25 am
I am also getting an error on exporting legends using win 64bit DFHack 0.43.05-alpha1-0-g4d74090. Am a DFhack noob and didn't expect everything to work on 64bit anyway, but figured I'd report.

Save if useful: http://dffd.bay12games.com/file.php?id=12573 (A rather unweildy 100mb 900ish year world)

Quote
Invoking: exportlegends info
...\Desktop\df 43.05/hack/scripts/exportlegends.lua:184: Cannot invoke field (global).TranslateName(): C++ exception: bad allocation.
stack traceback:
   [C]: in function 'dfhack.TranslateName'
   ...\Desktop\df 43.05/hack/scripts/exportlegends.lua:184: in global 'export_more_legends_xml'
   ...\Desktop\df 43.05/hack/scripts/exportlegends.lua:765: in global 'export_legends_info'
   ...\Desktop\df 43.05/hack/scripts/exportlegends.lua:822: in local 'f'
   \Desktop\df 43.05\hack\lua\dfhack.lua:562: in function 'dfhack.run_script_with_env'
   (...tail calls...)

Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 17, 2016, 03:11:58 pm
I am also getting an error on exporting legends using win 64bit DFHack 0.43.05-alpha1-0-g4d74090. Am a DFhack noob and didn't expect everything to work on 64bit anyway, but figured I'd report.

Save if useful: http://dffd.bay12games.com/file.php?id=12573 (A rather unweildy 100mb 900ish year world)

Quote
Invoking: exportlegends info
...\Desktop\df 43.05/hack/scripts/exportlegends.lua:184: Cannot invoke field (global).TranslateName(): C++ exception: bad allocation.
stack traceback:
   [C]: in function 'dfhack.TranslateName'
   ...\Desktop\df 43.05/hack/scripts/exportlegends.lua:184: in global 'export_more_legends_xml'
   ...\Desktop\df 43.05/hack/scripts/exportlegends.lua:765: in global 'export_legends_info'
   ...\Desktop\df 43.05/hack/scripts/exportlegends.lua:822: in local 'f'
   \Desktop\df 43.05\hack\lua\dfhack.lua:562: in function 'dfhack.run_script_with_env'
   (...tail calls...)

Your issue looks a lot like https://github.com/DFHack/dfhack/issues/1005, which should be fixed in the next release.


Aye, might be world-specific. Very young world, currently in 3rd year limestone as of save:
Download Link. (http://dffd.bay12games.com/file.php?id=12556)
Vanilla export worked, though.
I've gotten through the stage that was crashing, so it could be the same issue. However, I'm getting crashes in what appear to be the vanilla export stages now (mostly the drainage map, but one hang on the standard biome+site map), which is weird.
Title: Re: DFHack 0.43.03-r1
Post by: LordKnows on November 17, 2016, 07:16:24 pm
Your issue looks a lot like https://github.com/DFHack/dfhack/issues/1005, which should be fixed in the next release.

Ah, I should have figured there is a dedicated bug tracker to check. I always find github confusing though.  :P

That's in all likelihood it, thanks for all the hard work!
Title: Re: DFHack 0.43.03-r1
Post by: amade on November 17, 2016, 11:27:30 pm
I've been told to ask about this (http://www.bay12forums.com/smf/index.php?topic=161538.0) here.

Here's what I plan to do, but couldn't figure out how.
I want to ressurrect 6 dead goblin invaders and kill them again. I think full-heal would help me do this, but it kept giving me the following error:
Code: [Select]
No unit is selected in the UI.
Error: please select a unit or pass its id as an argument.

I've tried "selecting" the unit by using (k) on its corpse, and even pressing (enter) to view it, but still no luck. Is there another way available to select the unit or to find their ID?

Please note, I'm not exactly savvy with using DFHack and what I'm asking for might be a bit over my league.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 18, 2016, 12:48:53 am
Corpses are basically items, so selecting them won't work for something that expects a unit to be selected.

One thing I think you can do is select them in the dead/missing tab in the (u)nits screen. There could be a way to get their unit IDs from their corpses, but I don't remember if it's trivial or if you have to look up some references somewhere.
Title: Re: DFHack 0.43.03-r1
Post by: amade on November 18, 2016, 01:26:17 am
Yeah, I already tried that. Unfortunately the dead/missing tab don't list goblin invaders.

Been looking around on how to find unit IDs from their corpses, but no luck so far. And because I'm an idiot, I already deleted my backup saves from before the goblins were dead (otherwise I could find their unit ID via "teleport -showunitid".
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 18, 2016, 02:03:04 am
Try full-heal -r
Title: Re: DFHack 0.43.03-r1
Post by: amade on November 18, 2016, 02:09:22 am
Try full-heal -r

That was what I was trying. Sorry if I wasn't clear.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 18, 2016, 08:56:45 am
Okay, you should be able to get the unit ID from the corpse by selecting it and running

:lua ~dfhack.gui.getSelectedItem().unit_id

(or just ":lua ~item.unit_id" with DFHack for 0.43.05+)
Title: Re: DFHack 0.43.03-r1
Post by: amade on November 18, 2016, 11:41:59 am
Thanks, that worked for getting the IDs, and I think I was able to ressurect the goblins. Their corpses changed status to (h)idden, and then simply disappeared as soon as I unpaused the game (curiously, their severed body parts didn't disappear along with their corpses). But the goblins themselves were nowhere to be found, nor were they back in the units screen. I guess they respawned elsewhere? So I tried the same method on one of my dead dorfs (but via unit screen) and he reappeared where he was struck down.

So I'm guessing the goblins would also reappear where they fell and probably go into ambush state. However, since they died in various locations far from the fort (which I can't even remember the exact locations) I wasn't able to station my militia to cover all the suspected locations. The solution would be to use the teleport command. I tested it on a dorf and he teleported to the pos I had input. I tried it with the goblin's ID but they didn't appear at all (even though DFHack didn't output any errors).

Perhaps the goblin's ID I got was wrong or the full-heal -r didn't actually work. Either way, my fortress is still stuck with the perpetual SIEGE :-(
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 18, 2016, 04:44:03 pm
Oh, it's a stuck siege issue. Sieges have changed a lot since 0.31, so I don't know if that advice would be helpful, really.

If you're sure that a utility like DFHack didn't cause the issue, I would really recommend reporting that on Mantis and uploading a save to DFFD (or if it's already been reported, link to the save in the existing report).
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on November 18, 2016, 11:42:08 pm
Hmmm, I'm a bit drowsy, but couldn't you just lua search for the df.global.world.armies entry with the target being your site.id? I think it was under the controller subfield though, if you knew the general range of pos_x and pos_y which your fort covers you could manually dump them outside the boundaries.
Title: Re: DFHack 0.43.03-r1
Post by: amade on November 19, 2016, 02:19:48 am
Hmmm, I'm a bit drowsy, but couldn't you just lua search for the df.global.world.armies entry with the target being your site.id? I think it was under the controller subfield though, if you knew the general range of pos_x and pos_y which your fort covers you could manually dump them outside the boundaries.

Sorry, way over my head there :-P

Title: Re: DFHack 0.43.03-r1
Post by: Max™ on November 19, 2016, 10:19:43 am
Yeah, trying to think of where you'd check for the army besides guessing.

Hmmm, if you knew the civ attacking you then that has a list of the armies under df.global.world.entities[civ id].armies actually.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on November 20, 2016, 02:46:45 pm
probably need to at one point figure out what makes armies invade towns and use that to rescue recruit more people to new armies so they could invade more towns.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on November 20, 2016, 05:15:51 pm
Putting the army controller pos in a town seems to work pretty well.
Title: Re: DFHack 0.43.03-r1
Post by: amade on November 21, 2016, 01:45:39 pm
Welp, bug happened to me again.

I reloaded the fortress back to day 1 of embark and after 2 years the invaders came (but this time only 1 appeared). I think the rest of the invading party is stuck somewhere? Maybe ressurecting the dead invaders to kill them again was not the right approach after all.

Here's the bug report if anyone's interested: http://www.bay12games.com/dwarves/mantisbt/view.php?id=10075
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on November 22, 2016, 02:12:09 pm
How would I go about submitting scripts for inclusion in DFHack? What repository should I use? (I assume the process is fork>add script>submit pull request)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 22, 2016, 02:19:24 pm
Pretty much, and https://github.com/dfhack/scripts is the repo you want.
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on November 22, 2016, 02:22:13 pm
I hope this is about those seasonal color palettes.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on November 22, 2016, 02:23:52 pm
Yup, that, change-build-menu, and if-entity. :)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 22, 2016, 10:38:44 pm
Here's alpha2 (https://github.com/DFHack/dfhack/releases/tag/0.43.05-alpha2) (finally). Sorry for the many delays there.

Ruby should work everywhere now! (At least in theory - hopefully scripts work, but we haven't tested all of them, so please report anything you find.)
Title: Re: DFHack 0.43.03-r1
Post by: jecowa on November 22, 2016, 11:44:54 pm
Sorry for the many delays there.

It's okay. But if you keep it up, we'll dock your pay. :p

It must take lots of time to maintain this, especially with the last two updates. Hopefully toady won't ever have to double the bits or switch compilers for at least another ten years.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on November 23, 2016, 12:25:16 am
How would I go about submitting scripts for inclusion in DFHack? What repository should I use? (I assume the process is fork>add script>submit pull request)

Don't forget to document it!  Check other scripts for examples, and read the documentation on how to do documentation (https://dfhack.readthedocs.io/en/stable/Contributing.html#documentation-standards) (yo, I heard you like...)
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on November 26, 2016, 12:27:38 pm
Can somebody help with html side of things (e.g fancy javascript and stuff like that)? I've made a way to play df multiplayer-ish: server builds the fort and clients can see what their dwarf does and limits its burrows and labors.
However my html is rusty and i'm not very interested in improving it so it currently looks like this:
Spoiler (click to show/hide)
Also (almost)everything is in lua so it's easy to change :)

also: script -  here  (https://gist.github.com/warmist/753a2444bbe287efa59615913de3f433)
plugin dll from WINx64 this archive  here  (https://ci.appveyor.com/api/buildjobs/d6cmhsgnx92ea9iw/artifacts/build%2Fwin64%2Frelease.zip)

Edit: you can try it here: http://dwarffort.duckdns.org
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on November 28, 2016, 12:32:00 pm
That seems outside of the scope of this thread. You may be able to get some help if you start a fresh thread for it specifically, and maybe with some cleanup such that the HTML isn't generated in the Python directly.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 28, 2016, 04:19:19 pm
It's a DFHack-based project. (Also, that's Lua, not Python.)

This was discussed on IRC some, but in case I didn't mention it there, I'm interested in helping with it (to the extent that I can, being busy IRL and all).
Title: Re: DFHack 0.43.03-r1
Post by: Wegwerf on November 29, 2016, 10:38:39 am
What are we missing for a full release of dfhack for the 64bit version? How can I help developing or researching memory layouts etc? I searched for answers on the forum for an hour, but could not find a good starting point. Could someone please provide one? Sorry about the openness of my question. If someone has written a guide for this then it is well-hidden. I would really like to start contributing :)
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on November 29, 2016, 02:56:08 pm
What are we missing for a full release of dfhack for the 64bit version? How can I help developing or researching memory layouts etc? I searched for answers on the forum for an hour, but could not find a good starting point. Could someone please provide one? Sorry about the openness of my question. If someone has written a guide for this then it is well-hidden. I would really like to start contributing :)
http://dfhack.readthedocs.io/en/stable/library/xml/how-to-update.html

You should probably practice on an old 32-bit version (with known layouts) before attempting 64-bit.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 29, 2016, 04:32:44 pm
That document pretty much just covers globals. Most of the globals (except a few debug flags, I think) are already located.

To answer the original question, we need to check most tools and make sure they don't crash. It's also helpful to explore structure layouts (e.g. with gui/gm-editor) and make sure that doesn't crash either. Also, there are a couple other things to fix, like 64-bit Stonesense (which is mainly just missing allegro libraries).

Part of the delay is due to a lack of time spent testing. Out of the 247 people that have downloaded the 64-bit Windows build, I've seen exactly one report of a crash that occurs with the majority of Ruby scripts (exterminate, etc.). If only one person bothered to report an obvious crash like that, I'm not entirely confident in that build's overall stability.
Title: Re: DFHack 0.43.03-r1
Post by: Wegwerf on November 29, 2016, 04:55:31 pm
Oh boy, that guide was basically in front of me the whole time? Thanks for showing me. Is this the right thread to ask questions about the process?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 29, 2016, 04:58:24 pm
Sure, you can ask here. Or on IRC, if you prefer that.

Like I mentioned, though, that page is mostly about globals, which we already have done. The bigger issue now is checking various structures and making sure they're still valid (by poking around in the lua interpreter, in gui/gm-editor, etc.).
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on November 29, 2016, 06:05:49 pm
Part of the delay is due to a lack of time spent testing. Out of the 247 people that have downloaded the 64-bit Windows build, I've seen exactly one report of a crash that occurs with the majority of Ruby scripts (exterminate, etc.). If only one person bothered to report an obvious crash like that, I'm not entirely confident in that build's overall stability.

Okay, it sounds like we really need some automated testing.  I'm thinking that for a start, just trying to run all of the commands in a reasonably sensible context (eg correct game mode) and reporting any crashes would be great.  This will still take a fair bit of work, including maybe a script to navigate DF menus, but the payoff should be worth it.

More complicated stuff can come later.  I'd like command arguments, better context awareness, basic fuzzing, output checking, and so on... but all of that can be built on a basic "run all the commands and see what happens".

This might be my next project   :)
Title: Re: DFHack 0.43.03-r1
Post by: Rose on November 29, 2016, 11:07:31 pm
That document pretty much just covers globals. Most of the globals (except a few debug flags, I think) are already located.

To answer the original question, we need to check most tools and make sure they don't crash. It's also helpful to explore structure layouts (e.g. with gui/gm-editor) and make sure that doesn't crash either. Also, there are a couple other things to fix, like 64-bit Stonesense (which is mainly just missing allegro libraries).

Part of the delay is due to a lack of time spent testing. Out of the 247 people that have downloaded the 64-bit Windows build, I've seen exactly one report of a crash that occurs with the majority of Ruby scripts (exterminate, etc.). If only one person bothered to report an obvious crash like that, I'm not entirely confident in that build's overall stability.

Stonesense is already updated on windows, for both versions.

If nobody else can do it, I can try to update the Linux build process, but it's a last resort because I'd have to set up a dev environment first.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on November 29, 2016, 11:43:47 pm
Oh, right. 64-bit OS X needs to be fixed too. I'll have to look into building allegro again, I guess.

Okay, it sounds like we really need some automated testing.  I'm thinking that for a start, just trying to run all of the commands in a reasonably sensible context (eg correct game mode) and reporting any crashes would be great.  This will still take a fair bit of work, including maybe a script to navigate DF menus, but the payoff should be worth it.

More complicated stuff can come later.  I'd like command arguments, better context awareness, basic fuzzing, output checking, and so on... but all of that can be built on a basic "run all the commands and see what happens".

This might be my next project   :)
Yeah, testing is something I've wanted to do. I looked at unit tests recently, although those wouldn't be as useful for the DF-related issues. I have a script that walks through all of the structures (well, mostly), which crashes when something is misaligned badly enough, so that might be a decent place to start. Besides that, actual tests that run in DF would have a couple things to sort out (nothing impossible, though):
- Needing to start DF (this takes time, although it might be fast on Travis)
- Needing to restart DF if a test crashes DF (but not restarting unnecessarily, to save time)
- Needing to restart DF (or abort and reload the current game?) if a test does something difficult to reverse (3dveins, exterminate, etc.). Hopefully this isn't necessary often, though.

In short, it could be slow, but it's definitely something I want to look into.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on November 30, 2016, 12:12:38 am
Okay, it sounds like we really need some automated testing.  I'm thinking that for a start, just trying to run all of the commands in a reasonably sensible context (eg correct game mode) and reporting any crashes would be great.  This will still take a fair bit of work, including maybe a script to navigate DF menus, but the payoff should be worth it.
Yeah, testing is something I've wanted to do. I looked at unit tests recently, although those wouldn't be as useful for the DF-related issues. I have a script that walks through all of the structures (well, mostly), which crashes when something is misaligned badly enough, so that might be a decent place to start. Besides that, actual tests that run in DF would have a couple things to sort out (nothing impossible, though):
- Needing to start DF (this takes time, although it might be fast on Travis)
- Needing to restart DF if a test crashes DF (but not restarting unnecessarily, to save time)
- Needing to restart DF (or abort and reload the current game?) if a test does something difficult to reverse (3dveins, exterminate, etc.). Hopefully this isn't necessary often, though.

In short, it could be slow, but it's definitely something I want to look into.

Basically there's tests that run in seconds (before every commit), in minutes (when you go get a coffee), and in hours (overnight).  Obviously the faster the better!  Your script sounds fantastic as a fast-unit-test-ish-thing, and I'd certainly see how far it can go.  Interaction with DF is certain to slow things down, but that's just a feature of integration testing... which is exactly what DFHack needs to do.

I'd probably try to build two settings - one fast check (minutes) that either passes or fails, and one longer stress-test (many minutes or hours) that just hammers at everything I can think of and reports in detail on each thing it breaks.  I'm thinking more like AFL fuzzing than unit tests, if that clarifies things.
Title: Re: DFHack 0.43.03-r1
Post by: Immortal-D on December 01, 2016, 08:37:58 am
I was playing with the SpawnUnit command, and it works as expected.  However, I was wondering if anyone knows a way to spawn critters.  Or is it only possible for sentients?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 01, 2016, 10:51:38 am
Are you referring to "vermin" (like ants, small fish, etc.)? Spawnunit doesn't support those, and I'm not sure if it's possible to create them in another way.
Title: Re: DFHack 0.43.03-r1
Post by: TheFlame52 on December 01, 2016, 02:06:30 pm
I think createitem can make vermin.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 01, 2016, 04:06:18 pm
I'm sure I saw a command to create colony vermin (defaulting to bees). However, I thought the question was about regular animals rather than vermin or sapients?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 01, 2016, 04:14:29 pm
Well, I poked around with edb trying to follow the old methods to track down the last few linux 64 bit globals missing, had a few that looked like the right range for ui_advmode, but I had to kinda hit and miss hunt around because doing the full analysis step made edb hang and start eating Xorg's head, bleh.

It feels like it should be in the range of these but I finally just started counting through what should have been the right number of steps to find them before I noticed ui_look_list was missing too and I had been trying to work from the ui_look_sidebar or some shit, oh and first I started out trying to hunt it down in the wrong direction, I'm pretty sure it's just a bit (like 10000_16 or so) lower than the ui hex (0x1a6e540) but I wasn't paying attention to that since I was leaning in and squinting at the little numbers in the edb panes.

Code: [Select]
0x205cd40
0x2058140
0x1a81280
0x1a7e600
0x1a5e480
0x1a5b800
0x17f4020
0x17f3220
0x1484940
0x147fd40
I had thought I was closing in on it until I noticed the ui_look_list fuckup I was making, but none of those worked, just spat segfaults at me til I gave up and made a fort intending to track down the ui_look_list global before I started having fun poking at my dorfs and whatnot.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 01, 2016, 10:57:49 pm
I am working on some scripts and have a couple questions;

1. Is there a script that removes a tree (and all connecting branches and such) from a map? As in, I target a location or a tree id (I don't know, do tree's have individual ids?) and it will be erased?
2. Similarly, a script that does the same for bushes/shrubs/any growths?
3. Is milo christiansen's script (http://www.bay12forums.com/smf/index.php?topic=150776.msg6233559#msg6233559) still the best way to get a tile's material using lua?
4. Back to trees, is there a way to see how old a tree is and to get more information about it?
5. Do the current scripts for resurrecting corpses handle body parts? That is to say, if I target a corpse whose hand was chopped off and then rez it, will the hand corpse item be removed or will it stay in game?
6. Along the same lines, if a unit is resurrected will the other members of your fort still want to bury them?

I will have more questions later, but that's enough for now.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on December 02, 2016, 02:23:36 am
I'm sure I saw a command to create colony vermin (defaulting to bees). However, I thought the question was about regular animals rather than vermin or sapients?

FWIW, that command is colonies (https://dfhack.readthedocs.io/en/stable/docs/_auto/base.html#colonies)
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 02, 2016, 04:19:42 am
I am working on some scripts and have a couple questions;

Collection of vague guesses and pointers:

1. Is there a script that removes a tree (and all connecting branches and such) from a map? As in, I target a location or a tree id (I don't know, do tree's have individual ids?) and it will be erased?
2. Similarly, a script that does the same for bushes/shrubs/any growths?
3. Is milo christiansen's script (http://www.bay12forums.com/smf/index.php?topic=150776.msg6233559#msg6233559) still the best way to get a tile's material using lua?
4. Back to trees, is there a way to see how old a tree is and to get more information about it?
5. Do the current scripts for resurrecting corpses handle body parts? That is to say, if I target a corpse whose hand was chopped off and then rez it, will the hand corpse item be removed or will it stay in game?
6. Along the same lines, if a unit is resurrected will the other members of your fort still want to bury them?

I will have more questions later, but that's enough for now.
1. I don't know. Each tree/shrub on the map has it's individual entity in the df.global.world.plants.all list ("path" might not be completely correct as it's from memory). In addition to that, there's also info on the tile itself that there's a trunk/sapling. Highwood can cover several tiles. Branches are likewise "present" on their tiles. I haven't tried to remove any though, and I don't know if there are additional references (trees designated for cutting end up in the jobs list, but the tree being gone just results in an extra cutting job doing nothing, which happens when getplants is run several times with unpauses in between to designate the same trees). The Plants command creates plants, and you sort of want to do the reverse.
2. -
3. Probe does it interactively. I haven't looked at the script. I can use Probe's logic to get at the data using lua, though.
4. The plant info contains at least one timer, so you should be able to get the info there.
5. I don't really know, but other discussions indicate the corpse and body parts are generated upon death as separate items, so resurrecting a creature ought to give it a new body.
6. Speculating, I would expect the burial situation would correspond to the normal case of a lost body part without dying, in which case the body parts ought to be "stored" in the corpse stockpile until the final death. Would both/all bodies be buried? You try it out and tell us!
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 02, 2016, 07:38:35 am
well most of the rez scripts are bringing back the unit from death and usually leaves a body behind.
them dying again doesn't produce another corpse and they blink out of living realm.
rez interaction checks for a dead unit with matching historical figures to the corpse and Rez them with proper wounds or makes a new unit with the correct historical figures to the dead unit if the interaction couldn't find the dead unit in the list of all or active units.
if there a weird case of multiple rez attempts it will reanimate the other corpse parts and usually makes a new unit that just shares traits descriptions of the original.
leading to the clone zombie army dfhack trick where you resurrect the zombie you made with the script then reanimate them in game then get the fresh zombie killed so you can resurrect their soul.


hmm in other dfhack ideas I wonder if it's possible to remove the site restrictions on building in adventure mode in towns and have it not make a new camp on top of the site either.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on December 02, 2016, 12:51:36 pm
1. Is there a script that removes a tree (and all connecting branches and such) from a map? As in, I target a location or a tree id (I don't know, do tree's have individual ids?) and it will be erased?
2. Similarly, a script that does the same for bushes/shrubs/any growths?
3. Is milo christiansen's script (http://www.bay12forums.com/smf/index.php?topic=150776.msg6233559#msg6233559) still the best way to get a tile's material using lua?

1) Not that I know of, but it wouldn't be hard to write one...
2) I have a script that forcibly removes surface saplings. Actually if you look back a few pages in this thread I posted an early version of my sapling elimination code.

Speaking of my sapling deletion script I need to get that tested... The script is supposed to be an answer to "the jungle problem" (trees growing super thick on every map regardless of biome). Basically if surface trees go over a set limit it deletes all surface saplings until trees go under the limit again :)
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 02, 2016, 05:09:51 pm
1. Is there a script that removes a tree (and all connecting branches and such) from a map? As in, I target a location or a tree id (I don't know, do tree's have individual ids?) and it will be erased?
2. Similarly, a script that does the same for bushes/shrubs/any growths?
3. Is milo christiansen's script (http://www.bay12forums.com/smf/index.php?topic=150776.msg6233559#msg6233559) still the best way to get a tile's material using lua?

1) Not that I know of, but it wouldn't be hard to write one...
2) I have a script that forcibly removes surface saplings. Actually if you look back a few pages in this thread I posted an early version of my sapling elimination code.

Speaking of my sapling deletion script I need to get that tested... The script is supposed to be an answer to "the jungle problem" (trees growing super thick on every map regardless of biome). Basically if surface trees go over a set limit it deletes all surface saplings until trees go under the limit again :)

Well when I look at the information for a given tree I find
Code: [Select]
[lua]# ~df.plant.find(2114)
<plant: 0x18452340>
flags                    = <plant_flags: 0x18452340>
material                 = 153
pos                      = <coord: 0x18452344>
grow_counter             = 19982037
damage_flags             = <plant.T_damage_flags: 0x18452350>
hitpoints                = 400000
update_order             = 9
site_id                  = -1
srb_id                   = -1
contaminants             = <vector<spatter_common*>: 0x18452364>
tree_info                = <plant_tree_info: 0x185d0a30>
Note that this is the same as just going ~df.global.world.plants.all[2114], the 2114 was just picked at random and then I went to look at that spot on the map. What is growing here is a large three story tree. My efforts to remove it were as follows;

1. Set hitpoints to 0 and then to -1. I was really hoping this would just take care of the tree, but nothing seemed to happen.
2. Set grow counter to 0 and then to -1. Again, no visible effect.
3. Set all damage_flags to true. No change.
4. Change material just to make sure you can actually have an affect. Material of tree did change.
5. Remove the entry for the tree from the plant list. No change.
6. Change the tiletype to that of the adjacent grass square. Tile changed to grass, but rest of tree (the above trunks and branches and twigs) still remain.

Now 4 and 5 together might be necessary to remove the tree (didn't try 5 without 4) but what I can't figure out is how to find all of the tiles for the tree. The plant entry only lists the base trunk, but changing the material of the base trunk changes the material of the entire tree, so they must be connected. Now I could just iterate over all of the squares next to the base of the tree and see which ones are also TREE tile types, but what if two trees are right next to eachother? How do you determine which branches belong to which tree?

Also, I can't think of a slick way to determine the id of a tree at a given location. It's possible to just brute force it and go through the position of all the plants on the df.global.world.plants.all list, but that could be several thousand even on a small map. And also you may be looking at not the main tree trunk but a different part of the tree, in which case you would need to look for the main trunk first and then look for the id.

All of these issues definitely can be dealt with brute force style. Just wondering if anyone else can think of a more elegant way to go about it.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 02, 2016, 05:30:02 pm
I haven't looked at it, but I would expect the tree_info pointer to contain the rest of the tree (including roots...).
Thus, I would expect you to have to remove the tree parts tile for tile, and figure out when to replace roots with soil and branches with air (and probably cater for trees growing through bridges as well). You also need to experiment to find out if digging through tree roots changes the tree root info or not: if it doesn't you have to figure out when you should do nothing. Also note that tree parts can be dead and burned, so the tile type can be the burned version as well as the live one (at least).

I've found tree entries in the plants list that point to neither trees nor saplings, so I suspect the tree isn't actually removed upon cutting, but I don't know. IF you need to remove it you probably have to remove int from not only the plants.all, but from the plants.tree list as well.

One experiment you may want to do is to fire a ballista arrow at a tree to disintegrate it and see how things look before and after.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on December 02, 2016, 06:50:13 pm
What I would do is find tree tiles based on the tree_info field and set them to an appropriate tile type (open space mostly). Then delete the plant object from the list. Don't forget that there are actually two other lists containing trees (one for dry, one for wet), also you need to delete the tree object itself or you will leak memory.

If you want to see how to tell if a given tile is part of the tree see my material finder module.

Here is (an old version of) the code I use to delete saplings. For trees the main difference would be that you would need to change all the tiles, not just one.
Code: [Select]
-- Note that "del" is a (sorted) table of tables containing the plant index and a reference to the plant object itself
for _, plant in ipairs(del) do
local block = dfhack.maps.ensureTileBlock(plant.pos.x, plant.pos.y, plant.pos.z)
block.tiletype[plant.pos.x%16][plant.pos.y%16] = df.tiletype["SoilFloor1"]

-- The list is high indexes to low indexes, so we can just delete from the list without fear of messing up later indexes.
df.global.world.plants.all:erase(plant.i)

-- Plants do not have an ID number, so we need to compare them based on location.

for j = 0, #df.global.world.plants.tree_dry - 1, 1 do
if same_xyz(df.global.world.plants.tree_dry[j].pos, plant.ref.pos) then
df.global.world.plants.tree_dry:erase(j)
break
end
end

for j = 0, #df.global.world.plants.tree_wet - 1, 1 do
if same_xyz(df.global.world.plants.tree_wet[j].pos, plant.ref.pos) then
df.global.world.plants.tree_wet:erase(j)
break
end
end

plant.ref:delete()
end
Title: Re: DFHack 0.43.03-r1
Post by: mirrizin on December 02, 2016, 09:55:07 pm
That document pretty much just covers globals. Most of the globals (except a few debug flags, I think) are already located.

To answer the original question, we need to check most tools and make sure they don't crash. It's also helpful to explore structure layouts (e.g. with gui/gm-editor) and make sure that doesn't crash either. Also, there are a couple other things to fix, like 64-bit Stonesense (which is mainly just missing allegro libraries).

Part of the delay is due to a lack of time spent testing. Out of the 247 people that have downloaded the 64-bit Windows build, I've seen exactly one report of a crash that occurs with the majority of Ruby scripts (exterminate, etc.). If only one person bothered to report an obvious crash like that, I'm not entirely confident in that build's overall stability.

Stonesense is already updated on windows, for both versions.

If nobody else can do it, I can try to update the Linux build process, but it's a last resort because I'd have to set up a dev environment first.
So...this means that Stonesense works? Do the other visualizers work as well?
Title: Re: DFHack 0.43.03-r1
Post by: Immortal-D on December 02, 2016, 10:39:07 pm
I'm sure I saw a command to create colony vermin (defaulting to bees). However, I thought the question was about regular animals rather than vermin or sapients?
Yeah, I'm after normal animals for a bit of !SCIENCE!.  I actually didn't even know that spawning vermin was a thing, lol.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on December 03, 2016, 09:49:10 am
Then delete the plant object from the list. Don't forget that there are actually two other lists containing trees (one for dry, one for wet), also you need to delete the tree object itself or you will leak memory.
You'll need to remove it from the matching map_block_column as well (corresponding to its location within your embark region), otherwise the game will probably crash.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 03, 2016, 03:52:27 pm
Then delete the plant object from the list. Don't forget that there are actually two other lists containing trees (one for dry, one for wet), also you need to delete the tree object itself or you will leak memory.
You'll need to remove it from the matching map_block_column as well (corresponding to its location within your embark region), otherwise the game will probably crash.

It doesn't crash, but it does corrupt the save, so that is something to be very careful with. I think for now I will set aside the tree deletion and work on the other things.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 04, 2016, 12:57:33 am
hmm in other dfhack ideas I wonder if it's possible to remove the site restrictions on building in adventure mode in towns and have it not make a new camp on top of the site either.
Uh, put a tile of paint m lava_flow st 1 sv 0 l 0 underneath you and you can build, but it'll make the campsite still to save your changes.

Hmmm, there's something I'm forgetting that lets this work, but standing on an actual lava flow or in hell (paint m magma btw) works.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 04, 2016, 02:18:44 am
hmm in other dfhack ideas I wonder if it's possible to remove the site restrictions on building in adventure mode in towns and have it not make a new camp on top of the site either.
Uh, put a tile of paint m lava_flow st 1 sv 0 l 0 underneath you and you can build, but it'll make the campsite still to save your changes.

Hmmm, there's something I'm forgetting that lets this work, but standing on an actual lava flow or in hell (paint m magma btw) works.
I found a dfhack way to unlock building in adventure mode but doing anything in that mode will spawn a camp.
my question was is there a way to take over the site so the game doesn't make a camp and just save the changes to the site itself.
though this probably requires poking around what connects adv mode building to a site and what not.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 04, 2016, 03:14:37 am
Which flag/setting/etc unlocks it and I"ll fuck around with it next time I get on to hack around.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 04, 2016, 03:25:01 am
Which flag/setting/etc unlocks it and I"ll fuck around with it next time I get on to hack around.
oh found it. apperently there an option that allows you to expand the " you can build here zone"
usually it set around 148 but looking into it it seems to span farther
so it's possible to just walk into town and flip a
unk 3124 the menu above the anon 46  or where the timer for building is keeps all the adventure building screen data.
which seems to have a user data stored for sites and what not.

and in there anon 1 -4 controls the size of the build zones
just recently discovered this and pokin around it but it might be possible to expand the adventurer build mode now
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 05, 2016, 10:39:45 am
Oh, I can't even do it because the linux 64 ui_advmode is still missing.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on December 06, 2016, 01:28:04 pm
Then delete the plant object from the list. Don't forget that there are actually two other lists containing trees (one for dry, one for wet), also you need to delete the tree object itself or you will leak memory.
You'll need to remove it from the matching map_block_column as well (corresponding to its location within your embark region), otherwise the game will probably crash.

It doesn't crash, but it does corrupt the save, so that is something to be very careful with. I think for now I will set aside the tree deletion and work on the other things.

This is VERY good to know. I probably need to change my tree limit script!
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 06, 2016, 03:15:45 pm
Then delete the plant object from the list. Don't forget that there are actually two other lists containing trees (one for dry, one for wet), also you need to delete the tree object itself or you will leak memory.
You'll need to remove it from the matching map_block_column as well (corresponding to its location within your embark region), otherwise the game will probably crash.
It doesn't crash, but it does corrupt the save, so that is something to be very careful with. I think for now I will set aside the tree deletion and work on the other things.

This is VERY good to know. I probably need to change my tree limit script!

Granted I did a few things so I don't know what exactly it was that did it, but somewhere in step 4 and 5 after I saved and quit and tried reloading the save the game just crashed.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on December 06, 2016, 03:35:40 pm
Regardless, a dangling pointer to a reference I just deleted is a Bad Thing and should be avoided...
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 06, 2016, 06:21:13 pm
Then delete the plant object from the list. Don't forget that there are actually two other lists containing trees (one for dry, one for wet), also you need to delete the tree object itself or you will leak memory.
You'll need to remove it from the matching map_block_column as well (corresponding to its location within your embark region), otherwise the game will probably crash.

So looking into this I have gotten a little confused. What exactly are map_block_columns referring to? With a 96x96 embark cite I have 6x6 blocks (since blocks are 16x16). There are then 36 map blocks per z level. The game shows that I do indeed have 36 map block columns, and if I look at the individual columns they all seem to start and end at the correct x,y coordinates. So all of that is good, but when I look at the map_block_columns.plants thats where things get all screwy. It seems the first map_block_column contains all of the plants for the first 3x3 blocks. This trend continues for the entire grid such that for every nine blocks there is only 1 with plant data in it. The table below illustrates what I mean, with the green colored blocks representing the ones with plant data (if you are wondering why the strange numbering scheme that is how DF does it. I assume because this is a 2x2 embark so that each one square on the embark region cooresponds to 3 blocks)

03691215
147101316
258111417
182124273033
192225283134
202326293235
*Note that I messed up the numbering slightly. DF goes down before across so the 9-17 blocks should trade places with the 18-26 blocks

So basically I am just wondering, am I confusing what map_block_columns are, or is it just that only one map_block_column per embark square actually contains the plant data?
Title: Re: DFHack 0.43.03-r1
Post by: mifki on December 06, 2016, 07:51:02 pm
So basically I am just wondering, am I confusing what map_block_columns are, or is it just that only one map_block_column per embark square actually contains the plant data?

I haven't read everything, but here's the code I use. Oh, I mean I don't know why it's so, so it doesn't answer your question, but I confirm that's how it works.

Code: [Select]
                local mapcol = df.global.world.map.column_index[math.floor(x/48)*3][math.floor(y/48)*3]
               
                for i,p in ipairs(mapcol.plants) do
                    if not p.tree_info then
                        local pos = p.pos
                        if pos.x == x and pos.y == y and pos.z == z then
                            --found the plant
                            local plantraw = df.plant_raw.find(p.material)
                            --...
                            break
                        end
                    else
                        --handle trees differently
                    end
                end
Title: Re: DFHack 0.43.03-r1
Post by: Snafu on December 06, 2016, 07:59:21 pm
What exactly are map_block_columns referring to? With a 96x96 embark cite I have 6x6 blocks (since blocks are 16x16). [...] It seems the first map_block_column contains all of the plants for the first 3x3 blocks. This trend continues for the entire grid such that for every nine blocks there is only 1 with plant data in it.
Is it possible that trees/branches are 'bleeding over' into your embark (check also Z-levels)?
Title: Re: DFHack 0.43.03-r1
Post by: Rose on December 06, 2016, 10:58:17 pm
The first map_block_column per embark square has the plant data, and no plants can cross embark square boundaries.

This is because if they were stored per column, they wouldn't be able to cross map_block boundaries.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on December 07, 2016, 08:02:25 pm
The first map_block_column per embark square has the plant data, and no plants can cross embark square boundaries.

This is because if they were stored per column, they wouldn't be able to cross map_block boundaries.
To clarify, each map_block_column covers a 16x16 area (the "map_pos" field tells you exactly where it is) and mainly keeps track of special elevations or things which are independent of elevation. In older versions, map_block itself held the list of local plants, but the addition of large trees (which span multiple Z-levels) required moving it to map_block_column, and the fact that trees can span multiple map_blocks is why they're only stored in one column out of each 3x3 group (and why they can't extend between region tiles, which made it possible for Toady to much more easily keep terrain generation in Adventurer mode consistent).
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 07, 2016, 10:12:24 pm
New update on tree deletion. Successfully deleting the tree from the three different lists (plants.all, plants.tree_dry/tree_wet and map_block_column.plants) will remove the tree from the game and leave all tiles connected to that tree as just saying Tree. The game was fully able to be saved and reloaded as well. Even without changing the tile types. I have also figured out how to identify the position of each branch, thick branch, trunk, and twig of the tree so that they can be set to the correct tiletype.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on December 08, 2016, 03:22:05 am
New update on tree deletion. Successfully deleting the tree from the three different lists (plants.all, plants.tree_dry/tree_wet and map_block_column.plants) will remove the tree from the game and leave all tiles connected to that tree as just saying Tree. The game was fully able to be saved and reloaded as well. Even without changing the tile types. I have also figured out how to identify the position of each branch, thick branch, trunk, and twig of the tree so that they can be set to the correct tiletype.
Such hatred for trees to go to these length to destroy them without leaving anything. :D
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 08, 2016, 03:22:24 am
New update on tree deletion. Successfully deleting the tree from the three different lists (plants.all, plants.tree_dry/tree_wet and map_block_column.plants) will remove the tree from the game and leave all tiles connected to that tree as just saying Tree. The game was fully able to be saved and reloaded as well. Even without changing the tile types. I have also figured out how to identify the position of each branch, thick branch, trunk, and twig of the tree so that they can be set to the correct tiletype.
Interesting. A tangent question I get as a result is if the bugged underground tiles described as "grass" that sometimes appear are the result of a similar process, i.e. if they're "actually" underground fungal "grass", but the plant object has somehow been lost?
Title: Re: DFHack 0.43.03-r1
Post by: Rose on December 08, 2016, 04:06:01 am
Probably. Grass is stored on a contaminant layer, similar to mud and blood splatters. So it's possible that the actual grass is missing from there, but the tiletype is still grass.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 08, 2016, 06:00:50 am
Probably. Grass is stored on a contaminant layer, similar to mud and blood splatters. So it's possible that the actual grass is missing from there, but the tiletype is still grass.
Are you sure? As far as I've seen grass is stored as plants together with trees and shrubs? Mud and blood can lie on top of grass (just look at mud covered caverns!). However, blood can coexist with mud as well, so that's not much of an argument. However, I'll be on the lookout for unspecified grass tiles underground to take a closer look.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on December 08, 2016, 06:10:21 am
Considering that I read the grass in order to show it in both armok vision and stonesense, yes, I'm sure.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on December 08, 2016, 07:43:11 am
Probably. Grass is stored on a contaminant layer, similar to mud and blood splatters. So it's possible that the actual grass is missing from there, but the tiletype is still grass.
Are you sure? As far as I've seen grass is stored as plants together with trees and shrubs? Mud and blood can lie on top of grass (just look at mud covered caverns!). However, blood can coexist with mud as well, so that's not much of an argument. However, I'll be on the lookout for unspecified grass tiles underground to take a closer look.

Yes, he's sure - they're stored within "block_square_event_grassst" records, along with "block_square_event_mineralst" for mineral veins and "block_square_event_material_spatterst" for contaminants.
Title: Re: DFHack 0.43.03-r1
Post by: utunnels on December 08, 2016, 08:21:42 am
By the way, does anybody tried 43.05 alpha2 for 32bit windows?

Here's what I got. It seemed none of the paths are available, how?


Could not load dfhack-config/script-paths.txt
Plugin does not exist: 3dveins
Plugin does not exist: add-spatter
Plugin does not exist: autochop
Plugin does not exist: autodump
Plugin does not exist: autogems
Plugin does not exist: autohauler
Plugin does not exist: autolabor
Plugin does not exist: automaterial
Plugin does not exist: automelt
Plugin does not exist: autotrade
Plugin does not exist: blueprint
Plugin does not exist: building-hacks
Plugin does not exist: buildingplan
Plugin does not exist: burrows
Plugin does not exist: changeitem
Plugin does not exist: changelayer
Plugin does not exist: changevein
Plugin does not exist: cleanconst
Plugin does not exist: cleaners
Plugin does not exist: cleanowned
Plugin does not exist: command-prompt
Plugin does not exist: confirm
Plugin does not exist: createitem
Plugin does not exist: cursecheck
.............


Edit*

It seems to be the problem on the certain old machine without a video card.
I ran the 32bit version on a 64bit system and it worked.

Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 08, 2016, 10:09:33 am
That looks like an issue with your filesystem of some kind. DFHack sees each plugin in the hack/plugins folder, so it tries to load it, but then it can't find the plugin in the folder any more.

As for the first message, if you installed DFHack manually, did you remember to copy the dfhack-config folder?
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 08, 2016, 10:13:31 am
Thanks Japa and Quietust, now I'm with you. It's stored there as well as in the regular plants, not instead of, similar to how trees and shrubs are stored in an additional block location.

Edit:
I found an underground "grass" tile and the plants.all array had no reference to that coordinate and both of the two grass "events" for that block showed an amount of 0, so it looks like the tile's growth has been lost somewhere in the process (or the material hasn't been reverted).
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 08, 2016, 06:26:42 pm
So I'm using the alpha for the new version, where do I get the "ruby library" to use startdwarves?
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on December 08, 2016, 06:33:36 pm
New update on tree deletion. Successfully deleting the tree from the three different lists (plants.all, plants.tree_dry/tree_wet and map_block_column.plants) will remove the tree from the game and leave all tiles connected to that tree as just saying Tree. The game was fully able to be saved and reloaded as well. Even without changing the tile types. I have also figured out how to identify the position of each branch, thick branch, trunk, and twig of the tree so that they can be set to the correct tiletype.
Such hatred for trees to go to these length to destroy them without leaving anything. :D
We will make these trees unpersons. Soon they will be removed even from people's thoughts.
Title: Re: DFHack 0.43.03-r1
Post by: utunnels on December 08, 2016, 08:33:30 pm
As for the first message, if you installed DFHack manually, did you remember to copy the dfhack-config folder?

Yes I did. And I copied the whole folder from the 32bit machine to the 64bit one and it worked.

Edit*

Oh, dfhack-config is empty except for the default subfolder. It appeared dfhack failed to create files in that folder for some reason.

Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 08, 2016, 09:39:31 pm
So I'm using the alpha for the new version, where do I get the "ruby library" to use startdwarves?
Which is "the" alpha? There have been two, 0.43.05-alpha1 and 0.43.05-alpha2. The latter comes with a ruby plugin and runtime library.

As for the first message, if you installed DFHack manually, did you remember to copy the dfhack-config folder?

Yes I did. And I copied the whole folder from the 32bit machine to the 64bit one and it worked.

Edit*

Oh, dfhack-config is empty except for the default subfolder. It appeared dfhack failed to create files in that folder for some reason.


Was that 32-bit DFHack? I wouldn't expect 64-bit DFHack to launch at all on a 32-bit system, but that's very strange.
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 08, 2016, 09:54:07 pm
So I'm using the alpha for the new version, where do I get the "ruby library" to use startdwarves?
Which is "the" alpha? There have been two, 0.43.05-alpha1 and 0.43.05-alpha2. The latter comes with a ruby plugin and runtime library
Oh, there was an update? I should probably install that then

EDIT: Where do I obtain alpha 2, I have alpha 1 but the file thing where I got the alpha 1 apperentley only has an Alpha 0 which makes me very confused as to how exactly I even have alpha 1
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 08, 2016, 10:24:58 pm
Which "file thing"? All of the DFHack releases are at https://github.com/dfhack/dfhack/ under the "Releases" link.
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 08, 2016, 10:41:40 pm
Sorry that I'm so bad at this but this ZIP has... quite a lot more files then the one that I had and frankly, I've got no idea what they do or what to do with them
Title: Re: DFHack 0.43.03-r1
Post by: utunnels on December 09, 2016, 02:57:56 am
Was that 32-bit DFHack? I wouldn't expect 64-bit DFHack to launch at all on a 32-bit system, but that's very strange.

Yeah, it was.  The system I tried was windows 2003, which I used to run the game remotely to skip time.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 09, 2016, 09:00:35 am
Sorry that I'm so bad at this but this ZIP has... quite a lot more files then the one that I had and frankly, I've got no idea what they do or what to do with them
Did you download a release archive for Windows or something else?

To be clear, under DFHack 0.43.05-alpha2 (http://DFHack 0.43.05-alpha2), you want either "dfhack-0.43.05-alpha2-Windows-32.zip" or "dfhack-0.43.05-alpha2-Windows-64.zip".
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 09, 2016, 02:07:13 pm
New update on tree deletion. Successfully deleting the tree from the three different lists (plants.all, plants.tree_dry/tree_wet and map_block_column.plants) will remove the tree from the game and leave all tiles connected to that tree as just saying Tree. The game was fully able to be saved and reloaded as well. Even without changing the tile types. I have also figured out how to identify the position of each branch, thick branch, trunk, and twig of the tree so that they can be set to the correct tiletype.

So small hiccup. Got it all working perfectly except for the crashes... Namely it crashes when you are searching tree.tree_info.body and you go outside a certain value. Code copied below for reference. The main issue is the z search. Most trees I have examined have a tree_info.body_height of 10, but rarely actually go up 10 z levels. This causes the game to crash if it starts searching for more z levels then the tree has. If I manually set the height to the actual height of the tree everything is fine, but if it is even one more than the height it will crash. Anyone know of an easy way to get the actual tree height, or to prevent crashes when looking at a point in the tree_info.body vector outside of its boundaries?

Code: [Select]
function getTreePositions(tree)
 n = 0
 nTrunk = 0
 nTwigs = 0
 nBranches = 0
 nTBranches = 0
 positions = {}
 positionsTrunk = {}
 positionsTwigs = {}
 positionsBranches = {}
 positionsTBranches = {}
 local x1 = tree.pos.x - math.floor(tree.tree_info.dim_x / 2)
 local x2 = tree.pos.x + math.floor(tree.tree_info.dim_x / 2)
 local y1 = tree.pos.y - math.floor(tree.tree_info.dim_y / 2)
 local y2 = tree.pos.y + math.floor(tree.tree_info.dim_y / 2)
 local z1 = tree.pos.z
 local z2 = tree.pos.z + tree.tree_info.body_height
 for x = x1,x2 do
  for y = y1,y2 do
   for z = z1,z2 do
    pos = {x=x,y=y,z=z}
    body = tree.tree_info.body[pos.z-z1]:_displace((pos.y - y1) * tree.tree_info.dim_x + (pos.x - x1))
    if body.trunk then
     n = n + 1
     positions[n] = pos
     nTrunk = nTrunk + 1
     positionsTrunk[nTrunk] = pos
    elseif body.twigs then
     n = n + 1
     positions[n] = pos
     nTwigs = nTwigs + 1
     positionsTwigs[nTwigs] = pos
    elseif body.branches then
     n = n + 1
     positions[n] = pos
     nBranches = nBranches + 1
     positionsBranches[nBranches] = pos
    elseif body.thick_branches_1 or body.thick_branches_2 or body.thick_branches_3 or body.thick_branches_4 then
     n = n + 1
     positions[n] = pos
     nTBranches = nTBranches + 1
     positionsTBranches[nTBranches] = pos
    end
   end
  end
 end
 return positions,positionsTrunk,positionsTBranches,positionsBranches,positionsTwigs
end
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 09, 2016, 03:54:20 pm
Shouldn't it be "local z2 = tree.pos.z + tree.tree_info.body_height - 1"?
Title: Re: DFHack 0.43.03-r1
Post by: mifki on December 09, 2016, 04:26:28 pm
Have you seen thick_branches_* being actually set?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 09, 2016, 04:34:39 pm
Shouldn't it be "local z2 = tree.pos.z + tree.tree_info.body_height - 1"?

Possibly, but it would actually need to be -4 for the tree I tested on (actual height of 6)

Have you seen thick_branches_* being actually set?

I have not checked, I just use all the positions in my tree removal script so I've never actually gone through the individual tiles. Just figured I should put them there  because they are there, but if they never show up I could just as easily remove them.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on December 09, 2016, 04:51:03 pm
If tree.tree_info.body_height isn't accurate then how does the game know where the tree stops? Is there a "last item" marker of some kind?
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 09, 2016, 05:41:27 pm
Sorry that I'm so bad at this but this ZIP has... quite a lot more files then the one that I had and frankly, I've got no idea what they do or what to do with them
Did you download a release archive for Windows or something else?

To be clear, under DFHack 0.43.05-alpha2 (http://DFHack 0.43.05-alpha2), you want either "dfhack-0.43.05-alpha2-Windows-32.zip" or "dfhack-0.43.05-alpha2-Windows-64.zip".

thank you, I now have an updated version
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 09, 2016, 06:19:05 pm
It seems the x, y, z figures for a tree are the bounding box rather than the current values.

You can figure out how tall a tree can be by checking the age and the time for it to grow another level. It's still possible for the tree to be stunted due to obstacles, though.

When I've fiddled with it it seems some trees have a null pointer for tree_info. When I iterated over all dry trees in my world and skipped those with a null pointer it completed (I had reduced z2 by one as well, though).
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 10, 2016, 03:48:11 pm
For anyone who compiles DFHack on Linux/OS X:

Are there objections to removing support for GCC 4.5? The last couple builds have all used GCC 4.8 with no (reported) problems, and GCC 4.5 has incomplete C++11 support. Now that we're using MSVC 2015, which does have good C++11 support, GCC 4.5 is the only thing holding us back from nice C++11 things.

GCC 4.6 should still be supported, so I don't expect that this would cause a lot of problems on older systems, since most that come with GCC 4.5 as the default compiler have 4.6 available somewhere.

Edit: The minimum might be be pushed to 4.7 later. I think 4.6 will work for the features we're interested in now, though (range-based for, variadic templates, etc.)
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 10, 2016, 06:55:44 pm
I'm not even sure if the previous LTS ubuntu would still be stuck with GCC 4.5, and can't think of any reason an OS couldn't update to a newer version.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 11, 2016, 12:21:37 am
Eswald pointed out that DFHack actually requires 4.8+ on Linux (oops), so it looks like we'll be going with that.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 12, 2016, 09:55:31 pm
okay trying to see if I can fix the crash that would happen if you play on a dfhack spawn site in fort mode
and hit a snag on trying to insert a pointer to unk_188 in the site.
edit: so uhh just copied the unk_188 of another site and now need to see if this fix the seasonal bug with fort mode on dfhack made sites.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on December 13, 2016, 11:38:31 am
server online again: http://dwarffort.duckdns.org/

Now experimenting with tilesets... Anyone know how to color images correctly?

Edit: Okay finally done... The result is: first draw with normal tiles, then draw "source-atop" tile colors and then draw "destination-over" backgrounds.
Next maybe ajax? though don't really want to :/
This is how it looks like, when the server will go down to see:
Spoiler (click to show/hide)

Next idea: arena mode - each client gets a dwarf which fights in arena, you could buy items etc... Would get money for victories. Also you could probably direct where should the dwarf move... Maybe, i'm not sure...

EDIT: NOW WITH ANIMATED CANVAS
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 13, 2016, 03:18:35 pm
okay trying to see if I can fix the crash that would happen if you play on a dfhack spawn site in fort mode
and hit a snag on trying to insert a pointer to unk_188 in the site.
edit: so uhh just copied the unk_188 of another site and now need to see if this fix the seasonal bug with fort mode on dfhack made sites.
To help a bit more with this, crosspost from the adventurer threads, a pre-existing zone from an adventurer site seems to cause a crash any time visitors arrive in fort mode trying to go to the camp zone. Get "succession traveler placed out of bounds" type errors and poof game crashes to desktop.

Delete the camp zones before putting a fort on top.
Title: Re: DFHack 0.43.03-r1
Post by: hagger on December 13, 2016, 05:25:23 pm
Hi all,

I'm getting a crash whenever I try and run the adaptation script. I've tried pretty much all possible arguments, and DF just goes down once I enter that command.

I'm on x64, Windows 10, can try and get more details/upload a save if required. I've had a little poke around, and it seems to write the following to stderr in the df folder:

Code: [Select]
FirstCall()
Initized HOOKS!


I've never used this script before, so don't know expected functionality or anything, but I'm guessing crashes aren't expected hehe.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 13, 2016, 06:22:07 pm
Log information is appended to the end of stderr.log. That's status information that DFHack logs on startup.

Anyway, adaptation is a Ruby script, so it's probably https://github.com/DFHack/dfhack/issues/1023, which we already know about. I don't think anyone's mentioned that script, though, so I'll add it to the list. Thanks!
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 14, 2016, 05:31:14 am
hmm wonder if it's possible to generate a world that has one long road on a flat surface in the woods and to cram as many dwarves into a minecart and have online players send in push commands to the cart.
as an idea for warmist duckdns df
edit: thinking about a DF version of chicken where everyone shaking the minecart and seeing who going to chicken out last,
considering you could jump out of the minecart
Title: Re: DFHack 0.43.03-r1
Post by: hagger on December 14, 2016, 07:03:59 am
Log information is appended to the end of stderr.log. That's status information that DFHack logs on startup.

Anyway, adaptation is a Ruby script, so it's probably https://github.com/DFHack/dfhack/issues/1023, which we already know about. I don't think anyone's mentioned that script, though, so I'll add it to the list. Thanks!

cool, no problem! and thanks for the info. I'll just fix cave adaptation in soldiers the old-school way, by stationing them outside until they stop puking. Ahhh, Dwarf Fortess.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on December 14, 2016, 09:26:15 am
Log information is appended to the end of stderr.log. That's status information that DFHack logs on startup.

Anyway, adaptation is a Ruby script, so it's probably https://github.com/DFHack/dfhack/issues/1023, which we already know about. I don't think anyone's mentioned that script, though, so I'll add it to the list. Thanks!

cool, no problem! and thanks for the info. I'll just fix cave adaptation in soldiers the old-school way, by stationing them outside until they stop puking. Ahhh, Dwarf Fortess.
Does that work? I always thought that once you get cave adaptation it's there for all times.
Title: Re: DFHack 0.43.03-r1
Post by: DanielCoffey on December 14, 2016, 11:24:22 am
Fortunately not according to the wiki (http://dwarffortresswiki.org/index.php/DF2014:Cave_adaptation)... being "outside" will cause cave adaptaion to wear off (with possible vomiting and unhappy thoughts), being "indoors but light" will not affect adaptation either way and being "inside and dark" (below ground) will increase adaptation.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 14, 2016, 11:51:08 am
Log information is appended to the end of stderr.log. That's status information that DFHack logs on startup.

Anyway, adaptation is a Ruby script, so it's probably https://github.com/DFHack/dfhack/issues/1023, which we already know about. I don't think anyone's mentioned that script, though, so I'll add it to the list. Thanks!

cool, no problem! and thanks for the info. I'll just fix cave adaptation in soldiers the old-school way, by stationing them outside until they stop puking. Ahhh, Dwarf Fortess.
By the way, ab9rf should have fixed that issue. Turns out accessing globals on Win64 would always crash, because addresses were getting truncated somewhere in the Ruby API.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 14, 2016, 12:11:44 pm
What causes visitors to display that they're ready to leave (it seems they have a path for a meeting with the edge, but something ought to cause them to set up that path in the first place)? I've failed to find it, and I'd like to hack units that have overstayed their welcome by several years (causing scandals by running around naked as well as uselessly using up a visitor slot) to nudge them to depart.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 14, 2016, 02:25:54 pm
Here is a new alpha release, with the Ruby fix (and several other fixes): https://github.com/DFHack/dfhack/releases/tag/0.43.05-alpha3

Do keep reporting issues that come up, although hopefully there are fewer now.

What causes visitors to display that they're ready to leave (it seems they have a path for a meeting with the edge, but something ought to cause them to set up that path in the first place)? I've failed to find it, and I'd like to hack units that have overstayed their welcome by several years (causing scandals by running around naked as well as uselessly using up a visitor slot) to nudge them to depart.
I can't answer this well myself (maybe someone else can), but I did fairly minimal research into visitors when that version of DF came out, and I don't remember seeing a lot done by other people, so it's possible that nobody has discovered the relevant structure(s) yet (or they've been mapped but not named, which would make things a lot easier). It definitely seems like something unit-specific, so maybe look for unit fields added around 0.42.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 14, 2016, 02:50:23 pm
What does:  ui_advmode: aligned enough so that it doesn't crash (64-bit OS X/Linux) mean? The symbols are still missing or was it not merged from the symbols where that was changed?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 14, 2016, 03:31:11 pm
It means that I fixed the layout of the ui_advmode type. The address is available on OS X, but the layout is the same on Linux, so once the address is located there, it should be more stable.

It's also possible that the address originally couldn't be found on Linux because the layout was bad.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 14, 2016, 04:16:18 pm
Ahhhh, I was super confused when I pulled it up and started looking through the symbols and such, makes sense.
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 14, 2016, 07:45:18 pm
So what are the valid uses of the force command?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 14, 2016, 09:21:15 pm
You'll get a list if you run "modtools/force -help" (I'm not sure why "force -help" doesn't work, but I'll look into that).
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 15, 2016, 06:36:59 am
Here is a new alpha release, with the Ruby fix (and several other fixes): https://github.com/DFHack/dfhack/releases/tag/0.43.05-alpha3

Do keep reporting issues that come up, although hopefully there are fewer now.

What causes visitors to display that they're ready to leave (it seems they have a path for a meeting with the edge, but something ought to cause them to set up that path in the first place)? I've failed to find it, and I'd like to hack units that have overstayed their welcome by several years (causing scandals by running around naked as well as uselessly using up a visitor slot) to nudge them to depart.
I can't answer this well myself (maybe someone else can), but I did fairly minimal research into visitors when that version of DF came out, and I don't remember seeing a lot done by other people, so it's possible that nobody has discovered the relevant structure(s) yet (or they've been mapped but not named, which would make things a lot easier). It definitely seems like something unit-specific, so maybe look for unit fields added around 0.42.
Thanks lethosor.
I've been looking around trying to find any correlations and failed to find any of the base info of what location(s) visitors have come for, what they want to do (perform, research, petition...), or how long they're supposed to stay. However, setting the <unit>.flags1.forest flag to true have caused two (out of two attempts) over stayers to leave, but that's not how correctly behaving units leave. Thus, it seems to achieve the objective, but not in the correct way, and thus may very well have side effects (such as them ceasing to tour the world sites, for instance).
Title: Re: DFHack 0.43.03-r1
Post by: NonconsensualSurgery on December 15, 2016, 03:45:37 pm
Alpha 3 is remarkably stable, knock on wood. No save corruption or crashes yet although I haven't poked the more obscure functions.
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 15, 2016, 07:23:28 pm
I tried force MegaBeast and nothing happened, no errors but also no megabeast
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 16, 2016, 03:18:58 am
I tried force MegaBeast and nothing happened, no errors but also no megabeast
probably the same reason there no events for guests arriving.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 16, 2016, 09:42:59 am
I tried force MegaBeast and nothing happened, no errors but also no megabeast
probably the same reason there no events for guests arriving.
There is a MegaBeast event, which is why the script doesn't throw an error. I don't know exactly why it's not working, though, or if it's worked since 0.40. Is this a new world?
Title: Re: DFHack 0.43.03-r1
Post by: ab9rf on December 16, 2016, 03:07:19 pm
I will note that I've had some undesirable outcomes using building-plan's "planning mode" in alpha3, and would recommend that people not use planning mode unless they want their fortresses possibly irretrievably corrupted. See https://github.com/DFHack/dfhack/issues/1047 (https://github.com/DFHack/dfhack/issues/1047).
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 16, 2016, 06:39:07 pm
It is not, in fact a new world, it is my first world
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 16, 2016, 09:37:50 pm
Sorry, I meant to ask if it's a young world (or one without any megabeasts). Although if you've been playing with it for a while, I would expect there to be some megabeasts around.
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 16, 2016, 10:39:10 pm
There might very well be no megabeasts left, since I've yet to be attacked by more then cyclops in the entire existence of my fort
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 16, 2016, 11:38:28 pm
You can check in uh, df.global.world.history.total_powers vs ...history.eras[k].details.living_powers to see if any are still around.
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 17, 2016, 12:25:54 am
Are those commands or files?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 17, 2016, 01:06:55 am
Neither. They're names of relevant data you can access (using Lua syntax in this case). One option is running "gui/gm-editor" followed by the expression you want, e.g. "gui/gm-editor df.global.world.history.total_powers". (Note that I have not checked that specifically to see how easy it is to hunt down megabeasts, or if that's what you're looking for - this is just one way to access DF data in general from Lua.)
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 17, 2016, 04:49:21 am
Neither. They're names of relevant data you can access (using Lua syntax in this case). One option is running "gui/gm-editor" followed by the expression you want, e.g. "gui/gm-editor df.global.world.history.total_powers". (Note that I have not checked that specifically to see how easy it is to hunt down megabeasts, or if that's what you're looking for - this is just one way to access DF data in general from Lua.)
it's possible to just summon every historical being into one spot with fast traveling party manipulation but uhh oh boy hope you have a good pc for doing that.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on December 17, 2016, 06:34:40 am
Neither. They're names of relevant data you can access (using Lua syntax in this case). One option is running "gui/gm-editor" followed by the expression you want, e.g. "gui/gm-editor df.global.world.history.total_powers". (Note that I have not checked that specifically to see how easy it is to hunt down megabeasts, or if that's what you're looking for - this is just one way to access DF data in general from Lua.)
it's possible to just summon every historical being into one spot with fast traveling party manipulation but uhh oh boy hope you have a good pc for doing that.

...Can you share how? I kind of need that for a new force siege script.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on December 17, 2016, 07:24:35 am
Neither. They're names of relevant data you can access (using Lua syntax in this case). One option is running "gui/gm-editor" followed by the expression you want, e.g. "gui/gm-editor df.global.world.history.total_powers". (Note that I have not checked that specifically to see how easy it is to hunt down megabeasts, or if that's what you're looking for - this is just one way to access DF data in general from Lua.)
it's possible to just summon every historical being into one spot with fast traveling party manipulation but uhh oh boy hope you have a good pc for doing that.

...Can you share how? I kind of need that for a new force siege script.
You just move an army to your location and fill it with ALL historical figure ids. You can also set army contents to number=100, race=some_race instead.

Edit: use members for hist-fig based ones and/or unk2c for generic ones
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on December 17, 2016, 07:55:00 am
Oh, adventure mode? I can't get it to work at all in fort mode.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 17, 2016, 09:03:08 am
Oh, adventure mode? I can't get it to work at all in fort mode.
well you can't fast travel in fort mode I mean unless someone figured out how... well now time to see if you can move a fort.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 17, 2016, 02:38:46 pm
Moving forts around is possible but weird without all of the links tied in right. There are armies accessible in fort mode but the best way to access them is through the entities[k].armies linkage unless you want to whip up something to sort through the full armies list, going by which entities are likely to send soldiers instead of just scholars and performers around, though being sieged by naked musicians is probably hilarious.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on December 17, 2016, 05:54:17 pm
Oh, adventure mode? I can't get it to work at all in fort mode.
If you are talking about force-siege then yes, i could only get armies to appear in adv-mode. However i remember reading somewhere that someone had luck with army controllers...
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 17, 2016, 06:33:52 pm
Putnam and I were both screwing around with moving armies, if you set the army_controller.pos_x/pos_y in the right spots you can get the army to march to it apparently.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on December 18, 2016, 06:34:31 am
Putnam and I were both screwing around with moving armies, if you set the army_controller.pos_x/pos_y in the right spots you can get the army to march to it apparently.
So next: set it to fort position. You might need to mess with civ_id to make it enemy - instant invaders?
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on December 18, 2016, 06:40:06 am
I managed to get a siege by teleport+controller-change once. I messed further and the game crashed to just before the first time I did it. I recreated the exact process (I was editing a script to do it) and it didn't work.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on December 18, 2016, 07:53:30 am
I managed to get a siege by teleport+controller-change once. I messed further and the game crashed to just before the first time I did it. I recreated the exact process (I was editing a script to do it) and it didn't work.
I think it needs to enter the tile your for is in on it's own to let df manage the logic of spawning units and so on.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 20, 2016, 08:15:17 am
now to see if one could find companion wait armies and be able to send them after sites
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 20, 2016, 05:23:23 pm
I've noticed that the autodump command seems to be rather...selectivley functional when moving large amounts of objects or corpses/body parts..
Title: Re: DFHack 0.43.03-r1
Post by: Fleeting Frames on December 20, 2016, 05:31:10 pm
If you mean "couldn't move <x>" and forbidding the item on the spot, it's because that item was marked for a job (even one nobody had taken yet) already (the forbidding is so you can unpause, pause, unforbid and dump).
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 20, 2016, 05:41:45 pm
that's good to know, although in the multiple in game years some of those items have been sitting there before I tried this I've never seen any dwarf do anything with them (dorfs being stupid I guess...)
Title: Re: DFHack 0.43.03-r1
Post by: Fleeting Frames on December 20, 2016, 07:38:50 pm
More like job manager being stupid somewhere. A common instance with minecarts: Your minecart is deliberately inaccessible, but it has stopped, and job is generated to carry it to route stop - never mind that no dwarf can reach it.

In that case, I find it is best to delete the route.
Title: Re: DFHack 0.43.03-r1
Post by: Libash_Thunderhead on December 21, 2016, 10:28:08 am
It seems 43.05 alpha 3 is quite buggy. I'm using x64 version, and for some reason the enhanced stockpile management menu messes up items if I mark listed items as dump. The game creates ghost items on the screen, whose positions are random and can't be checked using k. And the game tends to crash after that. Autodump seems to have similar issue.
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on December 21, 2016, 01:16:37 pm
More like job manager being stupid somewhere. A common instance with minecarts: Your minecart is deliberately inaccessible, but it has stopped, and job is generated to carry it to route stop - never mind that no dwarf can reach it.

In that case, I find it is best to delete the route.
Or just forbid it?
Title: Re: DFHack 0.43.03-r1
Post by: ab9rf on December 21, 2016, 03:59:00 pm
It seems 43.05 alpha 3 is quite buggy. I'm using x64 version, and for some reason the enhanced stockpile management menu messes up items if I mark listed items as dump. The game creates ghost items on the screen, whose positions are random and can't be checked using k. And the game tends to crash after that. Autodump seems to have similar issue.
I suspect I know what's causing this, but it's not quite the same as the issues I've found (and probably fixed). See, e.g, #1047 (https://github.com/DFHack/dfhack/issues/1047/), #1050 (https://github.com/DFHack/dfhack/pull/1050), #173 (https://github.com/DFHack/df-structures/pull/173)
Title: Re: DFHack 0.43.03-r1
Post by: Fleeting Frames on December 21, 2016, 10:03:07 pm
Or just forbid it?
And wait a bit until the job disappears from listing, then unforbid, mark for dumping...But you likely don't need the route if it is inaccessible on purpose, and will have to do this whole forbid-wait-unforbid every time, not just the first time.
Title: Re: DFHack 0.43.03-r1
Post by: Libash_Thunderhead on December 23, 2016, 03:14:25 am
I suspect I know what's causing this, but it's not quite the same as the issues I've found (and probably fixed). See, e.g, #1047 (https://github.com/DFHack/dfhack/issues/1047/), #1050 (https://github.com/DFHack/dfhack/pull/1050), #173 (https://github.com/DFHack/df-structures/pull/173)
I reverted back to alpha 2 and it worked this time.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 24, 2016, 07:51:29 pm
Where do I find the list of keys that I can use in guis? Like 'LEAVESCREEN', 'CHANGETAB', 'CUSTOM_SHIFT_A' and such. I know I've seen it somewhere before but I can't remember where.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 24, 2016, 09:26:16 pm
A couple places:

- https://github.com/DFHack/df-structures/blob/master/df.keybindings.xml
- lua @df.interface_key
- data/init/interface.txt (this might not list all of them)
- https://github.com/svenstaro/dwarf_fortress_unfuck/blob/master/g_src/keybindings.h
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 24, 2016, 11:34:43 pm
A couple places:

- https://github.com/DFHack/df-structures/blob/master/df.keybindings.xml
- lua @df.interface_key
- data/init/interface.txt (this might not list all of them)
- https://github.com/svenstaro/dwarf_fortress_unfuck/blob/master/g_src/keybindings.h

Wow, I've been modding for I don't know how long and I just now learned about the @. I've just been going through one by one...
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 24, 2016, 11:45:49 pm
I added it in 0.40.12-r1, so it hasn't been around as long as the others. It's equivalent to printall_ipairs(), which is like printall(), but it uses, well, ipairs() to iterate over the thing you pass it, which produces nice results for enums. (printall() uses pairs(), which works well for most other stuff.)
Title: Re: DFHack 0.43.03-r1
Post by: Nagidal on December 26, 2016, 02:21:40 pm
Hello DFHackers,

I was playing my fort today in 43.03 with DFhack and when the human merchants visited, I did not see any finished goods bins in the list of items for trade.

I have uploaded the savegame (http://dffd.bay12games.com/file.php?id=12625) and filed a bug report (http://www.bay12games.com/dwarves/mantisbt/view.php?id=10100), but then it occurred to me that it could also have to do with DFHack, so if you want, you can check it out.

Or if you want to use my savegame with human traders and a tavern full of visitors (including a goblin bard, if he still hangs around) for some memory mapping feel free to do so.
Title: Re: DFHack 0.43.03-r1
Post by: Fleeting Frames on December 26, 2016, 03:04:38 pm
For present and future reference, you could check that by loading the vanilla game for most issues.

But tbh it is probably that you have culling on mandates on (default settings) and your nobles prohibited the export of bins or something that would be stored in bins.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 27, 2016, 02:15:56 am
Here's another question for those of you more knowledgeable about the gui programming. Right now I know how to put pictures and things onto the screen, but if I write text over them it appears as a black box with writing. Is it possible to make that box transparent so that you just see the text?
Title: Re: DFHack 0.43.03-r1
Post by: Nagidal on December 27, 2016, 03:58:07 am
For present and future reference, you could check that by loading the vanilla game for most issues.

O-oh, I have culling mandates indeed. Thanks for reminding me. Now I have to trade back all my crowns.

I have tried to open my savegame in the 43.03 vanilla, without DFHack. The issue is still there. Hence I conclude that it is not a DFHack problem. Thanks for your help and sorry for not checking this before posting.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 27, 2016, 01:43:24 pm
Here's another question for those of you more knowledgeable about the gui programming. Right now I know how to put pictures and things onto the screen, but if I write text over them it appears as a black box with writing. Is it possible to make that box transparent so that you just see the text?
By "pictures and things", are you referring to tiles? You can't put text partially on top of other tiles.
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 27, 2016, 01:49:50 pm
Is there any way to fix a siege where the enemy is all dead or other-wise disintegrated but it still thinks it's a siege
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 27, 2016, 02:00:01 pm
Here's another question for those of you more knowledgeable about the gui programming. Right now I know how to put pictures and things onto the screen, but if I write text over them it appears as a black box with writing. Is it possible to make that box transparent so that you just see the text?
By "pictures and things", are you referring to tiles? You can't put text partially on top of other tiles.

I realize an image might have better portrayed what I was trying to say. This is what I mean by pictures.
(https://i.img.ie/0jK.png)
If I were to place text over that picture it would show up with a black background and white text (or whatever color I used for the foreground and background). I was wondering if there was a transparent background pen color.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 27, 2016, 02:34:23 pm
Yeah, are you creating that picture out of tiles, like creature tiles? You can't put text tiles on top of graphical tiles (or any tiles on top of other tiles, for that matter). You can give text a "transparent" background of varying degrees (in fact, the vanilla tileset does this), but rather than showing another tile in the transparent parts, DF shows the background color you specify for that tile instead.

You might be able to get good results with text on a white background in the white parts of that image, though.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on December 27, 2016, 02:49:26 pm
Ah, I see what you mean now. Was hoping to be able to make a cool visual out of something like this for my Bestiary/Herbiary/Journal
Spoiler (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on December 28, 2016, 12:59:40 am
Is anyone else interested in fuzzing DFHack?  I was inspired by this blog post (https://danluu.com/testing), and a comment that the alphas would be more useful if people ran all the commands :)

I've put together a dead-simple example here (https://github.com/PeridexisErrant/dfhack-integration/blob/master/dfhack-fuzzer.py), which just uses dfhack-run to call every command output by ls.  This discovered two plugins that crash DF when called from dfhack-run, and more than twenty scripts that give stack traces instead of anything useful when called in fort mode.  My basic principle is that it is always a bug when DFHack can crash DF, or when scripts give the user a traceback instead of an error message.

If this does seem useful or interesting, I'd be interested in trying to make it smarter (ie knowing what context is required, that arguments exist, etc).  This would be helped by some helper scripts on the DFHack side - eg 'return to main screen', or ways to discover what mode a script can be used in.  And of course if we find more bugs, someone will need to fix them...
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on December 28, 2016, 01:32:21 am
How about adding another set of "special comments", but instead of specifying that the script can be loaded as a module, or that is can be enabled, they would specify the game mode and possibly a set of allowable UI contexts?

Tagging existing scripts would be a pain, but once it's done it's done.

At some later date DFHack itself could possibly warn users or simply not allow scripts to be used in invalid (for that script) contexts. Doing this once in the script execution system would remove the need to do it over and over in individual scripts. Just a thought.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on December 28, 2016, 02:09:22 am
Ah, I see what you mean now. Was hoping to be able to make a cool visual out of something like this for my Bestiary/Herbiary/Journal
Spoiler (click to show/hide)
you could play off the black and background with having the image be a giant inkblot that expands and reveals the ingame text and have the paper scroll out to show the other png doodles.
(http://www.truimagz.com/host/rumrusher/folder2/rose-visual-idea-help.png)
Title: Re: DFHack 0.43.03-r1
Post by: Rose on December 28, 2016, 02:32:27 am
Have the center fade to a specific background color that's one of the available background colors in DF, and have the text have that background color.
Title: Re: DFHack 0.43.03-r1
Post by: ab9rf on December 28, 2016, 04:05:40 am
My basic principle is that it is always a bug when DFHack can crash DF, or when scripts give the user a traceback instead of an error message.
Oh drat, that kiboshes the Ruby plugin then. It's fairly trivial to crash it, because Ruby code can access arbitrary memory pointers, and a segmentation error is an uncaught signal on Linux or uncaught exception on Windows, both of which lead to an immediate die. The Lua runtime seems to handle this a bit more robustly, with the exception/signal being confined to the Lua interpreter thread.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on December 28, 2016, 04:34:33 am
My basic principle is that it is always a bug when DFHack can crash DF, or when scripts give the user a traceback instead of an error message.

Oh drat, that kiboshes the Ruby plugin then. It's fairly trivial to crash it, because Ruby code can access arbitrary memory pointers, and a segmentation error is an uncaught signal on Linux or uncaught exception on Windows, both of which lead to an immediate die. The Lua runtime seems to handle this a bit more robustly, with the exception/signal being confined to the Lua interpreter thread.

I meant something more like "when using a standard script or plugin in any way can crash DF, that's a bug" - of course if users get arbitrary code execution and access to memory it's possible to cause a crash.  While I'm certainly not a fan of crashes and would like a more robust ruby plugin, it's useful enough to keep anyway :P
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on December 28, 2016, 05:16:43 am
My basic principle is that it is always a bug when DFHack can crash DF, or when scripts give the user a traceback instead of an error message.
Oh drat, that kiboshes the Ruby plugin then. It's fairly trivial to crash it, because Ruby code can access arbitrary memory pointers, and a segmentation error is an uncaught signal on Linux or uncaught exception on Windows, both of which lead to an immediate die. The Lua runtime seems to handle this a bit more robustly, with the exception/signal being confined to the Lua interpreter thread.
Actually it does not. E.g. if you try to print values from global.world.units.bad[id] when they are really deallocated it crashes df. This is because all data access checking would incur too much of a penalty and you don't want to deep print everything anyway.
However lua has 0 pointer checks (e.g. you can't print a struct if it's pointer 0) also type checks, so you can't insert random crap into std::vector<unit> and so on.
Title: Re: DFHack 0.42.06-r1
Post by: wooks on December 29, 2016, 12:20:59 am
Any chance either of these will work with current versions of DFHack/DF. Not really sure where I picked them up, but had them sitting around and thought they might be useful for some generational fort messing about...

I have no idea whether or not those scripts would still work. However, I do know that the current DFHack already has this functionality. Check the DFHack documentation for gui/family-affairs (http://dfhack.readthedocs.io/en/stable/docs/_auto/gui.html#gui-family-affairs): "view, add, remove, or otherwise change romantic relationships". This includes a user-friendly interface and, among other things, it allows the user to force a marriage or divorce.

This appears to have issues finding dwarfs whom are stuck at the 'lover' stage.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 29, 2016, 04:00:10 pm
I'm putting up a build now to fix the issues with buildingplan/etc. that showed up in alpha3, as well as some other outstanding Linux issues. Right now, there are only OS X and Linux builds. If anyone's around that can do both Windows builds (and check them with devel/check-release), that would be much appreciated.

Edit: https://github.com/DFHack/dfhack/releases/tag/0.43.05-alpha4

Edit 2: Windows builds are up, thanks to ab9rf!
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 29, 2016, 05:29:17 pm
So, can you show me how to use createitem to make dog bones?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 29, 2016, 05:33:48 pm
I believe those would have an item type of CORPSEPIECE, which isn't possible to create. createitem uses custom reactions, which don't support CORPSEPIECE items, so createitem blocks that item type. I think DF will crash if you try to bypass that.
Title: Re: DFHack 0.43.03-r1
Post by: scourge728 on December 29, 2016, 06:01:08 pm
drat...
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 29, 2016, 07:05:36 pm
I'm putting up a build now to fix the issues with buildingplan/etc. that showed up in alpha3, as well as some other outstanding Linux issues. Right now, there are only OS X and Linux builds. If anyone's around that can do both Windows builds (and check them with devel/check-release), that would be much appreciated.

Edit: https://github.com/DFHack/dfhack/releases/tag/0.43.05-alpha4
Would you like to rub beards and we can see which one of us ends up birthing horrific babies for the other?


Hrrm, I was trying out launch, it works fine if you run without a cursor, just spitting out the error (that you would get shot at light speed towards -30000 x/y/z/ and explode) but with an active cursor it just crashes:
Code: [Select]
./dfhack: line 66:  3825 Segmentation fault      (core dumped) setarch i386 -R env LD_PRELOAD="$PRELOAD_LIB" ./libs/Dwarf_Fortress "$@"

The only thing remotely relevant I can see in the error log is:
UNKNOWN CLASS 'ack21dfhack_lua_viewscreenE': vtable = 0x7ffff7d01a90

I don't see any other fields that were changed or why it should just segfault crash instead of spitting out an error.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 29, 2016, 08:52:34 pm
"launch" works in adventure mode for me (with the 'l' cursor) in both OS X builds, which ought to be similar enough to Linux.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on December 30, 2016, 07:56:12 am
Hmmm, I'll poke around at it some more, see if I can figure out what happened there.
Title: Command to get rid of scattered items
Post by: Nagidal on December 30, 2016, 12:33:11 pm
I'm looking for a command similar to cleanowned (http://dfhack.readthedocs.io/en/stable/docs/Plugins.html#id152), but instead of designating the items for dumping it would simply instantly destroy them, remove them from the map (and memory).

I have got too many forbidden arrows and forbidden troll fur armor pieces lying around all over the map which I want to get rid of, but don't like to spend several months of the whole fortress hauling them.

Is there something like that?
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on December 30, 2016, 03:18:26 pm
@Nagidal: There is a command to teleport all dump marked objects to the cursor and and a command to destroy objects collected (i.e. objects under the cursor). I've used that to get rid of webs to regain some FPS in the past, but the names escape me, so unless someone else can tell you you'll have to scour the DFHack command list for them.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 30, 2016, 03:41:47 pm
autodump-destroy-item and autodump-destroy-here (possibly not in that order)
Title: Re: DFHack 0.43.03-r1
Post by: Fleeting Frames on December 30, 2016, 05:08:02 pm
or just autodump-destroy, once they've been marked for dumping by cleanowned
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on December 30, 2016, 05:37:20 pm
That command doesn't exist, at least not in the default DFHack distribution.

Edit: "autodump destroy" does, though. The reason the others are also implemented as separate commands (e.g. "autodump-destroy-here" and "autodump destroy-here") is to allow them to be used as hotkey commands, and lets them specify when they should be invoked. (You can technically set up "autodump destroy-here" as a keybinding too, but it will be invoked inappropriately sometimes and spam error messages to the DFHack console.)
Title: Re: DFHack 0.43.03-r1
Post by: Fleeting Frames on December 30, 2016, 06:38:16 pm
Whoops >_>

Well, that makes sense.
Title: Re: DFHack 0.43.03-r1
Post by: Nagidal on December 31, 2016, 04:01:11 am
Ah, thank you. I will try this.
Title: Re: DFHack 0.43.03-r1
Post by: Nagidal on January 01, 2017, 02:20:15 pm
Sorry, but I still don't understand how "autodump destroy" works. If I mark a forbidden arrow on the map for dumping (under the k cursor), it seems unaffected by "autodump destroy" or "autodump destroy-here". A regular dumping job is created for it and it still stays on the map. What am I doing wrong?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 01, 2017, 05:42:01 pm
Sorry, but I still don't understand how "autodump destroy" works. If I mark a forbidden arrow on the map for dumping (under the k cursor), it seems unaffected by "autodump destroy" or "autodump destroy-here". A regular dumping job is created for it and it still stays on the map. What am I doing wrong?

You might need to unforbid it, or use "autodump destroy forbidden".
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 03, 2017, 07:29:27 pm
So, I hadn't thought much about this since originally I just attributed it to being on a personally compiled super-alpha develop branch of dfhack, but now with so many of the globals located I was trying to get some of my scripts back in order and ran into a problem with artifake not using the right value for artifact_next_id, and it seems to be because there isn't a value that makes sense for it at all?
Spoiler (click to show/hide)
I know that it should be like 17980 or so, not -159036100, and there are similar value issues for item_next_id and others seen there. The same problem happens with the alpha4 release so I'm rather confused that it otherwise works fine despite this.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 03, 2017, 08:46:39 pm
Well, those addresses must be wrong. I'm not sure how exactly they were located, but as long as they're within the section of memory that contains globals, which they probably are, you'll get unpredictable values instead of crashes.

Incidentally, it could be easier to locate the correct address if you know exactly what those values should be, as long as they're not particularly low.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 04, 2017, 12:46:30 am
It seems 43.05 alpha 3 is quite buggy. I'm using x64 version, and for some reason the enhanced stockpile management menu messes up items if I mark listed items as dump. The game creates ghost items on the screen, whose positions are random and can't be checked using k. And the game tends to crash after that. Autodump seems to have similar issue.

Could you check on this and see if it's fixed in alpha4?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 04, 2017, 04:37:28 am
Well, those addresses must be wrong. I'm not sure how exactly they were located, but as long as they're within the section of memory that contains globals, which they probably are, you'll get unpredictable values instead of crashes.

Incidentally, it could be easier to locate the correct address if you know exactly what those values should be, as long as they're not particularly low.

Code: [Select]
activity_next_id -1802810881 > 22785
artifact_next_id -159036100 > 44417
item_next_id 2055948296 > 1903806 
unit_next_id -2079390469 > 71293
hist_event_next_id 1149847552  > 720562
hist_figure_next_id -11891208 > 76043
squad_next_id -2092433408 > 110
Those should be right, I just checked a few which changed while I was checking (hist_event_next_id should have been and the newest entry in events was indeed 720562) so yeah, they're pretty whacky, but that would be why launch/advfort crash me and artifake just spits errors but so many other scripts work fine.
Title: Re: DFHack 0.43.03-r1
Post by: YetAnotherLurker on January 05, 2017, 02:46:18 pm
I've got a suggestion for an addition to the view-item-info script that takes maybe five seconds, but that I've found rather useful: Add the line append(list,"Dimension: "..item.dimension) somewhere in function GetMatPropertiesStringList (item) so that when you view cloth or thread, it shows you the dimensions and therefore lets you find out which thread/cloth has been used by your suturers and wound dressers. Wouldn't be difficult to display it as a fraction of a fresh/full piece either.
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on January 06, 2017, 12:04:47 am
I don't see any messages in logs, but I have an occasional crash when setting custom profession names in manipulator.

Using 0.43.05-alpha4 + TWBT.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 06, 2017, 08:09:31 am
Randomly or when you press a specific key? Have you tried it without TwbT?
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on January 06, 2017, 02:20:12 pm
Randomly or when you press a specific key? Have you tried it without TwbT?

Looks like its consistently the letter "p". TWBT does not seem to matter.

edit: looks like I have a keybind for "p" in dfhack.init. Removing it resolves the issue. It is in the example init file, however.

Code: [Select]
# assign weapon racks to squads so that they can be used
keybinding add P@dwarfmode/QueryBuilding/Some/Weaponrack gui/assign-rack

edit2: this error also appears when opening manipulator

Code: [Select]
...df_43.05/hack/scripts/gui/extended-status.lua:172: Cannot invoke field (global).getCurFocus(): C++ exception: string too long.
stack traceback:
[C]: in field 'getCurFocus'
...df_43.05/hack/scripts/gui/extended-status.lua:172: in function <...df_43.05/hack/scripts/gui/extended-status.lua:171>
...df_43.05/hack/scripts/gui/load-screen.lua:471: Cannot invoke field (global).getCurFocus(): C++ exception: string too long.
stack traceback:
[C]: in field 'getCurFocus'
...df_43.05/hack/scripts/gui/load-screen.lua:471: in function <...df_43.05/hack/scripts/gui/load-screen.lua:468>
...df_43.05/hack/scripts/view-item-info.lua:386: Cannot invoke field (global).getCurViewscreen(): C++ exception: string too long.
stack traceback:
[C]: in field 'getCurViewscreen'
...df_43.05/hack/scripts/view-item-info.lua:386: in function <...df_43.05/hack/scripts/view-item-info.lua:380>
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 06, 2017, 02:42:34 pm
Are you sure those show up when you open manipulator? They look like ones that showed up earlier.

Anyway, something is badly broken. That keybinding shouldn't even be run on that screen. What platform are you using?
Title: Re: DFHack 0.43.03-r1
Post by: wooks on January 06, 2017, 03:47:09 pm
Perhaps my search-fu isn't good enough, but could someone show me how to delete a building with DFHack please? Thanks in advance!
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 06, 2017, 04:56:37 pm
Like in a town?

It isn't something you can just show someone.

Get the world_sites_and_pops.txt number of the site and subtract 1 to get k:
gui/gm-editor df.global.world.world_data.sites[k].realization.buildings has entries with the walls and keeps and such and their dimensions/shape/inhabitants, deleting them CAN work but it is buggy, using buildings instead of realization is the zone-related stuff like tavern/hall/temple/etc I think.
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on January 06, 2017, 06:39:46 pm
Are you sure those show up when you open manipulator? They look like ones that showed up earlier.

Anyway, something is badly broken. That keybinding shouldn't even be run on that screen. What platform are you using?

Windows 10.

And the error happens when I hit "e" (for single-unit edit) or "b" (for batch edit).
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 06, 2017, 07:05:32 pm
I thought it happened when you were editing profession names. Could you clarify where it's occurring?

Also, what happens when you run "lua ~unit" with a unit selected in manipulator?
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on January 06, 2017, 07:13:03 pm
The gui/load-screen.lua error happens when I open either the single-unit ("e") or batch edit ("b") screens in manipulator.

The consistent crash happens if I have a keybind for "p" and press "p" while editing a profession. I added back to hotkey and did a few more tests and pressing "p" crashes the game at any point after hitting "e" or "b", even before choosing Nickname or Custom Profession. Pressing "p" at the manipulator main screen brings up profession selection as expected.

Given the three errors about string length on what appears to be an "active view" getter I'd imagine its related to nested view names length being too long in the 64-bit release somehow. I no longer have a setup to build DFHack so I'm unable to poke at it currently.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 06, 2017, 09:15:47 pm
Yeah, it sounds like the focus string (or context, path, etc) being determined incorrectly. Did you try running that lua command?

Edit: also, try running "keybinding" on all of the screens in question and see what it says for the current context (near the end of its output).
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on January 06, 2017, 11:29:56 pm
keybinding immediately crashes.

I did not try running any of those 3 lua commands in the error output.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 07, 2017, 12:16:14 am
No, try running this command with a unit selected (anywhere, really):
Code: [Select]
lua ~unit

Does keybinding give any output at all? If so, can you paste it here? (You can copy text by right-clicking in the title bar on Windows, rather than taking a screenshot.)

Just to confirm, this is 0.43.05-alpha4, and the issue occurs without TwbT, yes?
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on January 07, 2017, 02:04:52 pm
lua ~unit works (with our without a unit selected) and spits out data.

Spoiler (click to show/hide)

keybinding outputs nothing on the viewscreen_unitbatchopst screen (or either subscreen) and immediately crashes.

On the main manipulator screen it outputs:
Spoiler (click to show/hide)

On the profession assignment ("p") screen it outputs
Spoiler (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 07, 2017, 02:32:08 pm
Huh, the keybinding output looks okay on the screens that don't crash. I don't really see a difference between how the focus paths are returned for the different screens. What if you run "lua ~scr" on the screens in question?
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on January 07, 2017, 03:50:55 pm
For "dfhack/unitlabors"
Spoiler (click to show/hide)

for "dfhack/unitlabors/profession"
Spoiler (click to show/hide)

for "dfhack/unitlabors/batch"
Spoiler (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 07, 2017, 04:46:13 pm
Well, at least the ones that behave unpredictably seem to be the same each time. I'll try to figure it out, but I can't build on Win64 either, so perhaps somebody else will need to look into it.

Also, to clarify, the string length limit is way higher (as in orders of magnitude higher) than what the focus path for that screen should be, probably "dfhack/unitlabors/batch".
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on January 07, 2017, 06:40:47 pm
Yeah, it's odd. The profession one is longer!
Title: Re: DFHack 0.43.03-r1
Post by: Roses on January 09, 2017, 07:09:58 pm
Question, does anyone have a script that can tell you what an animal's butcher products are? Not necessarily the amount or anything like that, but just the names for everything that would be produced.

Also, does anyone know how, given an item id, to 'select' it like you would in arena mode. I ask because I figured that I could butcher bodies with scripts by changing modes and simulating the 'a' input. The only problem (so far at least) is that I already need to have the corpse selected. If I could figure out a way to select the corpse with a script I could make a script that simulates butchering.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 09, 2017, 07:17:47 pm
Couldn't you search for the entry in df.global.world.items.other.CORPSE?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on January 09, 2017, 08:23:07 pm
Couldn't you search for the entry in df.global.world.items.other.CORPSE?

Oh, I know how to find the corpse item itself. What I can't figure out is how to select it. In arena mode it would be simulating input 'k', moving the cursor to the location, then, if there is more than one item/creature at the location. selecting the correct corpse. You can then simulate input 'a' to butcher.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 09, 2017, 08:51:59 pm
Ahhh, not sure then.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 09, 2017, 09:16:15 pm
You could try changing ui.main.mode to LookAround, then adding an item to ui_look_list.items. (Note that I haven't tried this, and it could crash.)
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 09, 2017, 09:25:21 pm
I've avoided screwing with ui_look_list because it's crashed every time I played with it in past versions, stable or not.
Title: Re: DFHack 0.43.03-r1
Post by: mifki on January 09, 2017, 09:38:19 pm
I've avoided screwing with ui_look_list because it's crashed every time I played with it in past versions, stable or not.

I haven't had any problems with ui_look_list. Just make sure to access the correct item/unit/... field in a union there, based on type field value.
Oh, you're going to insert items there, sorry didn't read properly.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 09, 2017, 09:41:40 pm
Have you been working with it in the lua interpreter or something? That could crash if you insert an item before you set it up properly, since DF might try to use a null/uninitialized unit pointer or something similar.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 10, 2017, 02:10:06 am
Yeah, I was just using gm-editor to slap things in with the insert function after that was added, and previously just messing around with existing entries, it's been crashy enough that I just stopped poking at it.
Title: Re: DFHack 0.43.03-r1
Post by: moisesjns on January 17, 2017, 09:16:57 pm
I have a question. Does the new DFhack no longer include military-training anymore? i remember that sped up training. And tweak military-training or without tweak does nothing now.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 17, 2017, 11:57:39 pm
That appears to have been removed in 0.40.
Title: Re: DFHack 0.43.03-r1
Post by: Heretic on January 18, 2017, 06:14:07 am
I'm really sorry if it's incorrect place, but... can ve use such utilities as IDA or other disassemblers find some places in binary there it was "for" in source code? 
Hehe
Spoiler (click to show/hide)
As for me I has no ideas, why we can n't - we knw version of Toady's compiler and so on, so we can somehow find "for"s in style of needed compiler and with some macro switch it into for parallel there it needed?
As for me, i will try as for learning more about disasm, so my variant will probably meaningless and useless... But if some master will do something like this  :o
Title: Re: DFHack 0.43.03-r1
Post by: Rose on January 18, 2017, 07:00:42 am
No.
Title: Re: DFHack 0.43.03-r1
Post by: moisesjns on January 18, 2017, 08:54:26 am
That appears to have been removed in 0.40.
O ok. I was not aware. thank you.
Title: Re: DFHack 0.43.03-r1
Post by: feelotraveller on January 18, 2017, 01:27:05 pm
I can't get the 'teleport' script to work - linux 64bit, dfhack 43.05 alpha 4.  Terminal output:

Code: [Select]
[DFHack]# teleport -showunitid
460
[DFHack]# teleport -showpos
x                      = 72
y                      = 74
z                      = 79
[DFHack]# teleport -unit 460 -x 72 -y 74 -z 79
Cannot write field coord.y: integer expected.
stack traceback:
[C]: in ?
[C]: in ?
[C]: in field 'getTileBlock'
/path/to/df_linux/hack/scripts/teleport.lua:16: in global 'teleport'
/path/to/df_linux/hack/scripts/teleport.lua:54: in local 'script_code'
./hack/lua/dfhack.lua:562: in function 'dfhack.run_script_with_env'
(...tail calls...)

The destination is definitely a valid tile.

Does the script need tweaking for 64 bit?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 18, 2017, 01:55:17 pm
It's definitely not a 64-bit issue. It could be an issue with Lua 5.3, but I thought that script was working. I'll take a look when I get a chance, but you should probably report it on GitHub so it doesn't get lost here.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on January 18, 2017, 03:40:45 pm
Yeah, I thought I had fixed that with a bunch of other scripts that were having similar issues.
Title: Re: DFHack 0.43.03-r1
Post by: nefariousD on January 19, 2017, 08:57:22 am
Does anyone happen to have a precompiled copy of the 43.05 alpha4 they can put up for download somewhere?
Title: Re: DFHack 0.43.03-r1
Post by: ancient_vampire on January 19, 2017, 09:17:16 am
Does anyone happen to have a precompiled copy of the 43.05 alpha4 they can put up for download somewhere?

http://www.bay12forums.com/smf/index.php?topic=139553.msg7309791#msg7309791
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 19, 2017, 09:37:09 am
Any builds we make are always put on the GitHub releases page.
Title: Re: DFHack 0.43.03-r1
Post by: Ygvir on January 19, 2017, 01:14:17 pm
I've got a weird crash related to manipulator. If I go into manipulator and then choose 'e' to edit profession if I press SHIFT-B (to get a capital B) it crashes completely out of Dwarf Fortress. I don't know where to check logs to see if it is telling me something about what is going on. I suspect something with hot-key bindings but that is just a guess. I suspect that this also crashes with other keys; I've had other crashes but been unable to reproduce them. I'm on Win64 43.05-alpha4. Let me know if there is anything I can test.

I am able to make the change I want using the 'y' customize in native DF even with DFHack so there is a simple (though slightly annoying) workaround.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 19, 2017, 02:06:08 pm
Sounds pretty similar to this:

I don't see any messages in logs, but I have an occasional crash when setting custom profession names in manipulator.

Using 0.43.05-alpha4 + TWBT.

I mentioned a few things on that page that you could try to gather more information, but I have no clue why it's crashing.
Title: Re: DFHack 0.43.03-r1
Post by: Ygvir on January 19, 2017, 03:53:54 pm
@lethosor - yes, I'm pretty sure my crash is the same issue as @necrosis is experiencing.

Here are the results of my performing all of the testing I could find from your requests. Most of my experience mirrors @necrosis' results.

I am also on Win10 and I do have TWBT installed in my dfhack installation but I currently have it disabled (I think). Would you like me to test in a clean dfhack installation, e.g. without TWBT installed?

Here is the error message that I get as soon as I press 'e' from manipulator.
Spoiler (click to show/hide)

When I disable these two keybindings in dfhack.init (both from dfhack-example.init) 'p' and 'B' crash stops occuring
Spoiler (click to show/hide)

lua ~unit in manipulator with unit selected shows
Spoiler (click to show/hide)

Typing 'keybinding' in dfhack at the 'e' screen of manipulator causes a crash even if I have the problematic keybindings commented out. In manipulator before attempting to edit the unit I get.
Spoiler (click to show/hide)

Here is the output of lua ~scr in manipulator
Spoiler (click to show/hide)

In the 'e' menu of manipluator
Spoiler (click to show/hide)

and editing the profession
Spoiler (click to show/hide)

I'm sorry if this is overly verbose... I'm not sure I've added anything that @necrosis didn't already respond with. If there is any additional testing you'd like me to try I'd be happy to. It isn't a big deal for me to just disable those keybindings for now but I'd be happy to help with fixing this.

If I find any other keybindings that are crashing that screen I'll post them here. Thanks!

ps: while testing I also had this error show up but I don't know where it came from and it is likely unrelated.
Spoiler (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 19, 2017, 03:57:42 pm
Yeah, that all looks related. Just to confirm, when "keybinding" crashes, it doesn't print anything, right?
Title: Re: DFHack 0.43.03-r1
Post by: Ygvir on January 19, 2017, 04:01:56 pm
I don't see anything when 'keybinding' crashes. Is there a log somewhere that I can check? Sorry, I don't know dfhack very well.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 19, 2017, 04:10:10 pm
Uh, stderr.log, dfhack.history, errorlog.txt, stdout.log I think will have all the outputs.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 19, 2017, 04:41:18 pm
It's pretty unlikely that those would contain anything, since keybinding only prints to the console.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 19, 2017, 05:19:10 pm
Well, yeah, but worth a check in case there was something else going on, and useful generally to know where they are.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 19, 2017, 05:28:20 pm
The "string too long" exception might end up in stderr.log when you run keybinding, although I'm not sure if it would on Windows. It seems to be getFocusString, anyway, since that's the only non-trivial thing keybinding uses, but I can't imagine why that would crash with a specific DFHack screen.
Title: Re: DFHack 0.43.03-r1
Post by: Ygvir on January 19, 2017, 05:44:18 pm
@Max™ - Thanks for giving me the log files.

@lethosor - as you expected there isn't anything interesting in any of the files... but now we know that is the case.
Title: Re: DFHack 0.43.03-r1
Post by: Lamp on January 20, 2017, 11:47:28 am
Hey guys,

I'm sure this gets asked a lot but how far out are we from a stable build for 0.43.05?

Thanks for all your hard work!
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 20, 2017, 12:30:44 pm
The alpha4 is pretty stable, just missing a few symbols and a couple aren't aligned properly.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 20, 2017, 01:36:18 pm
Which ones aren't aligned properly?

Also, there are a couple random crashes I haven't been able to track down yet, including the manipulator crash on 64-bit Windows and a box-select crash on 64-bit Linux.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 20, 2017, 04:37:50 pm
Which ones aren't aligned properly?

Also, there are a couple random crashes I haven't been able to track down yet, including the manipulator crash on 64-bit Windows and a box-select crash on 64-bit Linux.
So, I hadn't thought much about this since originally I just attributed it to being on a personally compiled super-alpha develop branch of dfhack, but now with so many of the globals located I was trying to get some of my scripts back in order and ran into a problem with artifake not using the right value for artifact_next_id, and it seems to be because there isn't a value that makes sense for it at all?
Spoiler (click to show/hide)
I know that it should be like 17980 or so, not -159036100, and there are similar value issues for item_next_id and others seen there. The same problem happens with the alpha4 release so I'm rather confused that it otherwise works fine despite this.
Well, those addresses must be wrong. I'm not sure how exactly they were located, but as long as they're within the section of memory that contains globals, which they probably are, you'll get unpredictable values instead of crashes.

Incidentally, it could be easier to locate the correct address if you know exactly what those values should be, as long as they're not particularly low.

Code: [Select]
activity_next_id -1802810881 > 22785
artifact_next_id -159036100 > 44417
item_next_id 2055948296 > 1903806 
unit_next_id -2079390469 > 71293
hist_event_next_id 1149847552  > 720562
hist_figure_next_id -11891208 > 76043
squad_next_id -2092433408 > 110
Those should be right, I just checked a few which changed while I was checking (hist_event_next_id should have been and the newest entry in events was indeed 720562) so yeah, they're pretty whacky, but that would be why launch/advfort crash me and artifake just spits errors but so many other scripts work fine.
Those ones for sure aren't aligned properly.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 20, 2017, 04:43:26 pm
Oh, the addresses aren't right. I thought you meant the structures were badly aligned (e.g. incorrect world field sizes). That's another thing we need to fix. I'll open Github issues for these if I can't find any.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 20, 2017, 11:32:43 pm
I had intended to but forget what happened, I think I was on the tail end of a couple of days awake and ended up passing out.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on January 21, 2017, 12:15:32 am
Using a few prepared saves, I've located all of the *_next_id globals for 64-bit Linux. There are still a few others to locate, though they hopefully shouldn't be too difficult.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 21, 2017, 12:25:57 am
Link to new symbols.xml (https://github.com/DFHack/df-structures/blob/master/symbols.xml)
Dropping that into your hack folder should do the trick.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on January 21, 2017, 04:20:09 pm
I believe I've fixed the Manipulator problem - it was a bug in our RTTI parser for 64-bit Windows code.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 21, 2017, 05:53:44 pm
Using a few prepared saves, I've located all of the *_next_id globals for 64-bit Linux. There are still a few others to locate, though they hopefully shouldn't be too difficult.
A goddamn scholar and gentleman, truly.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on January 22, 2017, 10:05:36 pm
Does anyone have a list of things in the raws that don't translate directly into the game? These are all the two I know of,

PHYS_ATT_RANGE is capped at 5000 when read into the game, but creatures can have a higher value
BODY_SIZE also gets capped (although I don't remember the exact value)

Anyone know if there are others?
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on January 23, 2017, 03:46:01 am
Probably not what you're asking for, but in case it is:
- PSV values for elevation are translated from a range of 0-400 into a range of 0-250
- PSV values for temperature are modified by altitude and latitude (only if at least one pole is present) using formulae I only have table approximations for.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 23, 2017, 05:02:37 pm
PHYS_ATT_CAP_PERC does work though, and setting it to 1000 results in gm-editor showing 5000 for the attribute and 50000 for the cap, as expected.
Title: Re: DFHack 0.43.03-r1
Post by: Ryga_ on January 23, 2017, 08:32:57 pm
Just started trying to dive into dfhack scripting and was poking through the xml files for things. Is it possible to access and modify df.entities upon embark screen load? I'm not sure exactly what order DF loads things or if I'd have to mess with editing history. I would like to make a script that checks the civ level domestication status for animals and adds them to embark options if the level is Expert to get around the global limitations of the current animal training systems. Ideally this would modify the entity list of tamed animals available for embark but I'm not sure if that is only generated when USE_ANY_PET_RACE is included in the civ entity or always exists as an empty array. However before I get too far into trying to script this or figure out the relevant memory addresses, I'd like to know if I'll even be able to touch the required bits through dfhack. Apologies if this info is covered somewhere else but using google + forum search didn't net me any specific results. Thanks!
Title: Re: DFHack 0.43.03-r1
Post by: Roses on January 24, 2017, 03:55:11 am
Probably not what you're asking for, but in case it is:
- PSV values for elevation are translated from a range of 0-400 into a range of 0-250
- PSV values for temperature are modified by altitude and latitude (only if at least one pole is present) using formulae I only have table approximations for.

That's good to know, but I am more interested in numbers that you can change with dfhack that are still valid but outside of what you can do with just raws. I'm just not sure if there are any other numbers in items, materials, tissues, inorganics, interactions, or entities which fall under that category.

PHYS_ATT_CAP_PERC does work though, and setting it to 1000 results in gm-editor showing 5000 for the attribute and 50000 for the cap, as expected.

Also good to know, but still, if you want a creature to spawn with >5000 of an attribute that is not possible without dfhack, correct?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 24, 2017, 11:05:04 am
Not that I can tell.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on January 24, 2017, 12:41:12 pm
Anyone else notice this?
Quote from: DevLog
Last, there are some random requests and promises that have accumulated (some memory address help for modders, a little bit of XML, a few priority bug fixes).

Memory address help for modders? Maybe DFHack updates will be easier in the future...
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 24, 2017, 01:13:32 pm
Yeah, that's exactly what that is. It came up on the forums a while back, probably in the FotF thread, although I can't find a link right now.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on January 24, 2017, 01:17:11 pm
Well, all I can say is that faster DFHack updates (due to less work being required) will surely be a massive win for everyone.

Hopefully the data comes in a form that will be easy to generate (less work for Toady), and easy to integrate into the current DFHack update workflow.

I guess we will see...
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 24, 2017, 02:12:20 pm
Well, all I can say is that faster DFHack updates (due to less work being required) will surely be a massive win for everyone.

Hopefully the data comes in a form that will be easy to generate (less work for Toady), and easy to integrate into the current DFHack update workflow.

I guess we will see...

Part of the FotF discussion was here (http://www.bay12forums.com/smf/index.php?topic=159164.840). I think the format must have been discussed on IRC or something, but I asked Toady about it, and he said he's probably going with what mifki suggested, which is a global table of name/address pairs plus a couple sentinel values so it can be located in memory easily.

It's also worth noting that we're talking about addresses, not structures. Researching structure layouts could still take a lot of time. (There was some confusion last time due to people thinking Toady was making structure layouts available.)
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on January 24, 2017, 03:10:49 pm
Well, at least it will be one less thing to worry about. (too bad structure layouts aren't included...)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on January 24, 2017, 03:19:49 pm
Structure layouts would take a massive amount of effort from Toady (that or it would require him to release headers, which he doesn't want to do). Global addresses should take a couple hours at most, assuming he can figure out discrepancies between our names and his.
Title: Re: DFHack 0.43.03-r1
Post by: mifki on January 24, 2017, 04:53:37 pm
Structure layouts would take a massive amount of effort from Toady (that or it would require him to release headers, which he doesn't want to do). Global addresses should take a couple hours at most, assuming he can figure out discrepancies between our names and his.

It's not about effort, I offered to make tools to extract data structure layout automatically. But he doesn't want to disclose all of them at once; he's willing to answer questions about specific structures from time to time though.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on January 24, 2017, 08:13:46 pm
Yeah, structure research will still be a thing, but having an export of addresses instead of having to hunt through with various tools and figure them out by hand will save a lot of time. One of the things holding back the full dfhack release this time was that the methods used to find the addresses for various globals in 32 bit versions didn't always translate easily or at all to 64 bit, requiring a much more in depth effort instead of running a debugger > doing a reliably identified action in  the 32 bit game > seeing what changes > fleshing out the structures known to be related from there.
Title: Re: DFHack 0.43.03-r1
Post by: than402 on January 31, 2017, 06:48:30 am
could someone tell me what is the proper syntax of a create-unit command in order to spawn a dwarf that is considered a member of the fort through a reaction? because it keeps spawning friendlies
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on January 31, 2017, 12:31:51 pm
you probably need to change their civ ids and remove the resident flag on them if  you end up spawning friendlies
which might mean digging around the unit's data through gui/gm-editor.
Title: Re: DFHack 0.43.03-r1
Post by: xordae on January 31, 2017, 01:39:35 pm
The auto-melt for stockpiles doesn't seem to do anything.. I let it run for a month or two. Auto-trade works though. I'm on alpha 4.
Title: Re: DFHack 0.43.03-r1
Post by: Artemiuz28 on January 31, 2017, 02:40:26 pm
Hello. I want to know how to use furnaces in gui/adv-fort. All other workshops work fine, but I can't figure out how furnaces work. I'm using DFHack 43.05 alpha 3. Thanks

Edit: After an hour of browsing throufg wiki, I saw that furnaces have to be built in two steps. Solved
Title: Re: DFHack 0.43.03-r1
Post by: than402 on January 31, 2017, 03:26:32 pm
you probably need to change their civ ids and remove the resident flag on them if  you end up spawning friendlies
which might mean digging around the unit's data through gui/gm-editor.

so... I manually changed the civId and the resident flag is off, but I still can't assign jobs on him (DT considers him a non citizen). Which flags determine if he's a citizen?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on January 31, 2017, 04:18:15 pm
you probably need to change their civ ids and remove the resident flag on them if  you end up spawning friendlies
which might mean digging around the unit's data through gui/gm-editor.

so... I manually changed the civId and the resident flag is off, but I still can't assign jobs on him (DT considers him a non citizen). Which flags determine if he's a citizen?

Citizenship should be tied to civ_id and pop_id as well as having a correct hist_fig. I would look at the unit you spawned and a civ member with gui/gm-editor and see what differences there are. If none pop out at you you may need to change the values in the hist_fig as well.
Title: Re: DFHack 0.43.03-r1
Post by: FantasticDorf on February 01, 2017, 10:15:33 am
you probably need to change their civ ids and remove the resident flag on them if  you end up spawning friendlies
which might mean digging around the unit's data through gui/gm-editor.

so... I manually changed the civId and the resident flag is off, but I still can't assign jobs on him (DT considers him a non citizen). Which flags determine if he's a citizen?

Citizenship should be tied to civ_id and pop_id as well as having a correct hist_fig. I would look at the unit you spawned and a civ member with gui/gm-editor and see what differences there are. If none pop out at you you may need to change the values in the hist_fig as well.

I tried to clear relevant data off some intelligent pets (gremlins, i had heard rumours that freshly tamed gremlins could apply for residencies and citizenships, also playing as a goblin civ so keeping them was fine) the creature had the correct same civ, but no population information or additional data in those fields. Generally no luck though i could tone down its tameness in gm-editor to see if it has any effect or wait it out for a little while for it to do actions on its own (if inclined to residency petition at all)

I will try messing with the historical data, thanks for the nugget of guidance, and i hope it helps you too in understanding more about (something about meeting structure MEET_WORKERS, mixed in with locking onto a target = the noble & place being pre-determined when they prompt to apply) the mutual behaviours so that one day we could have a script where we simply click a target and they apply for citizenship/residency.


On another note, forgive my ignorance but on which edition of DFhack was the stockpile manager ([ i ] over stockpile) added? I've identified a bug which the stockpile manager helps to fix in this issue report about refuse materials not releasing rotted goods it percieves to be teeth/ivory & horns because they have no meat content. Just by using the stockpile controls to stop discriminating rotted goods ([CTRL] + [X])

0010130: Refuse stockpile disallows 'rotted' items from being used in reactions - teeth/ivory, horn (hotfix included) (http://www.bay12games.com/dwarves/mantisbt/view.php?id=10130)

its a good addition, and i'd personally like to know for reference how far back into DFhack it goes so it can help combat this bug further by applying the adjustment.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on February 01, 2017, 11:02:07 am
Gremlins apply for citizenship after a while (about a year or possibly two?), probably the same time as visitor residents apply for citizenship. They don't apply for residence, though, as that has already been forced upon them. It seems to happen slightly after they change "profession" to hunter, but that can be a coincidence.
Given their dual status as both animals and sapient members, they're fairly quirky to work with.
- You can give them regular work task through DT (but not DF itself).
- They need to be retrained regularly, but when citizens they generally work rather than show up for training -> recommend hacking their tameness to fully tame when accepting them as citizens.
- They're too small to wear any clothes, and they don't have any clothing size of their own. I modify them to twice their vanilla size so they fit into kobold clothed.
- If appointed as nobles, they can issue demands, and probably mandates as well, but you can't see what these are, as you can't view their thoughts.

Given their general quirkiness, I would avoid using gremlins as any kind of model to base citizen progression on.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on February 01, 2017, 11:43:15 am
you probably need to change their civ ids and remove the resident flag on them if  you end up spawning friendlies
which might mean digging around the unit's data through gui/gm-editor.

so... I manually changed the civId and the resident flag is off, but I still can't assign jobs on him (DT considers him a non citizen). Which flags determine if he's a citizen?

Citizenship should be tied to civ_id and pop_id as well as having a correct hist_fig. I would look at the unit you spawned and a civ member with gui/gm-editor and see what differences there are. If none pop out at you you may need to change the values in the hist_fig as well.

I tried to clear relevant data off some intelligent pets (gremlins, i had heard rumours that freshly tamed gremlins could apply for residencies and citizenships, also playing as a goblin civ so keeping them was fine) the creature had the correct same civ, but no population information or additional data in those fields. Generally no luck though i could tone down its tameness in gm-editor to see if it has any effect or wait it out for a little while for it to do actions on its own (if inclined to residency petition at all)

I will try messing with the historical data, thanks for the nugget of guidance, and i hope it helps you too in understanding more about (something about meeting structure MEET_WORKERS, mixed in with locking onto a target = the noble & place being pre-determined when they prompt to apply) the mutual behaviours so that one day we could have a script where we simply click a target and they apply for citizenship/residency.


I know I've created units that function as full members of a civ, but I can't remember all the things that needed to be changed. Unfortunately I recently lost many of my test scripts of which that was one, but it is definitely possible and I think it only involved changing some tags on the unit and then in the unit's hist_fig entry
Title: Re: DFHack 0.43.03-r1
Post by: Roses on February 01, 2017, 12:01:35 pm
Good News! I have figured out how to butcher a corpse using a script. All you need is the corpse id (or unit id). unfortunately my only access to the internet for the next month or so is through work, and I can't put any files on these computers which means I can't upload anything. So I won't be able to upload my script, but I can give a walkthrough here of the steps and if someone else is adventurous they can upload a script (it's really pretty simple). Note that this is just an outline and the variables are from memory, so they might not be exactly right;
And there you have it, a butchered creature with a script. Now I haven't fully tested the behavior or even the outputs of butchering an animal this way vs the normal way, so that may throw a wrench in things.

On a related note, is there a script for creating trees? Because I realized when I was doing this that you could create trees the same way we create units with modtools/create-unit. You can even specify the age of the tree and a few other things (like type). Wasn't sure if we could already do this, but if not then a simple edit of create-unit will give you create-tree.

On an unrelated note, I have a lua programming question. Say I have a table, Table.A.B.C.D.E, if I want to check if the last entry is there I can simply do if Table.A.B.C.D.E then ... But if I want to check if the last entry is there and I'm not sure if the others are there I have to do a nested if, (i.e.
Code: [Select]
if Table.A then
 if Table.A.B then
  if Table.A.B.C then
   if Table.A.B.C.D then
    if Table.A.B.C.D.E then ...
Is there a simpler way of doing this? Can I do, if Table.A and Table.A.B and Table.A.B.C and Table.A.B.C.D and Table.A.B.C.D.E then ...?
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on February 01, 2017, 12:10:14 pm
You could write a function to do the checks, I'll post one here in a few seconds.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 01, 2017, 12:14:40 pm
On a related note, is there a script for creating trees? Because I realized when I was doing this that you could create trees the same way we create units with modtools/create-unit. You can even specify the age of the tree and a few other things (like type). Wasn't sure if we could already do this, but if not then a simple edit of create-unit will give you create-tree.
I don't believe anyone has done this, but it could work.

On an unrelated note, I have a lua programming question. Say I have a table, Table.A.B.C.D.E, if I want to check if the last entry is there I can simply do if Table.A.B.C.D.E then ... But if I want to check if the last entry is there and I'm not sure if the others are there I have to do a nested if, (i.e.
Code: [Select]
if Table.A then
 if Table.A.B then
  if Table.A.B.C then
   if Table.A.B.C.D then
    if Table.A.B.C.D.E then ...
Is there a simpler way of doing this? Can I do, if Table.A and Table.A.B and Table.A.B.C and Table.A.B.C.D and Table.A.B.C.D.E then ...?

Yes: safe_index(Table, "A", "B", "C", "D", "E"). It will return nil if any keys are not found.




On another note, forgive my ignorance but on which edition of DFhack was the stockpile manager ([ i ] over stockpile) added? I've identified a bug which the stockpile manager helps to fix in this issue report about refuse materials not releasing rotted goods it percieves to be teeth/ivory & horns because they have no meat content. Just by using the stockpile controls to stop discriminating rotted goods ([CTRL] + [X])

0010130: Refuse stockpile disallows 'rotted' items from being used in reactions - teeth/ivory, horn (hotfix included) (http://www.bay12games.com/dwarves/mantisbt/view.php?id=10130)

its a good addition, and i'd personally like to know for reference how far back into DFhack it goes so it can help combat this bug further by applying the adjustment.
That looks like the "stocks" plugin, which has been around in some form since 0.34.11. I don't know when the "i" option was added. Incidentally, that option is apparently buggy in 0.43.05 - see this issue (https://github.com/DFHack/dfhack/issues/1045).
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on February 01, 2017, 12:18:18 pm
Code: [Select]
function CheckTable(tbl, keys)
    for _, key in ipairs(keys) do
        if tbl[key] == nil then return false end
        tbl = tbl[key]
    end
    return true
end

-- Usage:
local a = {a = {b = {c = 1}}}
CheckTable(a, {"a", "b", "c"}) -- returns true
CheckTable(a, {"x", "y", "z"}) -- returns false

Ninja!
Yes: safe_index(Table, "A", "B", "C", "D", "E"). It will return nil if any keys are not found.

Where does this function come from? (Google says dfhack.safe_index(), I must have missed it...)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 01, 2017, 12:55:16 pm
It's defined in hack/lua/dfhack.lua (or library/lua/dfhack.lua in the source tree), but it is not nested under "dfhack", so you need "safe_index", not "dfhack.safe_index".
Title: Re: DFHack 0.43.03-r1
Post by: FantasticDorf on February 01, 2017, 12:57:06 pm
On another note, forgive my ignorance but on which edition of DFhack was the stockpile manager ([ i ] over stockpile) added? I've identified a bug which the stockpile manager helps to fix in this issue report about refuse materials not releasing rotted goods it percieves to be teeth/ivory & horns because they have no meat content. Just by using the stockpile controls to stop discriminating rotted goods ([CTRL] + [X])

0010130: Refuse stockpile disallows 'rotted' items from being used in reactions - teeth/ivory, horn (hotfix included) (http://www.bay12games.com/dwarves/mantisbt/view.php?id=10130)

its a good addition, and i'd personally like to know for reference how far back into DFhack it goes so it can help combat this bug further by applying the adjustment.
That looks like the "stocks" plugin, which has been around in some form since 0.34.11. I don't know when the "i" option was added. Incidentally, that option is apparently buggy in 0.43.05 - see this issue (https://github.com/DFHack/dfhack/issues/1045).

Interesting, i've personally not experienced any bugs like this myself but then again i only used a limited range & amount of active stockpiles between testing (also tried said hotfix on elephants hunted animals for ivory, works like a charm). If it's any other valuable information dead_dwarf=true objects are not listed at all upon a relevant corpse (/graveyard) stockpile for citizens until they are unset from dead_dwarf true and changed to false (EI - dead_dwarf=false troll tripe as the FoTF derail thread shows (http://www.bay12forums.com/smf/index.php?topic=161408.msg7343915#msg7343915))

Dead_dwarf=true was active in previous version with no noticable effect on item usage, (as shown by Max's research on version 40.24 travelling around the world as a adventuerer eating the people who live on different sites for different dead_dwarf=true self set on citizens (http://www.bay12forums.com/smf/index.php?topic=161408.msg7341577#msg7341577)) so checking with a 40.24 linux version (the only availible version of that i've seen) whether stocks manager 'sees' the object might help.
Title: Re: DFHack 0.43.03-r1
Post by: TheFlame52 on February 01, 2017, 02:05:09 pm
Whatever happened to the drainaquifers script? Any way we could get it back?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 01, 2017, 02:16:27 pm
It was renamed to drain-aquifer.

Also, it's mentioned in http://dfhack.readthedocs.io/en/stable/docs/History.html. If you ever have similar questions, http://dfhack.readthedocs.io/en/stable/NEWS.html and that page are good places to look.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on February 01, 2017, 03:03:22 pm
@Roses: Yes, there is a script (actually a plugin) for creating trees called "plant". It creates saplings or shrubs, and it can also grow trees from saplings, so getting a grown tree is a two step process.
Title: Re: DFHack 0.43.03-r1
Post by: TheFlame52 on February 01, 2017, 05:10:28 pm
It was renamed to drain-aquifer.

Also, it's mentioned in http://dfhack.readthedocs.io/en/stable/docs/History.html. If you ever have similar questions, http://dfhack.readthedocs.io/en/stable/NEWS.html and that page are good places to look.
I looked through the list like three times and missed it. I am blind. Thanks for the help.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on February 01, 2017, 06:02:50 pm
It was renamed to drain-aquifer.

Also, it's mentioned in http://dfhack.readthedocs.io/en/stable/docs/History.html. If you ever have similar questions, http://dfhack.readthedocs.io/en/stable/NEWS.html and that page are good places to look.
I looked through the list like three times and missed it. I am blind. Thanks for the help.
I use ctrl+f for exactly this reason :)
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on February 02, 2017, 03:23:12 am
Yeah, ctrl+f is so easy to forget.

Oh, I meant to ask, is there anywhere known that the info displayed on the adventurer quest log would be saved? I'm guessing it's in there buried under a bunch of unk entries if you look through gview or one of the deeper piles of unk entries in ui_advmode.

Besides the gview.view.child.child.viewscreen_adventure_logst entry of course, unless it's likely that one of the unks in there has the links I'm looking for.

Always wanted to make a script to move your travel army to a position chosen on the quest log map but never got it going right.

Nevermind, I figured out that it was crashy trying to check out the items under the adventurer log so then I tried to hack gm-editor into doing this but fuck it, it's good enough for a script by itself:
Spoiler (click to show/hide)
Code: (questport.lua) [Select]
local qmap=dfhack.gui.getCurViewscreen()
local qx=qmap.cursor_x*48
local qy=qmap.cursor_y*48
local rx=qmap.player_region_x*48
local ry=qmap.player_region_y*48
  local qarm=df.global.world.armies.all
for k,v in ipairs(qarm) do
if v.flags[0] then
local my_arm=df.global.world.armies.all[k].pos
if rx~=qx then do
my_arm.x=qx
my_arm.y=qy
qmap.player_region_x=qmap.cursor_x
qmap.player_region_y=qmap.cursor_y
end
end
end
end
I wanted to put in a check attempt to make it look for the requisite screens (dfhack.gui.getCurViewscreen()==viewscreen_adventurer_logst)/travel state(df.global.ui_advmode.menu==26) but it got annoying figuring out which one wasn't working so I'll bother with that later when I push it upstream probably, since it just doesn't do anything outside of travel/quest combo.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on February 02, 2017, 11:54:09 am
So I managed to get around the internet limitation by writing the script on a piece of paper and then typing it in at work, here is a script for butchering a corpse. It takes a unit id (checks for it's corpse) or a corpse item id (checks to make sure it's actually a corpse) or a location (butchers the first corpse it finds on that location). Enjoy!

Code: [Select]
local utils=require 'utils'
local gui = require 'gui'
 
validArgs = --[[validArgs or]]utils.invert({
  'help',
  'unit',
  'corpse',
  'location',
  'kill',
 
})

local args = utils.processArgs({...}, validArgs)
if args.help then
  print('')
  return
end

corpse = nil
if args.unit and tonumber(args.unit) then
 unit = df.unit.find(tonumber(args.unit))
 if not unit then return end
 if unit.flags1.dead then
  for _,id in pairs(unit.corpse_parts) do
   item = df.item.find(id)
   if df.item_corpsest:is_instance(item) and not item.body.components.body_part_status[0].missing and item.corpse_flags.unbutchered then
    corpse = item
    break
   end
  end
 else
  if args.kill then
   print('-kill not currently working')
  else
   print('Unit is still alive and has not been ordered -kill')
  end
 end
elseif args.corpse and tonumber(args.corpse) then
 item = df.item.find(tonumber(args.corpse))
 if not item then return end
 if df.item_corpsest:is_instance(item) then
  if not item.body.components.body_part_status[0].missing and item.corpse_flags.unbutchered then
   corpse = item
  end
 end
elseif args.location then
 locx = tonumber(args.location[1])
 locy = tonumber(args.location[2])
 locz = tonumber(args.location[3])
 block = dfhack.maps.ensureTileBlock(locx,locy,locz)
 if block.occupancy[locx%16][locy%16].item then
  for _,id in pairs(block.items) do
   item = df.item.find(id)
   if df.item_corpsest:is_instance(item) then
    if item.pos.x == locx and item.pos.y == locy and item.pos.z == locz then
     if not item.body.components.body_part_status[0].missing and item.corpse_flags.unbutchered then
      corpse = item
      break
     end
    end
   end
  end
 end
end
if not corpse then return end

local view_x = df.global.window_x
local view_y = df.global.window_y
local view_z = df.global.window_z
local curViewscreen = dfhack.gui.getCurViewscreen()
local dwarfmodeScreen = df.viewscreen_dwarfmodest:new()
curViewscreen.child = dwarfmodeScreen
dwarfmodeScreen.parent = curViewscreen
local oldMode = df.global.ui.main.mode
df.global.ui.main.mode = df.ui_sidebar_mode.LookAround
local old_gametype = df.global.gametype
df.global.gametype = df.game_type.DWARF_ARENA

df.global.cursor.x = corpse.pos.x
df.global.cursor.y = corpse.pos.y
df.global.cursor.z = corpse.pos.z
for i,_ in pairs(df.global.ui_look_list.items) do
 df.global.ui_look_cursor = i
 if dfhack.gui.getCurFocus() == 'dwarfmode/LookAround/Item' then
  if corpse.id == dfhack.gui.getSelectedItem().id then
   break
  end
 end
end
gui.simulateInput(dfhack.gui.getCurViewscreen(), 'D_LOOK_ARENA_ADV_MODE')

df.global.gametype = old_gametype
curViewscreen.child = nil
dwarfmodeScreen:delete()
df.global.ui.main.mode = oldMode

df.global.window_x = view_x
df.global.window_y = view_y
df.global.window_z = view_z
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on February 02, 2017, 04:09:53 pm
So I managed to get around the internet limitation by writing the script on a piece of paper and then typing it in at work

I commend your dedication! I would never have the patience to do that...

The script looks very interesting, I may (finally) be able to get rid of the butchershop in Underhive Settlement... If I can come up with a way to replace slaughtering too...
Title: Re: DFHack 0.43.03-r1
Post by: Roses on February 02, 2017, 07:57:35 pm
So I managed to get around the internet limitation by writing the script on a piece of paper and then typing it in at work

I commend your dedication! I would never have the patience to do that...

The script looks very interesting, I may (finally) be able to get rid of the butchershop in Underhive Settlement... If I can come up with a way to replace slaughtering too...

Well the script does have an added argument -kill which kills the creature and then butchers it. But I disabled that particular feature because it caused crashes. I think it will work if you just allow one in-game tick to occur between killing and butchering.
Title: Re: DFHack 0.43.03-r1
Post by: FantasticDorf on February 03, 2017, 01:54:34 pm
I have a question, what is going on with animals turned with GM editor turning back and reverting to what they once were? Doing this more than once crashes the game.
Title: Re: DFHack 0.43.03-r1
Post by: Nahere on February 03, 2017, 06:25:30 pm
Is there a working version of bodyswap somewhere? Or some equivalent?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on February 03, 2017, 07:48:26 pm
Hmmm, I remember there was an extra step needed in there for the actual transfer, trying to just flip the relevant flags gives you the creepy "I am a bat in a cave in the far northwest, I have no mouth, and I must scream" bug.

Changing animals and other creatures with gm-editor properly would involve tracking down everything that points to that animal being a specific species.

Anybody know offhand what all is needed to put yourself into travel mode fully? Setting the menu type to 26 and travel_not_moved to true in arena mode lets you move around there but that isn't what I was looking for with the questport, but until you've moved or entered a wait timer you don't get an army entry you can edit.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on February 04, 2017, 09:07:29 am
Hmmm, I remember there was an extra step needed in there for the actual transfer, trying to just flip the relevant flags gives you the creepy "I am a bat in a cave in the far northwest, I have no mouth, and I must scream" bug.

Changing animals and other creatures with gm-editor properly would involve tracking down everything that points to that animal being a specific species.

Anybody know offhand what all is needed to put yourself into travel mode fully? Setting the menu type to 26 and travel_not_moved to true in arena mode lets you move around there but that isn't what I was looking for with the questport, but until you've moved or entered a wait timer you don't get an army entry you can edit.

oh wait adv body swap isn't fully put out oh crud uhh.... yeah here's one, though mostly this will do is make the character your swapping into a permanent adventurer so on retirement you could choose them.
gotta give warmist credit for making these small functions(and originally making bodyswap script), those were like building blocks to writing dfusion/dfhack lua scripts for me.

Spoiler (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: Nahere on February 05, 2017, 04:58:38 pm
@Rumrusher
Given that the units I'm trying to bodyswap to are already retired adventurers, that won't really help. Didn't you have a way of cutting the two week waiting period down though? That would work.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on February 05, 2017, 08:41:37 pm
Hmmm, my gui skills aren't up to the task so I just use gm-editor to open df.global.gview.view.child.child I think, and set the year_tick up or down if I want now/much later, but a script which popped up a prompt when the calendar starts to update would be doable.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on February 06, 2017, 12:25:07 am
@Rumrusher
Given that the units I'm trying to bodyswap to are already retired adventurers, that won't really help. Didn't you have a way of cutting the two week waiting period down though? That would work.

uhh gui/gm-editor dfhack.gui.getCurViewscreen() at the calendar then change either the tick or a year to 0 and you will instantly jump to the adv menu.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 06, 2017, 01:15:37 am
gui/gm-editor dfhack.gui.getCurViewscreen()
"gui/gm-editor scr" does the same thing, by the way.
Title: Re: DFHack 0.43.03-r1
Post by: Nahere on February 06, 2017, 03:02:43 am
uhh gui/gm-editor dfhack.gui.getCurViewscreen() at the calendar then change either the tick or a year to 0 and you will instantly jump to the adv menu.
"gui/gm-editor scr" does the same thing, by the way.
Thanks.
Title: Re: DFHack 0.43.03-r1
Post by: ab9rf on February 06, 2017, 07:43:07 am
The auto-melt for stockpiles doesn't seem to do anything.. I let it run for a month or two. Auto-trade works though. I'm on alpha 4.
It works for me fairly reliably. Note that while auto-melt marks things for melting, it doesn't queue up melt object jobs at a furnace. You have to use some other mechanism to arrange for that.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on February 07, 2017, 04:45:40 am
The auto-melt for stockpiles doesn't seem to do anything.. I let it run for a month or two. Auto-trade works though. I'm on alpha 4.
It works for me fairly reliably. Note that while auto-melt marks things for melting, it doesn't queue up melt object jobs at a furnace. You have to use some other mechanism to arrange for that.
Workflow (without a quota) will make repeat jobs suspend instead of cancelling when there are no inputs, and automatically resume when there are - which is perfect for automelt.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on February 07, 2017, 03:37:33 pm
Except last I knew that didn't work anymore... Maybe it was fixed.
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on February 09, 2017, 12:19:58 am
Except last I knew that didn't work anymore... Maybe it was fixed.

Workflow? It definitely works, even in 0.43.05. I use it all the time. I think it was partially busted when the new workorder system was added, but not for long.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 09, 2017, 01:57:33 am
It wasn't ever broken, as far as I know. The keybinding was removed because there was concern that it would be broken or unnecessary, but I haven't seen any reports of that.
Title: Re: DFHack 0.43.03-r1
Post by: necrotic on February 09, 2017, 10:52:49 am
Ah right. I knew there was something with workflow a while back.
Title: Re: DFHack 0.43.03-r1
Post by: ab9rf on February 09, 2017, 07:53:48 pm
The auto-melt for stockpiles doesn't seem to do anything.. I let it run for a month or two. Auto-trade works though. I'm on alpha 4.
It works for me fairly reliably. Note that while auto-melt marks things for melting, it doesn't queue up melt object jobs at a furnace. You have to use some other mechanism to arrange for that.
Workflow (without a quota) will make repeat jobs suspend instead of cancelling when there are no inputs, and automatically resume when there are - which is perfect for automelt.
You can also use DF's built-in job manager to get essentially the same effect now. Queue up a repeating "melt object" job with an input threshold on "meltable items" or something like that.

I haven't used workflow at all since 43.xx; the built-in manager can do almost as much and is in some ways better.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 11, 2017, 09:02:22 pm
A couple people have been reporting a Linux crash that was fixed a couple weeks ago, so I decided it would be a good time for another build:

https://github.com/DFHack/dfhack/releases/tag/0.43.05-beta1

Hopefully this one is more stable than others. We seem to have moved past the catastrophic issue stage, so this is now a "beta" build. Do keep checking for problems, though.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on February 13, 2017, 06:14:35 pm
Question about item-trigger. I know having more than one condition on a single item-trigger call isn't supported (i.e. you can't have -itemType and -material defined), but what if I create two seperate item-triggers, one that triggers on equip of an item type and one that triggers on equip of an item material? If I have an item of the correct type and material will both be triggered?

EDIT: Follow up question, will using modtools/equip-item trigger an -onEquip modtools/item-trigger?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 16, 2017, 08:38:10 pm
A couple people have been reporting a Linux crash that was fixed a couple weeks ago, so I decided it would be a good time for another build:

https://github.com/DFHack/dfhack/releases/tag/0.43.05-beta1

Hopefully this one is more stable than others. We seem to have moved past the catastrophic issue stage, so this is now a "beta" build. Do keep checking for problems, though.

Update: Windows builds are now available, thanks to Quietust.
Title: Re: DFHack 0.43.03-r1
Post by: Pwnzerfaust on February 16, 2017, 09:28:13 pm
A couple people have been reporting a Linux crash that was fixed a couple weeks ago, so I decided it would be a good time for another build:

https://github.com/DFHack/dfhack/releases/tag/0.43.05-beta1

Hopefully this one is more stable than others. We seem to have moved past the catastrophic issue stage, so this is now a "beta" build. Do keep checking for problems, though.

Update: Windows builds are now available, thanks to Quietust.
Awesome. Many thanks to both of you.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on February 22, 2017, 07:38:02 pm
Is it possible to pause a script at a certain line, let DF run for a given amount of frames, and then resume the script? I know I can use dfhack.timeout() to basically do what I want, but I was hoping for a smoother option.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on February 22, 2017, 07:59:37 pm
The script API allows that with script.sleep
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on February 23, 2017, 10:27:11 am
Hmmm, I'm probably a tard because I couldn't find more info on the script.sleep stuff in any of the docs, but it gave me a reason to learn more about timeouts which let me get questport working even if you're not in travel mode when you pull up the quest log and use it, had to fiddle with the timing some but the brief flicker when it is first used on foot is a small price to pay for zooping around the quest log and ending up where you're looking. Dunno why I thought I could just put myself into travel mode and do an hour wait, can't pull up the log that way, and incidentally yes I do know about the dfhack.screen and sendInput options, call it superstitious but the timing on those didn't work as well as just slapping in the simulated inputs, and when I tried to clean up the code a bit I lost the ability to use it without being in travel mode first so I had to roll it back and figure it out again.
Code: (questport.lua) [Select]
local gui=require 'gui'
local qp=df.global.gview.view.child
local qmap=dfhack.gui.getCurViewscreen()
local qarm=df.global.world.armies.all
if df.viewscreen_adventure_logst:is_instance(qmap) then
local qx=qmap.cursor_x*48
local qy=qmap.cursor_y*48
local rx=qmap.player_region_x*48
local ry=qmap.player_region_y*48
df.global.ui_advmode.unk_1=qx
df.global.ui_advmode.unk_2=qy
if df.global.ui_advmode.menu==0 then
gui.simulateInput(qp.child,'LEAVESCREEN')
df.global.ui_advmode.menu=26
df.global.ui_advmode.travel_not_moved=true
gui.simulateInput(qp,'CURSOR_DOWN')
dfhack.timeout(15,'frames',function()
gui.simulateInput(qp,'A_TRAVEL_LOG') end)
-- print('Ready to teleport!') end)
elseif df.global.ui_advmode.menu==26 then
for k,v in ipairs(qarm) do
if v.flags[0] then
local my_arm=df.global.world.armies.all[k].pos
if (rx~=qx or ry~=qy) then do
my_arm.x=qx
my_arm.y=qy
qmap.player_region_x=qmap.cursor_x
qmap.player_region_y=qmap.cursor_y
     end
end
    end
end
    end
end
Only bug I know of atm is that you can't use it if you've gotten the "you cannot travel til you leave this site" message, not sure which flag or whatnot has to be flipped to fix that, but assuming you don't try to travel out before using it, the script will zoop you out just fine.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 23, 2017, 10:47:10 am
There doesn't seem to be much documentation for the script module (actually gui.script). There are some examples in these scripts, though:

add-thought
gui/advfort
gui/advfort_items
gui/create-item

(note that the advfort ones refer to it as "gscript", and the others use "script")
Title: Re: DFHack 0.43.03-r1
Post by: Roses on February 23, 2017, 12:01:12 pm
The script API allows that with script.sleep

Perfect!

EDIT: Just for clarification, will all variables that were defined still be defined?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 23, 2017, 02:40:57 pm
Yes. It essentially suspends the current function (although it has to be wrapped with script.start).
Title: Re: DFHack 0.43.03-r1
Post by: Roses on February 23, 2017, 02:47:56 pm
Yes. It essentially suspends the current function (although it has to be wrapped with script.start).

Good to know, so basically I have a large mess of code and I can just put
Code: [Select]
script.start(function ()at the beginning of it and close it out with a
Code: [Select]
end)Then put script.sleep inside of it wherever I want to pause the script?

Will other timeout calls and eventful triggers still trigger while it is suspended?

EDIT: Is there a way to force pause/unpause the game from a lua script? Sorry for all the questions, this is all an area I haven't worked with yet.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 23, 2017, 05:56:26 pm
That should work, yes. Timeouts and eventful triggers shouldn't be inside of the function you're passing to script.start(), so those should still work (and even if they were declared inside of script.start(), it should work, since you'd be registering functions).

Pausing can be done by changing df.global.pause_state.
Title: Re: DFHack 0.43.03-r1
Post by: McNoodlehead on February 23, 2017, 07:56:51 pm
Is there a way to get the size of a procedural genned creature with DFHack? I'm trying to figure out the size of a wererhino, but since they're procedural and don't have raws, I don't know whether they can fit into rhinoman fitted armor or not.
Title: Re: DFHack 0.43.03-r1
Post by: TheFlame52 on February 23, 2017, 08:32:29 pm
'gui/gm-editor df.global.world.raws' will get you into your world's raws. Then hit creatures > alphabetical and look for w, then wererhino. At the bottom of the menu there should be an option called 'raws'. That will give you a huge list of unlabeled strings. I found the size of a werebeaver on line 73, so it should be around there somewhere. The last number on that line is the size of your creature. Compare that to the list of creatures by adult size (http://dwarffortresswiki.org/index.php/DF2014:List_of_creatures_by_adult_size) to find an animal man close to that size.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on February 23, 2017, 09:40:09 pm
Way harder than it needs to be, just target yourself and run gui/gm-editor then go down to body in the raws for a weremonitor I just checked it's adultsize 8100, while body.blood_max is 8100, as is body.size_info.size_base, while size_cur on this one is 9617. Just add a zero to get the value on the wiki lists, sperm whale man I checked was 1,181,315 while wiki lists 12,535,000 as max, so a weremonitor can wear the same armor as a kangaroo man, find your blood_max and size_cur as a wererhino and add a 0 then check the wiki list.
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on February 24, 2017, 05:12:53 am
(note that the advfort ones refer to it as "gscript", and the others use "script")

Oof. That's because I didn't know advfort or advfort-items used it when I wrote the other two, so I just sort of went at it freshly instead of following existing convention.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on February 24, 2017, 06:50:32 am
(note that the advfort ones refer to it as "gscript", and the others use "script")

Oof. That's because I didn't know advfort or advfort-items used it when I wrote the other two, so I just sort of went at it freshly instead of following existing convention.
Also i'm pretty sure both of them are using it incorrectly or superfluously. As each time i understand how it works i somehow manage to confuse myself into not understanding it anymore.

This reminded me that we (I) need some "script" dialogs that would let e.g. choose X units, Y items and then run "some command X Y". That would allow to have a more flexible and user friendly interface for some more used stuff.
Title: Re: DFHack 0.43.03-r1
Post by: TheFlame52 on February 24, 2017, 09:21:58 am
Way harder than it needs to be, just target yourself and run gui/gm-editor then go down to body in the raws for a weremonitor I just checked it's adultsize 8100, while body.blood_max is 8100, as is body.size_info.size_base, while size_cur on this one is 9617. Just add a zero to get the value on the wiki lists, sperm whale man I checked was 1,181,315 while wiki lists 12,535,000 as max, so a weremonitor can wear the same armor as a kangaroo man, find your blood_max and size_cur as a wererhino and add a 0 then check the wiki list.
I did not know that's how those numbers worked.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on February 24, 2017, 09:42:02 am
Oof. That's because I didn't know advfort or advfort-items used it when I wrote the other two, so I just sort of went at it freshly instead of following existing convention.
There's already some inconsistency between things like dlg/dialog, script/gscript/guiScript, etc. between scripts (turns out gui/gm-editor and gui/gm-unit use "guiScript"). As long as you stay consistent within a script, it's fine.


This reminded me that we (I) need some "script" dialogs that would let e.g. choose X units, Y items and then run "some command X Y". That would allow to have a more flexible and user friendly interface for some more used stuff.
Are you talking about adding stuff to the Lua libraries (e.g. library/lua/gui/script.lua) or adding scripts that wrap certain commands?
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on February 24, 2017, 09:49:28 am
Are you talking about adding stuff to the Lua libraries (e.g. library/lua/gui/script.lua) or adding scripts that wrap certain commands?

Ideally both. It would be like other dialog-things but then the script that wraps any other script that uses a unit/item/pos as variable would be trivial.
Title: Re: DFHack 0.43.03-r1
Post by: soul4hdwn on February 24, 2017, 11:11:13 am
edit: sorry there was deeper help menu explaining questions...
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on February 25, 2017, 12:33:06 am
Way harder than it needs to be, just target yourself and run gui/gm-editor then go down to body in the raws for a weremonitor I just checked it's adultsize 8100, while body.blood_max is 8100, as is body.size_info.size_base, while size_cur on this one is 9617. Just add a zero to get the value on the wiki lists, sperm whale man I checked was 1,181,315 while wiki lists 12,535,000 as max, so a weremonitor can wear the same armor as a kangaroo man, find your blood_max and size_cur as a wererhino and add a 0 then check the wiki list.
I did not know that's how those numbers worked.
Yeah, I could imagine there might be a case where blood_max wasn't accurate, but size_base should always be the critter size and I don't know if it possible to have size_cur so different you can't wear the same armor anymore.
Title: Re: DFHack 0.43.03-r1
Post by: PeridexisErrant on February 25, 2017, 08:01:52 am
Just a note for anyone doing release builds of DFHack - please include the documentation!  It's dead easy if you have Python installed, and for new users an undocumented feature basically doesn't exist.
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on March 01, 2017, 10:09:50 am
okay discovered you could trigger getting into fast travel by going into the sleep confirm menu in advmode ui,
all you need to do then is wait know what here's warmist portal.lua script for writing delay timing for teleporting
Spoiler (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on March 01, 2017, 07:51:36 pm
Yeah, I was trying to do that but if you try to force the quest log to open as well it crashes, but I was able to make questport (http://www.bay12forums.com/smf/index.php?topic=139553.msg7371328#msg7371328) send you where you point the cursor on the quest map whether you're on foot or in travel mode.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 01, 2017, 09:32:21 pm
What are you referring to by "DFHack auto-startup"? If you mean the fact that the DFHack console opens when you open DF, you can avoid this on Linux and OS X by running the "df" script instead of "dfhack". On Windows, you can rename SDL.dll to something else, then rename SDLreal.dll to SDL.dll (and reverse the process to re-enable DFHack).
Title: Re: DFHack 0.43.03-r1
Post by: Ragnoff on March 03, 2017, 04:13:57 pm
Not sure if this is the correct thread. I was trying to use the Planning Mode for furniture, doors, tables and chairs.  I check that any material and quality is allowed.  after 8 or so tables were placed shortly after startup, the rest has sat for several seasons.  There were idle dwarfs, but no one installed the furniture.  I am using workflow, and I save and restart often as I do not have a long time to play at any one setting, so the planned furniture would have been a great benefit if it had worked. Am I missing something obvious or is it bugged? Using the latest version of LBP

Any help is appreciated!
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 03, 2017, 11:09:51 pm
What DFHack version are you using? It should be logged in the console on startup, and on the title screen.
Title: Re: DFHack 0.43.03-r1
Post by: neo1096 on March 04, 2017, 05:03:42 am
Not sure if this is the correct thread. I was trying to use the Planning Mode for furniture, doors, tables and chairs.  I check that any material and quality is allowed.  after 8 or so tables were placed shortly after startup, the rest has sat for several seasons.  There were idle dwarfs, but no one installed the furniture.  I am using workflow, and I save and restart often as I do not have a long time to play at any one setting, so the planned furniture would have been a great benefit if it had worked. Am I missing something obvious or is it bugged? Using the latest version of LBP

Any help is appreciated!
I've noticed this too in dfhack 43.05 beta1 when I reload a saved game from the main menu after having exited out of another one. It seems to go away if I restart the dwarf fortress executable itself, and the dwarves resume placing the queued furniture.
Title: Re: DFHack 0.43.03-r1
Post by: ab9rf on March 04, 2017, 01:04:52 pm
Not sure if this is the correct thread. I was trying to use the Planning Mode for furniture, doors, tables and chairs.  I check that any material and quality is allowed.  after 8 or so tables were placed shortly after startup, the rest has sat for several seasons.  There were idle dwarfs, but no one installed the furniture.  I am using workflow, and I save and restart often as I do not have a long time to play at any one setting, so the planned furniture would have been a great benefit if it had worked. Am I missing something obvious or is it bugged? Using the latest version of LBP

Any help is appreciated!
I've noticed this too in dfhack 43.05 beta1 when I reload a saved game from the main menu after having exited out of another one. It seems to go away if I restart the dwarf fortress executable itself, and the dwarves resume placing the queued furniture.
Planning mode was bugged in early 43.05 alphas. I thought it was fixed in the beta, but maybe we missed something.
Title: Re: DFHack 0.43.03-r1
Post by: Ragnoff on March 06, 2017, 01:01:23 am
Using the LNP, DFHack 0.43.03.-r1-0-g9889379

Not sure if/when the LNP will update, but not confident in cobbling together my own version.

Ragnoff
Title: Re: DFHack 0.43.03-r1
Post by: Nagidal on March 06, 2017, 02:01:29 pm
Hello,

I'm running DFHack version 0.43.03-r1 (release) on Windows 10 (the console says Warning: Plugin RemoteFortressReader compiled for DFHack 0.34.11-r3-3104-g58ed20b running DFHack 0.43.03-r1-0-g9889379) with Dwarf Fortress 0.43.03, 32 bit.

It looks like the happiness meter at the bottom right is report different happiness than Dwarf Therapist (37.0.0). Right after the embark it says this:

Spoiler: DFHack hapiness report (click to show/hide)

I think that Dwarf Therapist has the right values. Why does the Happiness meter show something else?
Title: Re: DFHack 0.43.03-r1
Post by: Thorfinn on March 06, 2017, 04:48:11 pm
Not that big of a deal. DFHack has the lowest category at negative numbers, Therapist goes with non-positive (so includes zero). I don't know that the basic game tells you which, if either, is "correct".

I haven't actually looked all that hard for it in completely vanilla 43.05, but neither have I bumped into it. I've just been eyeballing the description to see how many satisfied, unfocused, unfettered, etc. I see. As long as I see a lot of green or teal or grey, I figure they are OK. Does it appear somewhere? That would be handy...

[EDIT]
Oh, I see it's probably that first sentence in the last paragraph --e.g., "somewhat focused with satisfied needs". Is there a screen that displays where he is in that broad range?
[/EDIT]
Title: Re: DFHack 0.43.03-r1
Post by: Nagidal on March 06, 2017, 06:07:30 pm
I don't quite understand what you're telling me. My problem may be much simpler than you think. If the happiness categories (http://dwarffortresswiki.org/index.php/v0.34:Thought) listed in the wiki to 0.34.x are still valid, then DFHack tells me that I have 7 dwarves who are "happy". But Dwarf Therapist categorizes them as "fine", which is two categories lower.

I understand that DFHack uses the happiness number, and Dwarf Therapist uses Stress value, but shouldn't these two lead to the same happiness category?

Or maybe, if these values are linked to fundamentally different feelings, Dwarf Therapist should rename it's column and instead of Happiness it should say Stress.
Title: Re: DFHack 0.43.03-r1
Post by: Quietust on March 06, 2017, 07:28:52 pm
I understand that DFHack uses the happiness number, and Dwarf Therapist uses Stress value, but shouldn't these two lead to the same happiness category?
That is not the case - the Happiness number was removed when Stress was added, and the difference is entirely due to DFHack and Therapist using different labels for the different ranges.

If the happiness categories (http://dwarffortresswiki.org/index.php/v0.34:Thought) listed in the wiki to 0.34.x are still valid
Those categories are NOT valid anymore - you should be looking at the DF2014 page (i.e. the one for the current version), not one for an outdated version.
Title: Re: DFHack 0.43.03-r1
Post by: Thorfinn on March 06, 2017, 08:26:45 pm
I don't quite understand what you're telling me. My problem may be much simpler than you think. If the happiness categories (http://dwarffortresswiki.org/index.php/v0.34:Thought) listed in the wiki to 0.34.x are still valid, then DFHack tells me that I have 7 dwarves who are "happy". But Dwarf Therapist categorizes them as "fine", which is two categories lower.

I understand that DFHack uses the happiness number, and Dwarf Therapist uses Stress value, but shouldn't these two lead to the same happiness category?

Or maybe, if these values are linked to fundamentally different feelings, Dwarf Therapist should rename it's column and instead of Happiness it should say Stress.
Quietust gives you the rigorously correct answer, so far as I know. I take a more casual approach.

In games where I play with DFHack, when I use (u)nits (l)abor,  I see stress starts with 0. I assume that is what DF reports. May or may not be true. I don't care. I just assume that if stress is increasing, I need to fix that. Lots of green or cyan means stress is decreasing. I think grey is more or less neutral. So long as there's more green than red, cyan than orange, all is good.

For what it's worth, I find unless you go out of your way, it's pretty easy to keep stress level negative.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on March 06, 2017, 09:58:53 pm
Hello,

I'm running DFHack version 0.43.03-r1 (release) on Windows 10 (the console says Warning: Plugin RemoteFortressReader compiled for DFHack 0.34.11-r3-3104-g58ed20b running DFHack 0.43.03-r1-0-g9889379) with Dwarf Fortress 0.43.03, 32 bit.
You have the wrong remotefortressreader version.
If the warning would mention the same DF version both times, it'd likely be fine, but this won't work at all.

You need to get a copy of the plugin that matches your DF version.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 07, 2017, 12:46:23 am
Hello,

I'm running DFHack version 0.43.03-r1 (release) on Windows 10 (the console says Warning: Plugin RemoteFortressReader compiled for DFHack 0.34.11-r3-3104-g58ed20b running DFHack 0.43.03-r1-0-g9889379) with Dwarf Fortress 0.43.03, 32 bit.
You have the wrong remotefortressreader version.
If the warning would mention the same DF version both times, it'd likely be fine, but this won't work at all.

You need to get a copy of the plugin that matches your DF version.
No, whoever built that plugin didn't have the proper git tags for some reason. If the plugin had been build against 0.34.11, it would fail to load entirely. That one was build with DFHack 0.43.03-r1 (it must have been, since it loads under that DFHack version), but its more detailed version is reported as "3104 commits after 0.34.11-r3" instead of anything more recent.

In other words, that plugin should work perfectly fine, but it really ought to be rebuilt to get rid of that warning.

Edit: looks like 58ed20b is actually newer (https://github.com/dfhack/dfhack/commits/58ed20b) than 0.43.03-r1, but just due to RFR changes.
Title: Re: DFHack 0.43.03-r1
Post by: Rose on March 07, 2017, 01:01:46 am
okay, I must have been doing something wrong then, because I was sure that any backwards-compatibility compiles I did were on a fork made after the tag.

Ugh, this confuses things.
Title: Re: DFHack 0.43.03-r1
Post by: Nagidal on March 07, 2017, 01:40:22 am
I understand that DFHack uses the happiness number, and Dwarf Therapist uses Stress value, but shouldn't these two lead to the same happiness category?
That is not the case - the Happiness number was removed when Stress was added, and the difference is entirely due to DFHack and Therapist using different labels for the different ranges.

If the happiness categories (http://dwarffortresswiki.org/index.php/v0.34:Thought) listed in the wiki to 0.34.x are still valid
Those categories are NOT valid anymore - you should be looking at the DF2014 page (i.e. the one for the current version), not one for an outdated version.

Thanks for explaining this. I was looking at the DF2014 Thought page, but I was expecting to find seven labels for the seven happiness levels displayed in DFHack's Happiness monitor at the bottom right. I only found them in the 0.34.x version of the article.

I'm starting to think that degrees of happiness are no longer what the thingy should show. Dwarves now have finely varied Emotions (http://dwarffortresswiki.org/index.php/DF2014:Emotion) which are somehow color-coded (http://dwarffortresswiki.org/index.php/DF2014:Stress). Maybe an indicator showing the population's current thoughts categorized by their color would be more useful.

In my last fortress, the monitor almost always showed me 90% of the fortress population in the top happiness category, the rest not too far below it. I was wondering what are they so ecstatic about, but when I looked in Dwarf Therapist or actually read dwarves' thoughts, I got a much more normal picture showing them just about fine, with the usual little annoyances.
Title: Re: DFHack 0.43.03-r1
Post by: Nagidal on March 07, 2017, 01:42:43 am
whoever built that plugin didn't have the proper git tags for some reason
Thanks, I reported this to PeridexisErrant. The build is from his current Starter Pack.
Title: Re: DFHack 0.43.03-r1
Post by: Squirrelloid on March 07, 2017, 02:38:17 pm
43.03-r1 is still the current version even for 43.05?
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on March 07, 2017, 03:16:58 pm
The beta (which is stable from everything I can see) is here: https://github.com/DFHack/dfhack/releases
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 07, 2017, 03:34:30 pm
43.03-r1 is still the current version even for 43.05?
No. DFHack releases never support DF versions newer than the ones they're named for. They sometimes support older versions, though (e.g. DFHack 0.43.03-r1 supports DF 0.43.03, 0.43.02, and 0.43.01).

Title: Re: DFHack 0.43.03-r1
Post by: soul4hdwn on March 09, 2017, 02:25:56 am
43.03-r1 is still the current version even for 43.05?
No. DFHack releases never support DF versions newer than the ones they're named for. They sometimes support older versions, though (e.g. DFHack 0.43.03-r1 supports DF 0.43.03, 0.43.02, and 0.43.01).


uhh well its working fine so far, df hack of 0.43.03-r1  applied on DF 64 bit windows 0.43.05.  only issue i've been having and its impossible to tell if its default DF or because i've been using fastdwarf obsessively, is that there's a lot of "distracted" dwarves that rapidly need to perform tavern and temple activities.  still happens with normal speed and moving dwarves but i only have about 20 out of 100 dwarves legitimately working (and everyone is maximal happy), thus dorfs still desperately using tavern and temple.

edit: clarified versions.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 09, 2017, 02:35:54 am
43.03-r1 is still the current version even for 43.05?
No. DFHack releases never support DF versions newer than the ones they're named for. They sometimes support older versions, though (e.g. DFHack 0.43.03-r1 supports DF 0.43.03, 0.43.02, and 0.43.01).


uhh well its working fine so far, df hack of 0.43.03-r1  applied on DF 64 bit windows 0.43.05.  only issue i've been having and its impossible to tell if its default DF or because i've been using fastdwarf obsessively, is that there's a lot of "distracted" dwarves that rapidly need to perform tavern and temple activities.  still happens with normal speed and moving dwarves but i only have about 20 out of 100 dwarves legitimately working (and everyone is maximal happy), thus dorfs still desperately using tavern and temple.

edit: clarified versions.
I can guarantee that you're either not using DF 0.43.05 or not using DFHack 0.43.03-r1. Can you double-check the version that gets logged in the console (or on the title screen)?

From what I remember, dwarves can become distracted if they aren't given break time to perform those tasks normally. That might happen if you're constantly scheduling work for those dwarves, although I'm not really sure there.
Title: Re: DFHack 0.43.03-r1
Post by: soul4hdwn on March 09, 2017, 09:30:14 pm
you're right, i'm using "dfhack v 0.43.05-beta1" as per listed on title screen then "v0.43.05" df per title screen.

about job orders, there's a LACK of things to do and yet the purple (aka important) break messages still occur and i can bring up my stress values if needed, they're all -40,000 or higher except for immigrants... which i will need to cull next map i play as fps plummets after 40 dwarves... yay teleporting dorfs doesn't help :D
Title: Re: DFHack 0.43.03-r1
Post by: Baffler on March 10, 2017, 04:35:58 pm
Is modtools/create-unit fully functional in the 43.05 beta 1 release? I'm able to use it to spawn units that show up on the citizens list and can be assigned labors, but they don't have proper ethics (they have their "he personally values" but not the civ ethics,) any gods, and an English first name. The command I'm using is:

modtools/create-unit -race DWARF -caste MALE -civId \\LOCAL -groupId \\LOCAL -name MOUNTAIN
Title: Re: DFHack 0.43.03-r1
Post by: wuphonsreach on March 12, 2017, 12:34:04 pm
Is stonesense included in dfhack-0.43.05-beta1-Linux-64-gcc-4.8.1?  The rest of DFHack works properly, but when I try and use the "stonesense" command at the DFHack# prompt, I get "stonesense is not a recognized command".

Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 12, 2017, 01:16:57 pm
about job orders, there's a LACK of things to do and yet the purple (aka important) break messages still occur and i can bring up my stress values if needed, they're all -40,000 or higher except for immigrants... which i will need to cull next map i play as fps plummets after 40 dwarves... yay teleporting dorfs doesn't help :D
It probably depends on which dwarves are doing work. This thread (http://www.bay12forums.com/smf/index.php?topic=155793.0) might explain it better. Also, teleporting dwarves doesn't make them do actual jobs faster - it only cuts down on travel time. I suppose that could allow them more time to take care of their needs, but it wouldn't necessarily be enough if they're doing time-consuming jobs.

Is modtools/create-unit fully functional in the 43.05 beta 1 release? I'm able to use it to spawn units that show up on the citizens list and can be assigned labors, but they don't have proper ethics (they have their "he personally values" but not the civ ethics,) any gods, and an English first name. The command I'm using is:

modtools/create-unit -race DWARF -caste MALE -civId \\LOCAL -groupId \\LOCAL -name MOUNTAIN
It hasn't changed since 0.42, as far as I know. It should be functional, but there have always been a few things it doesn't handle. I'm not sure what you mean by an "English first name" - are they missing a nickname? modtools/create-unit has an option for nicknames (see "modtools/create-unit -help"). There's also "spawnunit", which you might find easier for typical usage.

Is stonesense included in dfhack-0.43.05-beta1-Linux-64-gcc-4.8.1?  The rest of DFHack works properly, but when I try and use the "stonesense" command at the DFHack# prompt, I get "stonesense is not a recognized command".
It is not, sorry.
Title: Re: DFHack 0.43.03-r1
Post by: Baffler on March 12, 2017, 09:26:19 pm
Is modtools/create-unit fully functional in the 43.05 beta 1 release? I'm able to use it to spawn units that show up on the citizens list and can be assigned labors, but they don't have proper ethics (they have their "he personally values" but not the civ ethics,) any gods, and an English first name. The command I'm using is:

modtools/create-unit -race DWARF -caste MALE -civId \\LOCAL -groupId \\LOCAL -name MOUNTAIN
It hasn't changed since 0.42, as far as I know. It should be functional, but there have always been a few things it doesn't handle. I'm not sure what you mean by an "English first name" - are they missing a nickname? modtools/create-unit has an option for nicknames (see "modtools/create-unit -help"). There's also "spawnunit", which you might find easier for typical usage.

The name is untranslated. A dwarf I spawn using that line (with -name MOUNTAIN) will be called Castle Mosuskeskal, for instance, instead of Rimtar Mosuskeskal like a regular dwarf would be. The atheism doesn't really matter, but I at least need the ethics. Are there flags for those things I'm just missing, and if so are they documented somewhere?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 12, 2017, 10:14:03 pm
I'm looking into the name issue. I'm not familiar with ethics, but I suspect it's more complicated than setting a flag or two.
Title: Re: DFHack 0.43.03-r1
Post by: Veroule on March 13, 2017, 01:37:32 am
After a bit of searching it seems many people want the option to cancel all migrants but no one ever wrote it. I cobbled together this Lua script that I hope will do it correctly, but I would like some experts to look it over before I give it a try. It might be able to be improved by using onReport, but I could not find any documentation indicating what reportID would relate to a season change. Possibly adding a season change event to DFHack would be a good idea.

Spoiler (click to show/hide)
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on March 13, 2017, 02:13:45 am
Just set the pop cap to zero and you won't get any more migrants. There is no need to write a script for it as it's supported by vanilla DF already. As far as I understand, there was a bug a long time ago that caused it to fail to block the hard coded waves.
Title: Re: DFHack 0.43.03-r1
Post by: UnicodingUnicorn on March 13, 2017, 04:39:48 am
I apologise if this question has been asked before or this is the inappropriate place, but what has become of autosyndrome and its successors, item-trigger and reaction-trigger? I cannot find them anywhere in the new dfhack nor recent mention in the forums.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on March 13, 2017, 12:36:15 pm
I apologise if this question has been asked before or this is the inappropriate place, but what has become of autosyndrome and its successors, item-trigger and reaction-trigger? I cannot find them anywhere in the new dfhack nor recent mention in the forums.

There is an item-trigger and reaction-trigger script in modtools, along with interaction-trigger.
Title: Re: DFHack 0.43.03-r1
Post by: UnicodingUnicorn on March 13, 2017, 08:04:09 pm
There is an item-trigger and reaction-trigger script in modtools, along with interaction-trigger.

Oh dear, how could I have missed that. Thanks!
Title: Re: DFHack 0.43.03-r1
Post by: pikachu17 on March 14, 2017, 09:56:48 am
When I tried to use add-syndrome to remove a syndrome when an item was dropped, the syndrome itself disappeared, but the effects of the syndrome appeared to stay(this was in the arena). How do I get a syndrome to appear on the unit when they pick an item up, and then make the effects of the syndrome disappear when they drop it(preferably with an option for armors to activate when worn, and deactivated when taken off, even if still being held.)?
Title: Re: DFHack 0.43.03-r1
Post by: KillzEmAllGod on March 15, 2017, 07:20:07 pm
Still getting the odd crash when zooming to units.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 15, 2017, 07:54:18 pm
Still getting the odd crash when zooming to units.
Mind linking me to where this was reported before? I don't remember seeing it recently. Have you verified that it doesn't occur without DFHack (assuming it occurs consistently with DFHack)?

Edit: found it:
Getting a crash now and then when going to some units through to unit menu as well as when pressing v to inspect or examining creatures. Mostly seems to happen to creatures on different z levels, think it might be with some of the DFHack options on some of these things.
This is from quite a while ago. I can't think of many DFHack tools that have anything to do with that screen. What DFHack version are you using? Are you using Truetype? TwbT? You could try disabling the search and manipulator plugins, I guess.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 17, 2017, 11:58:41 pm
I got Stonesense "working" on 64-bit OS X today (in the sense that it loads, but it's still about as unstable as it was pre-0.43.05, which I'm afraid there isn't much I can do about). It has exposed a couple missing vtable addresses on 64-bit OS X that we still need to locate, but this is about the last major blocker before a stable release. I'll work on 64-bit Linux support soon, but that shouldn't run into the vtable issue.

Anyway, please be sure to report any issues you run into with 0.43.05-beta1. I'm hoping we can put up a stable release relatively soon.
Title: Re: DFHack 0.43.03-r1
Post by: da_nang on March 18, 2017, 03:07:37 pm
So hey, I was wondering, is there a script that fixes the "hostility" of tamed megabeasts? I glanced over the source code for the loyalty cascade fix and to my limited understanding, it only targets citizens?
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 18, 2017, 07:01:39 pm
alright I had a onload.init command that hooked a reaction to cause a unit to be created through create-unit on 43.03 at the location of the reaction,  the same line on dfhack 43.05 beta 1 places the unit at the 0,0,-25.

Here's the line:

modtools/reaction-trigger -reactionName KILL_CAPTIVE_DWARF -command [ create-unit -race FAKE_SAPIENT -caste MALE_DWARF -location [ \\LOCATION ] -age 20 ]

This line has worked before.  The only thing I can think of is how does the \\ thing work.  I was looking for some sort of documentation on this, but it is by far the hardest thing to search for.

Well I was going to post all of that.... then I remembered the create-unit.lua I was using in 43.03 was inside of raw\scripts\ not hack\scripts\modtools.  Moved it and the old line worked, but I really don't want to put it there.  So what would be the correct call of "location" if create-unit.lua in hack\scripts instead of raw\scripts? or is that the only way to get the location to be accurate to the reaction?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 18, 2017, 07:56:50 pm
Which file did you move where? I'm guessing your old version of create-unit works differently somehow. Where'd you get it from? Can you post it here?
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 18, 2017, 08:36:07 pm
Let me dig it back up.  It starts off similar but looks like its been restructured from an earlier version or the version included in DFHack 43.05 beta 1 was a modified version from the same version.  the move fixed a few problems I was seeing occur.  let me see:

Spoiler (click to show/hide)

this one was causing a Crash-To-Desktop.  While roaming the scripts and searching for keywords I discovered the revised version in the hack\scripts that came with DFHack 43.05  version 0.55 or this one:

Spoiler (click to show/hide)

So basically I kicked the old one out, and went back to testing, since generally it doesn't seem to care where the file is located as long as you have it.  Well first attempt the creature is gone!  No error in the console relating to the creature, so I go seeking the creature and find it literally beneath hell.  last level of z below the bottom z of hell and in the top corner. 0,0,-25 of the particular map I was on.  Which is when I started the above post... which made me think wait, how about move the create-unit.lua (the v 0.55) into the raw\scripts like the old one was and retest.  multiple tests now and every time it pops up right.

If I put it back, the unit shows up at the above mentioned location.  rather odd actually.  I'm not sure why its not wanting to read \\LOCATION, or this was an error to begin with.

Edit:
old version was in raw\scripts ; new version was in hack\scripts ; deleted old version ; new version placed in raw\scripts ; problem solved.

Second Edit: and my reaction hooks for create-unit-friendly need to be edited too... going to move the file like I did for create-unit, unless someone can show me how to rewrite the line...  and here's a nice image for you...
(http://image.prntscr.com/image/188950bb9d714be08ebf0cfc09b2bc43.png)
its confirmed you only get a number when you go to hell... create-unit-friendly tosses dwarfs too....  here's the code line from my onLoad.init

Code: [Select]
modtools/reaction-trigger -reactionName RELEASE_DWARF_MIGRANTS -command [ modtools/create-unit-friendly -race DWARF -caste MALE -civId a -groupId a -location [ \\LOCATION ] -name MOUNTAIN -age 20 ]
Title: Re: DFHack 0.43.03-r1
Post by: Roses on March 19, 2017, 12:51:44 am
I'm trying to get the EXTRA_BUTCHER_OBJECT of a creature from the df.global.world.raws.creatures.all.caste.body_info.extra_butcher_objects, but all that shows up is a list of 13 numbers. Now I'm fairly certain anon_1 is the body part that drops the butcher item. But I can't really figure out how to get the item type/subtype and material type/index.

Code: [Select]
[lua]# world.raws.creatures.all[31].caste[0].body_info.extra_butcher_objects[0]
<caste_body_info.T_extra_butcher_objects: 0x05ee36d0>
anon_1                   = 24
anon_2                   =
anon_3                   = 11
anon_4                   =
anon_5                   =
anon_6                   =
anon_7                   =
anon_8                   =
anon_9                   = 1
anon_10                  = -1
anon_11                  = -1
anon_12                  = -1
anon_13                  = 1
Title: Re: DFHack 0.43.03-r1
Post by: neo1096 on March 19, 2017, 03:00:47 am
So hey, I was wondering, is there a script that fixes the "hostility" of tamed megabeasts? I glanced over the source code for the loyalty cascade fix and to my limited understanding, it only targets citizens?
After my experience with raw modding, I believe the hostility is a function of the [MEGABEAST] token itself being present on the tamed creatures and not actually a bug with unit loyalty. That being said, I would also like a script to fix this if it is possible to make one.
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 19, 2017, 04:03:41 pm
Continuing from my previous conversation.....

Okay so here I am again.  So I moved the New version of create-unit.lua to the raw\scripts folder that had fixed my earlier problem allowing me to run this onLoad.init command with no issues:
Code: [Select]
modtools/reaction-trigger -reactionName KILL_CAPTIVE_DWARF -command [ create-unit -race FAKE_SAPIENT -caste MALE_DWARF -location [ \\LOCATION ] -age 20 -flagSet [ scuttle ] ]
:
And yes a dead dwarf appears at the feet of the one who operates this command, from the reaction... well its a fake dwarf... but it gets the job done of getting dwarf skulls (and other commands for humans, elves, goblins, kobolds, etc skulls and meat for everyone!).

well we had a different script that when reviewed was the new version of create-unit.lua renamed to create-unit-friendly.lua with a few minor changes.... I was shocked at how similar it was, and decided that because I couldn't get it to do anything right(moved it etc like I did with create-unit.lua), I removed it, retried these lines with create-unit...

Code: [Select]
modtools/reaction-trigger -reactionName RELEASE_DWARF_MIGRANTS -command [ create-unit -race DWARF -caste MALE -civId a -groupId a -location [ \\LOCATION ] -name MOUNTAIN -age 20 ]
modtools/reaction-trigger -reactionName RELEASE_DWARF_MIGRANTS -command [ create-unit -race DWARF -caste MALE -civId \\LOCAL -groupId \\LOCAL -location [ \\LOCATION ] -name MOUNTAIN -age 20 ]

The first line is the original line from the original onLoad.init, modified to access create-unit, we got a dwarf, but it was just set to friendly, and not a part of the fort civ/group at all.   It eventually wandered around the tavern then disembarked to who knows where....

The second line is the line written based on the information in the first part of "create-unit.lua" that says to use \\LOCAL to make the created unit a member of the local civ and group.... and well this dwarf did the same as the first one.  It appeared but was set to friendly, not a member of the civ/group, hung out roamed a statue garden then left to points unknown.  so now we have 2 free roaming dwarves just enjoying themselves free from the politics of any civ (and not forced into slave labor in my deep mines)...

The only thing I have to say is I'm glad it pops up in the right location?  but how do I force the dwarf to be a member of the fort?
Title: Re: DFHack 0.43.03-r1
Post by: KillzEmAllGod on March 19, 2017, 07:37:31 pm
Still getting the odd crash when zooming to units.
Mind linking me to where this was reported before? I don't remember seeing it recently. Have you verified that it doesn't occur without DFHack (assuming it occurs consistently with DFHack)?

Edit: found it:
Getting a crash now and then when going to some units through to unit menu as well as when pressing v to inspect or examining creatures. Mostly seems to happen to creatures on different z levels, think it might be with some of the DFHack options on some of these things.
This is from quite a while ago. I can't think of many DFHack tools that have anything to do with that screen. What DFHack version are you using? Are you using Truetype? TwbT? You could try disabling the search and manipulator plugins, I guess.

I was just using the default on the pre release, just seems to happen when I use z: Go to Unit. no idea what the cause could be but that's the thing that I last did when it happens. 64 bit this time last one would have been 32 bit from ages back.

edit: Just to be clear that it doesn't happen what so ever without DFhack. So it might be something on one of the screens that causes it for me or could it be one of the settings in init?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 19, 2017, 08:48:52 pm
What version, precisely, of DFHack are you using? "the pre release" isn't specific enough for me to tell. Something like "0.43.05-alpha3" would be, and that should be displayed on the title screen (and in the DFHack console).

just seems to happen when I use z: Go to Unit
By "seems to", are you saying that it crashes some time later, or that you can't get anything else to cause the crash?
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 19, 2017, 08:55:45 pm
Continuing from my previous conversation.....

Okay so here I am again.  So I moved the New version of create-unit.lua to the raw\scripts folder that had fixed my earlier problem allowing me to run this onLoad.init command with no issues:
Code: [Select]
modtools/reaction-trigger -reactionName KILL_CAPTIVE_DWARF -command [ create-unit -race FAKE_SAPIENT -caste MALE_DWARF -location [ \\LOCATION ] -age 20 -flagSet [ scuttle ] ]
:
And yes a dead dwarf appears at the feet of the one who operates this command, from the reaction... well its a fake dwarf... but it gets the job done of getting dwarf skulls (and other commands for humans, elves, goblins, kobolds, etc skulls and meat for everyone!).

well we had a different script that when reviewed was the new version of create-unit.lua renamed to create-unit-friendly.lua with a few minor changes.... I was shocked at how similar it was, and decided that because I couldn't get it to do anything right(moved it etc like I did with create-unit.lua), I removed it, retried these lines with create-unit...

Code: [Select]
modtools/reaction-trigger -reactionName RELEASE_DWARF_MIGRANTS -command [ create-unit -race DWARF -caste MALE -civId a -groupId a -location [ \\LOCATION ] -name MOUNTAIN -age 20 ]
modtools/reaction-trigger -reactionName RELEASE_DWARF_MIGRANTS -command [ create-unit -race DWARF -caste MALE -civId \\LOCAL -groupId \\LOCAL -location [ \\LOCATION ] -name MOUNTAIN -age 20 ]

The first line is the original line from the original onLoad.init, modified to access create-unit, we got a dwarf, but it was just set to friendly, and not a part of the fort civ/group at all.   It eventually wandered around the tavern then disembarked to who knows where....

The second line is the line written based on the information in the first part of "create-unit.lua" that says to use \\LOCAL to make the created unit a member of the local civ and group.... and well this dwarf did the same as the first one.  It appeared but was set to friendly, not a member of the civ/group, hung out roamed a statue garden then left to points unknown.  so now we have 2 free roaming dwarves just enjoying themselves free from the politics of any civ (and not forced into slave labor in my deep mines)...

The only thing I have to say is I'm glad it pops up in the right location?  but how do I force the dwarf to be a member of the fort?

Okay I have crafted a fix...  After forcing the script to print out info on what it was receiving, I found that it wasn't getting \\LOCAL from the onLoad.init.  it was getting LOCAL instead.  Well no matter what I did to the onload.init, it never got \\LOCAL.... I tried [ \\LOCAL ], "\\LOCAL", '\\LOCAL', \\\LOCAL and \\\\LOCAL and it all went became just LOCAL at the script.  So I rewrote the lines in the script here's the lines I changed:

create-unit.lua:
Code: [Select]
481 if args.civId == 'LOCAL' then
482   civ_id = df.global.ui.civ_id
483 elseif args.civId and tonumber(args.civId) then
484   civ_id = tonumber(args.civId)
485 end
486
487 local group_id
488 if args.groupId == 'LOCAL' then
489   group_id = df.global.ui.group_id
490 elseif args.groupId and tonumber(args.groupId) then
491   group_id = tonumber(args.groupId)
492 end

so that edit, changing the '\\LOCAL' to 'LOCAL' ;
moving the create-unit.lua from hacks\scripts to raw\scripts;
and then changing the onLoad.init line:
modtools/reaction-trigger -reactionName RELEASE_DWARF_MIGRANTS -command [ create-unit -race DWARF -caste MALE -civId LOCAL -groupId LOCAL -location [ \\LOCATION ] -name MOUNTAIN -age 20 ]

gets the effect I want with zero errors. I'm leaving it that way unless someone else comes up with a better fix for it.

for anyone that didn't catch that this was on 43.05 beta 1.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 19, 2017, 09:38:43 pm
Did you try \LOCAL ?

Edit: no, that won't work. However, I have been using \\LOCAL in the console (with modtools/create-unit) for other tests in 0.43.05-beta1, and it has been working consistently. Perhaps you have an older version of the script still. Try replacing your hack/scripts/modtools/create-unit.lua with the original from 0.43.05-beta1, and get rid of the file you have in raw/scripts (e.g. move it somewhere outside of your DF folder if you don't want to delete it). Scripts in raw/scripts always take priority, so a broken script there will override a working script in hack/scripts.

Edit 2: oh, and you should probably be using modtools/create-unit.
Title: Re: DFHack 0.43.03-r1
Post by: wuphonsreach on March 20, 2017, 08:36:03 am
Anyway, please be sure to report any issues you run into with 0.43.05-beta1. I'm hoping we can put up a stable release relatively soon.

Been running beta1 on 64-bit Linux for a week or two now with no issues.  Main things I use are prospect, showmood, cursecheck, autobutcher, seedwatch, zone, and cleanowned.

The only minor bug is that seedwatch does not auto-restart after loading (unlike autobutcher which works fine when loading up a save).
Title: Re: DFHack 0.43.03-r1
Post by: KillzEmAllGod on March 20, 2017, 05:13:58 pm
What version, precisely, of DFHack are you using? "the pre release" isn't specific enough for me to tell. Something like "0.43.05-alpha3" would be, and that should be displayed on the title screen (and in the DFHack console).

By "seems to", are you saying that it crashes some time later, or that you can't get anything else to cause the crash?

DFHack 0.43.05-beta1 though I have had it in the back in 42s ones as well. It's the last thing I do before the crash I get no other crash besides this one.

Started up DFHack and started going to units doesn't seem to be causing it at least not yet so something else must happen somewhere to cause it.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 21, 2017, 12:56:29 pm
The only minor bug is that seedwatch does not auto-restart after loading (unlike autobutcher which works fine when loading up a save).
That's really more of a missing feature - seedwatch has never persisted across save/load cycles.

DFHack 0.43.05-beta1 though I have had it in the back in 42s ones as well. It's the last thing I do before the crash I get no other crash besides this one.

Started up DFHack and started going to units doesn't seem to be causing it at least not yet so something else must happen somewhere to cause it.
0.42, really? This is the first time I've heard of the issue, so I'm fairly surprised. Does it occur with specific units? In a specific save? If so, uploading the save would be helpful.
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 21, 2017, 09:42:03 pm
Okay I've been having an issue with item-trigger.lua

basically repeatedly it spits out the same error over and over that looks like this:
Code: [Select]
...ed\Dwarf Fortress/hack/scripts/modtools/item-trigger.lua:116: attempt to index a nil value
stack traceback:
...ed\Dwarf Fortress/hack/scripts/modtools/item-trigger.lua:116: in global 'getitemType'
...ed\Dwarf Fortress/hack/scripts/modtools/item-trigger.lua:126: in global 'handler'
...ed\Dwarf Fortress/hack/scripts/modtools/item-trigger.lua:166: in global 'equipHandler'
...ed\Dwarf Fortress/hack/scripts/modtools/item-trigger.lua:175: in function <...ed\Dwarf Fortress/hack/scripts/modtools/item-trigger.lua:170>

so I thought maybe I'm having something that isn't built right causing thee error.  I looked at it and looked at and added this to the script trying to detect the error:
Code: [Select]
function getitemType(item)
 print("item: ", item)
 if item:getSubtype() ~= -1 then
  itemType = dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()).id
 else
  itemType = df.item_type[item:getType()]
 end
 return itemType
end
the print ("item: ",item) line is nice it gives me some info... not enough, but it got me looking for an answer. here's what the code looks like in the console when an error hits:

(http://image.prntscr.com/image/22056263c6234473a3fdccb0e8fc4084.png)

so now the issue is... why are plant growths causing this error... I tried a couple other lines trying to get the name of the item and it just errors out on the line... anyone have a clue what the line is I need to get the name to appear, so then I can start checking these "growths" for why they are erroring out?

does anyone else have similar issues with this script?
Title: Re: DFHack 0.43.03-r1
Post by: KillzEmAllGod on March 21, 2017, 10:03:17 pm
0.42, really? This is the first time I've heard of the issue, so I'm fairly surprised. Does it occur with specific units? In a specific save? If so, uploading the save would be helpful.
No idea though doing it at the start of loading a save doesn't seem to cause it so it must require something else to have happened before it. Seems like it would be a pretty painful crash to hunt down.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 22, 2017, 10:09:51 am
Okay I've been having an issue with item-trigger.lua

...

so now the issue is... why are plant growths causing this error... I tried a couple other lines trying to get the name of the item and it just errors out on the line... anyone have a clue what the line is I need to get the name to appear, so then I can start checking these "growths" for why they are erroring out?
Nice catch! My best guess is that it's a DFHack issue, with something not handling plant growths correctly. The error appears to be happening on this line:
Code: [Select]
  itemType = dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()).id
which implies that one of these things is nil.

Try this:
Code: [Select]
function getitemType(item)
 print("item: ", item)
 if item:getSubtype() ~= -1 then
  print(item:getType())
  print(item:getSubtype())
  print(dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()))
  print(dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()).id)
  itemType = dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()).id
 else
  itemType = df.item_type[item:getType()]
 end
 return itemType
end
I suspect that the third call to print under the "if" statement will print nil and the fourth will trigger an error for plant growths (the first two should be okay, since item has to be non-nil for "item:getSubtype()" in the "if" statement to work at all).
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 22, 2017, 10:36:09 am
Okay I've been having an issue with item-trigger.lua

...

so now the issue is... why are plant growths causing this error... I tried a couple other lines trying to get the name of the item and it just errors out on the line... anyone have a clue what the line is I need to get the name to appear, so then I can start checking these "growths" for why they are erroring out?
Nice catch! My best guess is that it's a DFHack issue, with something not handling plant growths correctly. The error appears to be happening on this line:
Code: [Select]
  itemType = dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()).id
which implies that one of these things is nil.

Try this:
Code: [Select]
function getitemType(item)
 print("item: ", item)
 if item:getSubtype() ~= -1 then
  print(item:getType())
  print(item:getSubtype())
  print(dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()))
  print(dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()).id)
  itemType = dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()).id
 else
  itemType = df.item_type[item:getType()]
 end
 return itemType
end
I suspect that the third call to print under the "if" statement will print nil and the fourth will trigger an error for plant growths (the first two should be okay, since item has to be non-nil for "item:getSubtype()" in the "if" statement to work at all).

lol you read my mind.... this is what I coded:
Code: [Select]
function getitemType(item)
 if item:getSubtype() ~= -1 then
  if dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()) then
   itemType = dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()).id
  else
   print("getSubtypeDef has returned nil. type:",item,item:getType(),"subtype:",item:getSubtype())
  end
 else
  itemType = df.item_type[item:getType()]
 end
 return itemType
end

I was still trying to get the item name... but I was at a loss...  its the dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()) that is returning nil for some reason.  here's the image of what it output....
(http://image.prntscr.com/image/c98569a39b54408391961f8f40f63b54.png)

 nice thing was its not a thousand things and pages of errors, I just get this quick nice list right about 200 ticks from when I load the save, but rarely get anything else let it run for most of a season (I wanted to 'die' before a new save occured)... I was about to try and figure out what type 55 is, then slapped myself on the head it has to be plantgrowths lol.... but I saw you had replied, so came back to remark on my progress.    The other error shown there, I was about to write a similar wrap around it and see if I couldn't identify what it was complaining about.  My biggest problem though is that I wish I understood the code well enough to get a name for what was causing the error.  there are many modified raws and I was concerned something had been a bad code.

separate note/issue: was there a change to unit.relations.{xxxxx}? I have one script that uses that and it now constantly spits out that relations is not found.  Think there must of been a change in dfhack to that, too.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on March 22, 2017, 11:03:54 am
Amostubal separate note/issue: If I'm not mistaken, units.relations stuff has been shifted up one level into the units structure itself (try gui/gm-editor on a unit and search for what you're looking for). I think that happened from 0.40.X to 0.42.X.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 22, 2017, 11:10:06 am
Okay, it looks like the issue is a combination of several things:
- Plant growths can have subtypes that aren't -1
- item-trigger assumes that anything with a subtype that isn't -1 has an entry in world.raws.itemdefs
- There isn't anything in world.raws.itemdefs for plant growths (and there doesn't appear to be anything there we haven't identified yet, either)

I think changing the "if" statement to this would work:
Code: [Select]
if item:getSubtype() ~= -1 and dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()) then

separate note/issue: was there a change to unit.relations.{xxxxx}? I have one script that uses that and it now constantly spits out that relations is not found.  Think there must of been a change in dfhack to that, too.
Yes. Most stuff that was in "relations" was moved out into the main "unit" struct - e.g. "unit.relations.pregnancy_timer" is now "unit.pregnancy_timer". This was done because the old layout was wrong, and it had to be fixed to work properly with 64-bit DF.

Ninja edit:
Amostubal separate note/issue: If I'm not mistaken, units.relations stuff has been shifted up one level into the units structure itself (try gui/gm-editor on a unit and search for what you're looking for). I think that happened from 0.40.X to 0.42.X.
0.43.05, not 0.42
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 22, 2017, 12:24:27 pm
Okay, it looks like the issue is a combination of several things:
- Plant growths can have subtypes that aren't -1
- item-trigger assumes that anything with a subtype that isn't -1 has an entry in world.raws.itemdefs
- There isn't anything in world.raws.itemdefs for plant growths (and there doesn't appear to be anything there we haven't identified yet, either)

I think changing the "if" statement to this would work:
Code: [Select]
if item:getSubtype() ~= -1 and dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()) then

separate note/issue: was there a change to unit.relations.{xxxxx}? I have one script that uses that and it now constantly spits out that relations is not found.  Think there must of been a change in dfhack to that, too.
Yes. Most stuff that was in "relations" was moved out into the main "unit" struct - e.g. "unit.relations.pregnancy_timer" is now "unit.pregnancy_timer". This was done because the old layout was wrong, and it had to be fixed to work properly with 64-bit DF.

Ninja edit:
Amostubal separate note/issue: If I'm not mistaken, units.relations stuff has been shifted up one level into the units structure itself (try gui/gm-editor on a unit and search for what you're looking for). I think that happened from 0.40.X to 0.42.X.
0.43.05, not 0.42

Awesome! and I just fixed my other item-trigger issue....

Items used up in reactions with zero skill, are gone before item-trigger.lua can operate on them.  I have an exchanger that is flipping coins from silvers to gold... the last coin in triggers a nil error, as the interaction is instantly complete in the next step and the dropped item is suddenly gone in 1 tick.  any other reaction of such nature would cause the same error. Here's the fix to stop the error from occuring:
Code: [Select]
function equipHandler(unit, item, isEquip)
 local mode = (isEquip and 'onEquip') or (not isEquip and 'onUnequip')

 local table = {}
 table.mode = mode
 table.item = df.item.find(item)
 table.unit = df.unit.find(unit)
 if table.item and table.unit then -- they must both be not nil or errors will occur after this point with instant reactions.
  handler(table)
 end
end
leave it up to me to do something that would cause errors to occur....

relation issue:  how to get lastattacker ID lol.... on-death.lua script from roses.... was going to contact them next on that one.  its under relationship_ids in the gm-editor.  but unit.relationship_id.lastAttacker, unit.relationship_ids.lastAttacker, and unit.lastAttacker all do not work.
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 22, 2017, 12:28:36 pm
the only issue that would remain with that instant reaction causing nil... is that if there is any 'effects' caused by that item that suddenly disappeared.  scriptors will have to watch out about making things that are used up in an instant(no-skill) reaction.  I use them because I don't want coinage with 'quality',lol.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 22, 2017, 12:32:31 pm
relation issue:  how to get lastattacker ID lol.... on-death.lua script from roses.... was going to contact them next on that one.  its under relationship_ids in the gm-editor.  but unit.relationship_id.lastAttacker, unit.relationship_ids.lastAttacker, and unit.lastAttacker all do not work.
unit.relationship_ids.LastAttacker. Case matters.

Edit: unit.relationship_ids[df.unit_relationship_type.LastAttacker] would also work, or, equivalently, unit.relationship_ids[4] (but you really shouldn't ever use the last one). unit.relationship_ids is really just an array, except with names for each index as well (corresponding to df.unit_relationship_type).
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 22, 2017, 12:47:47 pm
relation issue:  how to get lastattacker ID lol.... on-death.lua script from roses.... was going to contact them next on that one.  its under relationship_ids in the gm-editor.  but unit.relationship_id.lastAttacker, unit.relationship_ids.lastAttacker, and unit.lastAttacker all do not work.
unit.relationship_ids.LastAttacker. Case matters.


....... lol..... okay.. I should of kept plugging away... I'd of spotted it, eventually.... good thing too.... there's a opossum on this save that is probably tired of his groundhogs day...

and that good sirs gives me a no red console within 5 mins of game load.... first time in 4 months.  I'll post the line fix to roses page, mark it as a 43.05.  although I bet they already know, they just aren't moving their scripts to the dfhack 43.05 x64 architecture yet.

I owe you Lethosor, you can get an ale on me, if you visit my corner of the world.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 22, 2017, 12:50:44 pm
item-trigger? That's in the DFHack scripts repo, so I'm going to fix it there. I'm not sure if your/Roses' version is different, but the line numbers matched up with DFHack's, and DFHack's hasn't been changed in 9 months.

Ideally, scripts wouldn't require many changes to work under x64. There were a couple structure changes we had to make in 0.43.05, but those apply to x86 as well. Besides that, nearly all scripts don't need to be updated specifically to work with x64.
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 22, 2017, 01:20:30 pm
yeah I had item-trigger.lua from dfhack 43.05 beta 1.  the relations bug was in on-death.lua from roses base folder... there's a lot of relations usage in roses scripts.  I'll post the fix line for that file over there.  I don't think they are moved over to dfhack 43.05 architecture yet.  I'm sure someone out there is scratching their head over there.

So really other then those 2 fixes to item-trigger.lua the only other thing that I had for you, that you may want to fix, is the structures repository for units.xml it still mentions relations as the way to access the unit_relationship_type array. wish I had remembered gm-editor, I would of been done with that problem yesterday, so thanks to PatrickLundell, too!

I appreciate the work everyone does in this community... Its simply amazes me how much of people's free time are devoted to helping each other out here.
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 24, 2017, 02:48:18 pm
Did you try \LOCAL ?

Edit: no, that won't work. However, I have been using \\LOCAL in the console (with modtools/create-unit) for other tests in 0.43.05-beta1, and it has been working consistently. Perhaps you have an older version of the script still. Try replacing your hack/scripts/modtools/create-unit.lua with the original from 0.43.05-beta1, and get rid of the file you have in raw/scripts (e.g. move it somewhere outside of your DF folder if you don't want to delete it). Scripts in raw/scripts always take priority, so a broken script there will override a working script in hack/scripts.

Edit 2: oh, and you should probably be using modtools/create-unit.

Okay Lethosar  I returned to this issue for a few reasons...
1.  I want it to work most efficiently for everyone.
2.  I had another issue pop up, and went hunting for the fix, decided while I was at it that I should try and make it right.
3.  Armed with a good night of sleep, more information on lua and dfhack, I've discovered the problem that neither of us was looking at.

You stated it worked when you entered it in the console with a \\LOCAL like this line...

Code: [Select]
modtools/create-unit -race GOLEM_ORICHALCUM -caste GOLEM -civId \\LOCAL -groupId \\LOCAL -name MOUNTAIN -age 1

the number of times that a backslash is removed from an argument is what we weren't looking at.  I'm using this line:
Code: [Select]
modtools/reaction-trigger -reactionName ORICHALCUM_GOLEM -command [ modtools/create-unit -race GOLEM_ORICHALCUM -caste GOLEM -civId \\LOCAL -groupId \\LOCAL -location [ \\LOCATION ] -name MOUNTAIN -age 1 ]

and all the backslashes are gone long before it gets operated on in create-unit.lua....
first its one time processed when its picked up and placed in the reaction trigger tables, because when reaction-trigger tables expand it to check for \\LOCATION etc, \\LOCAL has already become \LOCAL... so after its processed there in processCommand, it's cut to LOCAL.  so it already is dead, no matter what happens after.

If I turned it into [ \\LOCAL ] around it, again its already [ \LOCAL ] by the time it is being sent to processCommand. at which point it becomes [ LOCAL ], then a run to utils.processArgs from create-unit.lua it becomes a table array, which is another dead end.

so i turned them into \\\LOCAL... well its \\LOCAL when its run through processCommand, its cut to \LOCAL, then the run to utils.processArgs from create-unit.lua, its cut to LOCAL....so its dead.  the final answer is \\\\LOCAL  I couldn't get anything else to work, and I have no clue why it didn't work before, but I bet its my fault.  really there is too many places where \ are removed.  once when the argument is first made from the onLoad.init, second time when its processed by reaction-trigger, and the third time when its processed by create-unit.lua.

basically if you want any series of backslashes that works in the console to work from onLoad.init involving a trigger... you need \\\\  4 of them.  It wouldn't need that many if it didn't go through utils.processArgs 2 times and reaction-trigger.processCommand once.



Now then the reason I actually went back and tackled this... I found an error in teleport.lua:
Code: [Select]
function teleport(unit,pos)
 local unitoccupancy = dfhack.maps.getTileBlock(unit.pos).occupancy[unit.pos.x%16][unit.pos.y%16]
 local newoccupancy = dfhack.maps.getTileBlock(pos).occupancy[pos.x%16][pos.y%16]
 if newoccupancy.unit then
  unit.flags1.on_ground=true
 end
 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

If the unit is created through create-unit.lua, there is an issue where it can fail to teleport the unit afterwards because of the line 18 indexed a nil....
I wrote this fix, but it causes Crash-To-Desktop.... around 50% of the time...

Code: [Select]
function teleport(unit,pos)
 if dfhack.maps.getTileBlock(unit.pos) then
  local unitoccupancy = dfhack.maps.getTileBlock(unit.pos).occupancy[unit.pos.x%16][unit.pos.y%16]
  local newoccupancy = dfhack.maps.getTileBlock(pos).occupancy[pos.x%16][pos.y%16]
  if newoccupancy.unit then
   unit.flags1.on_ground=true
  end
  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

 else   --dfhack.maps.getTileBlock(unit.pos) has failed. they probably came from create-unit.
  print("was unable to getTileBlock for Teleport.  Using an alternative method")
  local newoccupancy = dfhack.maps.getTileBlock(pos).occupancy[pos.x%16][pos.y%16]
  if newoccupancy.unit then
   unit.flags1.on_ground=true
  end
  unit.pos.x = pos.x
  unit.pos.y = pos.y
  unit.pos.z = pos.z
  --we wont need to set previous occupancy, because the unit literally existed outside of time and space, and we do not have access to it.
 end 
end

I'm not sure what I did wrong... BUT... it moves the unit when the dfhack can't getTileBlock.   The reason it can't getTileBlock? the only thing I can think of is that the created unit had appeared beneath hell, 2 floors beneath an eerie pit, at exactly 0,0,0.  It had no map tile beneath it?  I'm not sure.  but since this was the first test world that acted up, out of about 20.... its a rare issue to occur, and the fix will
Title: Re: DFHack 0.43.03-r1
Post by: Roses on March 24, 2017, 05:55:17 pm
You could switch from getTileBlock to ensureTileBlock, not sure if that will fix the problem though.
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on March 24, 2017, 07:46:22 pm
You could switch from getTileBlock to ensureTileBlock, not sure if that will fix the problem though.
nah same problem.... I'm not sure what the rest of the script is for other than repairing occupancy of the 2 blocks that its transfering between.  The interesting thing, is that I have an operating save, where the above reaction is being tested.... basically load and the reaction completes a few seconds later.  every other attempt it crashes with the above script, a flat out wipe clean and gone crash, nothing left.... I hate those, nothing in the errorlog or the stderr
Title: Re: DFHack 0.43.03-r1
Post by: Rose on March 26, 2017, 01:55:58 pm
Is there any possibility of upgrading the protobuf version were using?

Protobuf 3 is backwards compatible, and supports compiling for more languages than just c++.

There's two ways we could go about it. One would be to compile the new version with DF, otherwise just keep the binaries for each platform we build for, and link against that.
Tge second one would be far easier, I think.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 26, 2017, 09:46:45 pm
I'd be fine with protobuf 3. I'm not sure if anything relies on protobuf 2.x that would break with 3.x. One thing to note, though, is that the reason we use libprotobuf-lite currently is because libprotobuf has some sort of global registry of protobufs (according to angavrilov/ag) that would cause crashes when reloading plugins that use them. I'm not sure how the situation would change with protobuf 3, but I'd be fine with trying it out.

I'd rather avoid distributing protobuf 2 binaries if we're moving to protobuf 3, though.
Title: Re: DFHack 0.43.03-r1
Post by: ragundo on March 27, 2017, 08:50:00 am
I use all the time protobuf3 with dfhack. They are binary compatible.

You just need to add the syntax attribute to your .proto file and ready.

Here is df::coord in proto3


syntax = "proto2";
option optimize_for = LITE_RUNTIME;

message DF_coord
{
   required int32 x = 1;
   required int32 y = 2;
   required int32 z = 3;
}


Switching to proto3 would be all advantages:


Title: Re: DFHack 0.43.03-r1
Post by: Warmist on March 27, 2017, 10:13:32 am
  • Google support, etc

heh
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 27, 2017, 10:50:59 am
Yeah, the version we're using is pretty ancient. We did add in CMake support, though, so that wouldn't be new in protobuf 3.

Is it difficult to move existing .proto files over to protobuf 3? There really aren't that many (well, except for ragundo's "export everything" plugin).

I'd really rather distribute protobuf 3 libraries in case anyone does want to use protobuf 3 features, although it's good to know that they're binary-compatible. Is there an advantage to not compiling protobuf 3 along with DFHack, like we currently do with protobuf 2?
Title: Re: DFHack 0.43.03-r1
Post by: ragundo on March 27, 2017, 11:35:43 am
There are only 6 proto files in DFHack


The changes needed are adding the line
syntax = "proto2";
to each file.

In my Linux box I need to compile the plugin proto files using DFHack's protoc because if not, the files are not compatible with system protocol buffers 3 protoc compiler.
Also, you need to link with DFHack's protobuf library instead of the system one for plugins, not client code.

Anyway, my export df structures plugin is not intendend to be included in DFHack's source code at all!!!. I'll distribute it in binary form (but source code available), because it takes more time to compile than the whole DFHack  ;).
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on March 27, 2017, 11:56:18 am
The changes needed are adding the line
syntax = "proto2";
to each file.
I meant to ask what would be required without using that line (i.e. are there changes to the protobuf syntax that would require changing the body of those files?).
Title: Re: DFHack 0.43.03-r1
Post by: Rose on March 27, 2017, 11:59:24 am
remove the optional and required keywords, make sure the first listed item in any enum is 0, and put syntax = "proto3"; on top
Title: Re: DFHack 0.43.03-r1
Post by: Roses on March 30, 2017, 02:47:22 am
Question, will the onJobCompleted eventful event trigger when a tree is chopped down or a plant is harvested? I am thinking about adding a script that lets you "research" better farming techniques, thus increasing your yield.

EDIT: Or a tile is mined? Basically if I can detect whenever one of these things happen you could limit certain yields, and be able to research better "techniques" which would increase yield.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on April 01, 2017, 03:58:13 am
Question, will the onJobCompleted eventful event trigger when a tree is chopped down or a plant is harvested? I am thinking about adding a script that lets you "research" better farming techniques, thus increasing your yield.

EDIT: Or a tile is mined? Basically if I can detect whenever one of these things happen you could limit certain yields, and be able to research better "techniques" which would increase yield.
AFAIK tile mined worked okay. That is the way the auto-expanding burrows worked before.
Title: Re: DFHack 0.43.03-r1
Post by: Snafu on April 02, 2017, 07:00:21 pm
Is there a way to get autochop to prioritize mature trees or deprioritise immature ones)? Also, if I have AC enabled my chopping idiots will randomly chop trees (rather than the ones I've prioritised cos they're getting in the way of my buildings), & I don't seem to be able to cancel the global designation other than manually (disable autochop doesn't cancel the designation); is there a way around this?
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on April 05, 2017, 09:48:16 am
Scheduled meetings get screwed up when office holders are replaced (current DF bug). Is it known where the queue(s) holding the waiting petitioners/anger venters/diplomats is stored? It would be good to be able to reset the queue without slaughtering anyone suspected of stalling it (as reinstating the former office holder can be tricky after unfortunate accidents).

Another DF bug is where visitors somehow lose contact with what they're doing and just stays without doing anything ("no job"). In other cases they continue to socialize long after their clothes have degraded and fallen off their bodies. I'd guess there is some kind of timer that decides when it's time to stop the visit. Is it known where such a timer is located? It would be good to have a non violent way of telling the over stayers to get lost (the former kind can be told to head for the forest, but that's probably not the way they're supposed to leave, and so may have unwanted side effects. The second kind will only leave if they're blocked from socializing by the removal of the tavern).

Edit: Another pair of questions (not bug related): Where does DF store info of whether a biome will have an aquifer and at which depth it will appear at?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on April 06, 2017, 11:43:41 pm
So how far away is an official release for 0.43.05? I'm just wondering because I am still writing all of my scripts for 42.06 and would like to upgrade them all, but 43.03 to 43.05 has that unit.relationship structure change. Don't want to break everything for the official DFHack release.

EDIT: Did I brake the DFHack thread? No posts in a week! Well since mine is still the last I will put my new questions on to this one,

I am looking into total conversions and replacing built in things with custom scripts. The four big ones I can think of are
1. Smelting
2. Web Gather
3. Sand Gather
4. Butcher

Now I know milo has a working smelting script, and my butcher script does the job well enough. But does anyone know if there is a replacement for web and sand gathering?

EDIT2: Not sure how I forgot about it, but also, pretty much everything in the Farmer's Workshop (milking for example). I know I could probably make a script that targets a milkable creature, resets it's milkable counter, and then creates milk, but it would be so much easier if it could be possible to just be able to start a "Milk Creature" job without the need for the workshop.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on April 14, 2017, 03:09:10 pm
I was planning on putting up a second beta release a couple weeks ago. Unfortunately, I wound up being too busy to do it then, and then got sick, so that's been delayed for a while. I might be able to put one up this weekend, but if not, one is likely next weekend. I haven't gotten many reports of problems with 0.43.05-beta1, which is either a good thing or a sign that nobody's using it (at this point I'd like to assume it's actually stable, though). The main reason I want to put out another beta release is for Stonesense, so expect a stable release to follow that pretty quickly.

Well since mine is still the last I will put my new questions on to this one,
When you do that, this thread doesn't show up under "Updated topics" for anyone who's replied, which makes it less likely for people to notice that you've asked more questions.

I'm not at all familiar with those scripts myself, but what exactly about sand gathering are you looking to "replace"? Are you talking about reimplementing sand gathering, supporting additional materials, removing it entirely, or something else? (Same for the farmer's workshop jobs, etc.)
Title: Re: DFHack 0.43.03-r1
Post by: Roses on April 14, 2017, 08:51:47 pm
Well currently all of those functions are only available in hard coded buildings. I was hoping to make it possible to create custom buildings with those jobs
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on April 15, 2017, 02:38:14 am
Well currently all of those functions are only available in hard coded buildings. I was hoping to make it possible to create custom buildings with those jobs
Try adding sand collecting job to other buildings. Do the dwarves figure out how to do it? if so you just need to auto-add job.
If you want something more... different (like building which auto-fills bags with sand when it has power) you'll need to do it manually.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on April 15, 2017, 11:32:33 am
Well currently all of those functions are only available in hard coded buildings. I was hoping to make it possible to create custom buildings with those jobs
Try adding sand collecting job to other buildings. Do the dwarves figure out how to do it? if so you just need to auto-add job.
If you want something more... different (like building which auto-fills bags with sand when it has power) you'll need to do it manually.

How do I add the sand collecting job to other buildings?
Title: Re: DFHack 0.43.03-r1
Post by: Imic on April 17, 2017, 02:23:37 am
Mine doesn't open. Well, it does, but it immediately closes. Help?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on April 17, 2017, 01:13:07 pm
Mine doesn't open. Well, it does, but it immediately closes. Help?

Sounds like you might have a mismatch between DF version and DFHack version

Well currently all of those functions are only available in hard coded buildings. I was hoping to make it possible to create custom buildings with those jobs
Try adding sand collecting job to other buildings. Do the dwarves figure out how to do it? if so you just need to auto-add job.
If you want something more... different (like building which auto-fills bags with sand when it has power) you'll need to do it manually.

How do I add the sand collecting job to other buildings?

Can jobs be created from nothing with dfhack.job.linkIntoWorld(job,new_id)? When it talks about jobs is that just reactions, just "tasks" (e.g. Gather Sand, Milk Creature, Tame Animal, etc...), or both?

I'm guessing the eventful.addReactionToShop won't work for adding "tasks" to buildings since they don't have a reaction ID. Is there a similar function for adding "tasks"?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on April 17, 2017, 05:05:31 pm
Mine doesn't open. Well, it does, but it immediately closes. Help?

Sounds like you might have a mismatch between DF version and DFHack version
That should display a dialog and just deactivate DFHack (keeping DF open) - if it's not doing that when the DF/DFHack versions aren't compatible, that's another issue.

It could be due to a mismatch between architectures, though - e.g. using 32-bit DFHack with 64-bit DF or vice versa.
Title: Re: DFHack 0.43.03-r1
Post by: Warmist on April 18, 2017, 01:03:47 am
Can jobs be created from nothing with dfhack.job.linkIntoWorld(job,new_id)? When it talks about jobs is that just reactions, just "tasks" (e.g. Gather Sand, Milk Creature, Tame Animal, etc...), or both?

I'm guessing the eventful.addReactionToShop won't work for adding "tasks" to buildings since they don't have a reaction ID. Is there a similar function for adding "tasks"?

Yes jobs can be created from nothing. DF even assigns workers for some works. You might need to add it to job postings (or how it's called).

Yes task are a bit special. For one thing it needs other references which are not set by reaction framework. E.g. Tame Animal needs an animal target, which you could set manually. Imho you could add fake reactions that when triggered create the correct job. However each special task has it's own arcane invocation setup. That is basically why i'm procrastinating with advfort development (and the fact that it's a maze of code).
Title: Re: DFHack 0.43.03-r1
Post by: Roses on April 18, 2017, 10:48:01 am
Can jobs be created from nothing with dfhack.job.linkIntoWorld(job,new_id)? When it talks about jobs is that just reactions, just "tasks" (e.g. Gather Sand, Milk Creature, Tame Animal, etc...), or both?

I'm guessing the eventful.addReactionToShop won't work for adding "tasks" to buildings since they don't have a reaction ID. Is there a similar function for adding "tasks"?

Yes jobs can be created from nothing. DF even assigns workers for some works. You might need to add it to job postings (or how it's called).

Yes task are a bit special. For one thing it needs other references which are not set by reaction framework. E.g. Tame Animal needs an animal target, which you could set manually. Imho you could add fake reactions that when triggered create the correct job. However each special task has it's own arcane invocation setup. That is basically why i'm procrastinating with advfort development (and the fact that it's a maze of code).

Interesting. I will definitely have to take a look at assigning tasks through reaction-trigger. If I could figure that all out then you could get rid of all vanilla buildings and have a total conversion.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on April 18, 2017, 11:21:09 am
There appear to be issues with autochop not creating jobs correctly (described in this thread (http://www.bay12forums.com/smf/index.php?topic=163778.0) and on GitHub (https://github.com/DFHack/dfhack/issues/1076)). I hope to get those fixed by r1, although I do still plan on putting up a beta2 release soon (for Stonesense and a couple other things), and I can't guarantee autochop will be fixed for that.
Title: Re: DFHack 0.43.03-r1
Post by: Snafu on April 18, 2017, 08:04:59 pm
See also http://www.bay12forums.com/smf/index.php?topic=139553.msg7411188#msg7411188 above..
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on April 18, 2017, 08:36:50 pm
See also http://www.bay12forums.com/smf/index.php?topic=139553.msg7411188#msg7411188 above..
Sorry, I didn't reply to that because I'm really not familiar with autochop. I'm guessing the issues with designations and jobs targeting the wrong trees are related to the job creation issues, at least to an extent.

Does autochop currently have a feature to prioritize trees? I'm not seeing one on my end. Do you mean you designated some trees manually? That might not work because a lot of DFHack-created designations don't have priorities set properly, and can take precedence over DF-created ones.
Title: Re: DFHack 0.43.03-r1
Post by: Snafu on April 19, 2017, 06:57:46 pm
Does autochop currently have a feature to prioritize trees? [..] Do you mean you designated some trees manually?
Prioritising (mature) trees is a suggestion for a fix; AFAIK it's not currently implemented at all. However, prioritising manually selected trees over autochop's designation is a much-desired feature :)

While autochop was active I manually designated some trees (top (lvl 1) priority) to have them cleared ASAP, but nothing happened, even after a year or so :( My 10 idiot woodcutters still continued to chop saplings etc until I eventually turned off autochop & deselected the entire 5 z-lvls manually (turning off autochip didn't work just by itself), then reselected the priority trees
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on April 21, 2017, 10:32:35 am
Hey lethosor or anyone else knows...
Whats the status of makeown and tweak, are they all the way out?  They still show up in the DFHack readthedocs...
http://dfhack.readthedocs.io/en/stable/docs/Plugins.html?highlight=makeown

The reason I'm asking is we were having issues with a few commands trying to convert an invader into a citizen.

apparently our previous script was using makeown but it apparently hasn't been updated in quite some time, and now we came across 2 lines that are giving us issues that we really aren't sure what they did to begin with.

makeown.lua:151: Cannot write field historical_figure.anon_1: not found.

we removed the .relations from these 2 lines, since relations is gone... what were anon_1, anon_2, anon_3 discovered to be looking at? or what are they trying to reference.
        hf.anon_1 = unit.anon_2
        hf.anon_2 = unit.anon_3


....
if its not a script that's going to get fixed and re-released, does anyone else have a method to accomplish what makeown did, convert a unit to a citizen of the fort?

Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on April 21, 2017, 12:19:14 pm
Interesting. I will definitely have to take a look at assigning tasks through reaction-trigger. If I could figure that all out then you could get rid of all vanilla buildings and have a total conversion.

My Underhive Settlement reboot removes all vanilla workshops. Well, all except the butcher shop, as the slaughter job will not work at any other workshop (but milking will, go figure).

To do hardcoded jobs that cannot be replaced with reactions I hack a button for that job into the workshop sidebar. Triggering the job from a reaction will probably work better though...
Title: Re: DFHack 0.43.03-r1
Post by: Roses on April 21, 2017, 03:55:31 pm
Interesting. I will definitely have to take a look at assigning tasks through reaction-trigger. If I could figure that all out then you could get rid of all vanilla buildings and have a total conversion.

My Underhive Settlement reboot removes all vanilla workshops. Well, all except the butcher shop, as the slaughter job will not work at any other workshop (but milking will, go figure).

To do hardcoded jobs that cannot be replaced with reactions I hack a button for that job into the workshop sidebar. Triggering the job from a reaction will probably work better though...

Hmm, I didn't even think about just putting the button into a different workshop sidebar. I think I am going to try to get the reaction trigger method working, it might even give more options that are script customizable for each job.
Title: Re: DFHack 0.43.03-r1
Post by: milo christiansen on April 21, 2017, 04:07:17 pm
The problem with hardcoded jobs in custom workshops is that jobs the normally queue automatically don't. Also when hacking in buttons you can't queue jobs with the manager...

Using reaction-trigger should solve the manager issues, so that is one major point in its favor.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on April 21, 2017, 08:25:13 pm
Hey lethosor or anyone else knows...
Whats the status of makeown and tweak, are they all the way out?  They still show up in the DFHack readthedocs...
http://dfhack.readthedocs.io/en/stable/docs/Plugins.html?highlight=makeown

The reason I'm asking is we were having issues with a few commands trying to convert an invader into a citizen.

apparently our previous script was using makeown but it apparently hasn't been updated in quite some time, and now we came across 2 lines that are giving us issues that we really aren't sure what they did to begin with.

makeown.lua:151: Cannot write field historical_figure.anon_1: not found.

we removed the .relations from these 2 lines, since relations is gone... what were anon_1, anon_2, anon_3 discovered to be looking at? or what are they trying to reference.
        hf.anon_1 = unit.anon_2
        hf.anon_2 = unit.anon_3


....
if its not a script that's going to get fixed and re-released, does anyone else have a method to accomplish what makeown did, convert a unit to a citizen of the fort?
A couple things: "tweak" is a plugin, and "tweak makeown" is a subcommand of that plugin that does what you expect (ideally). There's also a "makeown.lua" file in hack/lua that other scripts can use more easily, which I just found out about thanks to you. "tweak" also has a lot of other unrelated subcommands.

Just because it's broken doesn't mean we plan to remove it - this is the first time I've heard about this file being an issue. It's usually better to report these sorts of things on GitHub (https://github.com/DFHack/dfhack/issues), because they can get buried here.

Anyway, the issue is almost certainly that "anon_1" and "anon_2" got renamed (well, named, since "anon_x" fields are placeholders for fields with no names). We strongly discourage using those without giving them proper names (in df-structures), but that file must have slipped through the cracks, presumably because it's old and in hack/lua instead of hack/scripts. I'll check on what the fields are named now.


Edit: try changing them to "birth_year_bias" and "birth_time_bias" respectively (keeping whatever relations-related changes you've made). If that works, could you make a pull request or post the fixed file?
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on April 21, 2017, 09:08:52 pm
sure I can post that lethosor.... I'm hacking it fast as I can trying to come up with something that works....

Here's our issue it seems there is a lot of stuff in there not working... I'm banging my head against it like a good little dwarf...
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on April 23, 2017, 08:47:59 pm
Here's a new beta release: https://github.com/DFHack/dfhack/releases/tag/0.43.05-beta2. Still waiting on Windows for now, but this adds 64-bit Stonesense support on OS X and Linux (which was already available on Windows), so I didn't want to delay this further.

Apologies for the long wait. I wanted to get this out for people to make sure 64-bit Stonesense worked a while ago, but didn't have time.

Hopefully a stable release will happen soon. There are just a couple issues left, particularly with autochop.

Amostubal: let me know how you fixed that file (if it works) so that the changes can be included.
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on April 24, 2017, 12:21:03 am
actually I just stopped trying on makeown... the issue I was facing wasn't going to be fixed by it... I went back to the other route, fixed create-unit issues.... the only thing I want more from create-unit is a way to actually designate a 'name' of another unit when calling it from another script... not sure how that would be accomplished...

the fixes I made to create-unit included:
1.  utilized arguments to get the location information to the createunit function so that it could properly place the cursor, over teleporting the unit from hell...  gets around the rare, but frustrating mapdata fail at 0,0,last z that I had a few weeks past.
2.  added an argument to setUnitToFort to clean up the verbose of other scripts that try to call it, left in the old \\LOCAL stuff to keep from breaking old scripts.
3.  fixed a bug in the part of the age script that would fail if the historical_figure went over ~32,000 switched it to the proper call to find the historical_figure instead of trying to index it.


Now if I can get past the bugs that crept into another script, masterwork/succubus related....
anyone have a good script that will kill a unit that is in an actual cage?  I've tried several unit.flags including scuttle, which is my favorite... I just love finding dead bodies... but the unit just stays in the box...  I've got a script that teleports the unit out of the box... but it leaves a funky remnant of a unit behind.
 
nvm... apparently the teleport script I have followed by a scuttle does the job, the remnants in the cages disappear when their teleported versions die.  Its a beautiful work too... created new unit based off information of the old unit, new unit set to civ/group, created on top of the old unit's cage, the old unit teleports out of the cage and insta dies... the new unit has a nice bit of terror and horror the first few minutes, sits there for half a month till it get hungry or thirsty enough or someone else with more discipline comes and gets the body.  I giggled halfed the night about it...
Title: Re: DFHack 0.43.03-r1
Post by: surazal on April 24, 2017, 09:24:55 am
Here's a new beta release: https://github.com/DFHack/dfhack/releases/tag/0.43.05-beta2. Still waiting on Windows for now, but this adds 64-bit Stonesense support on OS X and Linux (which was already available on Windows), so I didn't want to delay this further.

I logged on to my account on this site for the first time in months just to be able to say: Squeeeee! :D
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on April 24, 2017, 08:43:49 pm
Windows builds are up now, thanks to ab9rf: https://github.com/DFHack/dfhack/releases/tag/0.43.05-beta2
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on April 26, 2017, 12:02:07 am
Has there been any work done into figuring out how to adjust the combat wear feature?

Haven't actually played since it was added, but from what I've gathered it's over-zealous. Especially considering there's no way to repair masterworks or named items. Really worried about candy, as well.
Title: Re: DFHack 0.43.03-r1
Post by: Max™ on April 26, 2017, 05:43:53 am
It's difficult to damage candy, toggling the artifact_mood and artifact flags prevents item damage too.
Title: Re: DFHack 0.43.03-r1
Post by: creidieki on April 26, 2017, 01:19:32 pm
Hi, I really appreciate dfhack, I'm still learning to use it somewhat. I wanted to mention that I've been playing with gui/gm-editor and I'm pretty sure that in activity_event_performancest, the fields "anon_9" through "anon_11" hold the position of the dwarf performing. I hope that's helpful. Thanks!
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on April 26, 2017, 04:51:04 pm
Thanks! Looks like anon_7 and anon_8 are duplicates of the x and y coordinates, at least for the event I'm looking at.

Edit: the 10 fields after that are all -30000 for me, which is usually a sign that they're coordinates (that's what Toady uses for invalid coordinates). I'm not sure which ones are 2D and which are 3D, but I'm going to give them slightly better temporary names. If you do figure those out too, let me know.

Also, it's usually better to report that sort of thing at https://github.com/dfhack/df-structures so that it doesn't get buried (which happens sometimes on the forums).
Title: Re: DFHack 0.43.03-r1
Post by: rostbot on April 27, 2017, 01:26:05 pm
Here's a new beta release: https://github.com/DFHack/dfhack/releases/tag/0.43.05-beta2. Still waiting on Windows for now, but this adds 64-bit Stonesense support on OS X and Linux (which was already available on Windows), so I didn't want to delay this further.

I logged on to my account on this site for the first time in months just to be able to say: Squeeeee! :D
I created a forum account to be able express my excitement. Thank you, lethosor!
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on April 27, 2017, 06:19:49 pm
just thought of this now, is it possible to Copy the entire world data of another save and paste it into another world?
like take some old gen world and port it over to an Arena save? or is this working into Save corruption territory?
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on April 28, 2017, 03:42:53 am
just thought of this now, is it possible to Copy the entire world data of another save and paste it into another world?
like take some old gen world and port it over to an Arena save? or is this working into Save corruption territory?
I'm afraid I fail to understand exactly what you're trying to achieve, so the answer is hit-and-miss:
- You can copy your save, retire, and start in another mode, then revert to the original save, but I guess that's not what you want.
- Transplanting the history etc. from one geography to another would result in a mess, since some settlements would end up in the ocean, for instance. While it should be possible in principle by shifting settlements around, it would be very hard to do in practice.
- Keeping the geography and replacing it with a different history is easy: just keep the main seed and let DF randomize the other ones when generating a new world.
- Transplanting a fortress would likewise be a mess. The "easy" part would be to copy the site, but you'd also have to stitch the civ in, and its sites, and relation to other civs would have to be adjusted, etc. Likewise, the inhabitants would have to be adjusted, so Urist McTraderLover could not be friends with 15 traders from civs that only existed in the original world, etc. You also have regions, geo-regions, etc. to take into consideration, as well as instruments, dance forms, and so on that don't exist in the new world.
However, I suspect you're after something completely different...
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on April 28, 2017, 06:29:25 pm
just thought of this now, is it possible to Copy the entire world data of another save and paste it into another world?
like take some old gen world and port it over to an Arena save? or is this working into Save corruption territory?
I'm afraid I fail to understand exactly what you're trying to achieve, so the answer is hit-and-miss:
- You can copy your save, retire, and start in another mode, then revert to the original save, but I guess that's not what you want.
- Transplanting the history etc. from one geography to another would result in a mess, since some settlements would end up in the ocean, for instance. While it should be possible in principle by shifting settlements around, it would be very hard to do in practice.
- Keeping the geography and replacing it with a different history is easy: just keep the main seed and let DF randomize the other ones when generating a new world.
- Transplanting a fortress would likewise be a mess. The "easy" part would be to copy the site, but you'd also have to stitch the civ in, and its sites, and relation to other civs would have to be adjusted, etc. Likewise, the inhabitants would have to be adjusted, so Urist McTraderLover could not be friends with 15 traders from civs that only existed in the original world, etc. You also have regions, geo-regions, etc. to take into consideration, as well as instruments, dance forms, and so on that don't exist in the new world.
However, I suspect you're after something completely different...
well it's more taking the small Arena world map swapping it with a different world map.
porting  over history, civs, and all the other stuff is Accidental if works.
moving an entire Fort over to an arena mode world seem like Nuts and probably to advance for my skill.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on April 29, 2017, 03:30:01 am
I think I now understand what you're after, but I'm afraid I don't know anything about arena mode...
Looking at it just now for the first time, it looks like a single world tile world with a single "embark".
It might be possible to write something that exported an embark and then imported it into arena mode, replacing what's there, but it might be easier to make an editor that allowed you to modify the arena, export it, and import it. It might very well be that arena mode already contains the editor (as I said, I have no experience with it). If you have a working export/import function it ought to be possible export the corresponding stuff from a normal embark, though. It might be possible to do the same with adventure mode, but I haven't got any experience with that mode either.
All speculation, and no actual knowledge.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on May 01, 2017, 01:58:52 pm
Is it possible to run a script and suppress or redirect it's normal output?

For example, say I have a script 'attribute-change' that when run without a -unit declared will print a statement "No unit declared". In normal use I want that to be printed, but when running in "debug" mode I either don't want that statement printed, or I would like to send that statement to an external file. I know I could put a flag in the 'attribute-change' script, but I was wondering if there was another way.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 01, 2017, 02:16:41 pm
You can use dfhack.run_command_silent(), although that would probably require writing another script to actually send the output to another file.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on May 01, 2017, 02:58:45 pm
You can use dfhack.run_command_silent(), although that would probably require writing another script to actually send the output to another file.

Thanks! Silent running is better than nothing, if I really feel the ouput is necessary to properly debug I will write another script for that.

EDIT: Will running in silent mode also suppress error messages or will those still be listed?
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 01, 2017, 03:42:18 pm
All output is returned from that function instead of being printed, including errors. It's returned as a table, I think, which includes the color of each piece of text, so you could identify errors that way if you wanted.
Title: Re: DFHack 0.43.03-r1
Post by: Roses on May 01, 2017, 03:53:26 pm
All output is returned from that function instead of being printed, including errors. It's returned as a table, I think, which includes the color of each piece of text, so you could identify errors that way if you wanted.

Ah, perfect!
Title: Re: DFHack 0.43.03-r1
Post by: Bumber on May 03, 2017, 12:05:47 am
It's difficult to damage candy, toggling the artifact_mood and artifact flags prevents item damage too.
Was more thinking of some way to slow it way down.
Title: Re: DFHack 0.43.03-r1
Post by: Rusty Shackleford on May 04, 2017, 10:32:41 am
Not sure where to ask but is there an 'embark anywhere' utility with dfhack?
Title: Re: DFHack 0.43.03-r1
Post by: Roses on May 04, 2017, 12:28:44 pm
Three questions:

1. Is there an easy way to center the game screen on a given position? I seem to remember there was a function already built in, but I can't seem to find it.

2. Is there a builtin pop up box? What I mean is, I am altering one of my guis to allow changing of classes, but I want there to be a warning, something like "Are you sure you want to change class, Press Enter for Yes, Press Esc for No". I know I can use the same method I use for the gui (i.e. make a widget.Panel and add the options in there) but I was just wondering if there was already a pre-constructed option.

3. Does anyone have a working script that fully constructs a building? I remember making a rough one awhile back (to test the feasibility of multi-story buildings) but I seem to have lost that code. I know it is possible using the dfhack.buildings functions and then altering the construction stage, thought I would check if anyone has something already working before I re-do that work.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 04, 2017, 12:51:29 pm
Not sure where to ask but is there an 'embark anywhere' utility with dfhack?
"embark-tools anywhere". This is a good place to ask.

Three questions:

1. Is there an easy way to center the game screen on a given position? I seem to remember there was a function already built in, but I can't seem to find it.
There's Gui::revealInDwarfmodeMap() in C++. That doesn't seem to be exported to Lua, and I can't find a good equivalent. There's the Viewport class in the "gui.dwarfmode" module, but it looks like that requires more setup to use (I couldn't figure it out by playing around with it, but there are probably examples - maybe gui/liquids?). Anyway, I should have that available to Lua in r1.

Quote
2. Is there a builtin pop up box? What I mean is, I am altering one of my guis to allow changing of classes, but I want there to be a warning, something like "Are you sure you want to change class, Press Enter for Yes, Press Esc for No". I know I can use the same method I use for the gui (i.e. make a widget.Panel and add the options in there) but I was just wondering if there was already a pre-constructed option.
Take a look at the "gui.dialogs" module (specifically showYesNoPrompt()).

Quote
3. Does anyone have a working script that fully constructs a building? I remember making a rough one awhile back (to test the feasibility of multi-story buildings) but I seem to have lost that code. I know it is possible using the dfhack.buildings functions and then altering the construction stage, thought I would check if anyone has something already working before I re-do that work.
I haven't seen anything like this before, sorry. If you do come up with something that works, or find your original code, it would be nice to share that in case others find it useful.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 04, 2017, 09:20:47 pm
In case the handful of people who have reported autochop being totally broken didn't see my responses on GitHub (or if anyone else is curious): we've finally identified and fixed the issues with autochop creating and removing tree-cutting jobs, which probably dated back to 0.40.20 (the job priorities release). Issues such as dwarves standing by felled trees trying to cut them down a second time should be resolved now, as well as ones where autochop wouldn't actually stop trees from being cut down when requested.

I'm working on similar fixes for getplants now, but that was about the last major issue we had left to resolve before a stable release. If anyone wants to try out the autochop fixes, they're currently on the develop branch (https://github.com/dfhack/dfhack/tree/develop).
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 05, 2017, 07:33:00 am
I need a bit of help here, this is driving me nuts after two hrs of trying to figure it out. The Workflow Status GUI is accessible through selecting a workshop, then Alt-w and then Shift-S. How can I set a key bind like Alt-w or some other so I can get the Workflow Status GUI straight up from game or from z-stock menu? Please help me out and let me know what to do. I am using the 43.03 Peridexis Newb Pack.

And thank you guys for working on DFHack!
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on May 05, 2017, 07:54:15 am
In case the handful of people who have reported autochop being totally broken didn't see my responses on GitHub (or if anyone else is curious): we've finally identified and fixed the issues with autochop creating and removing tree-cutting jobs, which probably dated back to 0.40.20 (the job priorities release). Issues such as dwarves standing by felled trees trying to cut them down a second time should be resolved now, as well as ones where autochop wouldn't actually stop trees from being cut down when requested.

I'm working on similar fixes for getplants now, but that was about the last major issue we had left to resolve before a stable release. If anyone wants to try out the autochop fixes, they're currently on the develop branch (https://github.com/dfhack/dfhack/tree/develop).

good job lethosor, maybe in the future edition, I'll use autochop again!

oh and lethosor I did some more testing and made a few more fixes to create-unit.lua that I didn't notice originally, primarily, a couple of errors to the function calls and a fix to get rid of the "dog -123456789" weird naming errors (basically instead of just setting them to having no name, you have to blank the first name also).   I've got to test it versus one more script of Boltgun's (which helped me discover the other errors) this morning, and if everything seems to be in order, I'll upload it to github today. 



I need a bit of help here, this is driving me nuts after two hrs of trying to figure it out. The Workflow Status GUI is accessible through selecting a workshop, then Alt-w and then Shift-S. How can I set a key bind like Alt-w or some other so I can get the Workflow Status GUI straight up from game or from z-stock menu? Please help me out and let me know what to do. I am using the 43.03 Peridexis Newb Pack.

And thank you guys for working on DFHack!

in dfhack.init,

the line should be:
keybinding add Alt-W@overallstatus "gui/workflow status"

it shoukd already be in there, but if not just add it in, then you can pull up the workflow status window by pressing Alt-W at the overall status window (the one you get with 'z', that displays your fort value and food stocks on it, has menus for animals, stone settings, stocks, etc.)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 05, 2017, 08:00:04 am
No, there's another binding for alt+w when a workshop is selected. That one just gives a dashboard of sorts from the main fortress mode screen. I'll find the exact keybinding when I'm not on mobile.
Also, it's been missing intentionally by default from every DFHack version for 0.43 so far. I just recently added it back, so it'll be in r1.

Edit: here they are:
Code: [Select]
keybinding add Alt-W@dwarfmode/QueryBuilding/Some/Workshop/Job gui/workflow
keybinding add Alt-W@overallstatus "gui/workflow status"

Add these to your dfhack.init file to have them take effect every time. If you're already running DF and don't want to restart it, run those commands in the console too to have them take effect for your current DF session.
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 05, 2017, 08:48:26 am
Darn it, still it doesn't open the workflow status menu. If I set it to Alt-X for example then I can use the same keybind for the same thing but only in workshop. In workshop there is a Shift-S that opens the workflow status menu. Something is mixed and it's the "status thing"
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 05, 2017, 08:52:52 am
I'm not quite sure what you're referring to. Does alt+w in the main fortress mode screen open the status screen you're thinking of? What if  you run "gui/workflow status"?
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 05, 2017, 08:58:41 am
I'm not quite sure what you're referring to. Does alt+w in the main fortress mode screen open the status screen you're thinking of? What if  you run "gui/workflow status"?

If I run "gui/workflow status" directly from init then it opens. Saved text in init file doesn't work nor if I type it in. So I tried with Alt-x because alt-w was already in use. What I am sure is that we are binding the wrong path.

EDIT: OK got it now lol - keybinding add Alt-E@overallstatus "gui/workflow status" this is all that it needs to be accessed straight from the game. I set it to Alt-e

Thank you both for quick responses and help I am slowly learning the DFHack.

EDIT 2: Just to sum up because it's seems a bit strange how this thing worked out. I read that
keybinding add Alt-W@dwarfmode/QueryBuilding/Some/Workshop/Job gui/workflow
keybinding add Alt-W@overallstatus "gui/workflow status"
have been removed because it was not needed anymore. And adding this two commands to my init file did nothing to bring up the menu. The direct access to Workflow Status screen where you can manage the work orders is done by:
keybinding add Alt-E@ "gui/workflow status"
This will open the Status screen from any menu you are in. I just hope I didn't mess up any other bind with Alt-E. I used it because I was unable to find an key bind to it so I hope it's fine.

Tnx again and hats off to guys working on this awesome tool box for DF.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 05, 2017, 09:54:33 am
EDIT 2: Just to sum up because it's seems a bit strange how this thing worked out. I read that
keybinding add Alt-W@dwarfmode/QueryBuilding/Some/Workshop/Job gui/workflow
keybinding add Alt-W@overallstatus "gui/workflow status"
have been removed because it was not needed anymore.
They were removed because we weren't sure if people would still want those bindings, and we weren't sure if workflow was going to be stable. They have been re-added after DFHack 0.43.05-beta2.

Quote
And adding this two commands to my init file did nothing to bring up the menu. The direct access to Workflow Status screen where you can manage the work orders is done by:
keybinding add Alt-E@ "gui/workflow status"
This will open the Status screen from any menu you are in. I just hope I didn't mess up any other bind with Alt-E. I used it because I was unable to find an key bind to it so I hope it's fine.
Did you restart DF after editing your init file?

I'm a bit confused as to whether you're running these commands in the init file or the console (the window that opens when you run DF). "gui/workflow" will definitely not work in your init file, but it will work in the console.

Oh, also, "@overallstatus" is the "z" screen, not the main fortress mode screen (sorry about that). Does alt+w work there?
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 05, 2017, 11:05:38 am
Yes I restarted DF after every change of init file. I tried all combinations and nothing worked. I also tried the same commands in all variations through the console first but didn't work either. And yes I figured out that "@overallstatus" is the "z" menu and was trying with alt+w in this menu and main fortress one. (Heck I tried all possible ways with all the combos I could think off lol). Anyway here is my version of what might be wrong. The "keybinding add Alt-W@dwarfmode/QueryBuilding/Some/Workshop/Job gui/workflow" is something else than the workflow status screen. Go to one workshop and set a job. You have two options here to set the job. 1. Alt-A to set input and output stuff for a job/product and 2. option is ALT-W where you set workflow constraints like range/limits on production. At the bottom of the screen there is the shift+S option that opens the workflow status screen=GUI/workflow. Changing the above keybind /querryBuilding/some/wokshop... is changing the keybind for workflow constraints and thats not the status screen. Since the keybind alt-w is already taken, binding gui/workflow in fortress screen or in @overallstatus menu won't work either (because it is in second place and the code accepts only the first one and others are discarded - like if Alt-w is already in use then you can set all keybindings to alt-w but the code will only accept the first keybind set an not the ones after). So I used Alt-e since I think it's not tied to anything. At least I was unable to find it through notepad++

Not sure but I suggest you test if it works in the latest DFHack version (I am using 43.03 Peridax Newb Pack on an old 32bit potato computer) because if you just added those two lines of code back into init file I am sure the gui/workflow=workflow status screen wont open in @overallstatus/z-menu. You should not touch the above mentioned code line. Only add "keybinding add alt+whatever is still free (E works for me) "gui/workflow status" and that's it. If you want it open in z-menu than add the @overallstatus but I didn't try this option since I like the option to see it anytime in any other menu.

Sry for my bad english, not native for me so I hope I explained good enough.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 05, 2017, 12:55:03 pm
Oh, try this:
Code: [Select]
keybinding add Alt-W@dfhack/lua/status_overlay "gui/workflow status"
You might have a script running that changes the "z" screen (by adding an "x: Additional options" item), which adds an extra screen and keeps "overallstatus" from working.
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 05, 2017, 01:18:28 pm
Ah nice one it works this way now. TNX!
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 05, 2017, 01:57:06 pm
Cool. That has come up before, but I forgot about that script. I'll add that keybinding for r1 too.
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on May 06, 2017, 08:59:19 pm
here is an interesting line from onLoad.init in TESB:

Code: [Select]
modtools/reaction-trigger -reactionName TESB_DECONSTRUCT_TRIBUTE -command [ modtools/anonymous-script "dfhack.buildings.deconstruct(df.building.find(args[1]))" \\BUILDING_ID ]

Really this thing is annoying... spits out an error that reads:

Code: [Select]
(anonymous lua script):1: Cannot write field building.find(): integer expected.
stack traceback:
[C]: in field 'find'
(anonymous lua script):1: in main chunk
[C]: in function 'dfhack.safecall'
...warf Fortress/hack/scripts/modtools/anonymous-script.lua:26: in local 'script_code'
...ied-MWDF\MWDF Project\Dwarf Fortress\hack\lua\dfhack.lua:562: in function 'dfhack.run_script_with_env'
(...tail calls...)
[C]: in field 'runCommand'
...ied-MWDF\MWDF Project\Dwarf Fortress\hack\lua\dfhack.lua:580: in upvalue '_run_command'
...ied-MWDF\MWDF Project\Dwarf Fortress\hack\lua\dfhack.lua:595: in function 'dfhack.run_command'
...warf Fortress/hack/scripts/modtools/reaction-trigger.lua:146: in local 'doAction'
...warf Fortress/hack/scripts/modtools/reaction-trigger.lua:186: in function <...warf Fortress/hack/scripts/modtools/reaction-trigger.lua:115>

decided I'd ask here since, Dirst hasn't been on since December, otherwise I'm just going to have to disable it... this is just the first of a series of errors out of the code, but its the first that I don't understand....Its simple to remove the line from onload and manual deconstruct the buildings...
Title: Re: DFHack 0.43.03-r1
Post by: Putnam on May 06, 2017, 10:14:48 pm
replace df.building.find(args[1]) with df.building.find(tonumber(args[1]))
Title: Re: DFHack 0.43.03-r1
Post by: Roses on May 10, 2017, 02:32:02 pm
Is it possible to see what arguments a script takes from inside DFHack? For example, the modtools/create-item script has -creator, -item, -mat, etc... I'm looking to make a script that does something for each script it finds with a certain argument available. I know I could probably read in the scripts files, and do a simple word search, but I didn't know if that information gets loaded in somwhere else (I could also just run each script with run_command_silent and check if it accepts the argument I want, but that seems rather costly and a little dangerous.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 10, 2017, 04:29:56 pm
Not really, and it's unlikely that all of the scripts you find would work the way you expect if you could do that. Most scripts should have a "help" or "-help" option available, so I guess you could try that.
Title: Re: DFHack 0.43.03-r1
Post by: Amostubal on May 10, 2017, 09:31:03 pm
replace df.building.find(args[1]) with df.building.find(tonumber(args[1]))

sorry Putnam, I thought I told you thanks for this... I've got a fully working TESB up and going now!
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on May 11, 2017, 04:11:19 am
currently working on a play any Civ script for fort mode embark menu, but hitting a small snag trying to insert a position so folks can do basic DF entity stuff like Doctoring and building armies.
so far none of my insert entity position raw stuff works unless I manually do it in Gm-editor.
so I'm kinda stump on how do I write this into a script
Spoiler (click to show/hide)
so here's my work in progress loads of dummy out attempts
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on May 11, 2017, 04:39:56 am
@Rumrusher: Are you sure entito is a pointer to the target struct rather than a copy of the data of the target struct? I'm too hazy on Lua's rules myself to say anything with certainty, but it looks like a possible cause (and could be tested by using the full path to see if that takes hold).
Using a script rather than providing modified raws to swap in and out seems like a needlessly complicated way of doing things to me...
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on May 11, 2017, 05:03:13 am
@Rumrusher: Are you sure entito is a pointer to the target struct rather than a copy of the data of the target struct? I'm too hazy on Lua's rules myself to say anything with certainty, but it looks like a possible cause (and could be tested by using the full path to see if that takes hold).
Using a script rather than providing modified raws to swap in and out seems like a needlessly complicated way of doing things to me...
yeah it is given I could just make all civs have a position but, I figure doing this saves me when I roll in an hardcoded civ with no way to setting the entity position on a raw level to give me military.
entito is there as a "edit the newly made raw entity position", my problem is I don't know how to Insert a entity raw position to reach that spot of "is entito working" as every time I go through the available site entity raws they keep showing up there's no position.
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on May 11, 2017, 07:32:01 am
This added a position entry to the humans for me. Provided, of course, that is what your problem is.
Spoiler (click to show/hide)

Edit: Come to think of it, I suspect your approach is doomed. It ought to allow you to start playing (once you're added all that's needed), but never load a save, as the save probably loads raw files copied at the save creation, rather than writing to raw files from the raw data representation within DF as the game is saved (or at least that would require you to repatch things at every load).
Title: Re: DFHack 0.43.03-r1
Post by: Rumrusher on May 11, 2017, 08:59:57 am
thanks , darn I forgot about new().

though this set up would allow folks to play as angels ... doing so tends to crash the game.

...crud okay so it worked but didn't give the civs military so I ended up just going with plan b, using warmist tofort to unlock noble positions.
only got it to work with a bunch of Dwarves so I don't know if it works with every one, but doing so kinda remove job access to the other dwarves turning the fort into a weird hermit and the 6 useless peasants mess
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 11, 2017, 01:07:52 pm
@lethosor - you have been asking in this thread http://www.bay12forums.com/smf/index.php?topic=163671.0 (http://www.bay12forums.com/smf/index.php?topic=163671.0) if the script works for caravans and I confirm it did help me get the rest of the human caravan on the map. My case was a bit specific because when caravan was announced only guards entered the map but soon after some darn monkey attacked and killed a horse. Since I have horses on the map I didn't think it's related to caravan but indeed the monkey managed to kill the caravan horse and the rest of the caravan got stuck outside of map. Using the script a few in-game days later got the rest of the traders on the map but now they are stuck at the bin that was "dropped" by the dead horse and are stuck at the edge of the map again. As far as I know I just have to wait for them to go insane and die but that shouldn't affect future caravans visits from humans right?

In regards to sieges - I had one announced the other day and the game pauses and zooms to where the units entered the map. There is always only a few that get spotted on the edge like 10 units or so right from the start and other units enter the map following the ones that appeared when siege is announced. I made a quicksave because it was late for me and I said will deal with this siege next time I play. So I made a backup of the save and then I let the siege go forward for a while just to see how many attackers came and there was around 80 goblins & trolls (in the "u"/others screen). So before I started the game next time I used the backed up quicksave to start right from where the siege was announced. But this time there were only goblins that were already on the map, so some 8 goblins and all the other units from the siege were gone and have never entered the map (there were also only 8 present in the "u"/others screen). So it seems that quicksave at the time that siege is announced only saves the units that are present on the map but not the ones that still follow right behind them. It cuts out those that are entering the map. So that siege ended very fast with only a few goblins that I killed and I never got a siege again. I am not sure how much in-game time has passed since then but it seems like a lot. So do you guys have any experience with that and do you think that those goblins that didn't spawn might be stuck "somewhere in the savegame folder/world.sav file" between the world map and fort map and could create a mess long term or prevent other goblin sieges to happen? Any ideas on this one?

Also I think that the game does NOT save farm plots settings properly. The fertilize on/off function might not be saved properly, actually is always set/reset to "on" after you load the game. I set some farms to not be fertilized but when I reload all are set to fertilize "on" again. I did check if it might be because seasons changed but the fertilize "on/off" settings have all been reset for all farms and for all seasons. Might be a bug hiding in the potato farm that no one noticed :) Anyway you guys probably can check in a minute what stats are saved for farm plots and see if fertilize "on/off" option is also saved or not. Sounds strange to my because not saving it should crash the game on load I guess but hey this is DF and anything is possible :D

Please include the "caravan unit retrieval" script in DFHack and consider doing the same for siege units. I also hope that my experience above will help investigate this further.

EDIT: I always forget to tell I am playing 43.03 Newb Pack so not 100% up to date here :)
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 11, 2017, 01:23:05 pm
@lethosor - you have been asking in this thread http://www.bay12forums.com/smf/index.php?topic=163671.0 (http://www.bay12forums.com/smf/index.php?topic=163671.0) if the script works for caravans and I confirm it did help me get the rest of the human caravan on the map. My case was a bit specific because when caravan was announced only guards entered the map but soon after some darn monkey attacked and killed a horse. Since I have horses on the map I didn't think it's related to caravan but indeed the monkey managed to kill the caravan horse and the rest of the caravan got stuck outside of map. Using the script a few in-game days later got the rest of the traders on the map but now they are stuck at the bin that was "dropped" by the dead horse and are stuck at the edge of the map again. As far as I know I just have to wait for them to go insane and die but that shouldn't affect future caravans visits from humans right?
Maybe, but I'm not sure.

Quote
In regards to sieges - I had one announced the other day and the game pauses and zooms to where the units entered the map. There is always only a few that get spotted on the edge like 10 units or so right from the start and other units enter the map following the ones that appeared when siege is announced. I made a quicksave because it was late for me and I said will deal with this siege next time I play. So I made a backup of the save and then I let the siege go forward for a while just to see how many attackers came and there was around 80 goblins & trolls (in the "u"/others screen). So before I started the game next time I used the backed up quicksave to start right from where the siege was announced. But this time there were only goblins that were already on the map, so some 8 goblins and all the other units from the siege were gone and have never entered the map (there were also only 8 present in the "u"/others screen). So it seems that quicksave at the time that siege is announced only saves the units that are present on the map but not the ones that still follow right behind them. It cuts out those that are entering the map. So that siege ended very fast with only a few goblins that I killed and I never got a siege again. I am not sure how much in-game time has passed since then but it seems like a lot. So do you guys have any experience with that and do you think that those goblins that didn't spawn might be stuck "somewhere in the savegame folder/world.sav file" between the world map and fort map and could create a mess long term or prevent other goblin sieges to happen? Any ideas on this one?
Sounds like a DF bug to me. Did you try saving from the options menu as well?

Quote
Also I think that the game does NOT save farm plots settings properly. The fertilize on/off function might not be saved properly, actually is always set/reset to "on" after you load the game. I set some farms to not be fertilized but when I reload all are set to fertilize "on" again. I did check if it might be because seasons changed but the fertilize "on/off" settings have all been reset for all farms and for all seasons. Might be a bug hiding in the potato farm that no one noticed :) Anyway you guys probably can check in a minute what stats are saved for farm plots and see if fertilize "on/off" option is also saved or not. Sounds strange to my because not saving it should crash the game on load I guess but hey this is DF and anything is possible :D
I can't find any DFHack tools that deal with fertilization at all, so I don't think it's a DFHack issue. I've never had it happen, in any case. Just to check, does the "f" option when you select a farm plot say "Fertilize" or "Cancel fert"?

Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 11, 2017, 01:55:32 pm
Quote
Sounds like a DF bug to me. Did you try saving from the options menu as well?

After I let the siege go for a while I exited the game normally not with the kill command, so esc and savegame etc. The prob is that next time I run the game I deleted this last savegame because I had the quick save from only a few minutes before. I never loaded the save to be able to see if that one might be corrupt but never happened to me anyway so I am sure it was nothing wrong there. I am sure that quicksave cut out the units like there is a glitch between region-snapshot.dat and unit.dat. Where does the U screen/others get the units data from? Do like units get generated on the spot when siege is announced and are visible on U screen/others immediately/first and then units enter the map (same with caravans, megabeasts, etc)? It might explain why people get this strange "units not entering the map" because they save spot on when the game announces the event and pauses. If you then exit the game and reload the units that did not enter the map get bugged somehow/stuck out of map unable to enter.

Quote
I can't find any DFHack tools that deal with fertilization at all, so I don't think it's a DFHack issue. I've never had it happen, in any case. Just to check, does the "f" option when you select a farm plot say "Fertilize" or "Cancel fert"?

Yes it does change. I set them all to Cancel, only wanted my pig tail farms to be fertilized but after a reload all farms had fertilize back on.

EDIT: I just got the message that the caravan I spawned with the script is leaving soon.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 11, 2017, 02:40:49 pm
After I let the siege go for a while I exited the game normally not with the kill command, so esc and savegame etc. The prob is that next time I run the game I deleted this last savegame because I had the quick save from only a few minutes before. I never loaded the save to be able to see if that one might be corrupt but never happened to me anyway so I am sure it was nothing wrong there. I am sure that quicksave cut out the units like there is a glitch between region-snapshot.dat and unit.dat. Where does the U screen/others get the units data from? Do like units get generated on the spot when siege is announced and are visible on U screen/others immediately/first and then units enter the map (same with caravans, megabeasts, etc)? It might explain why people get this strange "units not entering the map" because they save spot on when the game announces the event and pauses. If you then exit the game and reload the units that did not enter the map get bugged somehow/stuck out of map unable to enter.
I suppose saving at that point could be the cause, although quicksave only triggers an autosave, so if that were the cause, it wouldn't be quicksave-specific.

Quote
Yes it does change. I set them all to Cancel, only wanted my pig tail farms to be fertilized but after a reload all farms had fertilize back on.
Are you saying that you switched it to display "f: Cancel fert"? I'm pretty sure that means you enabled fertilization, although I could be misunderstanding.
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 11, 2017, 03:09:16 pm
Quote
I suppose saving at that point could be the cause, although quicksave only triggers an autosave, so if that were the cause, it wouldn't be quicksave-specific.
Like you said saving at that point could be the cause. Might be worth keeping this in mind and test it further when events pop up to see if there is a savegame generating related bug

Quote
Yes it does change. I set them all to Cancel, only wanted my pig tail farms to be fertilized but after a reload all farms had fertilize back on.

Are you saying that you switched it to display "f: Cancel fert"? I'm pretty sure that means you enabled fertilization, although I could be misunderstanding.

When you build a farm plot, the default setting for fertilize is on, as fertilize. You can pres "f" and it sets the farm plot to cancel fert, meaning it won't be fertilized. If you set farms to cancel fert, save and reload those same farms will have fertilize back on. It seems the setting for fertilize is not saved it just goes back/reverts to default settings for farm plots on reload. It's like you would have to for example set plump helmets for all your plots every time you reload the game. At first I thought that I messed something up with season settings, like set plump helmets only for spring time and not other seasons and after reload there is a new season and you wonder why there are no crops. It's the same with fertilizer settings, except those revert to default after reload.

Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 11, 2017, 03:51:39 pm
Oh and btw an idea for Autobucher. Is it possible that one more thing would be included in those options and that is to be able to set collect eggs on/off for every "race". The don't collect eggs option, should be possible by a script that setts forbid on certain race eggs in the nest box. It sucks locking and unlocking or forbidding eggs. This option would perfectly round up the autobutcher tool.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 11, 2017, 04:39:30 pm
When you build a farm plot, the default setting for fertilize is on, as fertilize. You can pres "f" and it sets the farm plot to cancel fert, meaning it won't be fertilized. If you set farms to cancel fert, save and reload those same farms will have fertilize back on.
I'm pretty sure that's not right. "f: fertilize" means "if you press f, this plot will be fertilized, but right now it's not", and "f: Cancel fert" means "this plot is being fertilized, so pressing f will cancel fertilization". I'm basing this off of personal experience (I've never had a plot fertilized, so I'm pretty sure it's not the default), and the fact that fertilization counts are only displayed when "cancel fert" is displayed, which would be pretty useless if "cancel fert" meant "fertilization is inactive". I'll admit that it is inconsistent with other menus, though.

Also, this page (http://dwarffortresswiki.org/index.php/DF2014:Farming#Yield_and_Fertilization) says you need to press "f" to enable fertilization. However, you might find the "s"easonal fertilization option more helpful - the "f" option might be a one-time thing.

Oh and btw an idea for Autobucher. Is it possible that one more thing would be included in those options and that is to be able to set collect eggs on/off for every "race". The don't collect eggs option, should be possible by a script that setts forbid on certain race eggs in the nest box. It sucks locking and unlocking or forbidding eggs. This option would perfectly round up the autobutcher tool.
I tried making a separate plugin to forbid eggs once, and found that it was a lot harder than I expected. It might be easier now that we have ways to cancel jobs easily, and I've been meaning to look into it again at some point.
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 11, 2017, 05:10:48 pm
Tnx for the info on the farms and fertilizing! The options for it really are clunky and the more I look into it now it might really be that I set it to fertilize just once while I thought I set it for seasons. The devil hides in the details I guess.

I hope you find a solution for eggs, would be really neat.

Tnx again for all the work you do on DFHack!
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 13, 2017, 04:28:50 am
OK I can now confirm 100% my theory on units not showing up at least for a siege. When the siege is announced only a hand full of units enter the map (11 units), the rest of the siege force is yet to enter it in the next few in-game days. If you make a quick save right away when the alert for siege is announced and game pauses then load this save game only those few units that have already entered the map (so 11 units) will be the whole force that sieges. The rest that should enter the map never ever show up and are simply gone. I have both save games stored, one that is made spot on when the alert is announced and one that is made two in-game days later with all the siege units that arrived and have just reproduced it again. If I load up the save game when the siege alert is announced only those 11 units that are on the map attack and the rest never show up.

I was actually doing some observation on caravans and it's most likely the same since it took several in-game days before all 7 wagons and another 4 traders with single pack animals entered the map. So saving between the time after the caravan is announced and before the whole caravan envoy is actually present on the map itself might produce the problems people have. It does easily explain the prob with the caravan never fully unloading since it got "cut in half" during a save and reload while half of the wagons entered the map and the other half were still out but are now lost because of how the game creates the save. So the wagons that did arrive on the map start unloading but you can't trade until all the caravan wagons and traders with single pack animals (and some of those get lost on reload) get to the trade depot and unload their stuff. I was waiting for the dwarven caravan to show up to test this but instead the siege came up. I hope I get the dwarfen caravan today so I will make a save while half of the caravan enters the map and the other half is still out/off map and see if I can reproduce the same thing as with siege units.

Not sure if Liasons have guards with them when they enter the map but if they do, saving while all the guards still haven't entered the map might be a cause for stuck Liasons as well. Will test it out as soon as I get one visiting.

Who knows maybe Toady even did this deliberately so it would be harder for people to cheat through save games. But if this is not intentional then this is a big bug and Toady should be aware of it because at the end it's a big exploit where you just save and reload and 90% of the siege force never enters the map and it's a game breaking bug when it comes to caravans.

I am playing the 43.03-r09 PeridexisErrant Starter Pack
Title: Re: DFHack 0.43.03-r1
Post by: PatrikLundell on May 13, 2017, 07:18:17 am
Interesting observations, knedl.
I would recommend testing with a regular save, rather than a quicksave, to rule out that quicksave somehow misses something that a vanilla save captures. Caravan testing could be done by saving as a caravan season approaches, copy that save, and use copies of the copy to try different save times and save methods from the same base condition.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 13, 2017, 08:58:55 am
Any issues with quicksave would also occur with vanilla autosaves. Saving from the options menu would still be a good idea, though.
Title: Re: DFHack 0.43.03-r1
Post by: knedl on May 13, 2017, 02:08:33 pm
@Patric & lethosor

I am on it, I have all the save games set and ready to test in all possible ways. Will write what I come up with in a structure so it can be reported to Toady afterwards if I locate the bugs close enough. I plan to do it tomorrow or latest on monday.

I have been thinking about eggs some more and I am interested if you guys know if those can be forbidden by a script while eggs are inside a nest box. Also the autobutcher works the way that it slaughters the oldest animal when a child matures so this will cause problems. If an animal which laied eggs is butchered then those will not hatch. Those forbidden eggs then stay for ever and the nest box is occupied. Not sure how to get around that with a code. I have been doing a lot of this manually to try and figure out the best way.
Title: Re: DFHack 0.43.03-r1
Post by: Rusty Shackleford on May 13, 2017, 02:38:54 pm
I was playing with the embark anywhere feature and embarked on a goblin tower I visited in adventure mode. The layout of the tower changed. All the corpses were where my adventurer left them, but the rooms were different. So corpses were inside solid walls or in the air.

Just thought that was interesting since it was unexpected.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 13, 2017, 05:29:45 pm
@Patric & lethosor

I am on it, I have all the save games set and ready to test in all possible ways. Will write what I come up with in a structure so it can be reported to Toady afterwards if I locate the bugs close enough. I plan to do it tomorrow or latest on monday.

I have been thinking about eggs some more and I am interested if you guys know if those can be forbidden by a script while eggs are inside a nest box. Also the autobutcher works the way that it slaughters the oldest animal when a child matures so this will cause problems. If an animal which laied eggs is butchered then those will not hatch. Those forbidden eggs then stay for ever and the nest box is occupied. Not sure how to get around that with a code. I have been doing a lot of this manually to try and figure out the best way.
I think it would be best to keep autobutcher from marking units who have claimed a nestbox with (fertile) eggs. It doesn't look like it does that yet.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 13, 2017, 10:40:00 pm
I've made a new thread for 0.43.05-r1: http://www.bay12forums.com/smf/index.php?topic=164123

I saw Expwnent on IRC a couple days ago, but not recently enough to inform him of this, so I expect this thread will remain unlocked for a bit. It would be good to continue discussions in the new thread, though.

(Also, r1 is out: https://github.com/DFHack/dfhack/releases/tag/0.43.05-r1)
Title: Re: DFHack 0.43.03-r1
Post by: ab9rf on May 14, 2017, 10:03:02 am
I tried making a separate plugin to forbid eggs once, and found that it was a lot harder than I expected. It might be easier now that we have ways to cancel jobs easily, and I've been meaning to look into it again at some point.
I wrote the "nestboxes" plugin I can't remember how many years ago that does this: it forbids fertile eggs, no matter where they are, so they are left alone and allowed to hatch. (Some people consider this cheaty.) I suppose we could move this out of devel, it is perfectly stable.
Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 14, 2017, 10:32:14 am
I was having an issue in 0.40 where forbidding them wouldn't stop existing egg-hauling jobs. (Also, there's an item_eggst flag that you can check instead of working with pregnancy information.) I think the addition of Job::removeJob() would make it easier to stop existing hauling jobs, so hopefully we can get one of the plugins working for r2.
Title: Re: DFHack 0.43.03-r1
Post by: ab9rf on May 14, 2017, 12:45:17 pm
I was having an issue in 0.40 where forbidding them wouldn't stop existing egg-hauling jobs. (Also, there's an item_eggst flag that you can check instead of working with pregnancy information.) I think the addition of Job::removeJob() would make it easier to stop existing hauling jobs, so hopefully we can get one of the plugins working for r2.
Nestboxes runs fairly frequently (every five ticks), but it would be an idea to stop hauling jobs.

I think I coded it to check pregnancy information because the item_eggst flag was either unreliable or absent in 0.34.

Unless Toady's changed it, an egglayer that is currently incubating a brood is marked as being pregnant. It was my recollection that autobutcher will not butcher pregnant animals, and so it ought not butcher egglayers who are incubating a brood. I've noticed that there have been some changes in how pregnancy is handled in more recent versions of DF, and so these tools may need some tweaking to be reliable in current versions. (The main thing I've noticed is that dead units remain pregnant after dying.)

Title: Re: DFHack 0.43.03-r1
Post by: lethosor on May 14, 2017, 04:24:57 pm
Looks like it was present in 0.34.11-r4 (https://github.com/DFHack/df-structures/blob/0.34.11-r4/df.items.xml#L1062) and absent in r3 (https://github.com/DFHack/df-structures/blob/0.34.11-r3/df.items.xml#L1025), so that would explain it. Anyway, "tweak eggs-fertile" has used that flag successfully for a while, so I'd say it's safe to use.

Also, there's a new thread: http://www.bay12forums.com/smf/index.php?topic=164123 (not that I mind having this conversation here, but my last post is on an older page now, at least with 15 posts/page).