Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 13 14 [15] 16 17 ... 38

Author Topic: DFusion - a lua based plugin system (integrated into DFHack)  (Read 151998 times)

darius

  • Bay Watcher
  • ^^
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #210 on: February 27, 2011, 11:55:02 am »

Just noticed that give sentience does not work with new version, quick fix:
Code: [Select]
in plugins\tools\plugin.lua:
print("Caste name:"..engine.peekstr(off).."...")
off=engine.peekd(off+0x514)  -- <--change this to off=engine.peekd(off+0x524)
if(bit.band(engine.peekb(off+7),2)==2) then
will be updated next release.
Also quite cool to have a troll miner (with a kitty as a pet) which you can trim :D (and kobolds, they should lay eggs but started with three guys...)
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #211 on: February 27, 2011, 04:32:52 pm »

Just noticed that give sentience does not work with new version, quick fix:
Code: [Select]
in plugins\tools\plugin.lua:
print("Caste name:"..engine.peekstr(off).."...")
off=engine.peekd(off+0x514)  -- <--change this to off=engine.peekd(off+0x524)
if(bit.band(engine.peekb(off+7),2)==2) then
will be updated next release.
Also quite cool to have a troll miner (with a kitty as a pet) which you can trim :D (and kobolds, they should lay eggs but started with three guys...)
hmm also I was wondering do you find the address with a Hex editor like Cheat engine and write a code around it or do you do something different? I ask for the site changer been holding some outdated address and wonder how to fix it for getting a feel on how to add more plugins and maybe finding offsets for you.
edit. thanks for the guide.
« Last Edit: March 01, 2011, 02:24:04 pm by Rumrusher »
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

darius

  • Bay Watcher
  • ^^
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #212 on: February 28, 2011, 05:53:01 pm »

Warmist's illustrated guide to memory hacking.
(yup that is my 'real' name)
Part 1: static offset (site vector)
First of all I'm using a tool called "L'Spiros Memory hacking software" or MHS for short. You can find it by using google: like this.
Usually the job to find some offset is:
  • file->open process->dwarf fortress.exe
  • search-> (one of choices...) e.g data-type search (for simple stuff, like position an similar)
  • change something in DF
  • find again (second button below "found adrresses" bar)
  • rinse repeat till there are not a lot of addresses left
But this is not the best way for things like vectors (they use pointers, which are slow to find and sometimes they act differently). But for that i made a helper function: offsets.getvectors(). Returns tables with most vectors (static i.e. global) and times it is used in code. Simplest way to use it would be like this:
Code: [Select]
for k,v in pairs(offsets.getvectors()) do -- for each entry (here k is address of vector, v is times used)
vec=engine.peek(k,ptr_vector) -- load vector
print("Looking into:"..string.format("%x used:%d size=%d",k,v,vec:size())) --print all info...
end
Pasted that into research\plugin.lua and ran when DF was in legends mode (excerpt):
Spoiler (click to show/hide)
Now seeing DF:
Spoiler (click to show/hide)
You probably can guess which one is the correct vector... (hint both are 55 in size). Now because memory tend to move in computers (in some not but better safe than sorry) lets modify research\plugin.lua a bit more:
Code: [Select]
for k,v in pairs(offsets.getvectors()) do
vec=engine.peek(k,ptr_vector)
if vec:size()==55 then -- look only for vector with 55 as size
print("Looking into:"..string.format("%x used:%d size=%d",k-offsets.base(),v,vec:size())) -- note the k-offsets.base()
end
end
Now there is only one hit and its:
Code: [Select]
Looking into:131de24 used:8 size=55
Lets test it. In tools\plugins.lua there is function "tools.getsite(names)". In that function update the offsites line:
Code: [Select]
local offsites=0x131DE24+offsets.base() --todo make normal offset
and test tools->change site.

Next time: maybe actually using the MHS... :D

Spoiler (click to show/hide)

Hope that this helps somebody and maybe makes something more clear...
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #213 on: March 05, 2011, 04:22:58 am »

