Sjoe
2013-01-05 16:28:53
Ok I'm probably one of the few SRL members here that didn't know how to script ;) Don't judge me hehe.
It's a Sapphire Necklace Maker in Al Kharid
Just posting it for getting advice
Would like more advice on smarter scripting, and failsafes
Cheers guys
It's a Sapphire Necklace Maker in Al Kharid
Just posting it for getting advice
const
SpeedOfMouse = 20;
Loads = 50;
var
LoadsDone, AttemptsOnBank: Integer;
BlueSaph, GoldBar, GreenVial, SaphNeckInv: Integer;
Procedure AntiBan;
begin
case Random(150) of
1: begin HoverSkill('random', False) GameTab(25) end;
2-6: begin HoverSkill('crafting', False) GameTab(25) end;
6-8: BoredHuman;
9: PickUpMouse;
10: RandomMovement;
11: RandomRclick;
12: CompassMovement(10, 70, True);
end;
end;
//---------------------AutoColors--------------------\\
function NPCBANKColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.16, 1.90);
if not (FindColorsTolerance(arP, 2386031, MSX1, MSY1, MSX2, MSY2, 10)) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);
if (R >= 67) and (R <= 137) and (G >= 63) and (G <= 129) and (B >= 14) and (B <= 66) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 4.49) and (X <= 17.80) and (Y >= 4.99) and (Y <= 20.51) and (Z >= 1.69) and (Z <= 8.04) then
begin
Result := arC[i];
Break;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
function FurnaceColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.06, 2.74);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 11192803, MSX1, MSY1, MSX2, MSY2, 5);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);
if (R >= 211) and (R <= 240) and (G >= 188) and (G <= 214) and (B >= 161) and (B <= 183) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 51.85) and (X <= 67.85) and (Y >= 52.98) and (Y <= 69.34) and (Z >= 41.65) and (Z <= 54.07) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
//--------------------------------------------------------\\
//------------------Walking Procedures---------------------\\
procedure WalkToFurnace;
var
Furny: TPointArray;
begin
Case Random(15) of
1: begin HoverSkill('crafting', False) GameTab(25) end;
end;
FindNormalRandoms;
RunEnergy(30);
Furny := [Point(89, 164), Point(89, 165), Point(110, 150), Point(112, 126), Point(116, 110), Point(126, 95), Point(129, 78), Point(111, 79)]
SPS_WalkPath(Furny);
Wait(150+ Random (50));
end;
procedure WalkToBank;
var
Banky: TPointArray;
begin
FindNormalRandoms;
RunEnergy(30);
Banky := [Point(112, 73), Point(112, 72), Point(130, 77), Point(126, 94), Point(116, 105), Point(113, 122), Point(110, 136), Point(112, 153), Point(108, 166), Point(91, 167)]
SPS_WalkPath(Banky);
Wait(1250+ Random(250));
end;
//--------------------------------------------------------\\
//------------------------Banking----------------------------\\
procedure FindBankers;
var
x,y: Integer;
begin
repeat
if (BankScreen = False) then
begin
if FindObj(x, y, ('Bank'), NPCBANKColor, 5) then
MMouse(x, y, 3, 3);
Clickmouse2(mouse_right);
ChooseOptionEx('nk B', 'k Ba')
Wait(2250+ random(500))
end;
inc(AttemptsOnBank)
until((BankScreen = True) or (AttemptsOnBank=5))
if(BankScreen = True) then Writeln('opened')
end;
procedure BankingTheStuff;
var
BankAttempts, x, y: Integer;
begin
SaphNeckInv := DTMFromString('mggAAAHicY2NgYEhjYmAoBuIkIE4F4lwgrgRiOUYGBk4glgZiZSBWAGJhEBbrAupixMBGQJIfC8ZUCcEQAACzoQRy');
BlueSaph := DTMFromString('mggAAAHicY2NgYGADYg4g5gZifiBmZIAATigtCFUjAsSsQNzRMReqChXzM2AHmCoRdjAwAACwmAIw');
GoldBar := DTMFromString('mrAAAAHic42BgYOAFYmEglgViSSAWAGJOBgjgAmI2KJsFiHmAWBSqng+ImYB4SbM4kGTEiY2AJD8ejFsnBMMAAB10Arg=');
begin
begin
if FindDTM(SaphNeckInv, x, y, MIX1, MIY1, MIX2, MIY2) then
repeat
FindBankers;
QuickDeposit(SRL_DEPOSIT_ALL);
Wait(150 + Random(150))
MouseBox(396, 146, 413, 154, mouse_right)
Wait(150 + Random(150))
ChooseOption('-14')
Wait(150 + Random(150))
MouseBox(444, 145, 454, 154, mouse_Right)
Wait(150 + Random(150))
ChooseOption('-14')
Wait(800 + Random(150))
Inc(BankAttempts);
until (FindDTM(BlueSaph, x, y, MIX1, MIY1, MIX2, MIY2)
or (BankAttempts = 5))
end;
end;
FreeDTM(SaphNeckInv);
FreeDTM(BlueSaph);
FreeDTM(GoldBar);
end;
//----------------------------------------------------------\\
function CraftingScreen: Boolean;
var
x, y: Integer;
begin
Result := False;
GreenVial := DTMFromString('mggAAAHicY2NgYDBlgmAjILYEYisg1gPiZEYGhlAgTofiWCBOAGKGpfoMLYv3MKibezBImngxGBibMUhJSTH8B0rxY8GMODAEAAD/KgnE');
if FindDTM(GreenVial, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
Writeln('Opened Crafting Screen')
Result := True
end;
FreeDTM(GreenVial);
end;
procedure FindFurnace;
var
FurnaceFinding, x, y: Integer;
begin
Marktime(FurnaceFinding)
FindNormalRandoms;
if ((IsMoving = False) or FFlag(0)) then
begin
repeat
if FindObj(x, y, ('Smelt'), FurnaceColor, 5) then
begin
MMouse(x, y, 3, 3);
Clickmouse2(mouse_left);
Wait(1500 + Random(500));
end;
until((CraftingScreen) or (TimeFromMark(FurnaceFinding) > (30000)))
end;
end;
procedure CraftingRings;
var
WaitingTime, CraftingTheRings: Integer;
SaphNeckCraftScr: Integer;
x, y: Integer;
begin
SaphNeckCraftScr := DTMFromString('mbQAAAHicY2VgYAgF4mAgjgDiVCCOBuLDQHwKirdCsaBIGwM6MAJifjTMiAWDAQAJYwal');
WaitingTime := (23500 + Random(1250))
if CraftingScreen then
begin
if FindDTM(SaphNeckCraftScr, x, y, 220, 10, MSX2, MSY2) then
begin
MouseBox(265, 314, 480, 324, mouse_left)
Writeln('Crafting Necklaces')
Wait(2000)
end else
if FindDTM(SaphNeckCraftScr, x, y, MSX1, MSY1, 167, 227) then
begin
MouseBox(78, 134, 110, 167, mouse_left);
Wait(350 + Random(250));
MouseBox(265, 314, 480, 324, mouse_left)
Writeln('Crafting Necklaces')
Wait(2000)
end else
begin
Dragmouse(229, 205, 1, 1, 227, 89, 2, 2);
Wait(350 + Random(350))
MouseBox(78, 134, 110, 167, mouse_left);
Wait(550 + Random(150));
MouseBox(265, 314, 480, 324, mouse_left);
Writeln('Crafting Necklaces');
Wait(2000)
end;
end;
FreeDTM(SaphNeckCraftScr);
Marktime(CraftingTheRings);
repeat
AntiBan;
Wait(1250 + Random (750))
until (TimeFromMark(CraftingTheRings) > WaitingTime)
end;
begin
SetupSRL;
MouseSpeed := (SpeedOfMouse);
SPS_Setup(Runescape_Other, ['Al_Kharid']);
ClickNorth(SRL_Angle_High);
repeat
BankingTheStuff;
WalkToFurnace;
FindFurnace;
CraftingRings;
WalkToBank;
inc(LoadsDone);
until(LoadsDone = Loads)
end.
Would like more advice on smarter scripting, and failsafes
Cheers guys