rj
2012-11-23 16:14:54
Hi, I have managed to write a script that attacks a skeleton, waits to get out of combat, look for the bone color and picks up the gold charm. Now I am having a couple problems:
1) The bot spam clicks the hell out of the skeleton until my charactor attacks it
2) the bot keeps doing the looting procedure over and over instead of looting, then attacking another skeleton
Here is my script:
1) The bot spam clicks the hell out of the skeleton until my charactor attacks it
2) the bot keeps doing the looting procedure over and over instead of looting, then attacking another skeleton
Here is my script:
// fill out const's
const
NPC = 1121869;
loot = 14079706;
tolerence = 12;
time = 1; // in seconds
rwait = 100;
tleft = 41;
tright = 44;
bleft = 426;
bright = 280;
var
charm: Integer;
procedure PickUp;
var
X, Y: Integer;
begin
WriteLn('Looking for bones...');
if FindColorTolerance(X, Y, loot, 223, 114, 388, 290, 15) then
begin
WriteLn('Found bones!');
Movemouse(x, y);
Wait(120 + Random(80));
ClickMouse(x, y, mouse_Right);
end;
WriteLn('Looking for charm...');
Wait(1100);
if FindBitmapToleranceIn(charm, X, Y,161, 86, 420, 252, 85) then
begin
Movemouse(X, Y);
WriteLn('Found charm!');
Wait(500);
ClickMouse(X, Y, mouse_Left);
Wait(1820 + Random(80));
end;
end;
procedure CheckCombat;
var
X, Y: Integer;
Begin
if FindColorTolerance(X, Y, 49499, 244, 150, 283, 219, 15) then
begin
ClearDebug;
Wait((time+500) + Random(rwait));
WriteLn('Waiting to get out of combat . . .');
CheckCombat;
PickUp;
End;
End;
procedure ClickNPC;
var
X, Y: Integer;
begin // kill npc
WriteLn('Attacking skeleton...');
if FindColorTolerance(X, Y, NPC, tleft, tright, bleft, bright, tolerence) then
begin
MoveMouse(X, Y);
Wait(20 + Random(50));
ClickMouse(X, Y, Mouse_Left);
WriteLn('Attacked skeleton!');
CheckCombat;
end;
end;
begin
charm := BitmapFromString(31, 12, 'meJyTUdeWIQU5TPgPRyRpJNJkBj' +
'CgrvnIJkNEkNnUMpwMvVN3HIMj/IZjDXOscQFxCcRMiDdxmY/scrQ' +
'wxx8XcMPR2HiCBZmLi40ZJnAvUNdwBiSAJ9iJNxwevGiOx59mMJMl' +
'VnHMdIvf8WjKiBGnEQIAUtQGXA==');
repeat
ClearDebug;
ClickNPC;
until False;
FreeBitmap(charm);
end.
procedure CheckCombat;
begin
Wait((time * 500) + Random(rwait));
WriteLn('Waiting for loot...');
Wait((time * 500) + Random(rwait));
PickUp;
end;
procedure ClickNPC;
var
X, Y,cx,cy: Integer;
begin // kill npc
WriteLn('Attacking skeleton...');
if FindColorTolerance(X, Y, NPC, tleft, tright, bleft, bright, tolerence) then
begin
MoveMouse(X, Y);
Wait(2000 + Random(50));
ClickMouse(X, Y, Mouse_Left);
getmousepos(cx,cy)
if findcolortolerance(x, y, 65535, cx -25, cy -25, cx+ 25, cy +25, tolerence)then
ClickNPC;
else
WriteLn('Attacked skeleton!');
CheckCombat;
end;
end;
begin
charm := BitmapFromString(31, 12, 'meJyTUdeWIQU5TPgPRyRpJNJkBj' +
'CgrvnIJkNEkNnUMpwMvVN3HIMj/IZjDXOscQFxCcRMiDdxmY/scrQ' +
'wxx8XcMPR2HiCBZmLi40ZJnAvUNdwBiSAJ9iJNxwevGiOx59mMJMl' +
'VnHMdIvf8WjKiBGnEQIAUtQGXA==');
repeat
ClearDebug;
ClickNPC;
until False;
FreeBitmap(charm);
end.