well good news I discover how to store items... using Tweak. All I did was check on occupancy's 14-blood which cause any item on that tile to stay there when you leave so covering every tile with this you might get away with building an Adventure home in hell. Oh that and engrave/smooth stone accounts the tile to being apart of the site that on it so someone could get have much fun with out the need of lairs. Those getting the player forts to be save for retiring is my next step in custom adventure homes.
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

darius

  • Bay Watcher
  • ^^
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #214 on: March 05, 2011, 04:48:35 am »

wow cool! Gonna play with it now... Actually it would not be that hard to implement this into DFusion (after all the offsets are known)
Edit: Tweak not working for me. Finds process and tile edit crashes when trying to read something.
« Last Edit: March 05, 2011, 05:06:06 am by darius »
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #215 on: March 05, 2011, 08:10:33 pm »

wow cool! Gonna play with it now... Actually it would not be that hard to implement this into DFusion (after all the offsets are known)
Edit: Tweak not working for me. Finds process and tile edit crashes when trying to read something.
tried using the pointer?
or getting the new version of it?
sleeping at the abandon site for a couple times leads to ambushes so it's best to make sure to prep traps for this sort of thing.
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

darius

  • Bay Watcher
  • ^^
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #216 on: March 06, 2011, 04:05:20 am »

Using version from DFFD for 31.19_SDL, with pointer. I fear that it could be because of windows7 ASLR or just because my windows are 64bit.
EDIT: success, removing 0x40 flag from DLL_CHARACTERISTICS in pe header did the trick. Now it tweak works.
EDIT2: Made DFusion also work :) And built a first house for my adventurer

Edit3: here is code for that if somebody wants to test it.:
Code: [Select]
mapoffset=offsets.getEx("WorldData")
x=engine.peek(mapoffset+24,DWORD)
y=engine.peek(mapoffset+28,DWORD)
z=engine.peek(mapoffset+32,DWORD)
xblocks=engine.peek(mapoffset,DWORD)
for xx=0,x-1 do
for yy=0,y-1 do
for zz=0,z-1 do

yblocks=engine.peek(xblocks+xx*4,DWORD)
zblocks=engine.peek(yblocks+yy*4,DWORD)
myblock=engine.peek(zblocks+zz*4,DWORD)
if myblock~=0 then
for i=0,255 do
ff=engine.peek(myblock+0x67c+i*4,DWORD)
ff=bit.bor(ff,bit.lshift(1,14)) --set 14 flag to 1
engine.poke(myblock+0x67c+i*4,DWORD,ff)
end
end
end
end
end
and into offsets.lua:
Code: [Select]
function f_world()
local pos=offsets.base()
pos=offsets.find(pos+6,0xa1,ANYDWORD,0x8b,0x4c,0x88,0xFC,EOL)
print("offset:"..string.format("%x",pos))
if pos~=0 then
return engine.peekd(pos+1)-offsets.base()
end
return 0
end
offsets.new("WorldData",f_world)
and into offsets.txt (this is for 31.20):
Code: [Select]
WorldData : 0x1322128
Also not yet sure if all offsets work with 31.20 but it looks okay...
EDIT<somenumber>: the code above works but verryyy slowly...
« Last Edit: March 06, 2011, 03:54:30 pm by darius »
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #217 on: March 06, 2011, 03:59:10 pm »

I would love to see your house you made.
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

darius

  • Bay Watcher
  • ^^
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #218 on: March 06, 2011, 04:34:40 pm »

Hehe deleted with release of new version. It was 10x10 stone hut with cellar and a 20x10 crypt. One thing was annoying - it was a 4x4 embark so traveling into it and out took a lot of time. It's way easier to embar 2x2 and build something there. (almost) Did that on 31.20 but halfway through it got attacked by a titan :/
EDIT: OMG even reclaiming is so easy when everything does not scatter everywhere...
« Last Edit: March 06, 2011, 05:26:00 pm by darius »
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #219 on: March 07, 2011, 05:54:54 am »

Hehe deleted with release of new version. It was 10x10 stone hut with cellar and a 20x10 crypt. One thing was annoying - it was a 4x4 embark so traveling into it and out took a lot of time. It's way easier to embar 2x2 and build something there. (almost) Did that on 31.20 but halfway through it got attacked by a titan :/
EDIT: OMG even reclaiming is so easy when everything does not scatter everywhere...
oh man I used Nano fort to make a 1x1 tile that way I won't have to walk 2 Embark tiles to my sites. also I wonder reclaim spam will build enough of a peasant army to protect the area at night.

