SRL Archive - RS3 Outdated / Broken Scripts

Varrock Clay Softener


Pure1993

2010-03-17 07:12:09

Varrock East Clay Softener

Well, I guess I'm back again, carrying a script in my backpack. ;)
Enjoy it but use it with causion, clay softening has a high ban rate.
Either Download it or copy/paste it:


{==============================================================================}
{ }
{ Name: Varrock East Clay Softener }
{ Author: Pure1993 }
{ Category: Money Making }
{ Description: Softenes clay at Varrock East for profit }
{ Usage: Have hard clay and at least 14 Buckets in your Inventory }
{ and/or bank. Be located close to the Varrock East fountain }
{ or bank. You can buy Clay in the GE (recommended) or you }
{ can you can mine them. Buckets can be bought in any general }
{ store. }
{ Date Created: 11.3.2010 }
{ Last Update: 11.3.2010 }
{ Current Version: 1.0 }
{ }
{==============================================================================}
{ }
{ Setup: }
{ 1.) Go to lines 78+ and set your account(s) up }
{ 2.) Use Safe Mode and Full Brightness }
{ 3.) Press run and monitor the first 2 loads }
{ in case a massiv color change occurs (shouldn't }
{ actually happen though, just to play safe) }
{ 4.) If it doesn't work, try adjusting lines 45 to 51 }
{ }
{==============================================================================}
{ }
{ Best Proggy: }
{ Thank you for Running Varrock East Softener }
{ Runtime: 1 Hours, 58 Minutes and 1 Seconds }
{ }
{ Player #0: }
{ Nick: ache }
{ Clay Softened: 1974 }
{ Active: True }
{ }
{ Submitted by: Pure1993 (beat it to get yours displayed here ;D) }
{ }
{==============================================================================}

program VarrockEastSoftener;
{.include srl/srl.scar}

const
TheRoadColor = 8095361; // Choose a new one if the Tolerance increase doesn't work

AddedRoadTolerance = 5; // Increase if it doesn't realise that it is standing in the bank
// Decrease if it doesn't realise that it is at the fountain
// SHOULD work stable at 0 to 5;

AddedDTMTolerance = 0; // Increase if it doesn't find inventory Items
// Increase if it detects full buckets as empty buckets and vice versa
// SHOULD work stable at 0;

//-----------------------The Setup-----------------------\\

function GetLoc: string; forward;

var
// DTMS
H_Clay, E_Bucket, F_Bucket, S_Clay : Integer;

// Colors and Tolerances
V_Fountain, V_FountainMaxTol, V_Banker, V_BankerMaxTol : Integer;

// Proggy Variables
D_Clay : Integer;

// Essential Boolean for main loop
TheBool : Boolean;

// Essential Integer for main loop failproof
Failer : Integer;

// Fallback, increases Tolerances, decreses minimum ammount of pixels required
Sloppyness : Integer;

Procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active := True;
end;

function CreateSoftClayDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 663;
dtmMainPoint.y := 337;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 868439;
dtmMainPoint.Tolerance := AddedDTMTolerance + 10;

dtmSubPoints[0].x := 663;
dtmSubPoints[0].y := 346;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 131072 ;
dtmSubPoints[0].Tolerance := AddedDTMTolerance + 10;

dtmSubPoints[1].x := 650;
dtmSubPoints[1].y := 337;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 131072 ;
dtmSubPoints[1].Tolerance := AddedDTMTolerance + 10;

dtmSubPoints[2].x := 666;
dtmSubPoints[2].y := 327;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 131072 ;
dtmSubPoints[2].Tolerance := AddedDTMTolerance + 10;

dtmSubPoints[3].x := 673;
dtmSubPoints[3].y := 338;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 131072 ;
dtmSubPoints[3].Tolerance := AddedDTMTolerance + 10;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;

function CreateFullBucketDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 621;
dtmMainPoint.y := 259;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 9009015;
dtmMainPoint.Tolerance := AddedDTMTolerance + 10;

dtmSubPoints[0].x := 625;
dtmSubPoints[0].y := 254;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 131072 ;
dtmSubPoints[0].Tolerance := AddedDTMTolerance+10;

dtmSubPoints[1].x := 629;
dtmSubPoints[1].y := 270;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 131072 ;
dtmSubPoints[1].Tolerance := AddedDTMTolerance+10;

dtmSubPoints[2].x := 619;
dtmSubPoints[2].y := 277;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 131072 ;
dtmSubPoints[2].Tolerance := AddedDTMTolerance+10;

dtmSubPoints[3].x := 612;
dtmSubPoints[3].y := 269;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 131072 ;
dtmSubPoints[3].Tolerance := AddedDTMTolerance+10;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;

function CreateEmptyBucketDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 621;
dtmMainPoint.y := 259;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 1587788;
dtmMainPoint.Tolerance := AddedDTMTolerance + 10;

dtmSubPoints[0].x := 625;
dtmSubPoints[0].y := 254;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 131072 ;
dtmSubPoints[0].Tolerance := AddedDTMTolerance+10;

dtmSubPoints[1].x := 629;
dtmSubPoints[1].y := 270;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 131072 ;
dtmSubPoints[1].Tolerance := AddedDTMTolerance+10;

dtmSubPoints[2].x := 619;
dtmSubPoints[2].y := 277;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 131072 ;
dtmSubPoints[2].Tolerance := AddedDTMTolerance+10;

dtmSubPoints[3].x := 612;
dtmSubPoints[3].y := 269;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 131072 ;
dtmSubPoints[3].Tolerance := AddedDTMTolerance+10;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;

function CreateClayDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 661;
dtmMainPoint.y := 412;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 5010314;
dtmMainPoint.Tolerance := AddedDTMTolerance + 15;

dtmSubPoints[0].x := 660;
dtmSubPoints[0].y := 407;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 131072 ;
dtmSubPoints[0].Tolerance := AddedDTMTolerance + 10;

dtmSubPoints[1].x := 665;
dtmSubPoints[1].y := 413;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 131072 ;
dtmSubPoints[1].Tolerance := AddedDTMTolerance + 10;

dtmSubPoints[2].x := 655;
dtmSubPoints[2].y := 413;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 131072 ;
dtmSubPoints[2].Tolerance := AddedDTMTolerance + 10;

dtmSubPoints[3].x := 661;
dtmSubPoints[3].y := 415;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 131072 ;
dtmSubPoints[3].Tolerance := AddedDTMTolerance + 10;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
// Loads all global colors, tolerances and DTMS
procedure LoadInts;
begin
SetupSRL;
H_Clay := CreateClayDDTM;
F_Bucket := CreateFullBucketDDTM;
E_Bucket := CreateEmptyBucketDDTM;
S_Clay := CreateSoftClayDDTM;
V_Fountain := 16232075 ;
V_FountainMaxTol := 15;
V_Banker := 5061698;
V_BankerMaxTol := 10;
TheBool := True;
Failer := 0;
Sloppyness := 0;
end;


// Prompts the status in the status bar and as the window disguise
procedure PromptStatus(TheStatus : string);
begin
Status('Runtime: '+TimeRunning+' || Status: '+TheStatus+' || Clay softened: '+IntToStr(D_Clay));
Disguise('Runtime: '+TimeRunning+' || Status: '+TheStatus+' || Clay softened: '+IntToStr(D_Clay));
end;

function TPToStr( TP : TPoint): string;
begin
Result := '('+IntToStr(TP.x)+'|'+IntToStr(TP.y)+')';
end;

//-----------------------The Clay Related Functions-----------------------\\

// Searches for the Banker and clicks the desired option
function AtColors( Color, MaxTol : Integer; Uptext, Action : string; Click : Boolean): Boolean;
var
i, a, CurrentTol, Failer : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
TP : TPoint;
begin
Failer := 0;
for i := 5 downto 0 do
begin
if not LoggedIn then Exit;
CurrentTol := MaxTol - i;
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, CurrentTol);
if (Length(TPA) > 15) then
begin
ATPA := TPAToATPA( TPA, 10);
SortATPASize(ATPA, true);
for a := 0 to high(ATPA) do
begin
if (Action = 'ank') and (BankScreen) then
begin
Result := True;
Exit;
end;
if not LoggedIn then Exit;
MiddleTPAEx(ATPA[a], TP.x, TP.y)
MMouse(TP.x, TP.y, 3, 3);
if WaitUptext(Uptext, 500+random(500)) then
begin
Result := not Click;
if Result then Exit;
GetMousePos(TP.x, TP.y);
if (pos(Action, GetUptext) = 0) then
begin
Mouse(TP.x, TP.y, 0, 0, false);
Result := WaitOptionEx( Action,'action', ClickLeft, 3000+random(500));
Exit;
end else
begin
Mouse(TP.x, TP.y, 0, 0, true);
Result := True;
Exit;
end;
end;
if (Failer > 4 ) then
Exit;
Inc(Failer);
end;
end;
end;
Result := False;
end;


// Searches for the Fountain and clicks the desired option
function AtFountain: Boolean;
begin
PromptStatus('Looking for Fountain');
Result := AtColors( V_Fountain, V_FountainMaxTol+Sloppyness, 'se', 'se', True );
end;


// Searches for the Bank and clicks the desired option
function AtBanker: Boolean;
begin
PromptStatus('Looking for Banker');
Result := AtColors( V_Banker, V_BankerMaxTol+Sloppyness, 'ank', 'ank ', True );
end;


// Checks if a given item is in the inventory
function InvContains( ItemName : String ): boolean;
var
TP : TPoint;
TheDTM : Integer;
begin
case Lowercase(ItemName) of

'soft clay' : TheDTM := S_Clay;

'hard clay' : TheDTM := H_Clay;

'empty buckets' : TheDTM := E_Bucket;

'full buckets' : TheDTM := F_Bucket;

end;
Result := FindDTM( TheDTM, TP.x, TP.y, MIX1, MIY1, MIX2, MIY2);
end;


// Searches for a given DTM and clicks the desired option
function AtDTM(TheDTM : Integer; Uptext, TheOption : string): Boolean;
var
TP : TPoint;
begin
if ( FindDTM( TheDTM, TP.x, TP.y, MIX1, MIY1, MIX2, MIY2) ) then
begin
MMouse( TP.x, TP.y, 3, 3);
if WaitUptext(Uptext, 2000+random(500)) then
begin
GetMousePos(TP.x, TP.y);
if (pos(TheOption, GetUpText) = 0) then
begin
Mouse(TP.x, TP.y, 0, 0, false);
Result := WaitOptionEx( TheOption,'action', ClickLeft, 3000+random(500));
Exit;
end else
begin
Mouse(TP.x, TP.y, 0, 0, true);
Result := True;
Exit;
end;
end;
end;
Result := False;
end;


// Does the actual Banking
function DoBanking: Boolean;
var
s, h, e, f, x, y, Failer : integer;
TPA : Array [0..3] of TPoint;
TP : TPoint;
begin
s := CountItems( 'dtm', S_Clay, []);
h := CountItems( 'dtm', H_Clay, []);
e := CountItems( 'dtm', E_Bucket, []);
f := CountItems( 'dtm', F_Bucket, []);

Finddtm(S_Clay,TPA[0].x, TPA[0].y, MIX1, MIY1, MIX2, MIY2);
Finddtm(H_Clay,TPA[1].x, TPA[1].y, MSX1, MSY1, MSX2, MSY2);
Finddtm(F_Bucket,TPA[2].x, TPA[2].y, MSX1, MSY1, MSX2, MSY2);
Finddtm(E_Bucket,TPA[3].x, TPA[3].y, MSX1, MSY1, MSX2, MSY2);

Failer := 0;

if ( s + h + e + f < InvCount) then
begin
DepositAll;
while ((Failer < 50) and (InvCount > 0)) do
begin
Wait(100);
Inc(Failer);
end;
Result := False;
Exit;
end;

if s > 0 then
begin
if FindDTM( S_Clay, TP.x, TP.y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse( TPA[0].x, TPA[0].y, 3, 3, false);
WaitOption('ll', 3000+random(500));
while ((Failer < 50) and (InvContains('soft clay'))) do
begin
Wait(100);
Inc(Failer);
end;
Result := False;
Exit;
end;
end;

if ( e + f < 14) then
begin
if FindDTM( F_Bucket, x, y, MSX1, MSY1, MSX2, MSY2) then Mouse( TPA[2].x, TPA[2].y, 3, 3, false) else
if FindDTM( E_Bucket, x, y, MSX1, MSY1, MSX2, MSY2) then Mouse( TPA[3].x, TPA[3].y, 3, 3, false) else
begin
Result := False;
Exit;
end;
WaitOption('-X', 3000+random(500));
wait(600+random(300));
TypeSend(IntToStr(14 - (f + e)));
while ((Failer < 50) and (CountItems( 'dtm', E_Bucket, []) + CountItems( 'dtm', F_Bucket, []) < 14)) do
begin
Wait(100);
Inc(Failer);
end;
Result := False;
Exit;
end;


if h < 1 then
begin
if FindDTM( H_Clay, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
Mouse( TPA[1].x, TPA[1].y, 3, 3, false);
WaitOption('ll', 3000+random(500));
while ((Failer < 50) and (not InvContains('hard clay'))) do
begin
Wait(100);
Inc(Failer);
end;
Result := False;
Exit;
end else
begin
Writeln('NO MORE CLAY!');
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Strings[0] := 'Out of clay!';
CloseBank;
NextPlayer(false);
end;
end;

Result := True;
end;


// Handles the banking
function HandleBanking: Boolean;
begin
PromptStatus('Banking');
if not BankScreen then
begin
if ((rs_GetCompassAngleDegrees > 135) and ( rs_GetCompassAngleDegrees < 225)) then MakeCompass( random(180) + 270);
if not AtBanker then
exit else
begin
while (not BankScreen) do
wait(400+random(200));
end;
end;
PromptStatus('Banking');
repeat
if (not BankScreen) then Exit;
Result := DoBanking;
until Result;
CloseBank;
end;


// Checks if we need to Bank
function NeedToBank: Boolean;
var
s, h, e, f : integer;
begin
s := CountItems( 'dtm', S_Clay, []);
h := CountItems( 'dtm', H_Clay, []);
e := CountItems( 'dtm', E_Bucket, []);
f := CountItems( 'dtm', F_Bucket, []);
PromptStatus('Banking Check');
Result := (InvContains('full buckets') and InvContains('soft clay')) or
(s+h+e+f <> InvCount) or (InvCount = 0);
if ((not Result) and InvContains('soft clay')) then
Result := GetLoc = 'V_Bank';
end;


// Checks if we need to Fill
function NeedToFill: Boolean;
begin
PromptStatus('Filling Check');
Result := (InvContains('empty buckets') and InvContains('hard clay'));

if ((not Result) and InvContains('empty buckets')) then
Result := GetLoc = 'V_Fountain';
end;


// Checks if we need to Soften
function NeedToSoften: Boolean;
begin
PromptStatus('Softening Check');
Result := InvContains('full buckets') and InvContains('hard clay');
end;


// Does the actual softening
function DoSoften: Boolean;
var
TheDTM1, TheDTM2 : Integer;
begin
PromptStatus('Softening');
if random(2) = 1 then
begin
TheDTM1 := F_Bucket;
TheDTM2 := H_Clay;
end else
begin
TheDTM2 := F_Bucket;
TheDTM1 := H_Clay;
end;
if (AtDTM(TheDTM1, 'se', 'se')) then
begin
if (AtDTM(TheDTM2, 'se', 'se')) then
begin
MarkTime(Failer);
repeat
Wait(100);
if (TimeFromMark(Failer) > 4000) then
Exit;
until FindNPCChatText( 'oft clay', Clickright);
wait(300);
if ((pos( 'ucket', GetUptext) <> 0) or (pos( 'lay', GetUptext) <> 0)) then
begin
MouseBox(MSX1, MSY1, MIX2, MIY2, 2);
WaitOption( 'ancel', 3000+random(500));
Result := False;
Exit;
end;
Mouse( 260, 450, 5, 5, false);
Result := WaitOption( 'll', 3000+random(500));
if Result then
begin
MarkTime(Failer);
while InvContains('hard Clay') and InvContains('full buckets') do
begin
if FindNormalRandoms then Exit;
if (random(30) = 10) then MakeCompass(random(360));
if (random(10) = 5) then SleepAndMoveMouse(300+random(100)) else wait(200+random(100));
if (not InvContains( 'soft clay')) then
if (TimeFromMark(Failer) > 5000) then
Exit;
end;
end;
IncEx(Players[CurrentPlayer].Integers[0], CountItems( 'dtm', S_Clay, []));
IncEx(D_Clay, CountItems( 'dtm', S_Clay, []));
Exit;
end;
end;
Result := False;
end;


// Handles the Filling
function DoFilling: boolean;
var
Failer : Integer;
begin
PromptStatus('Filling');
if AtDTM( E_Bucket, 'ucket', 'se') then
if AtFountain then
begin
wait(400);
if (pos( 'ucket', GetUptext) <> 0) then
begin
MouseBox(MSX1, MSY1, MIX2, MIY2, 2);
WaitOption( 'ancel', 3000+random(500));
Result := False;
Exit;
end;
MarkTime(Failer);
while InvContains( 'empty buckets') do
begin
if FindNormalRandoms then Exit;
if (random(30) = 10) then MakeCompass(random(360));
if (random(10) = 5) then SleepAndMoveMouse(300+random(100)) else wait(200+random(100));
if (not InvContains( 'full buckets')) then
if (TimeFromMark(Failer) > 5000) then
Exit;
end;
end;
Result := not InvContains( 'empty buckets');
end;

//-----------------------The Walker Functions-----------------------\\

function GetCurrentRadian( Normal : Integer; Reset : Boolean ): Integer;
begin
Result := round((360 - rs_GetCompassAngleDegrees)) + Normal;
if ( Reset) then Result := (Result mod 360);
end;


procedure WalkNorthOfPoint( TP : TPoint; Distance : Integer);
var
x, y : Integer;
begin
x := ( round(sin((GetCurrentRadian( 0, true)*pi)/ 180) ) * Distance) + TP.x;
y := ( round(-cos((GetCurrentRadian( 0, true)*pi)/ 180) ) * Distance) + TP.y;
Mouse( x, y, 0, 0, true);
end;


function FindNPCGroup: Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
i, TestColor, r, g, b, NPCColor : Integer;
TP : Tpoint;
begin
FindColorsSpiralTolerance( MMCX, MMCY, TPA, 195836, MMX1, MMY1, MMX2, MMY2, 20+Sloppyness);
for i := 0 to high(TPA) do
begin
TestColor := GetColor( TPA[i].x, TPA[i].y);
ColorToRGB( TestColor, R, G, B);
if ( B < 5 ) then
if( R > 200 ) then
if ( G > 200 ) then
if( R - G > -20) then
if( R - G < 20) then
begin
NPCColor := TestColor;
FindColorsSpiralTolerance( MMCX, MMCY, TPA, NPCColor, MMX1, MMY1, MMX2, MMY2, 3+Sloppyness);
ATPA := TPAToATPA( TPA, 15);
SortATPASize( ATPA, true );
TP := MiddleTPA(ATPA[0]);
WalkNorthOfPoint( TP, 10);
Wait(800+random(100));
FFlag(0);
Wait(800+random(100));
Result := True;
Exit;
end;
end;
Result := False;
end;


function DrawCircle(StartRadial, EndRadial, x, y, radius: Integer): TPointArray;
var
TPA : Tpointarray;
a, i: Integer;
begin
i := 0;
SetArrayLength( TPA, (EndRadial - StartRadial) + 1);
for a := StartRadial to EndRadial do
begin
TPA[i].Y := (-round(cos((pi*a)/180) * radius)) + y ;
TPA[i].X := round(sin((pi*a)/180) * radius) + x;
inc(i);
end;
Result := TPA;
end;

function ReturnSimilarColorsIndex( Colors : TIntegerArray; Color, Tol : Integer): TIntegerArray;
var
i, a : Integer;
TI : TIntegerArray;
begin
a := 0;
SetArrayLength( TI, 0);
for i := 0 to High(Colors) do
begin
if SimilarColors( Colors[i], Color, Tol) then
begin
SetArrayLength( TI, Length(TI)+1);
TI[a] := i;
Inc(a);
end;
end;
Result := TI;
end;

function P_RadialWalk( Color, StartRadial, EndRadial, Radius, Tol: Integer): Boolean;
var
TPA_Circle, Temp_TPA: TPointArray;
TP : TPoint;
TI, TI2 : TIntegerArray;
i, a : Integer;
begin
for i := 0 to radius - 20 do
begin
TPA_Circle := DrawCircle( StartRadial, EndRadial, MMCX, MMCY, Radius - i);
TI := GetColors( TPA_Circle );
TI2 := ReturnSimilarColorsIndex( TI, Color, Tol+Sloppyness);
if Length( TI2) > 0 then
begin
SetArrayLength( TEMP_TPA, Length(TI2));
for a := 0 to high(TI2) do
begin
TEMP_TPA[A] := TPA_CIRCLE[TI2[A]];
end;
TP := MiddleTPA( TEMP_TPA );
Mouse( TP.x, TP.y, 0, 0, true);
wait(800+random(200));
FFlag(0);
Result := True;
Exit;
end;
end;
Result := False;
end;

function WalkToBank: Boolean;
begin
Result := P_RadialWalk( TheRoadColor, GetCurrentRadian(90, false), GetCurrentRadian(160, false), 72, AddedRoadTolerance+20);
if Result then
Result := FindNPCGroup;
end;

function WalkToFountain: Boolean;
begin
Result := P_RadialWalk( TheRoadColor, GetCurrentRadian(290, false), GetCurrentRadian(350, false), 72, AddedRoadTolerance+20);
end;


function GetLoc: string;
var
TPA_Circle: TPointArray;
TI, TI2 : TIntegerArray;
cSloppy : Integer;
begin
TPA_Circle := DrawCircle( GetCurrentRadian(0, false), GetCurrentRadian(45, false), MMCX, MMCY, 70);
TI := GetColors( TPA_Circle );
TI2 := ReturnSimilarColorsIndex( TI, TheRoadColor, 20 + AddedRoadTolerance);
if Sloppyness > 3 then
CSloppy := 3;
if (Length( TI2 ) > 4-CSloppy) then Result := 'V_Fountain' else Result := 'V_Bank';
end;


function GetToLoc(loc : string): Boolean;
var
cLoc : string;
begin
cLoc := GetLoc;
if lowercase(cLoc) = lowercase(loc) then
begin
Result := True
Exit;
end;
if lowercase(loc) = 'v_fountain' then
Result := WalkToFountain;
if lowercase(loc) = 'v_bank' then
Result := WalkToBank;
wait(300+random(200));
end;

procedure Proggy;
var
i : Integer;
begin
Writeln('Thank you for Running Varrock East Softener');
Writeln('Runtime: '+TimeRunning);
for i := 0 to high(players) do
begin
Writeln(' ');
Writeln('Player #'+IntToStr(i)+':');
Writeln('Nick: '+Players[i].Nick);
Writeln('Clay Softened: '+IntToStr(Players[i].Integers[0]));
writeln('Active: '+BoolToStr(Players[i].Active));
if (not Players[i].Active) then
writeln('Reason: '+Players[i].Strings[0]);
end;
end;

procedure HandleRun;
begin
if RunEnergy(20) then
begin
RestUntil( 80 + random(20))
SetRun(True);
end;
end;

function FollowProgram: Boolean;
begin
if NeedToBank then
begin
GetToLoc('V_Bank');
Result := HandleBanking;
Exit;
end;
if NeedToSoften then
begin
Result := DoSoften;
Exit;
end;
if NeedToFill then
begin
GetToLoc('V_Fountain');
Result := DoFilling;
Exit;
end;
end;

//Main Loop
begin
Wait(500);
DeclarePlayers;
LoadInts;
LoginPlayer;
wait(4000+random(500));
SetAngle( true );
while (not AllPlayersInactive) do
begin
while ((Sloppyness < 5) and LoggedIn) do
begin
while ((Failer < 3) and LoggedIn) do
begin
TheBool := FollowProgram;
FindNormalRandoms;
if TheBool then
Failer := 0 else
Inc(Failer);
Proggy;
end;
Failer := 0;
Inc(Sloppyness);
end;
Sloppyness := 0;
if (not LoggedIn) then
NextPlayer(false);
end;
Logout;
Proggy;
end.

What do you need?
  • SCAR Divi 3.23
  • Open Dev SRL

Proggies:

Runtime: 48 Minutes and 46 Seconds

Player #0:
Nick: ache
Clay Softened: 820
Active: False
Reason: Out of clay!


Runtime: 52 Minutes and 42 Seconds

Player #0:
Nick: ache
Clay Softened: 868
Active: True


Runtime: 1 Hours, 58 Minutes and 1 Seconds

Player #0:
Nick: ache
Clay Softened: 1974
Active: True


FAQ for all possible problems and questions:

Q: Does this script run with S.M.A.R.T.?
A: Well, it should, but somehow S.M.A.R.T. doesn't like my Windows 7 64bit OS, if you want to try to use S.M.A.R.T., simply add it yourself

Q: Does this script run with multiple accounts?
A: Once again, I have no clue, all but one of my accounts got banned while (ab)using RSBot, so I only have one acc to test it with… The main loop is set up for multiplayer though.

Q: The script is Stuck in the bank/by the fountain, what can I do?
A: Try adding to the AddedRoadTolerance in the constants. If that doesn't help, choose a darker shade of the raod color and change the constant TheRoadColor to it

Q: The script just keeps on walking, what do I do?
A: Try decreasing the AddedRoadTolerance in the constants. If that doesn't help, choose a lighter shade of the raod color and change the constant TheRoadColor to it

Q: The Script doesn't find a certain Item (full buckets, empty bucket, hard clay or soft clay), what can I do?
A: Add to the AddedDTMTolerance constant until it works

Q: The Script doesn't wait until the buckets are filled…
A: Decrease the AddedDTMTolerance constant until it works

Q: Some other problem is occuring which is not listed here….
A: Post a full description of your problem, this includes: when did it happen, what was the script doing, what was it supposed to be doing, any extra information

Possible Problems (SRL related)

Problem:

[Runtime Error] : Exception: Access violation at address 006CE72A in module 'scar.exe'. Read of address FFFFFFFF in line 283 in script C:\Users\Mastermind\Desktop\Scar\includes\SRL\SRL\Core\Text.scar

Solution:

Open Text.Scar and change the GetUpText function to this:

function GetUpText: string;
begin
try
{$IFDEF SIMBA}
Result := rs_GetUpText
{$ELSE}
{$IFDEF SCAR322_UP}
Result := rs_GetUpText;
{$ELSE}
Result := rs_GetUpTextAt(8, 8, 25);
{$ENDIF}
{$ENDIF}
except
Writeln('[WARNING]: Access violation in GetUpText (text.scar)');
end;
end;

Problem:

[Runtime Error] : Exception: Can't allocate the DIB handle in line 524 in script C:\Users\Mastermind\Desktop\Scar\includes\SRL\SRL\Core\GameTab.scar

Solution:

To fix that:
Using smart: Client -> Reset specified window. Re-run script.
Not using smart: Re-drag crosshair. Re-start script.

Credtis for the solution go to Timer. :)

Problem:

Right clicks on the text at the softening part where it should choose "all", yet it doesn't do anything

Solution:

Stop the script, close scar, open scar again and start the script, it should work then

Further Information:

The script uses a radial like walking and failsafe function, independet of the compass angle. It has not missclicked or walked while testing it. I hope it won't fail while you guys are using it. If it does, try following the steps mentioned in the "setup" commented part right on the top of the script. ^^

Cheers :)

PS: Feedback is ALWAYS appreciated. :D

Mrbanana

2010-03-17 07:20:48

Happy B'day! may try it later, made like 300 soft clay yesterday… D:

Timer

2010-03-17 19:29:25

[Runtime Error] : Exception: Can't allocate the DIB handle in line 524 in script C:\Users\Mastermind\Desktop\Scar\includes\SRL\SRL\Core\GameTab.scar

To fix that:
Using smart: Client -> Reset specified window. Re-run script.
Not using smart: Re-drag crosshair. Re-start script.

i luffs yeww

2010-03-17 19:45:45

First thing I found skimming through was


Disguise('Runtime: '+TimeRunning+' || Status: '+TheStatus+' || Clay softened: '+IntToStr(D_Clay));

You can just do


Disguise(GetStatus);

:)

