Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 163 164 [165] 166 167 ... 360

Author Topic: DFHack 0.43.03-r1  (Read 1120730 times)

4maskwolf

  • Bay Watcher
  • 4mask always angle, do figure theirs!
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2460 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...

scamtank

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2461 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.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2462 on: April 12, 2015, 12:47:25 am »

Oh, sorry, uh, this:


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.
« Last Edit: April 12, 2015, 01:12:22 am by Putnam »
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2463 on: April 12, 2015, 04:39:28 am »

Still closer and closer though to a consistent method.
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2464 on: April 12, 2015, 10:35:05 am »

have you guys found a way to teleport the current adventurer consistently?
Logged

scamtank

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2465 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?
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2466 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.

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

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2467 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.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2468 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

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2469 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]?
« Last Edit: April 13, 2015, 03:53:53 am by Max™ »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2470 on: April 13, 2015, 07:48:06 pm »

"x" will always evaluate as true if "x==true" evaluates as true in Lua.

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: DFHack 0.40.24-r3
« Reply #2471 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.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2472 on: April 13, 2015, 08:49:07 pm »

Thus why I didn't say that they were equivalent :P

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2473 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.
« Last Edit: April 13, 2015, 09:05:20 pm by Max™ »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2474 on: April 13, 2015, 09:10:51 pm »

print(find_player_army().id)

add that at the bottom
« Last Edit: April 14, 2015, 01:38:23 am by Putnam »
Logged
Pages: 1 ... 163 164 [165] 166 167 ... 360