Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 27 28 [29] 30 31 ... 38

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

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #420 on: September 28, 2011, 03:16:58 pm »

to answer this question
yes you can, though you need to know lua and hex editing to find those triggers. so far you can use dfusion to look up items and where they are in the map and align it to the creature and where they are on the map.
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

mstram

  • Bay Watcher
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #421 on: September 28, 2011, 06:39:18 pm »

Heh,  ok, what I should have asked ....has anyone already done it ? :)
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #422 on: September 28, 2011, 07:41:18 pm »

well no, it gives me an idea for setting up clone factories, if I can figure out how to attach a search for triggers being flip. though this might lead to melding of DFusion with DF and all types of FUN it brings.
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

mstram

  • Bay Watcher
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #423 on: September 30, 2011, 12:55:05 pm »

Ok, well after playing with dfusion, I ran the items/ print ref, and collected the names it found.

I don't see anything with a name like "lever" or "pressure plate".

I do see a few names that look like the linkable items :
  item_cagest
  item_chainst
  item_doorst
  item_floodgatest
  item_hatch_coverst
  item_gratest
  item_barst

Would plugging those items's addresses into Cheat Engine etc, be what I need to do?

Items found :


   item_cabinetst
   item_crownst
   item_weaponst
   item_anvilst
   item_glovesst
   item_coffinst
   item_millstonest
   item_backpackst
   item_armorstandst
   item_blocksst
   item_amuletst
   item_gemst
   item_gobletst
   item_liquid_miscst
   item_quernst
   item_boulderst
   item_totemst
   item_splintst
   item_plantst
   item_toyst
   item_binst
   item_tablest
   item_corpsest
   item_statuest
   item_crutchst
   item_roughst
   item_pipe_sectionst
   item_weaponrackst
   item_woodst
   item_traction_benchst
   item_scepterst
   item_corpsepiecest
   item_earringst
   item_bucketst
   item_quiverst
   item_instrumentst
   item_bedst
   item_chairst
   item_boxst
   item_helmst
   item_figurinest
   item_threadst
   item_skin_tannedst
   item_pantsst
   item_clothst
   item_smallgemst
   item_drinkst
   item_armorst
   item_foodst
   item_ringst
   item_shoesst
   item_seedsst
   item_flaskst
   item_shieldst
   item_barrelst
   item_braceletst
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #424 on: September 30, 2011, 09:45:05 pm »

oh you just remind me of a member who gave me this large flowchart of all the target wordings.
has a section on traps so maybe one could dive into that.
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

mstram

  • Bay Watcher
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #425 on: September 30, 2011, 11:49:58 pm »

Well that's a nice looking drawing..

But not very informative ;)
Logged

mstram

  • Bay Watcher
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #426 on: October 01, 2011, 01:54:43 pm »

Ok, I have it on "good authority", that I need to be looking at *buildings*, and not items :)

It seems that offsets.lua is where I would plug in a buildings_vector" value="0x1ed4d98"

It seems it needs a small lookup function to be added with values for the "offsets.find" function.

I have no idea what to plug in there.

I tried just using the exisiting items - items.select() function with myoff=offsets.getEx("Buildings") (after "adding Buildings : 0x1ed4d98" to
offsets.txt), but it wasn't happy with that.

Mike
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #427 on: October 02, 2011, 04:15:45 am »

First - you are correct you need to look into buildings. Second it's not that simple. No building data structure is known for dfusion. I'll try to make something (at least temporary)

Some clarification: Offsets.lua is used to automatically find new offsets with new df versions (almost never works fully). Adding value to offsets.txt (if you know it) is usually enough.
Found correct vector for buildings:
Code: [Select]
Buildings : 0x12C4DA8
Also onfunction trigger for levers:
Code: [Select]
onfunction.AddFunction(0x3D5886+offsets.base(),"Flip",{building="esi"})
Also some building patterns:
Code: [Select]
ptr_building={}
ptr_building.RTI={off=0,rtype=DWORD}
ptr_building.xs={off=4,rtype=DWORD}
ptr_building.ys={off=6,rtype=DWORD}
ptr_building.zs={off=8,rtype=DWORD}
ptr_building.xe={off=12,rtype=DWORD}
ptr_building.ye={off=16,rtype=DWORD}
ptr_building.ze={off=20,rtype=DWORD}
ptr_building.flags={off=24,rtype=ptt_dfflag.new(4)}
ptr_building.materials={off=28,rtype=DWORD}
ptr_building.builditems={off=228,rtype=ptr_vector}
function ptr_building.getname(self,RTI)
if RTI == nil then
return string.sub(RTTI_GetName(self.RTI),5,-3)
else
return string.sub(RTTI_GetName(RTI),5,-3)
end
end
ptr_subbuilding={}
ptr_subbuilding["building_trapst"]={}
ptr_subbuilding["building_trapst"].state={off=250,rtype=DWORD} -- atleast lever has this
ptr_subbuilding["building_doorst"]={}
ptr_subbuilding["building_doorst"].flg={off=248,rtype=WORD} --maybe flags?
ptr_subbuilding["building_doorst"].state={off=250,rtype=DWORD}
« Last Edit: October 02, 2011, 05:20:37 am by Warmist »
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #428 on: October 02, 2011, 08:18:37 am »

