firstly I am completely new to the scripting scene but i have been around bots since 2005 in runescape classic. I have always thought it was amazingly cool to be able to manipulate the game to do something that you want, but I just have not had the time until recently to try and script on my own.

That being said I have been browsing and reading the forums over the last couple of days and I just started to formulate my first script a auto fight for cows!
I was able to get a working TPA that would click on the cows but I ran into a little problem were the bot would keep clicking even if I was currently busy fighting. Now I am no botting expert but that would seem a little weird if some one was spam clicking cows around me. So then I wanted the bot to wait a bit before the next click so i used the wait option which was okay but sometimes I would kill the cow faster or slower then what I had the wait set for. So my next step was to try and detect the health bar and wait for it to go and that was okay other then I didn't know how to make it wait until after the hp bar was gone to move onto the fighting procedure. So I got a little discouraged took a break then starting looking through some old scripts which is alittle confusing but I came across

"Function IsFighting: Boolean;
var
PBox: TBox;
Begin
PBox := IntToBox(238, 169, 279, 217);
Result := (AveragePixelShift(PBox, 250, 350) > 15);
writeln('k') "

which I assume is looking for the hp bar above your head I was hoping to find out what it actually means?

anyways so I implemented that into my little cow killer script which is probably terrible but its my first go so yeah.


Program testP07;

{$I SRL/SRL.Simba}
{$I P07Include.Simba}

//LOGIN INFO STUFF
Procedure P07_DeclarePlayer;
Begin
P07_PlayerName:='username';
P07_PlayerPass:='password';
End;
const
player_mom= 14328641;//monster color


Function IsFighting: Boolean;
var
PBox: TBox;
Begin
PBox := IntToBox(238, 169, 279, 217);
Result := (AveragePixelShift(PBox, 250, 350) > 15);
writeln('k')
End;
Procedure fight;
var
x, y:integer;
begin
if FindColorTolerance(X, Y, player_mom, 6, 0, 514, 484, 5) then
begin
mmouse(x, y,1,1);
wait(randomrange(200,400))
if (P07_IsUpTextMultiCustom(['cow', 'attack'])) then
clickmouse (x, y, mouse_left);
Wait(RandomRange(800, 1200));
While IsFighting do
Wait(RandomRange(400, 800));
If not IsFighting then
end;
end;
Begin

P07_DeclarePlayer;
SetupP07Include;
ActivateClient;
Wait(2000);
If (Not P07_LoggedIn) Then
P07_LogInPlayer;
repeat
fight;
until(false);

End.

I was hoping someone could maybe point me in the right directions with a tutorial or maybe just give me some tips about the script anyways any help is greatly appreciated
and I am loving the community so far and hope I get to know some of you guys better.

cheers

Big