n3ss3s
2007-10-13 05:22:55
- by n3ss3s
A coal miner for Al-Kharid mine.
Features
- Antirandoms
- Banking
- Walking to mine and bank ofcourse
- Mines coal
- avoids gas
- Avoids fights
- Drops all shit so it banks only coal
- Gets new axe if it breaks (hopefully works :D )
- SRL Script Stats
- Now also proggie!
So, I need you guys to test this, and especially I'd like to know how walking works.
For me it goes pretty okay, but dont bet your grandma on it :D
Gas checking works good, uses both SKy's and Piv's.
Umm g2 love WizzyPlugin, my rock and axe head finding would be shitty without it :D
I'd also appreciate that if someone can find the current "SRL Progress Report" formerly known as "Procedure PlayerStats;" because without it, CurrentPlayer.Loc has no real purpose in the script..
Mainloop is poor atm, but when this script gets further developed, I will try to extend it a bit..
I also "obshizzled" (moved to the right) the KYAB paths, yes the script has option to use KYAB, so I moved the paths to the right so the script looks more pretty since 100 lines of just int array doesnt look too leet :p
Also little mistakes like doing something with some var are expected, I was too excited to finish properly xD I can claim the BETA stage of it :D :D :D
Anyways, the script (btw longest one of mine) :
{=========================================================================]
[ CoalMinerForDesert ]
[ ]
[ NAME : CoalMinerForDesert ]
[ WRITER : N3ss3s ]
[ CATEGORY : Mining ]
[ DESCRIPTION : A Coal Miner For Al-Kharid Mine ]
[ USAGE : Collecting coal. ]
[ AUTOCOLOR : Option ]
[ NOTES : Watch the script mine one coal, just incase. ]
[ NOTES2 : Procedure commenting is in the end of the script ]
[ CONTACT : PM n3ss3s at [url]www.SRL-Forums.com[/url] ]
[ ]
[ ]
[=========================================================================]
[ ]
[=========================================================================]
[ Instructions. ]
[=========================================================================]
[ 1. USE Runescape with Low Detail, Very Bright. ]
[ 2. Set your Screen to 32 bit TRUE color. ]
[ 3. Set Playernames and Passwords in DeclarePlayers. ]
[ 4. SET HOWMANYPLAYERS inside DeclarePlayers ]
[ 5. SET Constants Starting From Line 31 ]
[ 5. Start script Logged In! ]
[=========================================================================}
Program CoalMinerForDesert;
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/KYAB.scar}
{.include SRL/SRL/Skill/Mining.scar}
Const SC = 7977939;
Const SRL_ID = '2759'; // These are stats of the "leecher" acc..
Const SRL_Pass = 'koolminer'; // Yay 4 wizzy!
Const CoalColour = 3098182;
Const KYAB_Mode = False;
{========================================================================]
[ Const 1 - If you are NOT using KYAB, go in the A-K bank, and pick the ]
[ sand color near doors on mm, the one the area has most... ]
[ Const 2 - SRL Stats ID. ]
[ Const 3 - SRL Stats Password. ]
[ Const 4 - If the script does not find coals, go pick this from a coal ]
[ Const 5 - Are we using KYAB? ]
[ For KYAB, go to [url]www.KYAB.Asssoft.org[/url] ]
[========================================================================}
{========================================================================]
[ If you are using KYAB mode, you need Fixed SRL for KYAB from KYAB Home ]
[ - [url]www.KYAB.Asssoft.org[/url] - else, use regular SRL ]
[========================================================================}
Var
CoalTol, CoalArea, CoalColor, CC, Gases, CLS, Banked: Integer;
Var
InterCX, InterCY, AxesHandled, RLSC, Stepz, Loads: Integer;
Var
TBP, TMP: TPointArray;
Var
CoalSlots: TIntegerArray;
Var
NeedNew, FirstW: Boolean;
Procedure DeclarePlayers;
Begin
HowManyPlayers := 6;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
SRLID := SRL_ID;
SRLPassword := SRL_Pass;
CoalColor := CoalColour;
RLSC := SC;
CC := 2122820;
Loads := 33 + Random(6); // Set the loads here.
Players[0].Name := 'Timekiller46';
Players[0].Pass := 'meh';
Players[0].Nick := 'eki';
Players[0].Booleans[0] := False; (* Spare axes? *)
Players[0].Integers[0] := 1; (* If spare axes, what bank slot X? *)
Players[0].Integers[1] := 1; (* If spare axes, what bank slot Y? *)
Players[0].Active := True;
Players[1].Name := 'Username';
Players[1].Pass := 'Password';
Players[1].Nick := 'ser';
Players[1].Booleans[0] := False; (* Spare axes? *)
Players[1].Integers[0] := 1; (* If spare axes, what bank slot X? *)
Players[1].Integers[1] := 1; (* If spare axes, what bank slot Y? *)
Players[1].Active := True;
Players[2].Name := 'Username';
Players[2].Pass := 'Password';
Players[2].Nick := 'ser';
Players[2].Booleans[0] := False; (* Spare axes? *)
Players[2].Integers[0] := 1; (* If spare axes, what bank slot X? *)
Players[2].Integers[1] := 1; (* If spare axes, what bank slot Y? *)
Players[2].Active := True;
Players[3].Name := 'Username';
Players[3].Pass := 'Password';
Players[3].Nick := 'ser';
Players[3].Booleans[0] := False; (* Spare axes? *)
Players[3].Integers[0] := 1; (* If spare axes, what bank slot X? *)
Players[3].Integers[1] := 1; (* If spare axes, what bank slot Y? *)
Players[3].Active := True;
Players[4].Name := 'Username';
Players[4].Pass := 'Password';
Players[4].Nick := 'ser';
Players[4].Booleans[0] := False; (* Spare axes? *)
Players[4].Integers[0] := 1; (* If spare axes, what bank slot X? *)
Players[4].Integers[1] := 1; (* If spare axes, what bank slot Y? *)
Players[4].Active := True;
Players[4].Name := 'Username';
Players[4].Pass := 'Password';
Players[4].Nick := 'ser';
Players[4].Booleans[0] := False; (* Spare axes? *)
Players[4].Integers[0] := 1; (* If spare axes, what bank slot X? *)
Players[4].Integers[1] := 1; (* If spare axes, what bank slot Y? *)
Players[4].Active := True;
End;
Function HoursWorked: Extended;
Var
I: Integer;
Begin
I := GetTimeRunning;
Result := I / 1000 / 60 / 60;
End;
Function FixProg(ST, Max: String): String; // From JuKKas guild miner.
Var
I, O, L: Integer;
Begin
L:= Length(ST);
I:= Length(Max);
L:= L - 1;
I:= I - 3;
For O:= L To I Do
Result:= Result + ' ';
Result:= Result + '|';
End;
Procedure ProgressReport; // Modded from JuKKas guild miner.
Var
ActiveT, Longest: String;
Prog: Array[0..5] Of String;
I: Integer;
Begin
Writeln('/----------------------------------------\');
Writeln('| n3ss3s''s Desert coal miner |');
Longest:= ('|------------ Mining Report -------------|');
Writeln(Longest);
Prog[0]:= '| Worked: ' + FloatToStr(HoursWorked)+' hrs.';
Prog[1]:= '| Mined : ' + IntToStr(CLS) + ' Coals';
Prog[2]:= '| Gained: ' + IntToStr(CLS * 50) + ' Exp';
Prog[3]:= '| Banked: ' + IntToStr(Banked) + ' Loads';
Prog[4]:= '| Found : ' + IntToStr(Gases) + ' Gasses';
For I := 0 To 4 Do
Begin
Prog[I]:= FixProg(Prog[I], Longest);
Writeln(Prog[I]);
End;
Writeln('|------------ Players Report ------------|');
For I:= 0 To HowManyPlayers - 1 Do
Begin
If(Players[I].Active)Then
Begin
ActiveT := 'T';
End Else
Begin
ActiveT:= 'F';
End;
Prog[5]:= ('| #: '+IntToStr(I)+ ' Active: '+ActiveT+ ' - Mining Level: '+IntToStr(Players[I].Level[15])+ '; Coal: '+IntToStr(Players[I].Integers[0])+ '; Gained: '+IntToStr(Players[I].Integers[1])+ '; Banked: '+IntToStr(Banked)+ '; Location: '+Players[I].Loc +';');
Writeln(Prog[5]);
End;
Writeln('\----------------------------------------/');
SRLRandomsReport;
End;
Procedure Paths; Begin SetArrayLength(TBP,20); SetArrayLength(TMP,18); TBP[0].X:=3302; TBP[0].Y:=3298; TBP[1].X:=3302; TBP[1].Y:=3293; TBP[2].X:=3300; TBP[2].Y:=3288; TBP[3].X:=3301; TBP[3].Y:=3281; TBP[4].X:=3298;
{ The KYAB paths looked ugly so I "obshizzled" them to the right end.. } TBP[4].Y:=3275; TBP[5].X:=3296; TBP[5].Y:=3265; TBP[6].X:=3296; TBP[6].Y:=3258; TBP[7].X:=3295; TBP[7].Y:=3251; TBP[8].X:=3291; TBP[8].Y:=3245; TBP[9].X:=3290; TBP[9].Y:=3237; TBP[10].X:=3284; TBP[10].Y:=3232; TBP[11].X:=3280; TBP[11].Y:=3226; TBP[12].X:=3282; TBP[12].Y:=3219; TBP[13].X:=3285; TBP[13].Y:=3210; TBP[14].X:=3282;TBP[14].Y:=3203; TBP[15].X:=3281; TBP[15].Y:=3196; TBP[16].X:=3282; TBP[16].Y:=3189; TBP[17].X:=3278; TBP[17].Y:=3180; TBP[18].X:=3275; TBP[18].Y:=3170; TBP[19].X:=3269; TBP[19].Y:=3166; TMP[0].X:=3275; TMP[0].Y:=3168; TMP[1].X:=3278; TMP[1].Y:=3176; TMP[2].X:=3281; TMP[2].Y:=3181; TMP[3].X:=3283; TMP[3].Y:=3191; TMP[4].X:=3285; TMP[4].Y:=3199; TMP[5].X:=3282; TMP[5].Y:=3205; TMP[6].X:=3285; TMP[6].Y:=3211; TMP[7].X:=3281; TMP[7].Y:=3219; TMP[8].X:=3280; TMP[8].Y:=3228; TMP[9].X:=3285; TMP[9].Y:=3234; TMP[10].X:=3285; TMP[10].Y:=3240; TMP[11].X:=3289; TMP[11].Y:=3248; TMP[12].X:=3290; TMP[12].Y:=3255; TMP[13].X:=3293; TMP[13].Y:=3263; TMP[14].X:=3296; TMP[14].Y:=3275; TMP[15].X:=3300; TMP[15].Y:=3285; TMP[16].X:=3301; TMP[16].Y:=3292; TMP[17].X:=3302; TMP[17].Y:=3301; End;
Function FindSandColor: Integer;
Var
X, Y: Integer;
Begin
ColorToleranceSpeed(2);
If (FindColoredAreaTolerance(X, Y, SC, MMX1, MMY1, MMX2, MMY2, 20, 15)) Then
Begin
Result := GetColor(X, Y);
End Else
Begin
Result := SC;
End;
ColorToleranceSpeed(1);
End;
Function Al_Kharid: Boolean;
Var
TPA: TPointArray;
Var
CactusPoints: Integer;
Begin
If (Not (LoggedIn)) Then Exit;
ColorToleranceSpeed(2);
CactusPoints := 340;
Repeat
FindColorsTolerance(TPA, CC, MMX1, MMY1, MMX2, MMY2, 15);
If (Length(TPA) >= CactusPoints) Then
Begin
Writeln('Al-Kharid detected by cactuses!');
Result := True;
End Else
CactusPoints := CactusPoints - 1;
Until (CactusPoints <= 325) Or (Result) Or (Not (LoggedIn));
CC := GetColor(TPA[0].x, TPA[0].y);
ColorToleranceSpeed(1);
End;
Function FindBankers: Boolean;
Var
TB: TBox;
Var
I: Integer;
Var
TP, T: TPoint;
Var
TPA, Bankers: TPointArray;
Begin
If (Not (LoggedIn)) Then Exit;
MakeCompass('n');
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 195836, MMX1, MMY1, MMX2, MMY2, 15);
For I := 0 To GetArrayLength(TPA) - 1 Do
Begin
TP := TPA[i];
TB := IntToBox(TP.x - 4, TP.y - 25, TP.x + 4, TP.y + 25);
T := IntToPoint(TB.x1 + ((TB.x2 - TB.x1) / 2), TB.y1 + ((TB.y2 - TB.y1) / 2));
FindColorsSpiralTolerance(T.x, T.y, Bankers, 195836, TB.x1, TB.y1, TB.x2, TB.y2, 15);
If (GetArrayLength(Bankers) >= 6) Then
Begin
Mouse(T.x + 6, T.y - 6, 2, 2, True);
Flag;
Result := True;
Exit;
End;
End;
End;
Function OpenKharidBank: Boolean; // 94 ms with HSL - Nice.
Var
TPA, Skip: TPointArray;
Var
I, X, Y, CTS: Integer;
Var
C, Ctr, M: Integer;
Var
Skipp: Integer;
Var
BCMD: Boolean;
Var
TP, T: TPoint;
Begin
If (Not (LoggedIn)) Then Exit;
If BankScreen Then Exit;
CTS := GetColorToleranceSpeed;
M := GetSystemTime;
ColorToleranceSpeed(2);
Repeat
Wait(25);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5462367, MSX1, MSY1, MSX2, MSY2, 15);
If (GetArrayLength(TPA) <= 0) Then Exit;
For I := 0 To GetArrayLength(TPA) - 1 Do
Begin
Wait(5);
BCMD := False;
TP := TPA[i];
For Skipp := 0 To GetArrayLength(Skip) - 1 Do
Begin
T := Skip[Skipp];
If (PointInBox(TP, IntToBox(T.x - 10, T.y - 10, T.x + 10, T.y + 10))) Then
Begin
BCMD := True;
Break;
End;
End;
If (BCMD) Then Continue;
If (FindColorTolerance(X, Y, 4870227, TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10, 15)) Then
Begin
Writeln('Bank finding: '+IntToStr(GetSystemTime - M));
MMouse(TP.x, TP.y, 3, 3);
If (IsUpTextMulti('Bank booth', 'Bank bo', 'ank booth')) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 1, 1, False);
If (ChooseOption('uickl')) Then
Begin
Repeat
C := C + 1;
Wait(100);
Until (C > 100) Or (BankScreen) Or (Not (LoggedIn));
If (BankScreen) Then
Begin
Result := True;
ColorToleranceSpeed(CTS);
Writeln('Bank opening: '+IntToStr(GetSystemTime - M));
Exit;
End Else
Begin
If (Not (LoggedIn)) Then
Begin
Result := False;
ColorToleranceSpeed(CTS);
Writeln(IntToStr(GetSystemTime - M));
Exit;
End;
End;
SetArrayLength(Skip, GetArrayLength(Skip) + 1);
Skip[GetArrayLength(Skip) - 1] := TPA[i];
End;
End Else
Begin
SetArrayLength(Skip, GetArrayLength(Skip) + 1);
Skip[GetArrayLength(Skip) - 1] := TPA[i];
End;
If (Not (LoggedIn)) Then Exit;
End;
If (Not (LoggedIn)) Then Exit;
End;
Ctr := Ctr + 1;
Until (Result) Or (Not (LoggedIn)) Or (Ctr > 10);
ColorToleranceSpeed(CTS);
Writeln(IntToStr(GetSystemTime - M));
End;
Function CoalDDTM: Integer;
Var
CoalMP: TDTMPointDef;
Var
CoalSP: Array[0..8] Of TDTMPointDef;
Var
CoalDTMSkel: TDTM;
Begin
CoalMP.x := 622;
CoalMP.y := 300;
CoalMP.AreaSize := 0;
CoalMP.AreaShape := 0;
CoalMP.Color := 2570297;
CoalMP.Tolerance := CoalTol;
CoalSP[0].x := 634;
CoalSP[0].y := 292;
CoalSP[0].AreaSize := CoalArea;
CoalSP[0].AreaShape := 0;
CoalSP[0].Color := 65536;
CoalSP[0].Tolerance := 0;
CoalSP[1].x := 634;
CoalSP[1].y := 298;
CoalSP[1].AreaSize := CoalArea;
CoalSP[1].AreaShape := 0;
CoalSP[1].Color := 65536;
CoalSP[1].Tolerance := 0;
CoalSP[2].x := 632;
CoalSP[2].y := 307;
CoalSP[2].AreaSize := CoalArea;
CoalSP[2].AreaShape := 0;
CoalSP[2].Color := 65536;
CoalSP[2].Tolerance := 0;
CoalSP[3].x := 625;
CoalSP[3].y := 308;
CoalSP[3].AreaSize := CoalArea;
CoalSP[3].AreaShape := 0;
CoalSP[3].Color := 65536;
CoalSP[3].Tolerance := 0;
CoalSP[4].x := 612;
CoalSP[4].y := 307;
CoalSP[4].AreaSize := CoalArea;
CoalSP[4].AreaShape := 0;
CoalSP[4].Color := 65536;
CoalSP[4].Tolerance := 0;
CoalSP[5].x := 605;
CoalSP[5].y := 305;
CoalSP[5].AreaSize := CoalArea;
CoalSP[5].AreaShape := 0;
CoalSP[5].Color := 65536;
CoalSP[5].Tolerance := 0;
CoalSP[6].x := 605;
CoalSP[6].y := 300;
CoalSP[6].AreaSize := CoalArea;
CoalSP[6].AreaShape := 0;
CoalSP[6].Color := 65536;
CoalSP[6].Tolerance := 0;
CoalSP[7].x := 615;
CoalSP[7].y := 290;
CoalSP[7].AreaSize := CoalArea;
CoalSP[7].AreaShape := 0;
CoalSP[7].Color := 65536;
CoalSP[7].Tolerance := 0;
CoalSP[8].x := 624;
CoalSP[8].y := 288;
CoalSP[8].AreaSize := CoalArea;
CoalSP[8].AreaShape := 0;
CoalSP[8].Color := 65536;
CoalSP[8].Tolerance := 0;
CoalDTMSkel.MainPoint := CoalMP;
CoalDTMSkel.SubPoints := CoalSP;
Result := AddDTM(CoalDTMSkel);
End;
Function CreateCoalDTM(Var TheCDTM: Integer): Boolean;
Var
CoalDTM, X, Y: Integer;
Begin
CoalTol := 10;
Repeat
CoalTol := CoalTol + 1;
Repeat
CoalDTM := CoalDDTM;
If (FindDTM(CoalDTM, X, Y, MIX1, MIY1, MIX2, MIY2)) Then
Begin
Result := True;
TheCDTM := CoalDTM;
Exit;
End;
CoalArea := CoalArea + 1;
Until (CoalArea >= 5);
CoalArea := 0;
Until (CoalTol >= 50);
End;
Procedure EnlargeTBox(Var TheBox: TBox; Pix: Integer);
Begin
TheBox.x1 := TheBox.x1 - Pix;
TheBox.y1 := TheBox.y1 - Pix;
TheBox.x2 := TheBox.x2 + Pix;
TheBox.y2 := TheBox.y2 + Pix;
End;
Function FindRockIn(All: Boolean; Var RockTPA: TPointArray; x1, y1, x2, y2, Limit: Integer): Boolean;
{ Slower than in the competition, this is a "FindRock Home", not "FindRock Pro" :D }
Var
I, D, C, X, Y, A, Z, Fx, Fy, Q, Meh: Integer;
Var
TPA, TPA2, Duh, Mid: TPointArray;
Var
T: TPoint;
Begin
A := GetClientWindowHandle;
C := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
I := BitmapFromString(762, 502, '');
CopyClientToBitmap(i, 0, 0, 762, 502);
SetTargetBitmap(i);
FindColorsTolerance(TPA, CoalColor, x1, y1, x2, y2, 5);
Z := GetArrayLength(TPA);
If (Not (Z <= 0)) Then
Begin
For D := 0 To Z - 1 Do
Begin
FastSetPixel(i, TPA[d].x, TPA[d].y, 255);
End;
X := MSCX;
Y := MSCY;
If (Not (All)) Then
Begin
Repeat
If (FindColorSpiral2(X, Y, 255, MSX1, MSY1, MSX2, MSY2)) Then
Begin
FindColorsTolerance(Duh, 255, x - 10, y - 10, x + 10, y + 10, 0);
If(GetArrayLength(Duh) >= Limit)Then
Begin
FindColorsTolerance(TPA, 255, X - 15, Y - 15, X + 15, Y + 15, 0);
SetClientWindowHandle(A);
SetArrayLength(Mid, 1);
Mid[0] := MiddleTPA(TPA);
If(FindColorTolerance(X, Y, CoalColor, Mid[0].x - 8, Mid[0].y - 8, Mid[0].x + 8, Mid[0].y + 8, 7))Then
Begin
Result := True;
SetArrayLength(RockTPA, 1);
RockTPA := Mid;
End;
End;
End;
Meh := Meh + 1;
Until(Result) Or (Meh >= 7);
End Else
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA2, 255, MSX1, MSY1, MSX2, MSY2, 0);
If (GetArrayLength(TPA2) > 0) Then
Begin
For I := 0 To GetArrayLength(TPA2) - 1 Do
Begin
Fx := MSCX;
Fy := MSCY;
T := TPA2[i];
If(FindColorSpiral2(Fx, Fy, 255, T.x - 10, T.y - 10, T.x + 10, T.y + 10))Then
Begin
Q := Q + 1;
SetArrayLength(RockTPA, Q);
RockTPA[i] := IntToPoint(Fx, Fy);
End;
End;
End;
End;
End;
FreeBitmap(i);
SetClientWindowHandle(A);
ColorToleranceSpeed(C);
End;
Function WaitUntilCoal(Var Rx, Ry: Integer): Boolean;
Var
T: Integer;
Var
TPA: TPointArray;
Begin
T := GetSystemTime;
Repeat
Wait(50);
FindTalk;
Wait(25);
If (FindRockIn(False, TPA, MSX1, MSY1, MSX2, MSY2, 50)) Then
Begin
Rx := TPA[0].x;
Ry := TPA[0].y;
Result := True;
Exit;
End;
Until ((GetSystemTime - T) > 50000) Or (Not (LoggedIn));
End;
Procedure FollowCoal(Var CoalX, CoalY: Integer);
Var
TPA: TPointArray;
Begin
If (Not (LoggedIn)) Then Exit;
Case KYAB_Mode Of
False:
Begin
Repeat
Begin
If (FindRockIn(False, TPA, CoalX - 15, CoalY - 15, CoalX + 15, CoalY + 15, 30)) Then
Begin
CoalX := TPA[0].x;
CoalY := TPA[0].y;
End;
Wait(25);
If (Not (LoggedIn)) Then
Begin
CoalX := 0;
CoalY := 0;
Exit;
End;
End;
Until (Not (FlagPresent)) Or (Not (LoggedIn));
End;
True:
Begin
Repeat
Begin
If (FindRockIn(False, TPA, CoalX - 15, CoalY - 15, CoalX + 15, CoalY + 15, 30)) Then
Begin
CoalX := TPA[0].x;
CoalY := TPA[0].y;
End;
Wait(25);
If (Not (LoggedIn)) Then
Begin
CoalX := 0;
CoalY := 0;
Exit;
End;
End;
Until (Not (KYAB_IsMoving)) Or (Not (LoggedIn));
End;
End;
End;
Function GotHead: Boolean;
Var
Head, X, Y: Integer;
Begin
Head := DTMFromString('78DA6374676260F8CC800618914820ED0954F' +
'38D809A00A09A5F04D4F801D5FC25C2AEDF04D45811760F00A41F' +
'07A1');
Result := FindDTM(Head, X, Y, MIX1, MIY1, MIX2, MIY2);
FreeDTM(Head);
End;
Function HandleLostAxe: Boolean;
Var
X, Y, Z, CTS, H, S, I, Q, Px, Py, Hx, Hy: Integer;
Var
TPA, TPA2, TPA3: TPointArray;
Var
C: TIntegerArray;
Var
TP: TPoint;
Begin
If(GotHead) Or (Not(LoggedIn)) Then Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
C := [hc1, hc2, hc3, hc4, hc5];
H := GetClientWindowHandle;
S := BitmapFromString2(False, '');
CopyClientToBitmap(S, MSX1, MSY1, MSX2, MSY2);
SetTargetBitmap(S);
For Z := 0 To GetArrayLength(C) - 1 Do
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA, C[z], MSX1, MSY1, MSX2, MSY2, 15);
For I := 0 To GetArrayLength(TPA) - 1 Do
Begin
TP := TPA[i];
FastSetPixel(s, TP.x, TP.y, 255);
End;
X := MSCX;
Y := MSCY;
FindColorSpiral2(X, Y, 255, MSX1, MSY1, MSX2, MSY2);
FindColorsTolerance(TPA2, 255, X - 5, Y - 5, X + 5, Y + 5, 0);
If(GetArrayLength(TPA2) >= 6)Then
Begin
SetArrayLength(TPA3, GetArrayLength(TPA3) + 1);
TPA3[GetArrayLength(TPA3) - 1] := MiddleTPA(TPA2);
End;
End;
If(Not(GetArrayLength(TPA3) <= 0))Then
Begin
For Q := 0 To GetArrayLength(TPA3) - 1 Do
Begin
MMouse(TPA3[q].x, TPA3[q].y, 2, 2);
If(IsUpTextMulti('Take', 'pick', 'head'))Then
Begin
If(InvFull)Then
Begin
DropItem(28);
Wait(750 + Random(250));
End;
Mouse(TPA3[q].x, TPA3[q].y, 1, 1, True);
Wait(500 + Random(25));
If(FindBitmapToleranceIn(PickHead, Px, Py, MIX1, MIY1, MIX2, MIY2, 50))
And(FindBitmapToleranceIn(PickHandle, Hx, Hy, MIX1, MIY1, MIX2, MIY2, 50))Then
Begin
Mouse(Px, Py, 2, 2, True);
Wait(50 + Random(25));
Mouse(Hx, Hy, 2, 2, True);
Wait(500 + Random(25));
Result := True;
End Else
Begin
Writeln('Sorry m8, we lost your pick =/ ');
If(Players[CurrentPlayer].Booleans[0])Then
Begin
NeedNew := True;
End;
Exit;
End;
End;
End;
End;
End;
Function DualGasCheck(gx, gy: Integer): Boolean;
Begin
If(GasFound(Gx, Gy)) Or (GasCheck(Gx, Gy))Then
Begin
Result := True;
End;
End;
Function ClickRock: Boolean;
Var
X, Y: Integer;
Var
Txt: Boolean;
Begin
If (WaitUntilCoal(X, Y)) Then
Begin
If(DualGasCheck(X, Y))Then Exit;
Mouse(X, Y, 2, 2, True);
Wait(50);
If(Not(FlagPresent))Then
Begin
If(FindTalk)Then
Begin
Exit;
End;
End;
FollowCoal(X, Y);
Flag;
If(FTWait(4))Then
Begin
Exit;
End;
If(Not(GotHead))Then
Begin
If(HandleLostAxe)Then
Begin
AxesHandled := AxesHandled + 1;
End Else
Begin
If(Not(LoggedIn))Then
Begin
Logout;
End;
Exit;
End;
End;
Repeat
If(InChat('currently av'))Then
Begin
Result := False;
Txt := True;
Exit;
End;
If(InChat('swing your'))Then
Begin
If (Not (X = 0)) Then
Begin
InterCX := X;
InterCY := Y;
Result := True;
Txt := True;
End;
End;
Until(Txt) Or (Not(LoggedIn));
End;
End;
Function RockThere: Boolean;
Var
TPA: TPointArray;
Begin
Result := FindRockIn(False, TPA, InterCX - 20, InterCY - 20, InterCX + 20, InterCY + 20, 15);
End;
Function CountCoals: Integer; Forward;
Procedure MineRock;
Var
MM, CCC, IC: Integer;
Begin
If(Not(LoggedIn))Then Exit;
IC := CountCoals;
If (ClickRock) Then
Begin
MarkTime(MM);
Case KYAB_Mode Of
False:
Begin
Repeat
FindTalk;
Wait(50 + Random(25));
If(DualGasCheck(InterCX, InterCY))Then
Begin
MouseFindFlag(MMCX, MMCY, -1, - 1);
Wait(18000 + Random(2000));
ReportVars[2] := ReportVars[2] + 1;
Gases := Gases + 1;
SRLRandomsReport;
Exit;
End;
If(FindFight)Then
Begin
RunTo('s', True);
ReportVars[3] := ReportVars[3] + 1;
SRLRandomsReport;
End;
CCC := CCC + 1;
If(CCC Mod 2 = 0)Then FindNormalRandoms;
Until (Not (RockThere)) Or (Not(LoggedIn)) Or (TimeFromMark(MM) > 15000);
End;
True:
Begin
Repeat
If(FindTalk)Then Exit;
Wait(50 + Random(25));
If(DualGasCheck(InterCX, InterCY))Then
Begin
MouseFindFlag(MMCX, MMCY, -1, - 1);
Wait(18000 + Random(2000));
ReportVars[2] := ReportVars[2] + 1;
Gases := Gases + 1;
SRLRandomsReport;
Exit;
End;
If(FindFight)Then
Begin
RunTo('s', True);
ReportVars[3] := ReportVars[3] + 1;
SRLRandomsReport;
End;
CCC := CCC + 1;
If(CCC Mod 2 = 0)Then
If(FindNormalRandoms)Then Exit;
Until (Not (GetAnimation = 629)) Or (Not(LoggedIn)) Or (TimeFromMark(MM) > 15000);
End;
End;
End;
If(CountCoals > IC)Then
Begin
ReportVars[0] := ReportVars[0] + 1;
SRLRandomsReport;
End;
End;
Function CountCoals: Integer;
Var
I, C, X, Y: Integer;
Var
IB: TBox;
Begin
SetArrayLength(CoalSlots, 0);
If (CreateCoalDTM(i)) Then
Begin
For C := 1 To 28 Do
Begin
IB := InvBox(c);
If (FindDTM(I, X, Y, IB.x1, IB.y1, IB.x2, IB.y2)) Then
Begin
SetArrayLength(CoalSlots, GetArrayLength(CoalSlots) + 1);
CoalSlots[GetArrayLength(CoalSlots) - 1] := c;
Result := Result + 1;
End;
End;
FreeDTM(i);
End;
End;
Function ShittySandWalk(StartRadial, EndRadial: Integer; A: String; Var TR: Integer): Boolean; // SSW? :D
Var
I, X, Y, R, CTS, C: Integer;
Var
H, S: Extended;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
R := 70;
Repeat
SetColorSpeed2Modifiers(0.2, 0.2);
Repeat
Repeat
For I := StartRadial To EndRadial Do
Begin
X := Round(R * Sine(I)) + MMCX;
Y := Round(-R * Cose(I)) + MMCY;
If (SimilarColors(GetColor(X, Y), RLSC, C)) Then
Begin
MouseFindFlag(X + StrToInt(A), Y, 2, 2);
Wait(1000 + Random(250));
Flag;
Wait(100 + Random(25));
Result := True;
TR := R;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
Exit;
End;
End;
C := C + 1;
Until(C >= 10);
H := H + 0.05;
S := S + 0.05;
SetColorSpeed2Modifiers(H, S);
Until(H >= 0.5);
R := R - 1;
Until (R <= 1);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
End;
////////////////////////////////////////////////////////////////////////////////
///Some of the functions below dont work properly, and are not being used atm///
////////////////////////////////////////////////////////////////////////////////
Function GetWallColor(Var TPA: TPointArray): Integer;
Var
X, Y, I: Integer;
Begin
ColorToleranceSpeed(2);
If (FindColorTolerance(X, Y, 6721943, MMX1, MMY1, MMX2, MMY2, 20)) Then
Begin
Result := GetColor(x, Y);
End;
FindColorsTolerance(TPA, Result, MMX1, MMY1, MMX2, MMY2, 10);
For I := 0 To GetArrayLength(TPA) - 1 Do
Begin
If (Not (Rs_OnMinimap(TPA[i].x, TPA[i].y))) Then
Begin
SetArrayLength(TPA, GetArrayLength(TPA) + 1);
TPA[GetArrayLength(TPA) - 1].x := TPA[i].x;
TPA[GetArrayLength(TPA) - 1].y := TPA[i].y;
TPA[i].x := 0;
TPA[i].y := 0;
SetArrayLength(TPA, GetArrayLength(TPA) - 1);
End;
End;
ColorToleranceSpeed(1);
End;
Function ZeroToleranceZero(TPA: TPointArray): TPointArray;
Var
I: Integer;
Begin
For I := 0 To GetArrayLength(TPA) - 1 Do
Begin
If (Not (TPA[i].x = 0)) And (Not (TPA[i].y = 0)) Then
Begin
SetArrayLength(Result, GetArrayLength(Result) + 1);
Result[GetArrayLength(Result) - 1] := TPA[i];
End;
End;
End;
Function InMine: Integer;
Var
RTPA: TPointArray;
Begin
ColorToleranceSpeed(2);
GetWallColor(RTPA);
Result := GetArrayLength(RTPA);
ColorToleranceSpeed(1);
End;
Procedure GetCaveEdges(Var T1, T2: Integer);
Var
X, Y, I, C, Z, CTS: Integer;
Var
TPA: TPointArray;
Var
BCMD: Boolean;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
C := GetWallColor(TPA);
For Z := 65 DownTo 0 Do
Begin
For I := 180 DownTo 0 Do
Begin
X := Round(Z * Sine(i)) + MMCX;
Y := Round(-Z * Cose(i)) + MMCY;
If(SimilarColors(GetColor(X, Y), C, 10))Then
Begin
T1 := X;
BCMD := True;
Break;
End;
End;
If(BCMD)Then Break;
End;
For Z := 65 DownTo 0 Do
Begin
For I := 0 DownTo 180 Do
Begin
X := Round(Z * Sine(i)) + MMCX;
Y := Round(-Z * Cose(i)) + MMCY;
If(SimilarColors(GetColor(X, Y), C, 10))Then
Begin
T2 := X;
ColorToleranceSpeed(CTS);
Exit;
End;
End;
End;
ColorToleranceSpeed(CTS);
End;
Procedure OutWallWalk(Radius: String);
Var
T3: TPoint;
Var
T1, T2: Integer;
Begin
GetCaveEdges(T1, T2);
T3.x := T2 - (T2 - T1);
T3.y := MMCY + StrToInt(Radius);
Mouse(T3.x, T3.y, 2, 2, True);
End;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
Procedure MineWalk1;
Var
C, M, D, T, S: Integer;
Begin
Repeat
If (Not (ShittySandWalk(10, 25, '+4', D))) Then
Begin
Logout;
Players[CurrentPlayer].Loc := 'lost';
Exit;
End;
T := T + D;
S := S + 1;
Until(T >= 185) Or (S >= 6) Or (Not(LoggedIn));
If (Not (RadialRoadWalk(FindWaterColor, -20, 15, 70, -2, 2))) Then
Begin
Logout;
Players[CurrentPlayer].Loc := 'lost';
Exit;
End;
If(FirstW)Then
Begin
M := 4;
FirstW := False;
End Else
Begin
M := Stepz;
End;
For C := 1 To M Do
Begin
If (Not (ShittySandWalk(5, 20, '+2', D))) Then
Begin
If(M > 3)Then
Begin
Logout;
Players[CurrentPlayer].Loc := 'lost';
Exit;
End Else
Begin
Break;
End;
End;
End;
For C := 1 To 2 Do
Begin
Mouse(MMCX + C * 5 + 5, MMCY - 60 + Random(3), 2, 2, True);
Flag;
End;
If (Not (InMine >= 1650)) Then
Begin
Logout;
Players[CurrentPlayer].Loc := 'lost';
Exit;
End Else
Begin
Writeln('We made it to the mine!');
Players[CurrentPlayer].Loc := 'mine';
End;
End;
Function MineWalk2: Boolean;
Var
I, L: Integer;
Var
Randomm: String;
Begin
If(Not(LoggedIn))Then Exit;
Begin
L := GetArrayLength(TMP);
For I := 0 To L - 1 Do
Begin
Case Random(2) Of
0: Randomm := '-'+IntToStr(Random(1));
1: Randomm := '+'+IntToStr(Random(1));
End;
NewWalkToTile(TMP[i].x + StrToInt(Randomm), TMP[i].y + StrToInt(Randomm));
End;
If(PointInBox(GetLocation, IntToBox(3300, 3302, 3304, 3297)))Then
Begin
Result := True;
End;
End;
End;
Procedure BankWalk1;
Var
X, Y, I, C, Z, D: Integer;
Begin
If(Not(LoggedIn))Then Exit;
For C := 0 To 1 Do
Begin
Mouse(MMCX - 10, MMCY + 60 + Random(3), 2, 2, True);
Flag;
End;
Repeat
If (Not (ShittySandWalk(168, 192, '-10', D))) Then
Begin
Logout;
Players[CurrentPlayer].Loc := 'lost';
Exit;
End;
If (RadialRoadWalk(FindWaterColor, 160, 200, 70, -5, -2)) Then
Begin
Stepz := Z;
Break;
End;
Z := Z + 1;
Until(Z >= 4);
If (Not (ShittySandWalk(172, 188, '-3', D))) Then
Begin
Logout;
Players[CurrentPlayer].Loc := 'lost';
Exit;
End;
For I := 0 To 2 Do
Begin
MouseFindFlag(MMCX - 7, MMCY + 68, -4, 2);
Flag;
If(FindSymbol(X, Y, 'bank'))Then
Begin
Break;
End;
End;
If (Not (FindSymbol(X, Y, 'bank'))) Then
Begin
If(Not(FindBankers))Then
Begin
Logout;
Players[CurrentPlayer].Loc := 'lost';
Exit;
End Else
Begin
Writeln('We made it to the bank!');
Players[CurrentPlayer].Loc := 'bank';
Exit;
End;
End Else
Begin
Writeln('We made it to the bank!');
Players[CurrentPlayer].Loc := 'bank';
Mouse(X, Y, 2, 2, True);
Flag;
FindBankers;
End;
End;
Function BankWalk2: Boolean;
Var
I, L: Integer;
Var
Randomm: String;
Begin
If(Not(LoggedIn))Then Exit;
Begin
L := GetArrayLength(TBP);
For I := 0 To L - 1 Do
Begin
Case Random(2) Of
0: Randomm := '-'+IntToStr(Random(3));
1: Randomm := '+'+IntToStr(Random(3));
End;
NewWalkToTile(TBP[i].x + StrToInt(Randomm), TBP[i].y + StrToInt(Randomm));
End;
If(PointInBox(GetLocation, IntToBox(3269, 3172, 3272, 3164)))Then
Begin
Result := True;
End;
End;
End;
Procedure WalkTo(Mine: Boolean);
Begin
If(Not(LoggedIn))Then
Exit;
If(KYAB_Mode)Then
Begin
If(Mine)Then
Begin
MineWalk2;
If(Not(LoggedIn))Then
Begin
Exit;
End Else
Writeln('Succesfully walked to mine!');
End Else
Begin
If(BankWalk2)Then
Begin
Writeln('Succesfully walked to bank!');
End;
End;
End Else
Begin
If(Mine)Then
Begin
MineWalk1;
If(Not(LoggedIn))Then
Begin
Exit;
End Else
Writeln('Succesfully walked to mine!');
End Else
Begin
BankWalk1;
If(Not(LoggedIn))Then
Begin
Exit;
End Else
Writeln('Succesfully walked to bank!');
End;
End;
End;
Procedure CrapOff;
Var
I, C: Integer;
Var
TP: TPoint;
Begin
CountCoals;
If(NeedNew)Then
Begin
C := 1;
End Else
Begin
C := 2;
End;
For I := C To 28 Do
Begin
If(Not(InIntArray(CoalSlots, i)))Then
Begin
If(ExistsItem(i))Then
Begin
TP := ItemCoords(i);
Mouse(TP.x, TP.y, 2, 2, False);
ChooseOption('rop');
End;
End;
End;
End;
Procedure DepositCoals;
Var
TP: TPoint;
Var
I: Integer;
Begin
I := CountCoals;
CLS := CLS + I;
Players[CurrentPlayer].Integers[2] := I;
Banked := Banked + 1;
TP := ItemCoords(CoalSlots[0]);
Mouse(TP.x, TP.y, 2, 2, False);
ClickOption('ll', 2);
End;
Procedure NewAxe;
Var
X, Y, Sx, Sy: Integer;
Begin
X := Players[CurrentPlayer].Integers[0];
Y := Players[CurrentPlayer].Integers[1];
Sx := 35 + (X * 49);
Sy := 27 + (Y * 38);
MMouse(Sx, Sy, 2, 2);
If(IsUpText('xe'))Then
Begin
Withdraw(X, Y, 1);
ReportVars[1] := ReportVars[1] + 1;
SRLRandomsReport;
End Else
Begin
Writeln('Shit! Out of spare axes!');
Logout;
Players[CurrentPlayer].Loc := 'nomoreaxes';
End;
End;
Procedure Banking;
Begin
If(Not(OpenKharidBank))Then
Begin
If(Not(OpenBankQuiet('akbt')))Then
Begin
If(Not(OpenBankGlass('akb', True, True)))Then
Begin
If(Not(OpenBankFast('akb')))Then
Begin
Writeln('Could not find bank!');
Players[CurrentPlayer].Loc := 'lost';
Logout;
Exit;
End Else
Writeln('Found bank with OpenBankFast');
End Else
Writeln('Found bank with OpenBankGlass');
End Else
Writeln('Found bank with OpenBankQuiet');
End Else
Writeln('Found bank with (drumroll) OpenKharidBank! Woo!');
DepositCoals;
If(NeedNew)Then
Begin
NewAxe;
If(Not(Players[CurrentPlayer].Loc = 'nomoreaxes'))Then
Begin
Exit;
End Else
Begin
Logout;
Exit;
End;
End;
CloseBank;
End;
Procedure SetupPick;
Begin
If(Not(FindPickHeadColor))Then
Begin
Writeln('no pick plawkx?');
Logout;
NextPlayer(False);
End;
End;
Procedure AutoRetaliateOff;
Var
X, Y: Integer;
Begin
GameTab(1);
If(Not(FindColorTolerance(X, Y, 1777020, 609, 385, 637, 397, 20)))Then
Begin
GameTab(4);
End Else
Begin
Mouse(620, 390, 10, 10, True);
Wait(1500 + Random(250));
GameTab(4);
End;
End;
Procedure SetupCurrentPlayer;
Begin
SetupPick;
AutoRetaliateOff;
FirstW := True;
End;
Function AllPlayersFalse: Boolean; // Couldnt find the one by fawki anywhere?
Var
I: Integer;
Begin
Result := True;
For I := 0 To GetArrayLength(Players) - 1 Do
Begin
If(Players[i].Active)Then Exit;
End;
Result := False;
End;
Procedure RepeatMe;
Begin
If(Not(LoggedIn))Then Exit;
WalkTo(True);
Repeat
MineRock;
If(Not(LoggedIn))Then
Begin
Exit;
End;
Until(InvFull);
WalkTo(False);
Banking;
End;
Procedure MainLoop;
Var
X, I: Integer;
Begin
For I := 0 To GetArrayLength(Players) - 1 Do
Begin
SetupCurrentPlayer;
Repeat
RepeatMe;
X := X + 1;
ProgressReport;
Until(X >= Loads) Or (Not(LoggedIn));
If(Not(LoggedIn))Then
Begin
NextPlayer(False);
End Else
Begin
NextPlayer(True);
End;
ProgressReport;
End;
End;
Begin
SetupSRL;
ScriptID := '376'; if (SRL_ID = '') or (SRL_Pass = '')then begin ClearDebug; SRLid := '2368'; SrlPassword := 'password'; WriteLn('@@@ Hey! Don''t leech! Get an SRL Stats ID at : '); WriteLn('@@@ [url]http://www.Stats.SRL-Forums.com[/url] !!! '); WriteLn('@@@ And type it in the script'); WriteLn('@@@ Until you do that, the script will not run. '); WriteLn('@@@ Byee! '); TerminateScript; End;
If(KYAB_Mode)Then
Begin
SetupKYAB;
Paths;
End;
DeclarePlayers;
MainLoop;
End.
{=============== The almighty procedure/ function commenting ==================]
[ Procedure DeclarePlayers - Declares the SRL Player array ====================]
[ Procedure Pahts - Declares the KYAB walking paths ===========================]
[ Function FindSandColor - Finds the Al-Kharid sand color =====================]
[ Function Al-Kharid - Detects if we are in kharid-bank. Forgot where to use ==]
[ Function FindBankers - tries to find the bankers on minimap and walk to them ]
[ Function OpenKharidBank - tries to open Al-Kharid bank. =====================]
[ Function CoalDDTM - Loads the coal DDTM =====================================]
[ Function CreateCoalDTM - modifies the CoalDDTM until it is valid ============]
[ Procedure EnlargeTBox - Enlarges a TBox by X ===============================]
[ Function FindRockIn - Finds a coal damn fast ================================]
[ Function WaitUntilCoal - Waits until a coal is present ======================]
[ Procedure FollowCoal - Follows the coal rock ================================]
[ Function GotHead - checks if our pickaxe still has the head :D ==============]
[ Function HandleLostAxe - if our axehead is lost, finds it and reattaches ====]
[ Function DualGasCheck - Uses two different gas checking functions ===========]
[ Function ClickRock - Clicks a rock and follows it. ==========================]
[ Function RockThere - Checks if our coal rock is still there =================]
[ Procedure MineRock - Mines a rock. ==========================================]
[ Function CountCoals - Counts the coals in inventory and stores them in TPA ==]
[ Function ShittySandWalk - :D As the name says, a shitty sand walker =========]
[ Function GetWallColor - Gets the mine wall color ============================]
[ Function ZeroToleranceZero - Removes all zero values from an array ==========]
[ Function InMine - Checks if we are in the Al-Kharid mine. ===================]
[ Procedure GetCaveEdges - gets the X of the left and right side of mine walls ]
[ Procedure OutWallWalk - It is supposed to walk in middle of the mine ========]
[ Procedure MineWalk1/2 - SRL and KYAB walking to the mine ====================]
[ Procedure BankWalk1/2 - SRL and KYAB walking to the bank ====================]
[ Procedure WalkTo - Walks to bank or mine, KYAB or SRL =======================]
[ Procedure CrapOff - drops all "crap" from inventory =========================]
[ Procedure DepositCoals - deposits all the coals =============================]
[ Procedure NewAxe - gets a new axe from the bank =============================]
[ Procedure Banking - handles the banking =====================================]
[ Procedure SetupPick - checks if our pick is there ===========================]
[ Procedure AutoRetaliateOff - sets AutoRetaliate off =========================]
[ Procedure SetupCurrentPlayer - sets up the current player ===================]
[ Function AllPlayersFalse - checks if all our players are false ==============]
[==============================================================================}
And btw before you say anything, yes ' (* ' is also a comment.
EDIT: Parts that I would bet my grandma on include the rock mining, it works like t3h s3x!
EDIT EDIT: Proggified!