Hi.
I would like to create targeting in my bot. Unfortunately I have some problems with that.
That is a code what I found:
Code:
procedure Attack(name:string;typeof:string;id:integer);
var
i,target,attacking:integer;
nazwa:String;
PacketBuffer: array [0..200] of byte;
ProcessID: Cardinal;
begin
for i:=1 to 149 do
Begin
nazwa:=MemReadString(BATTLELIST_start+i*156+Distance_Name);
if ((nazwa=name) and (MemReadInteger(BATTLELIST_start+i*156+Distance_IsVisible)<> 0)) then
begin
if typeof='name' then target:=MemReadInteger(BATTLELIST_start+i*156+Distance_ID);
if typeof='id' then target:=MemReadInteger(BATTLELIST_start+id*156+Distance_ID);
end;
end;
MemWriteInteger(Target_ID,target,SizeOf(target));
attacking:=MemReadInteger(Target_ID);
GetWindowThreadProcessId(FindWindow('TibiaClient',Nil), @ProcessID);
packetBuffer[0] := $05;
packetBuffer[1] := $00;
packetBuffer[2] := $A1;
CopyMemory(@packetBuffer[3], @attacking, 4);
SendPacket(ProcessID, @PacketBuffer, TRUE, FALSE);
end;
The problem is that I don't know how could I make it work. I should make a button, but I don't know what should I write there.
At this moment it looks like that:
attack ('Goblin', 'monster', 1);
Do not ask me why 'monster', and why '1' I was just trying...