SRL Archive - Outdated / Broken

AIO Slayer Base


NKN

2012-05-09 17:18:39

Well, I started a Slayer Script awhile ago, but I haven't got around to finishing it.

A lot of motivation left when I had to switch partners three times, then I just got lazy of collecting colors.

Edit: If using this, please remember: To edit the task, (I.E, 'blue dragons') in WhichTask and the walking one to be only the first few letters(So 'blue', 6 letters max.)

It's not very neat, as I didn't finalize it, but here's what I got so far:


program new;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i SPS/SPS.simba}
{$i srl/srl/misc/paintsmart.simba}
var
CUT,Task,AmountS:String;
x,y,CColor,CTolerance,WTH,WaitFight_Shield, WaitFight_Damage:Integer;
SlayerGem,SlayerRing:Integer;
Amount:LongInt;
Food,Glory,Dueling,Loadstone:Boolean;
Mypath:TPointArray;
type
TCharSet = set of Char;
Const
SRLStats_User = '';
SRLStats_Password = '';
procedure DeclarePlayers;
begin
HowManyPlayers := 1; // This is set to the total amount of players (more on multiplayer later ;)), for now, just keep it set as 1
NumberOfPlayers(HowManyPlayers); // This is a procedure in SRL which sets up player arrays (also, more on that later), this will always be the same
CurrentPlayer := 0; // This is the player to start with; the first player will always be 0 (you'll find out when you learn all about arrays)

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
WTH := 60; //1-100% hp to heal it, keep at 60 for the best.
{
Players[1].Name := ''; // Username
Players[1].Pass := ''; // Password
Players[1].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[1].Active := True; // Set to true if you want to use Player 0
Players[1].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[1].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];}
{
Players[2].Name := ''; // Username
Players[2].Pass := ''; // Password
Players[2].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[2].Active := True; // Set to true if you want to use Player 0
Players[2].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[2].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];}
{
Players[3].Name := ''; // Username
Players[3].Pass := ''; // Password
Players[3].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[3].Active := True; // Set to true if you want to use Player 0
Players[3].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[3].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence']; }
end;


procedure CallDTMz;
begin
WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IGaBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8='); //Sets DTMs and Names
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBSBWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA==');
end;
procedure FreeDTMz;
begin
FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);
end;
function WaitForText:String;//Waits for Text from Slayer Master
begin
Result := GetTextAtExWrap(343,408,377,417,0,8,40,0,0,UpChars);
end;