the abandon site I have is a hole to the ground with a tweak path to the lair. the rooms to the left are pretty much experiments on optional death traps. one a vertex using a water wheel connected to two screw pumps with a treak hole that sucks victims into a chasm. next is a level attached to 4 wooden spikes and the room far to the right is filled with cage traps. which from past testing does not keep them cage if you leave the area. so pretty much any ideas of having a prison for bandits or a zoo of the crazy creatures that come in from the lair seem to be shut down until then.
also it seems that the site spawn loads of leather every where.
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

darius

  • Bay Watcher
  • ^^
    • View Profile
Re: DFusion - a lua based plugin system v2.8
« Reply #220 on: March 07, 2011, 08:26:48 am »

Updated DFusion to 2.8. Mostly offset fixes for 31.20/21 but also added marking of site as "cave". Although that could be slow but usually you don't need to run it more than once (basically it walks trough all tiles setting one flag- so more tiles more wait...)
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v2.8
« Reply #221 on: March 09, 2011, 07:26:57 pm »

Posting not on my main CPU but figured how to make a carry creature function using my old warp code. So far if any one uses the Xpointer on any living thing they will warp to the left side of them hold any one over open space will cause them to fall and take damage based on how deep the hole is but since the code repeats and corrects their Zlevels to the same the adventure is. The game will dribble their body until their dead(or the player go prone) which will end the carry code. Oh once my connection back I'll dump the code.
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

Thundercraft

  • Bay Watcher
    • View Profile
Re: DFusion - a lua based plugin system v2.7
« Reply #222 on: March 10, 2011, 02:16:30 am »

well good news I discover how to store items... using Tweak. All I did was check on occupancy's 14-blood which cause any item on that tile to stay there when you leave
...built a first house for my adventurer
It was 10x10 stone hut with cellar and a 20x10 crypt.
...
EDIT: OMG even reclaiming is so easy when everything does not scatter everywhere...

Holy crab apples! That's awesome! :o

Now all that's missing is a way to combine DFusion with DFMode in a way that allows swapping between Fortress Mode and Adventure Mode without all those unpleasant side effects.

I don't suppose there is a way to prevent our pets and creatures from dying after Abandon fortress, is there? (Perhaps changing the ownership or friendship before Abandon?) Or maybe a way to prevent our dwarves from leaving the site area after Abandon? (Maybe by changing the parent civilization or something beforehand?)

I'm looking forward to the day when we can "Retire" a Fortress without actually Abandoning the site. And I'm not the only one:
'Retiring' forts is a crazy popular suggestion.  Just below gunpowder and steampunk in it's perennial nature.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v2.8
« Reply #223 on: March 10, 2011, 02:56:29 am »

I remember from 40d is that when Abandoning Remove signs that they where Tamed(FLAG 26). usually that will save them from dying. hopefully I can figure out how to manually swap between Adventure mode and fort mode with out killing the fort .
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

Askot Bokbondeler

  • Bay Watcher
  • please line up orderly
    • View Profile
Re: DFusion - a lua based plugin system v2.8
« Reply #224 on: March 10, 2011, 03:43:37 am »

this is how it's done:

1 first, save your fortress as a lair using the dfusion "protect the site from item scattering" functionality
2 then run dfhack's reveal, leave it open
3 do the tricks required to swap to adventurer mode
4 fool around the world
5 return to your fortress
6 do the tricks required to swap to fortress mode
7 use runesmith to turn off the flag "is resident" on your friendly dwarves
8 before unpausing, unreveal your fortress tiles again using the reveal process you had already open


NOTE: it worked for me, but some dwarves were teleported into the unexplored depths, i haven't tried, but i suspect that if i use the fast mode of "protect the site from item scattering", only a few selected z levels are stored as a lair preventing the scattering of dwarves
also, always back up your save, it is extremely easy to screw up everything
Pages: 1 ... 13 14 [15] 16 17 ... 38