Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 345 346 [347] 348 349 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1388532 times)

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5190 on: January 27, 2014, 06:25:43 pm »

Is there a compiled version of cleanconst anywhere?
Sure, right here.
It works, though I needed to get the game save into a copy of 34.11 running alongside DFHack r2. Bit of fiddling about for one command, though the result was worth it. I didn't realise a mere ~3200 constructed blocks were eating 10-20fps.
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.

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5191 on: January 28, 2014, 02:20:05 am »

In caste_body_info there is a vector attacks which is padding. I was interested in using this creature body part attack data for a script, so I looked at the memory to determine the structure:

The structure, which could probably be called caste_attack, has a size of 0x148 (328) bytes. There is one structure in the vector for each body part attack option that you can choose from when aiming an attack (i.e. punch left, punch right, kick left, kick right, scratch left, scratch right, bite for most humanoids).

-Offset 0x0, size 0x1c is a string for the word X in "[ATTACK:X:BODYPART:BY_TYPE:Y]"
-Offset 0x1c, size 0x1c is a string for the 3rd person verb i.e. "punches"
-Offset 0x38, size 0x1c is a string for the 2nd person verb i.e. "punch"
-Offset 0x54, size 0x4 is flags. In ascending order (1,2,4,8) known flags are "with", "latch", "main", "edge". Secondary attacks don't get a flag, but just the absence of the "main" flag.
-Unknown stuff follows, which may be related to poison injection attacks (needs more research)
-Offset 0xe8, size 0x4 is the contact% of the body part attack, defaulting to 0x64 (100)
-Offset 0xec, size 0x4 is the penetration% of the body part attack, defaulting to 0x64 (100)
-Offset 0xf0, size 0x10 appears to be a [EDIT] vector of body part id numbers.
-[EDIT2] Offset 0x100, size 0x10 appears to be another vector of unknowns.
-Offset 0x110, size 0x4 is the skill number of the skill used for the attack (typically 0x66, 0x67, or 0x68)
-Offset 0x114, size 0x4 is the speed of the attack, defaulting to 0x3e8 (1000)
-Unknown stuff follows to the end of the structure.

[EDIT3]
It seems highly likely based on further probing and looking at how code uses the data, that the remaining unknown space is used for several size 0x10 vectors. The offsets are: 0x58, 0x68, 0x78, 0x88, 0x98, 0xa8, 0xb8, 0xc8, 0xd8, and also 0x118, 0x128, 0x138.
« Last Edit: January 28, 2014, 03:18:18 am by Urist Da Vinci »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r3
« Reply #5192 on: January 28, 2014, 01:42:24 pm »

A few corrections:

-Offset 0x54, size 0x4 is flags. In ascending order (1,2,4,8) known flags are "with", "latch", "main", "edge". Secondary attacks don't get a flag, but just the absence of the "main" flag.
Actual size is only 0x2.

-Offset 0xf0, size 0x10 appears to be a [EDIT] vector of body part id numbers.
-[EDIT2] Offset 0x100, size 0x10 appears to be another vector of unknowns.
It is important to know that both of these are int16 vectors; the first one is indeed body part IDs, while the second is tissue layer IDs.

-Offset 0x110, size 0x4 is the skill number of the skill used for the attack (typically 0x66, 0x67, or 0x68)
Again, actual size is only 0x2.

I also went through the raw parsing code and figured out what all of the other fields are:
Code: [Select]
    <struct-type type-name='caste_attack'>
        <stl-string name='name'/>
        <stl-string name='verb_3rd'/>
        <stl-string name='verb_2nd'/>
        <bitfield name='flags' base-type='uint16_t'>
            <flag-bit name='with'/>
            <flag-bit name='latch'/>
            <flag-bit name='main'/>
            <flag-bit name='edge'/>
        </bitfield>
        <stl-vector type-name='int32_t' name='specialattack_type' comment='0 = inject extract, 1 = suck blood, 2 = perform interaction'/>
        <stl-vector type-name='int16_t' name='specialattack_mat_type' comment='extract injected'/>
        <stl-vector type-name='int32_t' name='specialattack_mat_index'/>
        <stl-vector type-name='matter_state' name='specialattack_mat_state'/>
        <static-array count='4' name='specialattack_temp_mat' comment='parsed during second pass'><stl-vector pointer-type='stl-string'/></static-array>
        <stl-vector type-name='int32_t' name='specialattack_min' comment='amount of extract injected or blood sucked'/>
        <stl-vector type-name='int32_t' name='specialattack_max'/>
        <int32_t name='contact_perc'/>
        <int32_t name='penetration_perc'/>
        <stl-vector type-name='int16_t' name='body_part_idx'/>
        <stl-vector type-name='int16_t' name='tissue_layer_idx'/>
        <enum base-type="int16_t" type-name="job_skill" name="skill"/>
        <stl-vector pointer-type='stl-string' name='specialattack_interaction_tmp_name' comment='parsed during second pass'/>
        <stl-vector type-name='int32_t' name='specialattack_interaction_id'/>
    </struct-type>