function StripNonConforming(const S: string;
const ValidChars: TCharSet): string;//Removes Conforming things
var
DestI: Integer;
SourceI: Integer;
begin
SetLength(Result, Length(S));
DestI := 0;
for SourceI := 1 to Length(S) do
if S[SourceI] in ValidChars then
begin
Inc(DestI);
Result[DestI] := S[SourceI]
end;
SetLength(Result, DestI)
end;
function StripNonNumeric(const S: string): string;//Removes numbers
begin
Result := StripNonConforming(S, ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
end;
procedure Walking;
begin
case Lowercase(Task) of
'aberrant spectres': //TODO
begin

end;

'abyssal demon': //TODO
begin

end;

'aquanite': //TODO
begin

end;

'banshees': //TODO - SUMONA ONLY
begin

end;

'basilisks': //TODO - SUMONA ONLY
begin

end;

'blacks': //Black Demons, I'm not racist. [TODO]
begin

end;

'bloodvelds': //TODO
begin

end;

'blue dragons': //TODO
begin

end;

'cave crawlers': //TODO - SUMONA ONLY
begin

end;

'cave horror': //TODO - SUMONA ONLY
begin

end;

'dagannoths': //TODO
begin

end;

'desert strykewyrms': //TODO
begin

end;

'elves': //TODO - SUMONA ONLY
begin

end;

'dust devil': //TODO
begin

end;

'fire giant': //TODO
begin

end;

'fungal mage': //TODO - SUMONA AND DURADEL ONLY
begin

end;

'gargoyle': //TODO
begin

end;

'greater demon': //TODO
begin

end;

//Grifolaroo skipped: [url]http://runescape.wikia.com/wiki/Grifolaroo[/url]

'hellhounds': //TODO
begin

end;

'iron dragons': //TODO
begin

end;

'jungle strykewyrms': //TODO
begin

end;

'kalphites': //TODO
begin
if(Amount > 0) then
begin
Writeln('Walking');
if(Food = False) then
begin
SPS_Setup(RUNESCAPE_SURFACE,['11_10','12_10']);
myPath := [Point(4759, 4232), Point(4780, 4237), Point(4797, 4236),
Point(4820, 4233), Point(4844, 4242), Point(4864, 4237), Point(4884, 4241),
Point(4898, 4247), Point(4917, 4242), Point(4940, 4232), Point(4965, 4240),
Point(4986, 4237), Point(5015, 4230), Point(5029, 4230), Point(5047, 4222),
Point(5054, 4201), Point(5059, 4184)];
SPS_WalkPath(myPath);
end else
begin
SPS_Setup(RUNESCAPE_SURFACE,['8_5','7_5','8_6']);
myPath := [Point(3404, 2535), Point(3422, 2509), Point(3418, 2478),
Point(3392, 2459), Point(3367, 2441), Point(3344, 2434),
Point(3314, 2432), Point(3290, 2392), Point(3277, 2378),
Point(3237, 2342), Point(3216, 2325), Point(3184, 2299),
Point(3177, 2280), Point(3181, 2255), Point(3196, 2244),
Point(3210, 2224), Point(3244, 2218), Point(3253, 2221),
Point(3275, 2217), Point(3295, 2216), Point(3304, 2234),
Point(3304, 2257), Point(3297, 2275),Point(3285, 2290)];
SPS_WalkPath(myPath);
end;
end else
begin
Writeln('Walking to bank!');
SPS_Setup(RUNESCAPE_SURFACE,['11_10','12_10']);
myPath := [Point(4759, 4232), Point(4780, 4237), Point(4797, 4236),
Point(4820, 4233), Point(4844, 4242), Point(4864, 4237), Point(4884, 4241),
Point(4898, 4247), Point(4917, 4242), Point(4940, 4232), Point(4965, 4240),
Point(4986, 4237), Point(5015, 4230), Point(5029, 4230), Point(5047, 4222),
Point(5054, 4201), Point(5059, 4184)];
SPS_WalkPath(myPath);
//MasterWalkProcHere
end;
end;

'kurasks': //TODO - SUMONA ONLY
begin
end;

'mutated jadinko': //TODO
begin

end;

'nechryaels': //TODO
begin

end;

'red dragons': //TODO - SUMONA ONLY
begin

end;

'scabarite minions': //TODO - SUMONA ONLY (Duradel gives Scabarites though?)
begin

end;

'spiritual mages': //TODO
begin

end;

'spiritual warriors': //TODO - SUMONA ONLY
begin

end;

'terror dogs': //TODO - SUMONA AND KURADEL ONLY
begin

end;

'trolls': //TODO - SUMONA ONLY
begin
if(Amount > 0) then
begin
Writeln('Walking');
if(Food = False) then
begin
SPS_Setup(RUNESCAPE_SURFACE,['8_5','7_5','8_6']);
myPath := [Point(3303, 2272), Point(3301, 2235), Point(3288, 2214),
Point(3262, 2217), Point(3246, 2217), Point(3221, 2217), Point(3200, 2231),
Point(3183, 2257), Point(3181, 2286), Point(3188, 2307), Point(3206, 2317),
Point(3221, 2324), Point(3245, 2352), Point(3262, 2368), Point(3282, 2387),
Point(3296, 2406), Point(3312, 2419), Point(3357, 2431), Point(3374, 2444),
Point(3405, 2456), Point(3419, 2468), Point(3423, 2494), Point(3427, 2513),
Point(3404, 2534)];
SPS_WalkPath(myPath);
end else
begin
SPS_Setup(RUNESCAPE_SURFACE,['8_5','7_5','8_6']);
myPath := [Point(3404, 2535), Point(3422, 2509), Point(3418, 2478),
Point(3392, 2459), Point(3367, 2441), Point(3344, 2434),
Point(3314, 2432), Point(3290, 2392), Point(3277, 2378),
Point(3237, 2342), Point(3216, 2325), Point(3184, 2299),
Point(3177, 2280), Point(3181, 2255), Point(3196, 2244),
Point(3210, 2224), Point(3244, 2218), Point(3253, 2221),
Point(3275, 2217), Point(3295, 2216), Point(3304, 2234),
Point(3304, 2257), Point(3297, 2275),Point(3285, 2290)];
SPS_WalkPath(myPath);
end;
end else
begin
Writeln('Walking to bank!');
SPS_Setup(RUNESCAPE_SURFACE,['8_5','7_5','8_6']);
myPath := [Point(3303, 2272), Point(3301, 2235), Point(3288, 2214),
Point(3262, 2217), Point(3246, 2217), Point(3221, 2217), Point(3200, 2231),
Point(3183, 2257), Point(3181, 2286), Point(3188, 2307), Point(3206, 2317),
Point(3221, 2324), Point(3245, 2352), Point(3262, 2368), Point(3282, 2387),
Point(3296, 2406), Point(3312, 2419), Point(3357, 2431), Point(3374, 2444),
Point(3405, 2456), Point(3419, 2468), Point(3423, 2494), Point(3427, 2513),
Point(3404, 2534)];
SPS_WalkPath(myPath);
//MasterWalkProcHere
end;
end;

'turoth': //TODO - SUMONA ONLY
begin

end;

'vyrewatch': //TODO
begin

end;

'warped tortoises': //TODO
begin
end;
end;
end;
function UpTextGone(S: TStringArray; Time: Integer): Boolean;//Waits for uptext to be gone, and then instantly clicks.
var
T,i: Integer;
There:Boolean;
begin
Result := false;
T := GetSystemTime + Time;
while (GetSystemTime < T) do
begin
if(i = 0) then
begin
if (IsUpTextMultiCustom(S)) then
begin
There := True;
Inc(i);
end;
end;
if(There = True) then
begin
i := 0
if not(IsUpTextMultiCustom(S)) then
begin
Writeln('Uptext gone');
There := False
Result := True;
Exit;
end;
end;
end;
Wait(20 + Random(20));
end;
function WaitOnText(txt: TStringArray; action: fnct_ActionOptions; time:Integer): boolean; //Waits for text to appear, and instantly finds it.
var
x, y, finaltime: integer;
chars: TStringArray;
begin
chars := [UpChars, CharsNPC];
finaltime := GetSystemTime + Time;
while(finaltime > GetSystemTime) do
begin
if (findTextEx(x, y, txt, chars, MCX1, MCY1, MCX2, MCY2)) then
begin
case action of
Move: MMouse(x, y, 6, 3);
ClickLeft: Mouse(x, y, 6, 3, mouse_Left);
ClickRight: Mouse(x, y, 6, 3, mouse_Right);
end;

result := true;
exit;
end;
end;
end;
{*******************************************************************************
function UseGem: Boolean;
Description: Contacts our Slayer Master to check our task. Returns true if
we managed to interect with our Gem.
Supports Ring of Slaying too.
*******************************************************************************}
function UseGem: Boolean;

begin
SlayerGem := DTMFromString('mlwAAAHicY2dgYLjMxMBwAYhvAvFdIL4GxKeB+AQQP2JkY' +
'HgDxC+A+CkQXwPi+1C2rX0vUDcTVswPJHFhRjwYCgAn7w2Z');
SlayerRing := DTMFromString('mrAAAAHic42BgYHBjYmCwA2J3IPYGYlsgdgFiLyC2BGJG' +
'RgYGfiDmA2JOIGYC4j9AfX8ZIPypro+ALCYwNlBQgLNhm' +
'J8BP2AkgGEAADM6BrM=');

GameTab(25);

if FindDTM(SlayerGem, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Writeln('Found Slayer Gem')
Mouse(x, y, 3, 3, False);
if ChooseOptionMulti(['Kills']) then
begin
wait(1000);
Result := True;
end;
end else
if FindDTM(SlayerRing, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Writeln('Found Ring of Slaying')
Mouse(x, y, 3, 3, False);
if ChooseOptionMulti(['ills', 'left']) then
begin
wait(1000);
Result := True;
end;
end;
FreeDTM(SlayerGem);
FreeDTM(SlayerRing);
end;


{*******************************************************************************
procedure IdentifyTask;
Description: Identifies the current task. (monster and number)
*******************************************************************************}
procedure IdentifyTask;
begin
Task := GetTextAtExWrap(166, 444, 196, 458, 0, 5, 2, 0, 0, SmallChars);
AmountS:= StripNonNumeric(GetTextAtExWrap(20,444,496,458,0, 5, 2, 0, 0, SmallChars));
if(AmountS='' ) then
begin
Writeln('Need new task!');
Exit;
end;
Amount := StrToInt(Amounts);
writeln('Task Identified!');
writeln('You''re currently assigned to kill ' + Task+'s; only ' + AmountS + ' more to go.');
if Task = 'cave' then
begin
writeln('Attempting to differentiate between cave slim and cave horrors');
//if find horror then
// monster := 'cave horror'
//else
// monster := 'cave crawlers'
//above may not be necessary as cave horror may give us 'cave h'
//and cave crawlers may give us 'cave c'
//WILL BE NECESSARY FOR SPIRITUAL WARRIORS/MAGES.
end;
end;

procedure WhichTask;//Decides which task
begin
if(UseGem) then//CUT = Uptext to look for. So, Trolls would be Troll, or Roll.
IdentifyTask;
case Lowercase(Task) of
'aberrant spectres': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0, 0);
CColor := 0
CTolerance := 0
end;

'abyssal demon': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0, 0);
CColor := 0
CTolerance := 0
end;

'aquanite': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'banshees': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'basilisks': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'blacks': //Black Demons, I'm not racist. [TODO]
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'bloodvelds': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'blue dragons': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'cave crawlers': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'cave horror': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'dagannoths': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'desert strykewyrms': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'elves': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'dust devil': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'fire giant': //TODO
begin
CUT := 'Fire giant'
SetColorSpeed2Modifiers(0.07, 0.75);
CColor := 3359354
CTolerance := 18
end;

'fungal mage': //TODO - SUMONA AND DURADEL ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'gargoyle': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'greater demon': //TODO
begin
CUT := 'Greater'
SetColorSpeed2Modifiers(0.20,2.36);
CColor := 2964309
CTolerance := 10
end;

//Grifolaroo skipped: [url]http://runescape.wikia.com/wiki/Grifolaroo[/url]

'hellhounds': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'iron dragons': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'jungle strykewyrms': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'kalphites': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'kurasks': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'mutated jadinko': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'nechryaels': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'red dragons': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'scabarite minions': //TODO - SUMONA ONLY (Duradel gives Scabarites though?)
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'spiritual mages': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'spiritual warriors': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'terror dogs': //TODO - SUMONA AND KURADEL ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'trolls': //TODO - SUMONA ONLY
begin
CUT := 'troll'
SetColorSpeed2Modifiers(0.04,0.32);
CColor := 7306625
CTolerance := 21
Writeln('Doing trolls. ' + IntToStr(Amount) + ' left to kill');
end;

'turoth': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'vyrewatch': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'warped tortoises': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;
end;
end;
procedure Write;
begin
Writeln('Finished');
end;
function Eating:Boolean;//Eats
var
InvSpaceOn:Integer;
begin
for InvSpaceOn := 2 to 28 do
begin
if(ExistsItem(InvSpaceOn)) then
begin
Food := True;
if(HPPercent < WTH) then
begin
InvMouse(InvSpaceOn,3);
if(WaitUpText('Eat',100)) then
begin
InvMouse(InvSpaceOn,1);
if(UpTextGone(['Eat'],1500)) then
begin
Writeln('Success!');
Result := True;
Food :=True
end else
begin
ClickMouse2(mouse_left);
if(UpTextGone(['Eat'],1500)) then
begin
Result := True;
Food := True;
end;
end;
end;
end;
end else
if(InvSpaceOn = 28) then
begin
Writeln('Out of food!');
Food := False;
Result := False;
Exit;
end else Continue;
end;
end;

function InCombat:Boolean;//Checks if in fight
Var
Time, x, y, WaitFight_Shield, WaitFight_Damage : integer;
begin
FFlag(0); //Incase you clicked a monster that isn't close by
MarkTime(Time); //marks the time
Writeln('In Fight');
Repeat
Wait(50+Random(50));
if(FindDTM(WaitFight_Shield, x, y, MSX1, MSY1, MSX2, MSY2))then
begin //if it finds the blue "shield" dtm it resets the time marker
MarkTime(Time);
Result := True;
end;
if(FindDTM(WaitFight_Damage, x, y, MSX1, MSY1, MSX2, MSY2))then
begin //if it finds the red "damage" dtm it resets the time marker
MarkTime(Time);
Result:=True
end;
Eating;
Until(TimeFromMark(Time) > 10000); //if it hasn't found either for 2000msec then it exits, (i don't play RS much, is there a very slow weapon that this wouldn't work for?)
end;
procedure ReturnToCenterOfMM; //Returns to center of minimap
var
a:Integer;
TPA :TPointArray;
MP:TPoint;
ATPA:T2DPointArray;
begin
begin
Writeln('Failed to find the monster');
if(FindColorsSpiralTolerance(x,y,TPA,125169,MMX1,MMY1,MMX2,MMY2,10)) then
begin
SortTPAFrom(TPA,Point(MMCX + 10,MMCY + 10));
ATPA := TPAtoATPAEx(TPA,15,15);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
x := MP.x
y := MP.y
Writeln('Clicking NPC dot')
Mouse(x,y,2,2,True);
Exit;
end;
end;
end;
end;
function AnimatingMultiEat(B: TBoxArray; Time, MinCount: Integer): TBooleanArray;
var
Shifts: TIntegerArray;
TT, I, H: Integer;
begin
TT := GetSystemTime + Time;
H := High(B);
SetLength(Result, H + 1);
for I := 0 to H do
Result[I] := True;
while (GetSystemTime < TT) do
begin
Eating;
Shifts := PixelShiftMulti(B, 50);
for I := 0 to H do
if (Shifts[I] <= MinCount) then
Result[I] := False;
end;
end;
function AnimatingEat(B: TBox; Time, MinCount: Integer): Boolean;
var
TBA: TBooleanArray;
begin
TBA := AnimatingMultiEat([B], Time, MinCount);
Result := TBA[0];
end;
function NewPixelShift:Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(230, 130, 300, 195);
SMART_DrawBoxEx(False,Pbox,clPurple);
Result := (AveragePixelShift(PBox, 250, 500) > 400);
Writeln(Result);
end;

function AIOCombat : Boolean;//The fighting engine
var
a : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
tmpCTS : Integer;
//Box,SearchArea : TBox;
begin
if not LoggedIn then Exit;
tmpCTS := GetColorToleranceSpeed;
SMART_ClearCanvas;
Result := False
ColorToleranceSpeed(2);
Writeln(CUT);
FindColorsSpiralTolerance(x,y,TPA,CColor,MSX1,MSY1,MSX2,MSY2,CTolerance);
ATPA := TPAtoATPAEx(TPA,15,15);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
SMART_DrawDotsEx(False,TPA,clBlue);
MMouse(MP.x,MP.y,4,4);
Eating;
Writeln(Amount);
if(WaitUpText(CUT,250))then
begin
Writeln('Found ' + Task);
x := MP.x; y := MP.y;
Result := True
SMART_ClearCanvas;
Mouse(x,y,0,0,3);
if(WaitUpText('Attack',350)) then
begin
Writeln('Attacking');
Mouse(x,y,3,3,True);
While(NewPixelShift) do
Wait(50+random(25));
Amount := Amount - 1
Result := True
Exit;
end else
begin
Mouse(x,y,3,3,False);
if(WaitOption('Attack',400)) then
begin
While(NewPixelShift) do
Wait(50+random(25));
Amount := Amount - 1
Result := True
Exit;
end;
end;
end;
end;
if(Result = False) then
ReturnToCenterOfMM;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2,0.2);
end;
procedure Mainloop;
begin
while((Amount > 0)) do
begin
//Walking stuff here
Eating;
if(Food = False) then Break;
Walking;
AIOCombat;
if(Amount = 0) then Break;
end;
Walking;
//Go To master and get new task
end;
begin
// These 4 lines HAVE to be set BEFORE you call SetupSRL;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;

