Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 22 23 [24] 25 26 ... 38

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

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #345 on: July 07, 2011, 04:49:42 pm »

Sweet looks like I could get into a jump start on giving companions armor.
or work on a pack mule command.
Though I guess I need to have it select the creature with the special back pack and then store the item in said back pack.
wait this giving me an error
Code: [Select]
plugins/itempatterns.lua:lua79: '=' expected near '+'
plugins/itempatterns.lua:14: attempt to index global 'ptt_dfflag' (a nil value)
stack traceback:
       init.lua:6: in function <init.lua:4>
       plugins/itempatterns.lua:14: in main chunk
       [C]: in function 'xpcall'
       init.lua:11: in function 'dofile'
       plugins/common.lua:408: in main chunk
       [C]: in function 'xpcall'
       init.lua:11: in function 'dofile'
       init.lua:19: in main chuck
all the commands don't work.
« Last Edit: July 07, 2011, 06:06:31 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

thatkid

  • Bay Watcher
  • <Servibot> thatkid, swag percentiles: 94
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #346 on: July 07, 2011, 10:15:52 pm »

I can't seem to duplicate whatever was causing Dfusion to not work with wine the other day, as it's working fine now.
Logged
Fame is a vapor. The only earthly certainty is oblivion.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #347 on: July 08, 2011, 02:32:00 am »

so you got 3.6 working or 3.5 or 3.4?
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

ribosom

  • Bay Watcher
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #348 on: July 08, 2011, 07:18:32 am »

Sweet looks like I could get into a jump start on giving companions armor.
or work on a pack mule command.
Though I guess I need to have it select the creature with the special back pack and then store the item in said back pack.
wait this giving me an error
Code: [Select]
plugins/itempatterns.lua:lua79: '=' expected near '+'
plugins/itempatterns.lua:14: attempt to index global 'ptt_dfflag' (a nil value)
stack traceback:
       init.lua:6: in function <init.lua:4>
       plugins/itempatterns.lua:14: in main chunk
       [C]: in function 'xpcall'
       init.lua:11: in function 'dofile'
       plugins/common.lua:408: in main chunk
       [C]: in function 'xpcall'
       init.lua:11: in function 'dofile'
       init.lua:19: in main chuck
all the commands don't work.

I have the same problem with v3.6

DF_31_25_win

XP 32bit

edit: also -f doesnīt work.
I donīt have the error message right now because Iīm not at home, but it stops at 'CreatureGloss' or something like that.
« Last Edit: July 08, 2011, 07:26:07 am by ribosom »
Logged

darius

  • Bay Watcher
  • ^^
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #349 on: July 08, 2011, 07:58:45 am »

 :-[
i forgot to fix += somewhere in code before releasing.

Change self.en+=engine.sizeof(self.type) into self.en=self.en+engine.sizeof(self.type) in patterns.lua for now...
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #350 on: July 08, 2011, 11:16:23 am »

sweet it works, I have work up a simple edit companions items command, and learn I can just simply type the function and the utility would call to it with out any hassle.
Saves me need to stick the same commands in the file.
though now I wonder is it possible to give an item to someone(that and getting the pointer to select the creature which then find their items so I can set it on fire)?
Code: [Select]
function items.trade_adv() --only allows access to edit companions items no trading.
vec=engine.peek(offsets.getEx("CreatureVec"),ptr_vector)
local trgs=selectcomp()
for k,v in pairs(trgs) do
items.edit(items.select_creature(v))
end
end

function selectcomp()
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("AdvCreatureVec")
  vector=engine.peek(myoff,ptr_vector) --standart start
  for i=0,vector:size()-1 do --check all creatures
     local off
     off=vector:getval(i)
     lfollow=engine.peek(off,ptr_Creature.followID) -- get target creatures "now following ID"
     if lfollow ~=0xFFFFFFFF then --if its set
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
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 v3.6
« Reply #351 on: July 08, 2011, 01:11:48 pm »

Updated to 3.7 fixing that bug, also added interactive console thingy... (basically a line by line lua interpreter)
Too lazy/tired/hot to update first page and answer questions...
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #352 on: July 08, 2011, 07:09:46 pm »

oh I just switch over to flash develop for understanding which line was broken.

here some 3.6 commands for lighting up enemies by just looking at them.
Code: [Select]
function items.wepbrn2(offset)
flg=engine.peek(offset,ptr_item.flags)
flg:set(22,1)
engine.poke(offset,ptr_item.flags,flg)
end
function items.point_adv()
vec=engine.peek(offsets.getEx("CreatureVec"),ptr_vector)
indx=GetCreatureAtPos(getxyz())
items.wepbrn2(items.select_creature(vec:getval(indx)))
end

okay this command doesn't work and will just crash the game.
Code: [Select]
function items.cross(offset)
Advitem=engine.peek(vec:getval(0),ptr_Creature.itemlist1)
Advitem2=engine.peek(vec:getval(0),ptr_Creature.itemlist2)
compitem=engine.peek(offset,ptr_Creature.itemlist2)
compitem2=engine.peek(offset,ptr_Creature.itemlist1)
engine.poke(vec:getval(0),ptr_Creature.itemlist2,compitem)
engine.poke(vec:getval(0),ptr_Creature.itemlist1,compitem2)
end
« Last Edit: July 09, 2011, 05:43:03 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

The Master

  • Bay Watcher
  • A respectable sort of psychopath
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #353 on: July 09, 2011, 07:47:22 pm »

help? If I start Dwarf Fortress THEN DFusion, it gives me an unauthorized request error and crashes Dwarf Fortress simultaneously. It won't detect the game AT ALL if I start DFusion first then Dwarf Fortress.
Logged
Holy jesus I thought I was ready but nothing could have prepared me for this
Hush, little Asea, don't you cry.
If he notices we'll surely die!
You. Made. Asea. CRY.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #354 on: July 09, 2011, 07:49:32 pm »

which version of Dwarf fortress and Dfusion are your currently using?
the new ones should just send an error and not crash.
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 v3.6
« Reply #355 on: July 10, 2011, 02:25:35 am »


okay this command doesn't work and will just crash the game.
Code: [Select]
function items.cross(offset)
Advitem=engine.peek(vec:getval(0),ptr_Creature.itemlist1)
Advitem2=engine.peek(vec:getval(0),ptr_Creature.itemlist2)
compitem=engine.peek(offset,ptr_Creature.itemlist2)
compitem2=engine.peek(offset,ptr_Creature.itemlist1)
engine.poke(vec:getval(0),ptr_Creature.itemlist2,compitem)
engine.poke(vec:getval(0),ptr_Creature.itemlist1,compitem2)
end
Actually i have no idea how itemlist1 is used :/ so try without it and also if you are doing anything with pointers (in this case you are :) ) crash sometimes could be avoided by adding:
Code: [Select]
debuger.suspend()
<... your code >
debuger.resume()
Debuger lib (in dfusion) is undocumented and mostly crashes DF but this should be relatively safe.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #356 on: July 10, 2011, 02:50:12 am »