But doesn't really matter. I'll check it again a little later.

Oh, actually, why use DDTMs for this? :o DTMs/bitmaps would suffice.

mormonman

2010-03-17 20:05:48

From: i luffs yeww
Oh, actually, why use DDTMs for this? :o DTMs/bitmaps would suffice.


Probably so that he can easily edit them.

i luffs yeww

2010-03-17 20:07:01

You can easily edit bitmaps, amirite? :o And even if not, they shouldn't need any updating for awhile.

mormonman

2010-03-17 20:08:18

From: i luffs yeww
You can easily edit bitmaps, amirite? :o And even if not, they shouldn't need any updating for awhile.


Stuff changes with every runescape update. Its more difficult to edit bitmaps plus he uses the AddedDTMTolerance so that the end-user can add tolerance if the dtm isn't working.

i luffs yeww

2010-03-17 20:10:10

But the tolerance wouldn't even be needed if he used a bitmap. And no matter what, he'll have to update the script when rs updates. It just seems easy/cleaner to use a bitmap to me.

mormonman

2010-03-17 20:12:40

From: i luffs yeww
But the tolerance wouldn't even be needed if he used a bitmap. And no matter what, he'll have to update the script when rs updates. It just seems easy/cleaner to use a bitmap to me.


Bitmaps need tolerance just like everything else :duh:
It is his personal preference to use a ddtm in this case. I would have done the same thing. I don't like bitmaps.