ClearDebug;
AddOnTerminate('Write');
SetupSRL;
DeclarePlayers; // Calls the procedure, you can't forget this!
LoginPlayer;
AddOnTerminate('FreeDTMz');
CallDTMz;
WhichTask;
repeat
Mainloop;
until AllPlayersInactive;
end.

Some of the functions aren't really used, as they were just testing ones. Most should work to an extent. Here it is.

Mat

2012-05-09 17:27:18

:o Me may look at this <3

[XoL]

2012-05-09 17:30:21

ooh, nice job :)

Joe

2012-05-09 21:06:13

I put out an AIO base too, this looks quite nice though. Good job and rep+

NKN

2012-05-09 21:46:29

Haha, thanks guys. :)

xtrapsp

2012-05-10 11:16:21

Gonna borrow parts if thats ok :3

mika

2012-05-10 12:47:58

this could be finished nicley if we all work together, id love to make the walking if we continue this.

xtrapsp

2012-05-10 13:15:49

From: mika
this could be finished nicley if we all work together, id love to make the walking if we continue this.


mika i'm getting colours etc :) + I have checkpoison procedures etc

NKN

2012-05-10 15:53:14

One big group project. xD

Sounds like a plan, anyone up for it?!

xtrapsp

2012-05-10 16:01:17

