Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 128 129 [130] 131 132 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1457249 times)

Tierre

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1935 on: June 20, 2012, 06:34:36 am »

Can anybody answer my question about degraded clothing? How do i repair it with DFhack?
Logged

San-A

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1936 on: June 20, 2012, 06:36:57 am »

Nope, the reading memory thing is the old way of doing things that didn't work well.

Nowadays people read the readme file that tells you what, exactly, you are supposed to do with the files you just downloaded.
I was quite sure it was reading the memory, so this is why I thought there was a bug. Hence I didn't read the readme (but I should have). No need to be rude mate, everyone makes mistake
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1937 on: June 20, 2012, 06:40:25 am »

Yeah, I know, everybody makes mistakes, and I have to correct every single one of those, so it gets tedious. Anyway, DF loads up DFhack as a DLL, making memory reading much faster.
Logged

AustralianWinter

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1938 on: June 20, 2012, 09:30:15 am »

Yeah, I know, everybody makes mistakes, and I have to correct every single one of those, so it gets tedious. Anyway, DF loads up DFhack as a DLL, making memory reading much faster.

Aww, man, you have it so hard.

At any rate, thanks for the new edition, it works like a charm.
Logged
And the Lord said unto John, "Come forth and receive eternal life." But John came fifth and won a toaster.

San-A

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1939 on: June 20, 2012, 09:38:00 am »

Yeah, I know, everybody makes mistakes, and I have to correct every single one of those, so it gets tedious. Anyway, DF loads up DFhack as a DLL, making memory reading much faster.
The duty of the master is to initiate the profane  :)
Logged

Altaree

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1940 on: June 20, 2012, 01:25:19 pm »

Hi!
I just wrote up this script that will remove naked thoughts from all of your dwarves.  Once DFHack 0.34.11 is released this shouldn't be needed but until then, HAVE FUN!

I had a bit of trouble removing elements from the list of recent_events so I have to start over every time I find and event I want to remove.

Comments are WELCOME!
Code: [Select]
function fixnaked()
local total_fixed = 0
local total_uncovered = 0
local total_noshirt = 0
local total_noshoes = 0

for fnUnitCount,fnUnit in ipairs(df.global.world.units.all) do
    if fnUnit.race == df.global.ui.race_id then
local listEvents = fnUnit.status.recent_events
--for lkey,lvalue in pairs(listEvents) do
-- print(df.unit_thought_type[lvalue.type],lvalue.type,lvalue.age,lvalue.subtype,lvalue.severity)
--end

local found = 1
local fixed = 0
while found == 1 do
local events = fnUnit.status.recent_events
found = 0
for k,v in pairs(events) do
if v.type == 109 then
events:erase(k)
found = 1
total_uncovered = total_uncovered + 1
fixed = 1
break
end
if v.type == 110 then
events:erase(k)
found = 1
total_noshirt = total_noshirt + 1
fixed = 1
break
end
if v.type == 111 then
events:erase(k)
found = 1
total_noshoes = total_noshoes + 1
fixed = 1
break
end
end
end
if fixed == 1 then
total_fixed = total_fixed + 1
print(total_fixed, total_uncovered+total_noshirt+total_noshoes,dfhack.TranslateName(dfhack.units.getVisibleName(fnUnit)))
end
end
end
print("thought 109 = "..df.unit_thought_type[109])
print("thought 110 = "..df.unit_thought_type[110])
print("thought 111 = "..df.unit_thought_type[111])
print("Total Fixed: "..total_fixed)
print("Total thoughts removed: "..total_uncovered)
print("Total thoughts removed: "..total_noshirt)
print("Total thoughts removed: "..total_noshoes)

end
fixnaked()
create a file named fixnaked.lua in <DF>/hack/scripts
At the [DFHack] prompt run 'fixnaked'

