SRL Archive - First Scripts

Bat Killing Script Shtoof


kenkopp69

2013-06-22 00:48:46

So I wanted to try to script. Everyone's gotta start somewhere, right? Anyway, I based from Ubutu's 'FrostChopper 4 Project Awesome' code. I put the most basic things I knew from his into mine, and compiled it to fix up the errors in coding and changed over the woodcutting into attacking. I know I'm missing parts to it, but I can't find out what it is… The point of the script was to kill the bats in the cave near Taverly (they don't damage me and are high-leveled aggros, I liked the idea). That's all - just point and click - but it only activates the antiban actions, nothing else. Could someone tell me the secret ingredient I'm missing? Thanks if someone replies :]

Here's what I have:

Program FightBats;

{==========================================================}
{Code based from 'FrostChopper 4 Project Awesome' by Ubuntu}
{==========================================================}

{$DEFINE SMART8}
{$i srl/srl.simba}
{$i SPS/SPS.simba}
{$i SRL/SRL/Misc/SmartGraphics.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
end;
end;

Procedure CheckFriends;
Var
NCx, NCy, ONx, ONy :Integer;
begin
if not LoggedIn then LoginPlayer;
if (not LoggedIn) or (InvFull) then Exit;
gametab(tab_friends);
If FindColorTolerance(NCx, NCy, 16683035, 546, 246, 722, 451, 5) Then
begin
MMouse(NCx, NCy, 5, 5);
Wait(RandomRange(1000, 2000));
end;
If FindColorTolerance(ONx, ONy, 6619135, 546, 246, 722, 451, 5) Then
begin
MMouse(ONx, ONy, 5, 5);
Wait(RandomRange(1000, 2000));
end else
begin
Wait(RandomRange(500, 1000));
end;
FTab(tab_Inv);
end;

procedure Antiban;
begin
case Random(1000) of
0: HoverSkill(skill_attack,false);
10: PickUpMouse;
20: CheckFriends;
30: RandomMovement;
40: BoredHuman;
50: ExamineInv;
60: RandomRClick;
70: begin
HoverSkill('Attack', false);
GameTab(Tab_Inv);
end;
80: Wait(5000+random(2000));
5..12: HoverSkill('random', False);
100:begin
GameTab(Tab_Stats);
Wait(3000 + Random(1500));
GameTab(tab_Inv);
end;
101: begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
FindNormalRandoms;
end;
end;
end;

Function IsAttacking: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 500, 650) > 350);
end;

Procedure Attack;
var x, y: integer;
begin
SetAngle(SRL_ANGLE_HIGH);
repeat
FindNormalRandoms;
While IsAttacking Do Wait(500+Random(50));
if (FindObjCustom(x,y,['Attack '], [7238003,4473926,3487032], 3)) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('Attack');
end;
repeat
wait(400+random(250));
AntiBan;
until false;
until false;
end;

begin
SRL_SixHourFix := True;
SetupSRL;
DeclarePlayers;
Repeat
if not LoggedIn then LoginPlayer;
Attack;
Until false;
end.

edmondc2

2013-06-22 11:26:27

hmmm

 
Begin
if FindObj(x, y, 'ttack', 4473926, 7) then
begin
GetMousePos(x, y);
Mouse(x, y, 3, 3, false);
WaitOption('ttack', 1500);// In case of lag and miss clicks
end else //you need the else because of your if... then.. else statement.
Repeat // This will just sort of be a failsafe incase
wait(4000 + random(200));
if FindObj(x, y, 'ttack', 4473926, 7) then
begin
GetMousePos(x, y);
Mouse(x, y, 3, 3, false);
WaitOption('ttack', 1500);
end else
Writeln('Couldn't Find Bats Logging Off!');
LogOut;
TerminateScript;
Until false
End;

Hope it Helps somewhat idk