indeed, I'm gonna do some more slayer tasks with my script then post it here with all the TPA details? then we add to it?

NKN

2012-05-10 16:04:27

Sure.

Is this script going to be for everyone, or SRL Members only?

If it's SRL Members, I'll have to delete that thread or have a mod delete it.

xtrapsp

2012-05-10 16:08:38

They can have a lite version?

NKN

2012-05-10 16:14:07

:|

Sure, I guess. I don't really see the harm in releasing a full version, not really a gold farming script.

xtrapsp

2012-05-10 16:19:36

From: NKN
:|

Sure, I guess. I don't really see the harm in releasing a full version, not really a gold farming script.


loses it's novelty though :3

NKN

2012-05-10 16:21:11

I guess so.

xtrapsp

2012-05-11 05:12:20

program new;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i SPS/SPS.simba}
{$i srl/srl/misc/paintsmart.simba}
var
CUT,Task,AmountS:String;
x,y,CColor,CTolerance,WTH,WaitFight_Shield, WaitFight_Damage:Integer;
SlayerGem,SlayerRing:Integer;
Amount:LongInt;
Food,Glory,Dueling,Loadstone:Boolean;
Mypath:TPointArray;
type
TCharSet = set of Char;
Const
SRLStats_User = '';
SRLStats_Password = '';
procedure DeclarePlayers;
begin
HowManyPlayers := 1; // This is set to the total amount of players (more on multiplayer later ;)), for now, just keep it set as 1
NumberOfPlayers(HowManyPlayers); // This is a procedure in SRL which sets up player arrays (also, more on that later), this will always be the same
CurrentPlayer := 0; // This is the player to start with; the first player will always be 0 (you'll find out when you learn all about arrays)

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
WTH := 60; //1-100% hp to heal it, keep at 60 for the best.
{
Players[1].Name := ''; // Username
Players[1].Pass := ''; // Password
Players[1].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[1].Active := True; // Set to true if you want to use Player 0
Players[1].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[1].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];}
{
Players[2].Name := ''; // Username
Players[2].Pass := ''; // Password
Players[2].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[2].Active := True; // Set to true if you want to use Player 0
Players[2].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[2].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];}
{
Players[3].Name := ''; // Username
Players[3].Pass := ''; // Password
Players[3].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[3].Active := True; // Set to true if you want to use Player 0
Players[3].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[3].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence']; }
end;


procedure CallDTMz;
begin
WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IGaBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8='); //Sets DTMs and Names
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBSBWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA==');
end;
procedure FreeDTMz;
begin
FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);
end;
function WaitForText:String;//Waits for Text from Slayer Master
begin
Result := GetTextAtExWrap(343,408,377,417,0,8,40,0,0,UpChars);
end;