Should be in df-structures shortly.
« Last Edit: January 28, 2014, 08:29:48 pm by Quietust »
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Starweaver396

  • Bay Watcher
  • Misplaced
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5193 on: January 28, 2014, 10:49:22 pm »

Nevermind. Sorry.
« Last Edit: January 28, 2014, 11:20:46 pm by Starweaver396 »
Logged
...a limbless, headless, bloodless and mutilated dwarf torso that is nevertheless kept alive through benevolent faerie magicks. He is blind, helpless, and in excruciating pain, and yet does not die...
E: I should point out that this is all because of Starweaver giving me inspiration   Aren't you happy with yourself, Starweaver?

Bo-Rufus CMVII

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5194 on: February 01, 2014, 05:38:38 am »

For using workflow to manage boots and gloves, do you specify how many items, or how many pairs?

Does 'count' vs. 'amount' make a difference here?
Logged

DrKillPatient

  • Bay Watcher
  • The yak falls infinitely
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5195 on: February 02, 2014, 01:40:10 am »

Hello! I've got DFHack running mostly properly on OSX Mavericks, but Stonesense has some issues. Upon open it via DFHack in the terminal, DF and SS run together for just a moment — I can see my map load — and then both crash. Strangely, it only occurs when I set a different PRINT_MODE in my init.txt. Unfortunately, as I have a Retina display, I can't use PRINT_MODE:2D (I use STANDARD). What can I do here?

There are still serious issues with Stonesense on OS X that I haven't yet had time to iron out in Mountain Lion, let alone Mavericks.

For the time being, if you can get Stonesense to work at all on OS X, you're in the lucky minority.

I hope to have more time to look into its issues in a few weeks. Unfortunately, right now, I'm swamped.

I now have access to a Windows computer... I'm going to try Stonesense on it with an unusual PRINT_MODE and see if it still crashes. Perhaps it's not Mac-specific?
Logged
"Frankly, if you're hanging out with people who tell you to use v.begin() instead of &v[0], you need to rethink your social circle."
    Scott Meyers, Effective STL

I've written bash scripts to make using DF easier under Linux!

Raidau

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5196 on: February 02, 2014, 06:17:32 am »


[SYN_CLASS:script][SYN_CLASS:\UNIT_ID][SYN_CLASS:ITEM_WEAPON_DAGGER_LONG][SYN_CLASS:IRON] will make an iron dagger.

Its possible to change it to tools as well, would just need to change a few lines. (actually I think the only thing you would need to change is 'WEAPON' to 'TOOL' and 'item_weaponst' to 'item_toolst'. Although I am not positive about that)

It works (at least initial testing conformed that). I made this crude variation (for tools) for my own use, it also takes one more argumet as quality. Gonna try expand this for armor as well. Thanks Roses.

Code: [Select]
args = {...}

local unit = df.unit.find(tonumber(args[1]))
local mat = args[3]
local quality = args[4]
local mat_type = dfhack.matinfo.find(mat).type
local mat_index = dfhack.matinfo.find(mat).index

local item_index = df.item_type['TOOL']
local item_subtype = 'nil'

for i=0,dfhack.items.getSubtypeCount(item_index)-1 do
  local item_sub = dfhack.items.getSubtypeDef(item_index,i)
  if item_sub.id == args[2] then
  item_subtype = item_sub.subtype
end
end

if item_subtype == 'nil' then
  print("No weapon of that type found")
  return
end