All the names were found at https://github.com/peterix/df-structures
Thanks to angavrilov for the fat-dwarves script, it showed me the path!
Logged
Dan Pearson:
This is a game which calculates the volume of blood in every creature it generates so it knows how much alcohol it would have to consume to get drunk, an update which, remarkably, ended up covering people's fortresses in cat vomit.

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1941 on: June 20, 2012, 02:40:22 pm »

For erasing stuff you can apply the trick Toady uses:

Code: [Select]
for k = #events-1,0,-1 do ... events:erase(k) ... end
This lets you erase the item you are looking at without disrupting the iteration.

You can also use df.unit_thought_type.Whatever instead of numbers. It works as a bi-directional mapping between numbers and strings.
« Last Edit: June 20, 2012, 02:47:09 pm by ag »
Logged

Altaree

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1942 on: June 20, 2012, 03:14:05 pm »

For erasing stuff you can apply the trick Toady uses:

Code: [Select]
for k = #events-1,0,-1 do ... events:erase(k) ... end
Thanks for the feedback!  I saw that syntax before.  Can you explain what it is doing?  It is a bit confusing to me and the docs at lua.org aren't helping :)
Logged
Dan Pearson:
This is a game which calculates the volume of blood in every creature it generates so it knows how much alcohol it would have to consume to get drunk, an update which, remarkably, ended up covering people's fortresses in cat vomit.

Rafal99

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1943 on: June 20, 2012, 03:35:15 pm »

Code: [Select]
for k = #events-1,0,-1 do ... events:erase(k) ... end
Thanks for the feedback!  I saw that syntax before.  Can you explain what it is doing?  It is a bit confusing to me and the docs at lua.org aren't helping :)

It is iterating from #events - 1, which is index of the last element, down to 0, which is index of the first element. The -1 is step.

Equivalent C++ code would look like:
for (int k = numEvents - 1; k >= 0; k--) {
Logged
The spinning Tantrum Spiral strikes The Fortress in the meeting hall!
It explodes in gore!
The Fortress has been struck down.

Altaree

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1944 on: June 20, 2012, 08:53:36 pm »

Code: [Select]
for k = #events-1,0,-1 do ... events:erase(k) ... end
Thanks for the feedback!  I saw that syntax before.  Can you explain what it is doing?  It is a bit confusing to me and the docs at lua.org aren't helping :)

It is iterating from #events - 1, which is index of the last element, down to 0, which is index of the first element. The -1 is step.

Equivalent C++ code would look like:
for (int k = numEvents - 1; k >= 0; k--) {
DOH! That makes sense! Thanks!
Logged
Dan Pearson:
This is a game which calculates the volume of blood in every creature it generates so it knows how much alcohol it would have to consume to get drunk, an update which, remarkably, ended up covering people's fortresses in cat vomit.

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1945 on: June 20, 2012, 09:34:15 pm »

Just remember that if you delete something, you have to say k++ or you might miss some stuff if the thing you're looking for can happen twice in a row.
Logged

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1946 on: June 21, 2012, 01:57:37 am »

Just remember that if you delete something, you have to say k++ or you might miss some stuff if the thing you're looking for can happen twice in a row.

No you don't. That's the whole reason for iterating end-to-start.
Logged

Tierre

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1947 on: June 21, 2012, 06:13:29 am »

Post scripts then they are ready:) We, people without lua knowledge, will gladly use them:)
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1948 on: June 21, 2012, 06:54:17 am »

I just realize toady removed Cage traps from the list of traps you can trigger in adventure mode. Man a part of me dis like this so much, but another part kinda glad we figure out how to recreate the process in adventure mode.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

telarin

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1949 on: June 21, 2012, 09:47:42 am »

I would like to suggest an improvement to autolabor:

autolabor exclude - would exclude the currently selected dwarf from autolabor control. That way, if you have a specific dwarf you want to control labors on manually (such as your CMD) you can.
Logged
Pages: 1 ... 128 129 [130] 131 132 ... 373