Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 248 249 [250] 251 252 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1008711 times)

scamtank

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3735 on: May 14, 2013, 10:31:16 am »

Final product:
Code: (blooddel.lua) [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" "
local k=0
local v=1

for x,y in pairs(df.global.world.entities.all) do
my_entity=y
k=0
while k < #my_entity.resources.misc_mat.extracts.mat_index do
v=my_entity.resources.misc_mat.extracts.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.extracts.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="BLOOD") then
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
end
if(sText.material.id=="ICHOR") then
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
end
if(sText.material.id=="GOO") then
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
end
--VENOM
--POISON
--FLUID
--MILK
--EXTRACT

end
k=k+1
end
end

EDIT: for people who haven't been following my recent posts in this thread, the above script prevents all civilizations in the world from bringing blood, ichor, and "liquid" barrels in caravans. If used before embark (at the screen where you choose your site location), it prevents you from being able to embark with barrels of blood, considerably shortening the extracts list. It also shortens the list that you use to request extracts from the liaison.

I'm really glad that you're here doing the things that you do. This little snag has ground my gears for so long.
Logged

Mr S

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3736 on: May 14, 2013, 01:31:51 pm »

I, for one, enjoy adding [EDIBLE_COOKED] to blood and having my dorfs make black pudding.  Of course, YMMV.
Logged

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3737 on: May 14, 2013, 02:13:08 pm »

I've got a dfhack-internals question for peterix or anyone else who knows.

The sample plugin skeleton.cpp has a comment that dfhack console commands are called from a different thread than the main DF thread.

Is this only true of the console commands?  Or do plugin_* run in a different thread?

I assume that vtable hooks must run in DF's main thread, at least.