okay this command doesn't work and will just crash the game.
Code: [Select]
function items.cross(offset)
Advitem=engine.peek(vec:getval(0),ptr_Creature.itemlist1)
Advitem2=engine.peek(vec:getval(0),ptr_Creature.itemlist2)
compitem=engine.peek(offset,ptr_Creature.itemlist2)
compitem2=engine.peek(offset,ptr_Creature.itemlist1)
engine.poke(vec:getval(0),ptr_Creature.itemlist2,compitem)
engine.poke(vec:getval(0),ptr_Creature.itemlist1,compitem2)
end
Actually i have no idea how itemlist1 is used :/ so try without it and also if you are doing anything with pointers (in this case you are :) ) crash sometimes could be avoided by adding:
Code: [Select]
debuger.suspend()
<... your code >
debuger.resume()
Debuger lib (in dfusion) is undocumented and mostly crashes DF but this should be relatively safe.
using it causes all items your holding to disappear then the game crash. Having the command flip where tries to take the item from the creature does nothing.
now I guess I could try to recreate the crash using the companion command to see if it's a pointer issue but really I guess if I broke DF then I done something right in coding.
Or... give up on trading for it's way out of my reach and try recreating spells. given I need to make a select "Rune" command and have it check if one any item is made of this material and any of the flags on it was triggered.
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 v3.6
« Reply #357 on: July 10, 2011, 02:56:15 am »

You could try exchanging two items...

Code: [Select]
Advitem=engine.peek(vec:getval(0),ptr_Creature.itemlist2)
it=engine.peekd(Advitem:getval(0)) -- first item
compitem=engine.peek(offset,ptr_Creature.itemlist2)
it2=engine.peekd(compitem:getval(0))
engine.poked(compitem:getval(0),it)
engine.poked(Advitem:getval(0),it2)
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFusion - a lua based plugin system v3.6
« Reply #358 on: July 10, 2011, 03:12:35 am »

nah didn't work.
looks like the game doesn't like the idea of someone taking an item from their pocket and giving it to someone else.
my other plan is to see if one could just drop the item on the ground and give it to someone.
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 v3.8
« Reply #359 on: July 10, 2011, 05:43:43 am »

Glorious day everyone. After months (or year(s)) of development I finally finished triggers plugins (although now it kinda does not match its name). Run once to install and second time for a menu. It allow calling DF functions, currently there is only print but more to come later (e.g. create item or creature and so on...). Finding locations for functions is a pain but it gives us ultimate power - control over DF with its own functions :)

To use in code (after triggers got installed) use this:
Code: [Select]
if engine.getmod("triggers_main") then
loadTriggers()
FILE="A" --work around for now... will split functions and its menu later
dofile("plugins/triggers/functions.lua") -- this is where the magic lies
func.PrintMessage("Oh such a nice wheather here.",6,1) -- last two are color and intensity
FILE=nil
else
print("Error: triggers plugin must be installed to run this!")
end
Logged
Pages: 1 ... 22 23 [24] 25 26 ... 38