function StripNonConforming(const S: string;
const ValidChars: TCharSet): string;//Removes Conforming things
var
DestI: Integer;
SourceI: Integer;
begin
SetLength(Result, Length(S));
DestI := 0;
for SourceI := 1 to Length(S) do
if S[SourceI] in ValidChars then
begin
Inc(DestI);
Result[DestI] := S[SourceI]
end;
SetLength(Result, DestI)
end;
function StripNonNumeric(const S: string): string;//Removes numbers
begin
Result := StripNonConforming(S, ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
end;
procedure Walking;
begin
case Lowercase(Task) of
'aberrant spectres': //TODO
begin

end;

'abyssal demon': //TODO
begin

end;

'aquanite': //TODO
begin

end;

'banshees': //TODO - SUMONA ONLY
begin

end;

'basilisks': //TODO - SUMONA ONLY
begin

end;

'blacks': //Black Demons, I'm not racist. [TODO]
begin

end;

'bloodvelds': //TODO
begin

end;

'blue dragons': //TODO
begin

end;

'cave crawlers': //TODO - SUMONA ONLY
begin

end;

'cave horror': //TODO - SUMONA ONLY
begin

end;

'dagannoths': //TODO
begin

end;

'desert strykewyrms': //TODO
begin

end;

'elves': //TODO - SUMONA ONLY
begin

end;

'dust devil': //TODO
begin

end;

'fire giant': //TODO
begin

end;

'fungal mage': //TODO - SUMONA AND DURADEL ONLY
begin

end;

'gargoyle': //TODO
begin

end;

'greater demon': //TODO
begin

end;

//Grifolaroo skipped: [url]http://runescape.wikia.com/wiki/Grifolaroo[/url]

'hellhounds': //TODO
begin

end;

'iron dragons': //TODO
begin

end;

'jungle strykewyrms': //TODO
begin

end;

'kalphites': //TODO
begin
if(Amount > 0) then
begin
Writeln('Walking');
if(Food = False) then
begin
SPS_Setup(RUNESCAPE_SURFACE,['11_10','12_10']);
myPath := [Point(4759, 4232), Point(4780, 4237), Point(4797, 4236),
Point(4820, 4233), Point(4844, 4242), Point(4864, 4237), Point(4884, 4241),
Point(4898, 4247), Point(4917, 4242), Point(4940, 4232), Point(4965, 4240),
Point(4986, 4237), Point(5015, 4230), Point(5029, 4230), Point(5047, 4222),
Point(5054, 4201), Point(5059, 4184)];
SPS_WalkPath(myPath);
end else
begin
SPS_Setup(RUNESCAPE_SURFACE,['8_5','7_5','8_6']);
myPath := [Point(3404, 2535), Point(3422, 2509), Point(3418, 2478),
Point(3392, 2459), Point(3367, 2441), Point(3344, 2434),
Point(3314, 2432), Point(3290, 2392), Point(3277, 2378),
Point(3237, 2342), Point(3216, 2325), Point(3184, 2299),
Point(3177, 2280), Point(3181, 2255), Point(3196, 2244),
Point(3210, 2224), Point(3244, 2218), Point(3253, 2221),
Point(3275, 2217), Point(3295, 2216), Point(3304, 2234),
Point(3304, 2257), Point(3297, 2275),Point(3285, 2290)];
SPS_WalkPath(myPath);
end;
end else
begin
Writeln('Walking to bank!');
SPS_Setup(RUNESCAPE_SURFACE,['11_10','12_10']);
myPath := [Point(4759, 4232), Point(4780, 4237), Point(4797, 4236),
Point(4820, 4233), Point(4844, 4242), Point(4864, 4237), Point(4884, 4241),
Point(4898, 4247), Point(4917, 4242), Point(4940, 4232), Point(4965, 4240),
Point(4986, 4237), Point(5015, 4230), Point(5029, 4230), Point(5047, 4222),
Point(5054, 4201), Point(5059, 4184)];
SPS_WalkPath(myPath);
//MasterWalkProcHere
end;
end;

'kurasks': //TODO - SUMONA ONLY
begin
end;

'mutated jadinko': //TODO
begin

end;

'nechryaels': //TODO
begin

end;

'red dragons': //TODO - SUMONA ONLY
begin

end;

'scabarite minions': //TODO - SUMONA ONLY (Duradel gives Scabarites though?)
begin

end;

'spiritual mages': //TODO
begin

end;

'spiritual warriors': //TODO - SUMONA ONLY
begin

end;

'terror dogs': //TODO - SUMONA AND KURADEL ONLY
begin

end;

'trolls': //TODO - SUMONA ONLY
begin
if(Amount > 0) then
begin
Writeln('Walking');
if(Food = False) then
begin
SPS_Setup(RUNESCAPE_SURFACE,['8_5','7_5','8_6']);
myPath := [Point(3303, 2272), Point(3301, 2235), Point(3288, 2214),
Point(3262, 2217), Point(3246, 2217), Point(3221, 2217), Point(3200, 2231),
Point(3183, 2257), Point(3181, 2286), Point(3188, 2307), Point(3206, 2317),
Point(3221, 2324), Point(3245, 2352), Point(3262, 2368), Point(3282, 2387),
Point(3296, 2406), Point(3312, 2419), Point(3357, 2431), Point(3374, 2444),
Point(3405, 2456), Point(3419, 2468), Point(3423, 2494), Point(3427, 2513),
Point(3404, 2534)];
SPS_WalkPath(myPath);
end else
begin
SPS_Setup(RUNESCAPE_SURFACE,['8_5','7_5','8_6']);
myPath := [Point(3404, 2535), Point(3422, 2509), Point(3418, 2478),
Point(3392, 2459), Point(3367, 2441), Point(3344, 2434),
Point(3314, 2432), Point(3290, 2392), Point(3277, 2378),
Point(3237, 2342), Point(3216, 2325), Point(3184, 2299),
Point(3177, 2280), Point(3181, 2255), Point(3196, 2244),
Point(3210, 2224), Point(3244, 2218), Point(3253, 2221),
Point(3275, 2217), Point(3295, 2216), Point(3304, 2234),
Point(3304, 2257), Point(3297, 2275),Point(3285, 2290)];
SPS_WalkPath(myPath);
end;
end else
begin
Writeln('Walking to bank!');
SPS_Setup(RUNESCAPE_SURFACE,['8_5','7_5','8_6']);
myPath := [Point(3303, 2272), Point(3301, 2235), Point(3288, 2214),
Point(3262, 2217), Point(3246, 2217), Point(3221, 2217), Point(3200, 2231),
Point(3183, 2257), Point(3181, 2286), Point(3188, 2307), Point(3206, 2317),
Point(3221, 2324), Point(3245, 2352), Point(3262, 2368), Point(3282, 2387),
Point(3296, 2406), Point(3312, 2419), Point(3357, 2431), Point(3374, 2444),
Point(3405, 2456), Point(3419, 2468), Point(3423, 2494), Point(3427, 2513),
Point(3404, 2534)];
SPS_WalkPath(myPath);
//MasterWalkProcHere
end;
end;

'turoth': //TODO - SUMONA ONLY
begin

end;

'vyrewatch': //TODO
begin

end;

'warped tortoises': //TODO
begin
end;
end;
end;
function UpTextGone(S: TStringArray; Time: Integer): Boolean;//Waits for uptext to be gone, and then instantly clicks.
var
T,i: Integer;
There:Boolean;
begin
Result := false;
T := GetSystemTime + Time;
while (GetSystemTime < T) do
begin
if(i = 0) then
begin
if (IsUpTextMultiCustom(S)) then
begin
There := True;
Inc(i);
end;
end;
if(There = True) then
begin
i := 0
if not(IsUpTextMultiCustom(S)) then
begin
Writeln('Uptext gone');
There := False
Result := True;
Exit;
end;
end;
end;
Wait(20 + Random(20));
end;
function WaitOnText(txt: TStringArray; action: fnct_ActionOptions; time:Integer): boolean; //Waits for text to appear, and instantly finds it.
var
x, y, finaltime: integer;
chars: TStringArray;
begin
chars := [UpChars, CharsNPC];
finaltime := GetSystemTime + Time;
while(finaltime > GetSystemTime) do
begin
if (findTextEx(x, y, txt, chars, MCX1, MCY1, MCX2, MCY2)) then
begin
case action of
Move: MMouse(x, y, 6, 3);
ClickLeft: Mouse(x, y, 6, 3, mouse_Left);
ClickRight: Mouse(x, y, 6, 3, mouse_Right);
end;

result := true;
exit;
end;
end;
end;
{*******************************************************************************
function UseGem: Boolean;
Description: Contacts our Slayer Master to check our task. Returns true if
we managed to interect with our Gem.
Supports Ring of Slaying too.
*******************************************************************************}
function UseGem: Boolean;

begin
SlayerGem := DTMFromString('mlwAAAHicY2dgYLjMxMBwAYhvAvFdIL4GxKeB+AQQP2JkY' +
'HgDxC+A+CkQXwPi+1C2rX0vUDcTVswPJHFhRjwYCgAn7w2Z');
SlayerRing := DTMFromString('mrAAAAHic42BgYHBjYmCwA2J3IPYGYlsgdgFiLyC2BGJG' +
'RgYGfiDmA2JOIGYC4j9AfX8ZIPypro+ALCYwNlBQgLNhm' +
'J8BP2AkgGEAADM6BrM=');

GameTab(25);

if FindDTM(SlayerGem, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Writeln('Found Slayer Gem')
Mouse(x, y, 3, 3, False);
if ChooseOptionMulti(['Kills']) then
begin
wait(1000);
Result := True;
end;
end else
if FindDTM(SlayerRing, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Writeln('Found Ring of Slaying')
Mouse(x, y, 3, 3, False);
if ChooseOptionMulti(['ills', 'left']) then
begin
wait(1000);
Result := True;
end;
end;
FreeDTM(SlayerGem);
FreeDTM(SlayerRing);
end;


{*******************************************************************************
procedure IdentifyTask;
Description: Identifies the current task. (monster and number)
*******************************************************************************}
procedure IdentifyTask;
begin
Task := GetTextAtExWrap(166, 444, 196, 458, 0, 5, 2, 0, 0, SmallChars);
AmountS:= StripNonNumeric(GetTextAtExWrap(20,444,496,458,0, 5, 2, 0, 0, SmallChars));
if(AmountS='' ) then
begin
Writeln('Need new task!');
Exit;
end;
Amount := StrToInt(Amounts);
writeln('Task Identified!');
writeln('You''re currently assigned to kill ' + Task+'s; only ' + AmountS + ' more to go.');
if Task = 'cave' then
begin
writeln('Attempting to differentiate between cave slim and cave horrors');
//if find horror then
// monster := 'cave horror'
//else
// monster := 'cave crawlers'
//above may not be necessary as cave horror may give us 'cave h'
//and cave crawlers may give us 'cave c'
//WILL BE NECESSARY FOR SPIRITUAL WARRIORS/MAGES.
end;
end;

procedure WhichTask;//Decides which task
begin
if(UseGem) then//CUT = Uptext to look for. So, Trolls would be Troll, or Roll.
IdentifyTask;
case Lowercase(Task) of
'aberrant spectres': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0, 0);
CColor := 0
CTolerance := 0
end;

'abyssal demon': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0, 0);
CColor := 0
CTolerance := 0
end;

'aquanite': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'banshees': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'basilisks': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'blacks': //Black Demons, I'm not racist. [TODO]
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'bloodvelds': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'blue dragons': //TODO
begin
CUT := 'Blue'
SetColorSpeed2Modifiers(0.10, 0.07);
CColor := 6249258;
CTolerance := 8;
end;

'cave crawlers': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0.03, 0.62);
CColor := 6185308;
CTolerance := 21;
end;

