Page 3 of 3

Re: using MM to pass information to addon?

Posted: Fri Aug 03, 2012 3:12 am
by lisa
you will probably find if you change the value it will update automatically back, in order to stop the updates you would need to stop the function that updates the value.
Like how the attack works now or swimhack.
It removes the code that updates the value and then once you are done with it then puts the function back the way it was.

It can get complicated but I think I might see where you are going with it, for instance farming to not need a reseter.
I seriously doubt you could do honor parties like this as it would have checks for party member lvl aswell.

Re: using MM to pass information to addon?

Posted: Fri Aug 03, 2012 3:33 am
by silinky
yeah, this would be a possibility also.
for now i am only interested about the theory behind this so i could be able to find these things alone and not be forced to wait for the experts to mouth-feed me with every trivial task :)
lisa you have a PM also please check it :)

Re: using MM to pass information to addon?

Posted: Sat Aug 04, 2012 3:35 am
by silinky
rock5 wrote:You could create a bot function or waypoint onload code that keeps checking if the player has a target. If so, the easy solution would be to change a variable in game, eg

Code: Select all

RoMScript("} targetdistance = "..distance.." a={")
Then just have the addon use that value when it's there.

But to get faster speed than using a RoMScript you could write to a macro instead, eg.

Code: Select all

writeToMacro(macroNum, distance)
Then you can have the addon read the macro using GetMacroInfo function. Of course you would have to make sure they use the same macro.
i finally reached the point when this has made sence, and i could use successfully the first one, but this does not work:

Code: Select all

writeToMacro(7, targetdistance)
targetdistance is printed in mm window so it is ok.
is there anything i should do for macro slot 7?
should there be an empty macro created? or is it a problem if it already has some value? has to be clear?

Re: using MM to pass information to addon?

Posted: Sat Aug 04, 2012 4:03 am
by lisa
my guess is you missed this step
Then you can have the addon read the macro using GetMacroInfo function. Of course you would have to make sure they use the same macro.

Re: using MM to pass information to addon?

Posted: Sat Aug 04, 2012 6:09 am
by silinky
oh, no, i did this step :)
and when i write smtg in that macro slot, the getmacroinfo is printing my macro text.

it's just that MM does not update that text.
and i cannot figure out why bc it gives me no error message

Re: using MM to pass information to addon?

Posted: Sat Aug 04, 2012 6:35 am
by rock5
It doesn't update itself. You have to keep updating it. Here's an example in a waypoint onload.

Code: Select all

<waypoints>
<onLoad>
repeat
    player:update()
    local target = player:getTarget()
    if target then
        local dist = distance(player.X,player.Z,target.X,target.Z)
        writeToMacro(7, dist)
    else
        writeToMacro(7, nil)
    end
    yrest(200)
until false
</onLoad>
</waypoints>
So while this waypoint file is running, when you read the macro with your addon, it will have an updated distance to the target or nil if you don't have a target.

Re: using MM to pass information to addon?

Posted: Sat Aug 04, 2012 6:48 am
by silinky
i have it in a loop :)
i think something else is wrong there, the function just does nothing in my wp.

i wil try to get a gode that updates it, maybe this one you posted and try to find out what is keeping it from working

Re: using MM to pass information to addon?

Posted: Mon Aug 13, 2012 5:07 pm
by silinky
progress is going OK, but i need another info, if available.
how can i check an object's buff? before targeting. so me targeting it depends on what buffs it has.
thx :)

Re: using MM to pass information to addon?

Posted: Mon Aug 13, 2012 6:04 pm
by lisa
you need to create a pawn of the object and that is pretty much it.

Code: Select all

local mob = CPawn(obj.Address)
if mob:hasBuff(buffname, count) then
--do stuff
end

Re: using MM to pass information to addon?

Posted: Tue Aug 14, 2012 1:40 am
by silinky
thank you lisa :)
i didn't know that i could do that.

Re: using MM to pass information to addon?

Posted: Tue Aug 14, 2012 1:57 am
by lisa
In a nut shell, if you use any code that uses the objectlist,like findNearestNameOrId, it will have these variables.

Code: Select all

		self.Address = ptr;
		self.Name = "<UNKNOWN>";
		self.Id = 0;
		self.Type = PT_NONE;
		self.X = 0.0;
		self.Y = 0.0;
		self.Z = 0.0;
If you want any more info than that from a mob/npc/obj then you need to make it a pawn using it's address, once you do that then you have all the info in pawn.lua.
Not going to post it as it is pretty long and I am sure you know how to have a look in the file =)

Re: using MM to pass information to addon?

Posted: Mon Sep 24, 2012 3:27 pm
by Bubi
Hi Lisa,
I used the userfunction "pawnlog" and got the info i want. Now I try to write a different value to the memory. I looked at the swimhack userfunktion but its not working that way for me Image

thats the pawnlog I got

Code: Select all

Bits,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,1,0,0,0, XXXX
thats what I want to write to memory

Code: Select all

Bits,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,0,0
so in Code:

Code: Select all

if (bitAnd(inp,0x8000000) and bitAnd(inp,0x2000000)) then 
???
memoryWriteIntPtr(getProc(), obj.Address, addresses.pawnAttackable_offset, active);
""0x4000000=0"" 
???
end
Thanks for your help

Re: using MM to pass information to addon?

Posted: Mon Sep 24, 2012 3:40 pm
by rock5
I did something similar recently so I know how to do it.

If inp is the byte that you read from memory and 0x8000000 is the bit you want to add or remove then.

To add a bit you can just do

Code: Select all

inp = bitOr(inp,0x8000000)
It will only add the bit if it doesn't already exist.

To remove a bit you can just minus the value but you have to check that is exists first

Code: Select all

if bitAnd(inp,0x8000000) then
    inp = inp - 0x8000000
end
You can also add the bit in this way too

Code: Select all

if bitAnd(inp,0x8000000) then
    inp = inp + 0x8000000
end
Then just rewrite the byte back to memory.

Hope that helps.

Re: using MM to pass information to addon?

Posted: Mon Sep 24, 2012 4:06 pm
by Bubi
Hi Rock5,
thanks allot for the fast answer.
Just one more noob question.
rock5 wrote:Then just rewrite the byte back to memory.
how to rewrite back to memory? Image

Re: using MM to pass information to addon?

Posted: Mon Sep 24, 2012 4:20 pm
by rock5
Writing is similar to reading but I see you made a mistake in that too. So I'll just point you to the wiki.
http://www.solarstrike.net/wiki/index.p ... _Functions
Note: Some functions are for pointers and others are not. Learn the difference.

Re: using MM to pass information to addon?

Posted: Mon Sep 24, 2012 4:23 pm
by Bubi
rock5 wrote:Note: Some functions are for pointers and others are not. Learn the difference.
I will Image