Replaced test function with OnCreature move...

develop
Warmist 2011-08-20 20:23:47 +03:00
parent 3e75ac015c
commit 97a85f274c
3 changed files with 6 additions and 5 deletions

@ -26,7 +26,7 @@ function GetTextRegion()
return nil
end
function GetRegionIn(pos)
ranges__=ranges__ or Process.getMemRanges()
ranges__= Process.getMemRanges()
for k,v in pairs(ranges__) do
--for k2,v2 in pairs(v) do
-- print(string.format("%d %s->%s",k,tostring(k2),tostring(v2)))
@ -449,7 +449,7 @@ end
function GetCreatureAtPos(x,y,z) -- gets the creature index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=engine.peek(offsets.getEx("AdvCreatureVec"),ptr_vector) -- load all creatures
for i = 0, vector:size() do -- look into all creatures offsets
for i = 0, vector:size()-1 do -- look into all creatures offsets
local curoff=vector:getval(i) -- get i-th creatures offset
local cx=engine.peek(curoff,ptr_Creature.x) --get its coordinates
local cy=engine.peek(curoff,ptr_Creature.y)

@ -21,7 +21,7 @@ function OnFunction(values)
print(string.format("%s=%x",k,v))
end
print("stack:")
for i=0,2 do
for i=0,3 do
print(string.format("%d %x",i,engine.peekd(values.esp+i*4)))
end
return onfunction.calls[values.ret] --returns real function to call
@ -40,7 +40,8 @@ end
mypos=engine.getmod("functions")
if mypos then
print("Onfunction already installed")
onfunction.patch(0x189dd6+offsets.base())
--onfunction.patch(0x189dd6+offsets.base())
onfunction.patch(0x55499D+offsets.base()) --on creature move
else
onfunction.install()
end

@ -4,7 +4,7 @@ function func.Find_Print()
end
function func.PrintMessage(msg,color1,color2)
func.f_print_pos= func.f_print_pos or func.Find_Print()
--print(string.format("%x",func.f_print_pos))
print(string.format("Print @:%x",func.f_print_pos))
debuger.suspend()
d=NewCallTable() -- make a call table
t=Allocate(string.len(msg))