'cave horror': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'dagannoths': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'desert strykewyrms': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'elves': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'dust devil': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'fire giant': //TODO
begin
CUT := 'Fire giant'
SetColorSpeed2Modifiers(0.07, 0.75);
CColor := 3359354
CTolerance := 18
end;

'fungal mage': //TODO - SUMONA AND DURADEL ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'gargoyle': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'greater demon': //TODO
begin
CUT := 'Greater'
SetColorSpeed2Modifiers(0.20,2.36);
CColor := 2964309
CTolerance := 10
end;

//Grifolaroo skipped: [url]http://runescape.wikia.com/wiki/Grifolaroo[/url]

'hellhounds': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'iron dragons': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'jungle strykewyrms': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'kalphites': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'kurasks': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'mutated jadinko': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'nechryaels': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'red dragons': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'scabarite minions': //TODO - SUMONA ONLY (Duradel gives Scabarites though?)
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'spiritual mages': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'spiritual warriors': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'terror dogs': //TODO - SUMONA AND KURADEL ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'trolls': //TODO - SUMONA ONLY
begin
CUT := 'troll'
SetColorSpeed2Modifiers(0.04,0.32);
CColor := 7306625
CTolerance := 21
Writeln('Doing trolls. ' + IntToStr(Amount) + ' left to kill');
end;