so now we can set up horrible science experiments and create mutants through a single flip of a switch?
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

mstram

  • Bay Watcher
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #429 on: October 02, 2011, 09:07:10 am »

> No building data structure is known for dfusion. I'll try to make something (at least temporary)

Is the buildings.cpp in dfhack of any relevance ?

>onfunction.AddFunction(0x3D5886+offsets.base(),"Flip",{building="esi"})

Where does that code go, and how do I use it?

I put it in offsets.lua, and got :

offsets.lua:3: attempt to index global 'onfunction' (a nil value)

I'm not sure where the rest of the code should go either.

offsets.lua ?

or  plugins\buildings\plugin.lua ?

What would be the function for :

Code: [Select]
offsets.new("Buildings", <?????????)
« Last Edit: October 02, 2011, 09:26:23 am by mstram »
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #430 on: October 02, 2011, 11:51:50 am »

I think warmist talking about Onfunction folder in dfhdfusion
you need to stick the second line in the onfunction/location file

the building patterns(third set of code) go to the patterns file best to stick it at the bottom so that it doesn't get mix in with anything else.
the only thing that goes into offsets is the top one.
the onfunction code suppose to set a trigger on any fliped lever to run the function you set it to.
the rest is just making a command that eithers runs on it's own after the trigger or take what triggers it and "poke at it".
I just hope this means we can build teleporters and spark space stations.

« Last Edit: October 02, 2011, 12:15:18 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

mstram

  • Bay Watcher
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #431 on: October 02, 2011, 02:58:49 pm »

I created a folder plugins\buildings, and created plugin.lua inside of that, copied from plugins\items\plugin.lua

I changed the name of  function items.select() to  function buildings.select(), but when I run it I get :
plugins/buildings/plugin.lua:88: attempt to index global 'buildings' (a nil value)

 
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #432 on: October 02, 2011, 04:55:31 pm »

hmm did you change the rest of the item.select to building.select?
it might be an issue of dfusion getting mix messages.
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

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #433 on: October 02, 2011, 05:08:38 pm »

"Buildings.<anything>" must go after line "Buildings={}". The second second sentence creates a new table to put functions/values into. Effectively what the dfusion says is that there is no table to put Select function into. Putting this into start of the file should fix it:
Code: [Select]
buildings=buildings or {} -- if there is table named "buildings" leave it alone, if not create an empty one.
The function also needs to be changed a bit (disclaimer writing before going to bed/not tested):
Code: [Select]
function buildings.select()
myoff=offsets.getEx("Buildings")
vector=engine.peek(myoff,ptr_vector)
tx,ty,tz=getxyz()
T={}
for i=0,vector:size()-1 do --this finds all item offsets that are on pointer
itoff=vector:getval(i)
xs=engine.peek(itoff,ptr_building.xs)
xe=engine.peek(itoff,ptr_building.xe)
ys=engine.peek(itoff,ptr_building.ys)
ye=engine.peek(itoff,ptr_building.ye)
zs=engine.peek(itoff,ptr_building.zs)
ze=engine.peek(itoff,ptr_building.ze)
if tx>=xs and ty>=ys and tz>=zs and tx<=xe and ty<=ye and tz<=ze then
table.insert(T,itoff)
end
end
print("Buildings under cursor:")
i=1
for _,v in pairs(T) do
RTI=engine.peek(v,ptr_building.RTI)
print(i..". "..ptr_building.getname(nil,RTI))
i=i+1
end
print("Type number to edit or 'q' to exit")
while true do
q=io.stdin:read()
if q=='q' then return end
if tonumber(q) ~=nil and tonumber(q)<i then break end
end
return T[tonumber(q)]
end
Don't remember if this works correctly but could help (generic function to edit anything that has a pattern entry)
Code: [Select]
ModPattern(itoff,ptr_building) -- first argument is offset (could be gotten with buildings.select) and second which pattern to use (could be ptr_subbuilding[name])

mstram

  • Bay Watcher
    • View Profile
Re: DFusion - a lua based plugin system v3.8
« Reply #434 on: October 02, 2011, 07:07:47 pm »

Don't we need some kind of function in the offsets.lua file too ?

offsets.new("Buildings",f_buildings)

function f_buildings
   pos=offsets.find(??????????????????????????)
.....
end
Logged
Pages: 1 ... 27 28 [29] 30 31 ... 38