i luffs yeww

2010-03-17 20:16:09

I know they do, but it wouldn't be a needed const. :p

Whatever floats your boat. x] I was just suggesting it because to me it looks cleaner/better. :)

Happy birthday, by the way. ^^

Pure1993

2010-03-18 07:02:10

From: Mrbanana
Happy B'day! may try it later, made like 300 soft clay yesterday… D:


Thanks. ^^
If you try it, don't forget to post if it works for you. ;)

From: Timer
[Runtime Error] : Exception: Can't allocate the DIB handle in line 524 in script C:\Users\Mastermind\Desktop\Scar\includes\SRL\SRL\Core\GameTab.scar

To fix that:
Using smart: Client -> Reset specified window. Re-run script.
Not using smart: Re-drag crosshair. Re-start script.


Ah thanks, I'll add that to the main post. :)

From: i luffs yeww
First thing I found skimming through was


Disguise('Runtime: '+TimeRunning+' || Status: '+TheStatus+' || Clay softened: '+IntToStr(D_Clay));

You can just do


Disguise(GetStatus);

:)

But doesn't really matter. I'll check it again a little later.

Oh, actually, why use DDTMs for this? :o DTMs/bitmaps would suffice.


rofl, didn't even know of the getStatus function. Thanks! =)
Concerning DDTMs, it is just like mormonman said, it's my personal preference to use them. Originally I planned on making DDTM walking anyway, so it would have looked less out of place, but then the idea to use radial like walking struck me and I had no intention to change the ddtms back to dtms because of a style "issue". ^^