'turoth': //TODO - SUMONA ONLY
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'vyrewatch': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;

'warped tortoises': //TODO
begin
CUT := 'null'
SetColorSpeed2Modifiers(0,0);
CColor := 0
CTolerance := 0
end;
end;
end;
procedure Write;
begin
Writeln('Finished');
end;
function Eating:Boolean;//Eats
var
InvSpaceOn:Integer;
begin
for InvSpaceOn := 2 to 28 do
begin
if(ExistsItem(InvSpaceOn)) then
begin
Food := True;
if(HPPercent < WTH) then
begin
InvMouse(InvSpaceOn,3);
if(WaitUpText('Eat',100)) then
begin
InvMouse(InvSpaceOn,1);
if(UpTextGone(['Eat'],1500)) then
begin
Writeln('Success!');
Result := True;
Food :=True
end else
begin
ClickMouse2(mouse_left);
if(UpTextGone(['Eat'],1500)) then
begin
Result := True;
Food := True;
end;
end;
end;
end;
end else
if(InvSpaceOn = 28) then
begin
Writeln('Out of food!');
Food := False;
Result := False;
Exit;
end else Continue;
end;
end;

function InCombat:Boolean;//Checks if in fight
Var
Time, x, y, WaitFight_Shield, WaitFight_Damage : integer;
begin
FFlag(0); //Incase you clicked a monster that isn't close by
MarkTime(Time); //marks the time
Writeln('In Fight');
Repeat
Wait(50+Random(50));
if(FindDTM(WaitFight_Shield, x, y, MSX1, MSY1, MSX2, MSY2))then
begin //if it finds the blue "shield" dtm it resets the time marker
MarkTime(Time);
Result := True;
end;
if(FindDTM(WaitFight_Damage, x, y, MSX1, MSY1, MSX2, MSY2))then
begin //if it finds the red "damage" dtm it resets the time marker
MarkTime(Time);
Result:=True
end;
Eating;
Until(TimeFromMark(Time) > 10000); //if it hasn't found either for 2000msec then it exits, (i don't play RS much, is there a very slow weapon that this wouldn't work for?)
end;
procedure ReturnToCenterOfMM; //Returns to center of minimap
var
a:Integer;
TPA :TPointArray;
MP:TPoint;
ATPA:T2DPointArray;
begin
begin
Writeln('Failed to find the monster');
if(FindColorsSpiralTolerance(x,y,TPA,125169,MMX1,MMY1,MMX2,MMY2,10)) then
begin
SortTPAFrom(TPA,Point(MMCX + 10,MMCY + 10));
ATPA := TPAtoATPAEx(TPA,15,15);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
x := MP.x
y := MP.y
Writeln('Clicking NPC dot')
Mouse(x,y,2,2,True);
Exit;
end;
end;
end;
end;
function AnimatingMultiEat(B: TBoxArray; Time, MinCount: Integer): TBooleanArray;
var
Shifts: TIntegerArray;
TT, I, H: Integer;
begin
TT := GetSystemTime + Time;
H := High(B);
SetLength(Result, H + 1);
for I := 0 to H do
Result[I] := True;
while (GetSystemTime < TT) do
begin
Eating;
Shifts := PixelShiftMulti(B, 50);
for I := 0 to H do
if (Shifts[I] <= MinCount) then
Result[I] := False;
end;
end;
function AnimatingEat(B: TBox; Time, MinCount: Integer): Boolean;
var
TBA: TBooleanArray;
begin
TBA := AnimatingMultiEat([B], Time, MinCount);
Result := TBA[0];
end;
function NewPixelShift:Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(230, 130, 300, 195);
SMART_DrawBoxEx(False,Pbox,clPurple);
Result := (AveragePixelShift(PBox, 250, 500) > 400);
Writeln(Result);
end;

