Simba Code:
//This script kills goblins in lumbridge, It will even walk back if you die. Give me feedback in the forms.
program GoblinKiller;
{.include SRL/SRL/Misc/Smart.scar}
{.include SRL/SRL.scar}
{$i sps/sps.simba}
{$i SRL/SRL/Misc/stats.simba}
{$i SRL/SRL/misc/paintsmart.scar}
{.include SRL/SRL/Skill/Fighting.scar}
Var
ChangePlayerEveryR, BreakEveryR, BreakForR, LastBreaked, LastSwapped, Location, x, y, TimeLast, Time, bones, i, attackedsinceburried, bonesburried, timespentb, TimeLastPainted, z : Integer;
Lumbridge, Goblins1, Goblins2, Goblins3: TPoint;
WalkGoblins: TPointArray;
Colours, BoneColours, PlayersToUse : TIntegerArray;
Ver, CurStatus : String;
DoneAntiban, PermissionToLocate, NoMoreBones, PtoLB, LootBones, JustLootBones : Boolean;
Const
Version = 4;
NCPColour1 = 4363920; //If the script won't fight the goblins then change these
NCPColour2 = 8029837;
NCPColour3 = 5994344;
NCPColour4 = 6516083;
WaitTime = 2000; //Wait Time before attacking another NCP
Tolerance = 3; //Colour Tolerence
HowOften = 0; //How often in seconds should it check the location? If it gets lost a lot lower this, if it is slow and is always checking location increase this
INeedHelp = False; //Do you need help setting this script up?
SRLStats_User = 'IDoNotHaveAnAccount'; // Your SRL Stats ID (If you dont have one then just leave it as it is)
SRLStats_Password = '12345abc'; // Your SRL Stats Password (If you dont have one then just leave it as it is)
TimeSpentBurrying = 10; //How much of the time should be spent burrying bones? Scale 1 to 10
ChangePlayerEvery = 60; //How often should it swap players +/-5
BreakEvery = 30; //Minutes +/-5
BreakFor = 10; //Minutes +/-5
ReusePlayers = True; //Once all the players have been used should it start again or end?
BoneCol1 = 9343124;
BoneCol2 = 11777723;
procedure DeclarePlayers;
begin
LootBones := True; //Loot and bury bones?
JustLootBones := True; //Just loot and bury bones? (no combat) For an explanation of why these aren't constants look here: [url]http://villavu.com/forum/showthread.php?p=863322[/url]
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :=''; //use " if you are getting ~
Players[0].Pass :='';
Players[0].Nick :='';//3-4 phrase from your name Ex. "ownage" = "nag"
Players[0].Active := True;
end; //no editing required below here...
Procedure SetBitmaps;
begin
bones := BitmapFromString(21, 18, 'meJx9k1lLQmEQhqVf4g8oiCKIbo' +
'wguu0i2mihbF9tQyRsEdO0PbHEss0WWwxLDGm/if5WDwwMH+dUMBy' +
'G+Wbe953lVLoaKlz1la6G8po6sbLq2hKHIx4/HBubwtGgmaBGodSa' +
'CFQdHV96vX4cp7NcIgr1j0kadnGRDQRWpZzv5dV9LJbUV4ESSYjXw' +
'qenj9u7/MlJBvF+f6DXPSjxQuHt7Ox6fSMWDEZ9vsWJiRmC0qYY+A' +
'eH6c3NOKQLi8H5+WW+pgAwpRDM5pZ2iYMJUTi8wZPHM4eZCrU2my1' +
'EIlsqRuIYdAQHBkdlzjc3j5YesWLxEwpBlioxWgZzaGhcM9/fv0HY' +
'208hFSeff3l9+0Ihc7BgijEKxcTJ5Yqp1Dm9JJOnmUzu4fFZZPf1D' +
'5PJ6IizFOIQ4Wst88eHiHaYA5msXmRPT3sxBKyE1nlNJI7T57cQ0S' +
'b6pQvZHbymNlpg/jgjI5Mzsz58EnZ2E/BChG8/G20E2dG1Hab6a9c' +
'YCs1jFtMrZYAwWqatJtrk8u1Hi7alpVBHZ4+Um2n6v8jhmbVsiplw' +
'twijX6WWqtIql/0HNMvZCNe7vb3HqBsbm/SPU1K7bwKKcnYEdWtbp' +
'1n+F6kFTdYHe1e328JuB/kBYKY/7Q==');
end;
Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer); //Thanks to BobboHobbo
var
mx, my, Pic, I, B, H, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
for I := 0 to High(TP) do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,8388736);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;
Procedure Paint;
begin
If((GetTimeRunning-TimeLastPainted)>5000) then
begin
PrintOnSmart(['Status:', CurStatus ], Point(42, 45), 16695040);
PrintOnSmart(['this script was written by putonajonny'], Point(270,359),16695040);
PrintOnSmart(['Time Running (Perodically Updated)',TimeRunning],Point(563,424),16695040);
TimeLastPainted := GetTimeRunning
end;
end;
function FindHPBars(Sx, Sy, x1, y1, x2, y2: Integer): TBoxArray; //this function is an exact copy of FindAllHPBars except the colours needed changing
var
a, b : TPointArray;
ATPA : T2DPointArray;
H, I : Integer;
begin
FindColorsSpiralTolerance(Sx, Sy, a, 524473, x1, y1, x2, y2, 0);
FindColorsSpiralTolerance(Sx, Sy, b, 51867, x1, y1, x2, y2, 0);
ATPA := TPAToATPAEx(CombineTPA(a, b), 55, 7);
H := High(ATPA);
SetLength(Result, Length(ATPA));
for I := 0 to H do
Result[i] := GetTPABounds(ATPA[i]);
end;
function GetHits(Sx, Sy, x1, y1, x2, y2: Integer): TIntegerArray; //this function is an exact copy of GetHitsIn but i needed to make it call FindHPBars not FindAllHPBars
var
E: Extended;
I, H: Integer;
TBA : TBoxArray;
begin
TBA := FindHPBars(Sx, Sy, x1, y1, x2, y2);
SetArrayLength(Result, GetArrayLength(TBA));
H := High(TBA);
for I := 0 To H Do
begin
E := CountColorTolerance(56488, TBA[i].x1, TBA[i].y1, TBA[i].x2, TBA[i].y2, 43) / 60;
Result[i] := Round(100 * E);
end;
end;
function IsFighting(Tolerance : Integer) : Boolean; //My function
var
Hits : TIntegerArray;
HP : Integer;
begin
Result := False
Hits := GetHits(253, 99, 0, 0, 764, 502);
if GetArrayLength(Hits) = 0 then
Exit;
HP := HPPercent
Result := ((HP-Tolerance) < Hits[0]) and ((HP+Tolerance) > Hits[0]);
if (GetArrayLength(Hits) > 1) and (not Result) then
Result := ((HP-Tolerance) < Hits[1]) and ((HP+Tolerance) > Hits[1]);
end;
Procedure CheckVersion;
Begin
CurStatus := 'Checking that you are running the most recent version'
Ver := GetPage('http://goblinkiller.webuda.com/Ver');
If Version = StrToInt(Ver) then
begin
WriteLn('You are using the most up to date version -Thank you');
end else
begin
If Version > StrToInt(Ver) then
begin
WriteLn('**You seem to be useing some sort of beta version, be careful')
end else
begin
ClearDebug;
WriteLn('Please Update This Script, opening web page...');
OpenWebPage('http://goblinkiller.webuda.com/Redirect');
TerminateScript; //Comment out this to use this version anyway
end;
end;
End;
Procedure CheckRandoms;
begin
CurStatus := 'Checking for Randoms'
Paint;
FindNormalRandoms;
If Not(LoggedIn) Then
begin
WriteLn('I think we failed a random - I will just Check');
LoginPlayer;
FindNormalRandoms;
If Not(LoggedIn) Then
begin
WriteLn('Client has Logged Out So Probably Failed a Random - Terminating Script');
TerminateScript;
end
end;
end;
Procedure CheckLocation;
begin
If((GetTimeRunning<60000) or ((GetTimeRunning-TimeLast)>HowOften*1000) or (PermissionToLocate)) then
begin
CurStatus := 'Checking Location'
Paint;
Wait(4000+Random(2000))
Location := 2;
if (SPS_PosOnMM(Lumbridge)) then
Location := 0; //lumbridge
if (SPS_PosOnMM(Goblins1)) or (SPS_PosOnMM(Goblins2)) or (SPS_PosOnMM(Goblins3)) then
Location := 1; //Goblins
TimeLast := GetTimeRunning
end;
end;
Procedure WalkToGoblins;
begin
CurStatus := 'Walking to Goblins'
Paint;
WalkGoblins := [Point(4708, 3767), Point(4733, 3767), Point(4753, 3761), Point(4759, 3743), Point(4748, 3723),
Point(4731, 3707), Point(4717, 3693), Point(4710, 3676), Point(4698, 3677), Point(4675, 3674),
Point(4648, 3678), Point(4625, 3675), Point(4598, 3677), Point(4580, 3676), Point(4565, 3676), Point(4565, 3650)]
If(SPS_WalkPath(WalkGoblins)) then
WriteLn('At Goblins');
end;
Procedure RectifyLocation;
begin
CurStatus := 'Rectifying Location'
Paint;
Mouse(254, 309, 10, 5, true);
Wait(250+Random(250));
Mouse(544, 24,5,5,true);
If (FindSymbol( x, y, 'fishing shop')) then //attempt 1
begin
WriteLn('using fishing shop to fix location')
CurStatus := 'using fishing shop to fix location'
Paint;
Wait(500+Random(200));
x := x-43
y := y-5
Mouse(x, y,5,5,true);
Wait(2000+Random(2000));
end;
If (FindSymbol( x, y, 'dungeon')) then //attempt 2
begin
WriteLn('using dungeon to fix location')
CurStatus := 'using dungeon to fix location'
Paint;
Wait(500+Random(200));
x := x+66
y := y+7
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;
If (FindSymbol( x, y, 'fish')) then //attempt 3
begin
WriteLn('using fishing spot to fix location')
CurStatus := 'using fishing spot to fix location'
Paint;
Wait(500+Random(200));
x := x+59
y := y+68
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;
If (FindSymbol( x, y, 'water')) then //attempt 4
begin
WriteLn('using water to fix location')
CurStatus := 'using water to fix location'
Paint;
Wait(500+Random(200));
x := x-45
y := y+87
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;
If (FindSymbol( x, y, 'churn')) then //attempt 5
begin
WriteLn('using churn to fix location')
CurStatus := 'using churn to fix location'
Paint;
Wait(500+Random(200));
x := x-52
y := y+108
Mouse(x, y,2,2,true);
Wait(2000+Random(2000));
end;
PermissionToLocate := True
CheckLocation;
case location of //final attempt
2: begin
Mouse(626,152,2,2,True)
Wait(2000+Random(1000));
end;
end;
PermissionToLocate := True
CheckLocation;
case location of
2:
begin
Writeln('Location Not Recognised - Lets Teleport Home')
GameTab(tab_Magic)
Wait(1000+Random(500))
Mouse(575, 230, 5, 5, true)
Time := GetTimeRunning;
Repeat
Wait(2000+Random(500));
If((GetTimeRunning - Time) > 15000) and (Not SPS_PosOnMM(Lumbridge)) then
begin
GameTab(tab_Magic)
Wait(1000+Random(500))
Mouse(575, 230, 5, 5, true)
Time := GetTimeRunning;
end;
Until(SPS_PosOnMM(Lumbridge));
PermissionToLocate := True;
Wait(2000+Random(1000))
end;
end;
end;
Procedure Attack;
begin
CurStatus := 'Attacking'
Paint;
If (FightNPC(Colours, Tolerance, WaitTime)) then
stats_IncVariable('Monsters Killed', 1)
else
SetAngle(True);
DoneAntiban := False;
attackedsinceburried := attackedsinceburried + 1
If (attackedsinceburried>(10-TimeSpentBurrying)) then
begin
PtoLB := True;
attackedsinceburried := 0
end;
end;
Procedure AntiBan;
begin
CurStatus := 'Antiban'
Paint;
If Not(DoneAntiban) then
begin
x := Random(51)
case x of
0: HoverSkill('Attack', False); //Beautiful Antiban
1: HoverSkill('Strength', False);
2: HoverSkill('Defence', False);
3: HoverSkill('hitpoints', False);
4: HoverSkill('smithing', False);
5: HoverSkill('woodcutting', False);
6: HoverSkill('firemaking', False);
7: HoverSkill('magic', False);
8: HoverSkill('woodcutting', False);
9: HoverSkill('fishing', False);
10: HoverSkill('prayer', False);
11: HoverSkill('runecrafting', False);
12..15: PickUpMouse;
16..25: RandomMovement;
26..27: RandomRClick;
28..32: BoredHuman;
33: ExamineInv;
34: RandomAngle(True);
35..48: Wait(1000+random(1000));
49..50: Wait(1000+Random(20000));
end;
DoneAntiban := True;
Wait(2000+Random(500));
end;
end;
Procedure Rest;
begin
If(TimeFromMark(LastBreaked) > (BreakEveryR*60000)) then
begin
WriteLn('Breaking For '+IntToStr(BreakForR)+' Minutes')
If(LoggedIn) then
Logout;
Wait(BreakForR*60000);
BreakEveryR := BreakEvery - 5 + Random(10);
BreakForR := BreakFor - 5 +Random(10);
WriteLn('Break Done!')
WriteLn('We will break in '+IntToStr(BreakEveryR)+' minutes, for '+IntToStr(BreakForR)+' minutes.')
LogInPlayer;
MarkTime(LastBreaked)
end;
end;
Procedure BuryBones;
begin
CurStatus := 'Burying Bones'
Paint;
TimeSpentB := TimeSpentBurrying;
GameTab(25);
for i := 1 to 28 do
begin
If (ExistsItem(i)) then
begin
Repeat
InvMouse(i, 3);
If(WaitUptextMulti(['ury','one'],1000)) then
begin
ClickMouse2(True);
bonesburried := bonesburried + 1;
stats_IncVariable('Bones (Burried)',1);
end;
Wait(500+Random(800));
Until(not ExistsItem(i) or not(WaitUptextMulti(['ury','one'],1000)))
end;
end;
end;
Procedure Loot;
begin
CurStatus := 'Looting'
Paint;
BuryBones;
If((LootBones and PtoLB) or (JustLootBones)) then
begin
for i := 0 to High(BoneColours) do
begin
IF(FindColorTolerance(x, y, BoneColours[i], 0, 0, 516, 338, 10)) then
begin
Wait(400+Random(200))
Mouse( x, y, 2, 2, False);
If (WaitOption('one', 2000)) then
stats_IncVariable('Bones (Collected)',1);
BuryBones;
end;
end;
Wait(3000+Random(500));
end;
end;
Procedure BonesProgress;
begin
CurStatus := 'Progress Report'
Paint;
If((((GetTimeRunning-Time)>15000) and (JustLootBones)) or ((GetTimeRunning-Time)>60000)) then
begin
WriteLn('')
WriteLn('')
WriteLn('[-------------------------------------------------------------------------------]');
WriteLn('[' + padr(padl('Bone Burrier by Putonjonny', 38 + Length('Bone Burrier by Putonjonny') / 2), 79) + ']');
WriteLn('[-------------------------------------------------------------------------------]');
WriteLn(PadR('[ Time Running: ' + TimeRunning, 80) + ']');
WriteLn(PadR('[ Bones Burried: ' + IntToStr(bonesburried), 80) + ']');
Writeln('[-------------------------------------------------------------------------------]');
WriteLn('')
Time := GetTimeRunning;
end;
end;
Procedure ChangePlayer;
begin
MarkTime(LastSwapped)
z := z+1
If(LoggedIn) then
Logout;
if(z = GetArrayLength(PlayersToUse)) then
begin
case ReusePlayers of
True: z := 0;
False: begin
WriteLn('****All players Used and ReusePlayers is False so Ending Script****')
TerminateScript;
end;
end;
end;
SwitchToPlayer(PlayersToUse[z],ReusePlayers)
Repeat
LoginPlayer;
Wait(2000);
Until(LoggedIn)
ChangePlayerEveryR := ChangePlayerEvery - 5 + Random(10)
WriteLn('We will change players again in '+IntToStr(ChangePlayerEveryR)+' minutes.')
end;
Procedure OpenHelpPage;
begin
ClearDebug;
WriteLn('You have not uncommented lines 11 and 44 or you have not setup the script correctly')
Wait(1000+Random(100)); //why have I put a random on this :S
WriteLn('You obvoiusly need some help...')
Wait(1000+Random(100));
WriteLn('Reaching out for help...')
Wait(1000+Random(100));
WriteLn('I cant find any...')
Wait(1000+Random(100));
WriteLn('It seems that nobody can help you now...')
Wait(1000+Random(100));
WriteLn('Oh wait...')
Wait(1000+Random(100));
WriteLn('Here we go... :)')
Wait(1000+Random(100));
OpenWebPage('http://putonajonnyscripts.hostoi.com/Help.htm')
WriteLn('')
WriteLn('')
WriteLn('')
Wait(250)
WriteLn('To Clarify: You have not uncommented lines 11 and 44 or you have not setup the script correctly.')
WriteLn('Please set up script again then restart.')
WriteLn('The Webpage that Just Opened should help.')
TerminateScript;
end;
Procedure EndScript;
begin
BonesProgress;
Status('Goodbye... I will miss you :(')
WriteLn('Goodbye...')
WriteLn('Script Ran For: '+TimeRunning)
FreeBitmap(3)
end;
begin
ClearDebug;
If (IneedHelp) then
begin
WriteLn('Opening Help Page');
OpenWebPage('http://goblinkiller.webuda.com/Help');
TerminateScript;
end;
CheckVersion;
AddOnTerminate('EndScript');
CurStatus := 'Setting Up'
Lumbridge := Point(4706, 3767);
Goblins1 := Point(4570, 3650);
Goblins2 := Point(4570, 3650);
Goblins3 := Point(4570, 3650);
Colours := [NCPColour1,NCPColour2,NCPColour3,NCPColour4];
BoneColours := [BoneCol1, BoneCol2, 9737883, 12962254,13159633,13948382,11974847,9803164,9671578,8421510,14211810];
bonesburried := 0;
z := 0
ChangePlayerEveryR := ChangePlayerEvery - 5 + Random(10)
BreakEveryR := BreakEvery - 5 + Random(10)
BreakForR := BreakFor - 5 + Random(10)
Smart_Server := 11;
Smart_Members := False;
Smart_Signed := False;
Smart_SuperDetail := False;
SetupSRL;
SetupSRLStats(305, SRLStats_User, SRLStats_Password);
cleardebug;
Paint;
WriteLn('***************Goblin Killer by Putonajonny Version '+IntToStr(Version)+'***************');
CheckVersion;
SetBitmaps;
DeclarePlayers;
LoginPlayer;
WriteLn('We will break in '+IntToStr(BreakEveryR)+' minutes, for '+IntToStr(BreakForR)+' minutes.');
WriteLn('We will change players in '+IntToStr(ChangePlayerEveryR)+' minutes.')
SPS_Areas := ['11_9'];
SPS_Setup(RUNESCAPE_SURFACE, SPS_Areas);
MarkTime(LastSwapped);
MarkTime(LastBreaked);
If (JustLootBones) then
begin
SetAngle(True)
Repeat
If(TimeFromMark(LastSwapped)>(60000*ChangePlayerEveryR)) then
ChangePlayer;
Loot;
BonesProgress;
CheckRandoms;
Stats_Commit;
Until(false)
end;
Repeat
If(TimeFromMark(LastSwapped)>60000*ChangePlayerEveryR) then
ChangePlayer;
Rest;
Paint;
SetAngle(True);
CheckRandoms;
Rest;
Stats_Commit;
CheckLocation;
case location of
0: WalkToGoblins;
1:begin
Loot;
If(bonesburried>0) then
BonesProgress;
If(isfighting(10)) then
AntiBan
else
Attack;
end;
2: RectifyLocation;
else
RectifyLocation;
end;
until(false)
end.