From: i luffs yeww
I know they do, but it wouldn't be a needed const. :p

Whatever floats your boat. x] I was just suggesting it because to me it looks cleaner/better. :)

Happy birthday, by the way. ^^


This one doesn't "need" a const either, it is just for the end user, I could have added the tolerance to each search function, but it is a lot easier this way for everyone. Oh well, I think we can finish this discussion since it is a matter of personal opinion and preference. ;)
But I am glad you guys took the time to read/skim through it and to post some advice/started a discussion. That is mains aspect I missed while taking a break from using scar/srl and started using RsBot to get used to java… the only things you every recieved as feedback were proggies or problems, not a single comment on what you could do to improve the code of you script. :garfield:

And thanks for the "happy birthday". :)

Home

2010-03-24 09:58:11

From: Pure1993
Thanks. ^^
If you try it, don't forget to post if it works for you. ;)



Ah thanks, I'll add that to the main post. :)



rofl, didn't even know of the getStatus function. Thanks! =)
Concerning DDTMs, it is just like mormonman said, it's my personal preference to use them. Originally I planned on making DDTM walking anyway, so it would have looked less out of place, but then the idea to use radial like walking struck me and I had no intention to change the ddtms back to dtms because of a style "issue". ^^



This one doesn't "need" a const either, it is just for the end user, I could have added the tolerance to each search function, but it is a lot easier this way for everyone. Oh well, I think we can finish this discussion since it is a matter of personal opinion and preference. ;)
But I am glad you guys took the time to read/skim through it and to post some advice/started a discussion. That is mains aspect I missed while taking a break from using scar/srl and started using RsBot to get used to java… the only things you every recieved as feedback were proggies or problems, not a single comment on what you could do to improve the code of you script. :garfield:

And thanks for the "happy birthday". :)


Justa little suggestiong ;) Start using your [PHP]Procedure HandleRun;[/PHP]

I have added it to my own script, but some people (new ones) might not know how to :)

So for more profit per hour, add running :)


~Home

Ohh and Nice Script :)

neko gio goto

2010-04-19 17:40:25

All the script does is click the settings tab and clicks regular detail and stops.

thebob142

2010-04-19 22:59:09

From: neko gio goto
All the script does is click the settings tab and clicks regular detail and stops.


that's because it is outdated.