function AIOCombat : Boolean;//The fighting engine
var
a : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
tmpCTS : Integer;
//Box,SearchArea : TBox;
begin
if not LoggedIn then Exit;
tmpCTS := GetColorToleranceSpeed;
SMART_ClearCanvas;
Result := False
ColorToleranceSpeed(2);
Writeln(CUT);
FindColorsSpiralTolerance(x,y,TPA,CColor,MSX1,MSY1,MSX2,MSY2,CTolerance);
ATPA := TPAtoATPAEx(TPA,15,15);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
SMART_DrawDotsEx(False,TPA,clBlue);
MMouse(MP.x,MP.y,4,4);
Eating;
Writeln(Amount);
if(WaitUpText(CUT,250))then
begin
Writeln('Found ' + Task);
x := MP.x; y := MP.y;
Result := True
SMART_ClearCanvas;
Mouse(x,y,0,0,3);
if(WaitUpText('Attack',350)) then
begin
Writeln('Attacking');
Mouse(x,y,3,3,True);
While(NewPixelShift) do
Wait(50+random(25));
Amount := Amount - 1
Result := True
Exit;
end else
begin
Mouse(x,y,3,3,False);
if(WaitOption('Attack',400)) then
begin
While(NewPixelShift) do
Wait(50+random(25));
Amount := Amount - 1
Result := True
Exit;
end;
end;
end;
end;
if(Result = False) then
ReturnToCenterOfMM;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2,0.2);
end;
procedure Mainloop;
begin
while((Amount > 0)) do
begin
//Walking stuff here
Eating;
if(Food = False) then Break;
Walking;
AIOCombat;
if(Amount = 0) then Break;
end;
Walking;
//Go To master and get new task
end;
begin
// These 4 lines HAVE to be set BEFORE you call SetupSRL;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;

ClearDebug;
AddOnTerminate('Write');
SetupSRL;
DeclarePlayers; // Calls the procedure, you can't forget this!
LoginPlayer;
AddOnTerminate('FreeDTMz');
CallDTMz;
WhichTask;
repeat
Mainloop;
until AllPlayersInactive;
end.

Added Blue drags and cavecrawlers

NKN

2012-05-11 06:54:16

Remember to edit the task, (I.E, 'blue dragons') in WhichTask and the walking one to be only the first few letters(So 'blue', 6 letters max.)

mika

2012-05-11 16:40:02

@NKN

I want to make the walking. How does it work, who or from where does it walk to?
I am going to assume that it walks from Sumona (as i use her most often) to the selected slayer monster.

NKN

2012-05-20 11:30:23

Oops, late response.


It works like this: Teleports from Master to nearest loadstone. Walks to monster. When out of food or task is done, walk to nearest bank. If the task is finished, teleport to nearest loadstone by a master, then get a new task and repeat. It's what I had in mind,

J J

2012-06-02 16:22:46

Great base so far, I might be working on a Turael Slayer Script in the future. Definately some interesting functions in here! Rep :)