(I know, I know, I should write test code and figure it out myself.  DFHack is dauntingly complex, and I'm trying to get a handle on how it all fits together.)
Logged

Kurik Amudnil

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3738 on: May 14, 2013, 06:32:26 pm »

I am working on a script to display information about a unit such as birth day (civ members/pets), max age (currently as an average), body size estimate,  milkable, and grazer info.  I have it respecting assumed identities for the birth/age/name and can display animals with/without "Stray".

However, I am having some trouble figuring out how to determine that a unit is supposed to have "Corpse" in the name.  Black Mamba Man Corpse comes out as Black Mamba Man.  Since the zombie looks very similar to vampires in code I don't know what to base the decision to tack on "corpse" to the name/profession.  I am also curious as to how many other name/profession modifications I might need for units such as necromancers, ghosts, demons, clowns, husks, etc

I would also like to show "missing" units as missing with perhaps the time they were reported missing, but I am uncertain if the game records that date.  If it also recorded a last known location I might want to allow centering on that location.

I am also currently trying to print the basic description provided by the caste definition but am finding it difficult to find the printable width of my lua screen / widget so that I can insert appropriate NEWLINE breaks.  I am probably trying to perform that logic in the wrong place (:init of my framed screen class).  I think I ought to break up the info chunks into their own individual widget labels too.

I am currently calling it more-unit-info.lua and binding it to Alt-I but eventually it might be able to duplicate the "thoughts and preferences" screen so maybe another name would be more appropriate.
My Current Draft:
Spoiler (click to show/hide)
« Last Edit: May 14, 2013, 07:04:35 pm by Kurik Amudnil »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3739 on: May 14, 2013, 06:47:36 pm »

The first thing I can think of is that zombies don't have souls.

Kurik Amudnil

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3740 on: May 14, 2013, 07:13:31 pm »

The first thing I can think of is that zombies don't have souls.

The example zombies I have in my fort are from the curious structure in the bottom cavern, and a quick peak shows that they do have a current_soul reference

dfhack.TranslateName( unit ) returns ""
dfhack.units.getProfessionName(unit) returns "Black Mamba Man"
game displays "Black Mamba Man Corpse"

*edit

found a reference in unit.enemy.undead on my "Corpse" zombies and not my vampire so I can use that for now.  I may need to make changes once I get examples for the other types of undead (zombies, husks, murked, reanimated, etc)

also found unit.flags1.zombie .  I don't know how I missed that one before, but strangely these "Corpse" are flags1.zombie == false.

on another note:  unit.flags3.unk21 == missing
« Last Edit: May 15, 2013, 03:50:10 am by Kurik Amudnil »
Logged

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3741 on: May 15, 2013, 04:42:09 am »

also found unit.flags1.zombie .  I don't know how I missed that one before, but strangely these "Corpse" are flags1.zombie == false.
on another note:  unit.flags3.unk21 == missing

That zombie flag is obsolete and not used any more. Also, if you mean discovered/not discovered death, it is stored in a completely different object.
Logged

PeridexisErrant

  • Bay Watcher
  • Dai stihˇ, Hrasht.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3742 on: May 15, 2013, 06:22:01 am »

How difficult would it be to add an option for the init file for the game and hack windows?  For example - starting the DF window maximised and on top, so that I wouldn't have to shuffle and resize each time but could just get straight into the game. 

I ask because to the pack for newbs in my sig, where an option that makes it clear which window to use first would be rather useful - as part of a general program which includes the LNP gui enabling minimized/maximized launch, the game would fill the screen with soundsense and dfhack minimized.  (utilities can now auto-launch with the latest LNP)

Is this possible?  Not going to happen?  Coming in a specific timeframe?


ps - PTW an awesome tool
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3743 on: May 15, 2013, 08:24:37 am »

the above script prevents all civilizations in the world from bringing blood, ichor, and "liquid" barrels in caravans. If used before embark (at the screen where you choose your site location), it prevents you from being able to embark with barrels of blood, considerably shortening the extracts list.
How do you use it? I've got blooddel.lua in the plugins folder, but I can't tell if it's done anything because I don't have a trade agreement to look at. I've looked at the lua section of the readme, but while I can run the file I can't do anything with it.
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

scamtank

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3744 on: May 15, 2013, 10:41:48 am »

How do you use it? I've got blooddel.lua in the plugins folder, but I can't tell if it's done anything because I don't have a trade agreement to look at. I've looked at the lua section of the readme, but while I can run the file I can't do anything with it.

No, you put it in the \hack\scripts folder. Then you can run the command "blooddel" while you're hanging around in the site selection screen. If it worked, your embark preparations menu should have nothing but syrup, milk and poison available in the Extracts category.
Logged

Kurik Amudnil

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3745 on: May 15, 2013, 12:06:38 pm »

also found unit.flags1.zombie .  I don't know how I missed that one before, but strangely these "Corpse" are flags1.zombie == false.
on another note:  unit.flags3.unk21 == missing

That zombie flag is obsolete and not used any more. Also, if you mean discovered/not discovered death, it is stored in a completely different object.

its good to know that flags1.zombie is obsolete.

As for flags3.unk21, it appears to only be true when a person is missing such as when my miner burned to death channeling a magma hole.  Yes it probably parallels discovered/not discovered death.  At the moment, said miner is the only missing unit in my fort, and is the only unit in units.all that has unk21 == true.

*edit:  i suppose I am jumping to conclusions since it just occurred to me that it might represent being on fire instead

**edit:  setting units on fire didn't do it, at least not right away, but units in the smoke cloud seem to be getting the flag after a time.  Some wounded/bleeding, some not.  Will need to see if the flag gets set when walking through miasma or other cloud
« Last Edit: May 15, 2013, 01:08:23 pm by Kurik Amudnil »
Logged

Mr S

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3746 on: May 15, 2013, 01:13:45 pm »

If a creature is lost in a cloud of smoke and not seen for X time, are they counted as missing?

Also, the flames are by tissue/object, not the entire entity.  The dorfs in question eventually die of blood loss currently.
Logged

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3747 on: May 15, 2013, 02:31:21 pm »

No, you put it in the \hack\scripts folder. Then you can run the command "blooddel" while you're hanging around in the site selection screen.
Cool, thanks.
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

Kurik Amudnil

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3748 on: May 15, 2013, 03:29:06 pm »

If a creature is lost in a cloud of smoke and not seen for X time, are they counted as missing?

Also, the flames are by tissue/object, not the entire entity.  The dorfs in question eventually die of blood loss currently.

I believe that a unit can only go missing if they die without a witness.  I would like to verify that though.

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3749 on: May 16, 2013, 12:19:04 am »

OK, so I changed the dwarven civ to only have elves as wagon-pullers by editing the relevant vector, and the caravan just arrived being pulled by elves. I didn't have to give the elves any of the tokens that normally causes this. Other amusing things are probably possible by editing the list of resources that a civilization can bring to your fort.
Pages: 1 ... 248 249 [250] 251 252 ... 373