local item=df['item_toolst']:new() --incredible
item.id=df.global.item_next_id
df.global.world.items.all:insert('#',item)
df.global.item_next_id=df.global.item_next_id+1
item:setSubtype(item_subtype)
item:setMaterial(mat_type)
item:setMaterialIndex(mat_index)
item:categorize(true)
item.flags.removed=true
item:setSharpness(1,0)
item:setQuality(quality)
dfhack.items.moveToGround(item,{x=unit.pos.x,y=unit.pos.y,z=unit.pos.z})

By the way, what will happen if item:setSharpness(1,0) is used on a non-sharp non-weapon tool? looks like honeycombs dont become edged this way
« Last Edit: February 02, 2014, 06:29:57 am by Raidau »
Logged
Marital status manipulator
Custom item descriprions
Natural Balance Mod (2013-2015) development suspended...

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5197 on: February 02, 2014, 01:21:04 pm »

...
By the way, what will happen if item:setSharpness(1,0) is used on a non-sharp non-weapon tool? looks like honeycombs dont become edged this way

Strangely, it appears items with Sharpness that don't come with ATTACK tokens will be treated as blunt if used in melee, but will treated as edged if thrown. This should apply to knapped rocks as well (needs verification)

Baleur

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5198 on: February 02, 2014, 06:10:24 pm »

Is there anyway to keep autolabor on WITHOUT it doing either of two things;

1. Not changing labors of specified dwarves, such as my miners.
2. Not assigning/deassigning the mining labor, but keeping the already assigned dwarves to it.

I absolutely love autolabor, but this one single issue where it keeps messing up the miners is pretty much a dealbreaker, almost making it as bad at managing the fortress as it is in vanilla with micromanagement. Having your Engineer suddenly become a Dabbling Miner while your Master Miner is now crafting wooden arrows pretty much breaks the game.
Logged

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5199 on: February 02, 2014, 06:18:21 pm »

IIRc, dwarves assigned to a burrow (not civilian alert) are left alone by autolabor, so you could just define the whole map as one burrow and assign them to that.  In this one, extra mining is still handled... I'm pretty sure that you can modify the autolabor job priorities too, so if you get that command and set mining to zero it should just be the burrowed miners. 
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5200 on: February 03, 2014, 02:36:15 am »

So I have been trying to get the unit id of both the person who used an interaction and the id of the unit targeted by that interaction. The closest I have been able to come up with so far is giving the interaction a CDI:VERB so that it generates an announcement, and as soon as the syndrome is triggered, checking for the last announcement generated. This gives me the position of the generated announcement which I can use to check the units on that map square for their ID. This works, but is obviously very buggy as several announcements triggering in close succession will give false results.

Does anyone have a better idea for attempting this? I figured a creature might have a list of used interactions, or maybe they would appear in the units attack tables, but after hours of testing I can't find anything else that would link the interaction to its source.
Logged

Ravendarksky

  • Bay Watcher
    • View Profile
    • DFMon.exe - Get rid of DF SPAM
Re: DFHack 0.34.11 r3
« Reply #5201 on: February 04, 2014, 08:16:44 am »

... Nevermind
« Last Edit: February 04, 2014, 08:18:18 am by Ravendarksky »
Logged

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: DFHack 0.34.11 r3
« Reply #5202 on: February 05, 2014, 11:42:29 am »

Is there anywhere I can find a list of all the existing eventTypes?  I have a script I'd like to run when a caravan is about to leave, as well as some other circumstances.  Eventful's enableEvent(evType,frequency) says it can do that, but what's the event type?

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5203 on: February 05, 2014, 03:01:22 pm »

Is there anywhere I can find a list of all the existing eventTypes?  I have a script I'd like to run when a caravan is about to leave, as well as some other circumstances.  Eventful's enableEvent(evType,frequency) says it can do that, but what's the event type?

https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#eventful
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #5204 on: February 05, 2014, 03:10:45 pm »

Is there anywhere I can find a list of all the existing eventTypes?  I have a script I'd like to run when a caravan is about to leave, as well as some other circumstances.  Eventful's enableEvent(evType,frequency) says it can do that, but what's the event type?

https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#eventful

You may notice that that doesn't actually contain the event table, meaning the event table has to be found manually through lua.
Pages: 1 ... 345 346 [347] 348 349 ... 373