SRL Archive - Archive

King of the Nites - SRL Member Application


King of the Nites

2011-04-06 20:41:12

How Long have You Played Runescape?
6 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
None other than what I've learned from SRL


Are you a member of any other communities?
RSBuddy


Tell us about yourself…
From: King of the Nites
Hi! My name is Justin. I'm a high school student, currently a junior. Some extra curriculars I'm involved in is competitive swimming. I've been swimming for about 12 years now and surprisingly I still enjoy it. I swim for my high school team and for a club team, so most of my time is spent in the pool. Swimming wears me out, so I love doing stuff on the computer where I don't have to use a lot of energy :p. Runescape has become a fun past time, but a better past time for me is cheating on Runescape! When I'm not in the pool, on the forums, or playing Runescape, I like to do what most people do and that is hang with friends. My friends help me make it through the day, and that is one particular reason I love these forums. I've made a lot of friends here that help me get through day to day!



Please show us one (or multiple) of your scripts.
program Kings_Clay_Softener_and_Vial_Filler;
{$DEFINE SMART}
{$include SRL/SRL.scar}
{$i SRL/SRL/Misc/stats.simba}
//===============================*****===============================//
// _ _ _ King's Clay Softener and Vial Filler //
// | | / / (_) Version 1.0 //
// | | / / _ _ __ _____ //
// | |/ / | | | |/_ \ / ___ \ What It Does: //
// | | | | | / \ \ | | | | Softens clay or fills //
// | |\ \ | | | | | | | |___| | vials at the nearest //
// |_| \_\ |_| |_| |_| \____ | fountain or well. //
// _ | | Supported Locations: //
// SCRIPTS | |___/ | Varrock East Bank, //
// \_____/ Edgeville Bank //
//===================================================================//
// Instructions! //
// 1. Place your player(s) in your selected bank. //
// 2. Have clay or vials somewhere visible in your bank. //
// 3. Set up Const and DeclarePlayers sections of the script. //
// 4. Press play and post the progress report on the main thread! //
//===================================================================//
// ///|||\\\ Version History ///|||\\\ //
//===================================================================//
// Version 0.9: First stable release of the script. Clay softening //
// support. Varrock East Bank support. //
// Version 0.95 Vial filling support added. Breaking system added. //
// Fixed DTMs and other randoms stuff. //
// Version 0.96 Fixed login problem. Added a new DTM. Added some //
// more failsafes. //
// Version 1.0 Added Edgeville well support! Fixed the finding //
// fountain issue. //
//===============================*****===============================//

const
LoadsToDo = 15;// Number of loads to do before switching

TakeBreaks = False;//Will take breaks when one player is active
BreakFor = 5;//How long to break for, in minutes

SMARTWorld = 36;//SMART world to load
SMARTMembers = False;//RuneScape member = True
SMARTSigned = True;//Signed = True

StatsUser = '';
StatsPass = '';

procedure DeclarePlayers;
begin
HowManyPlayers := 2;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer :=0;

Players[0].Name := '';//Username
Players[0].Pass := '';//Password
Players[0].Nick := '';// Nick
Players[0].Strings[0] := 'eb';//Options are: 'veb' or 'eb'
Players[0].Strings[1] := 'clay';//Options are: 'vial' or 'clay'
Players[0].Active :=True;//Active?

Players[1].Name := '';//Username
Players[1].Pass := '';//Password
Players[1].Nick := '';// Nick
Players[1].Strings[0] := 'veb';//Options are: 'veb' or 'eb'
Players[1].Strings[1] := 'clay';//Options are: 'vial' or 'clay'
Players[1].Active :=True;//Active?

end;


var
x, y, Clay, SoftClay, VEBankers, ToDo, TimeLeft, Breaking, VEBanker2,
Loads, Start, TotalSoftened, TotalBanked, FilledVial, EBankers,
Vial, TotalFilled, BreakTime, Broke, TotBreak : Integer;
Logged: Boolean;


procedure ProgressReport; forward;


function SetDDTM(Path: Integer): Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..6] of TDTMPointDef;
TempTDTM: TDTM;
VRC: Integer;
begin
VRC := AutoColor(srl_VarrockRoadColor);
case (Path) of
0:begin
dtmMainPoint.x := 840;
dtmMainPoint.y := 163;
dtmMainPoint.Color := 8620686;
dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 840;
dtmSubPoints[0].y := 163;
dtmSubPoints[0].Color := 8620686;
dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 844;
dtmSubPoints[1].y := 147;
dtmSubPoints[1].AreaSize := 3;
dtmSubPoints[1].Color := VRC;
dtmSubPoints[1].Tolerance := 15;

dtmSubPoints[2].x := 851;
dtmSubPoints[2].y := 147;
dtmSubPoints[2].AreaSize := 3;
dtmSubPoints[2].Color := VRC;
dtmSubPoints[2].Tolerance := 15;

dtmSubPoints[3].x := 825;
dtmSubPoints[3].y := 160;
dtmSubPoints[3].AreaSize := 3;
dtmSubPoints[3].Color := VRC;
dtmSubPoints[3].Tolerance := 15;

dtmSubPoints[4].x := 822;
dtmSubPoints[4].y := 169;
dtmSubPoints[4].AreaSize := 3;
dtmSubPoints[4].Color := VRC;
dtmSubPoints[4].Tolerance := 15;

dtmSubPoints[5].x := 910;
dtmSubPoints[5].y := 170;
dtmSubPoints[5].AreaSize := 3;
dtmSubPoints[5].Color := VRC;
dtmSubPoints[5].Tolerance := 15;

dtmSubPoints[6].x := 910;
dtmSubPoints[6].y := 163;
dtmSubPoints[6].AreaSize := 3;
dtmSubPoints[6].Color := VRC;
dtmSubPoints[6].Tolerance := 15;
end;

1:begin
dtmMainPoint.x := 852;
dtmMainPoint.y := 185;
dtmMainPoint.Color := 65536;
dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 852;
dtmSubPoints[0].y := 185;
dtmSubPoints[0].Color := 65536;
dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 866;
dtmSubPoints[1].y := 161;
dtmSubPoints[1].AreaSize := 3;
dtmSubPoints[1].Color := VRC;
dtmSubPoints[1].Tolerance := 15;

dtmSubPoints[2].x := 880;
dtmSubPoints[2].y := 179;
dtmSubPoints[2].AreaSize := 3;
dtmSubPoints[2].Color := VRC;
dtmSubPoints[2].Tolerance := 15;

dtmSubPoints[3].x := 845;
dtmSubPoints[3].y := 196;
dtmSubPoints[3].AreaSize := 3;
dtmSubPoints[3].Color := VRC;
dtmSubPoints[3].Tolerance := 15;

dtmSubPoints[4].x := 844;
dtmSubPoints[4].y := 203;
dtmSubPoints[4].AreaSize := 3;
dtmSubPoints[4].Color := VRC;
dtmSubPoints[4].Tolerance := 15;

dtmSubPoints[5].x := 926;
dtmSubPoints[5].y := 196;
dtmSubPoints[5].AreaSize := 3;
dtmSubPoints[5].Color := VRC;
dtmSubPoints[5].Tolerance := 15;

dtmSubPoints[6].x := 926;
dtmSubPoints[6].y := 203;
dtmSubPoints[6].AreaSize := 3;
dtmSubPoints[6].Color := VRC;
dtmSubPoints[6].Tolerance := 15;
end;
2:begin
dtmMainPoint.x := 929;
dtmMainPoint.y := 224;
dtmMainPoint.Color := 9079182;
dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 929;
dtmSubPoints[0].y := 224;
dtmSubPoints[0].Color := 9079182;
dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 936;
dtmSubPoints[1].y := 228;
dtmSubPoints[1].AreaSize := 3;
dtmSubPoints[1].Color := VRC;
dtmSubPoints[1].Tolerance := 15;

dtmSubPoints[2].x := 935;
dtmSubPoints[2].y := 220;
dtmSubPoints[2].AreaSize := 3;
dtmSubPoints[2].Color := VRC;
dtmSubPoints[2].Tolerance := 15;

dtmSubPoints[3].x := 909;
dtmSubPoints[3].y := 153;
dtmSubPoints[3].AreaSize := 3;
dtmSubPoints[3].Color := VRC;
dtmSubPoints[3].Tolerance := 15;

dtmSubPoints[4].x := 924;
dtmSubPoints[4].y := 158;
dtmSubPoints[4].AreaSize := 3;
dtmSubPoints[4].Color := VRC;
dtmSubPoints[4].Tolerance := 15;

dtmSubPoints[5].x := 824;
dtmSubPoints[5].y := 217;
dtmSubPoints[5].AreaSize := 3;
dtmSubPoints[5].Color := VRC;
dtmSubPoints[5].Tolerance := 15;

dtmSubPoints[6].x := 824;
dtmSubPoints[6].y := 225;
dtmSubPoints[6].AreaSize := 3;
dtmSubPoints[6].Color := VRC;
dtmSubPoints[6].Tolerance := 15;
end;
3:begin
dtmMainPoint.x := 821;
dtmMainPoint.y := 239;
dtmMainPoint.Color := VRC;
dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 821;
dtmSubPoints[0].y := 239;
dtmSubPoints[0].Color := VRC;
dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 901;
dtmSubPoints[1].y := 208;
dtmSubPoints[1].AreaSize := 3;
dtmSubPoints[1].Color := VRC;
dtmSubPoints[1].Tolerance := 15;

dtmSubPoints[2].x := 890;
dtmSubPoints[2].y := 248;
dtmSubPoints[2].AreaSize := 3;
dtmSubPoints[2].Color := VRC;
dtmSubPoints[2].Tolerance := 15;

dtmSubPoints[3].x := 828;
dtmSubPoints[3].y := 292;
dtmSubPoints[3].AreaSize := 3;
dtmSubPoints[3].Color := VRC;
dtmSubPoints[3].Tolerance := 15;

dtmSubPoints[4].x := 890;
dtmSubPoints[4].y := 228;
dtmSubPoints[4].AreaSize := 3;
dtmSubPoints[4].Color := VRC;
dtmSubPoints[4].Tolerance := 15;

dtmSubPoints[5].x := 833;
dtmSubPoints[5].y := 260;
dtmSubPoints[5].AreaSize := 3;
dtmSubPoints[5].Color := VRC;
dtmSubPoints[5].Tolerance := 15;

dtmSubPoints[6].x := 820;
dtmSubPoints[6].y := 229;
dtmSubPoints[6].AreaSize := 3;
dtmSubPoints[6].Color := VRC;
dtmSubPoints[6].Tolerance := 15;
end;
end;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);

end;

procedure FreeAllDTM;
begin
FreeDTM(SetDDTM(0));
FreeDTM(SetDDTM(1));
FreeDTM(SetDDTM(2));
FreeDTM(SetDDTM(3));
FreeDTM(Clay);
FreeDTM(SoftClay);
FreeDTM(VEBankers);
FreeDTM(Vial);
FreeDTM(FilledVial);
FreeDTM(VEBanker2);
FreeDTM(EBankers);
end;


procedure PlayerFailed(Reason: String);
begin
WriteLn('FAILED: ['+ Players[CurrentPlayer].Nick +'] ' + Reason + '.');
Players[CurrentPlayer].Active := False;
CloseBank;
LogOut;
if (AllPlayersInactive) then
begin
FreeAllDTM;
ProgressReport;
WriteLn('Thanks for using King''s Clay Softener and Vial Filler!');
WriteLn('Please post progress report on the main thread.');
TerminateScript;
end;
end;


function OpenTheBank: Boolean;
var
OpeningBank: Integer;
begin
if (not LoggedIn) then
Exit;
if (BankScreen) then
begin
Result := True;
Players[CurrentPlayer].Loc := 'Bank';
Exit;
end;
FindNormalRandoms;
if (not(OpenBankNPC)) then
if (not(OpenBankFast(Players[CurrentPlayer].Strings[0]))) then
begin
PlayerFailed('Could find the bank.');
Result := False;
Exit;
end;
MarkTime(OpeningBank);
while (not(BankScreen)) do
begin
Wait(10 + Random(10));
FindNormalRandoms;
if (TimeFromMark(OpeningBank) > 5000) then
Break;
end;
if (BankScreen) then
begin
WriteLn('Inside the bank.');
Wait(300 + Random(200));
Players[CurrentPlayer].Loc := 'Bank';
Result := True;
end else
begin
Result := False;
PlayerFailed('Did not find the bankscreen.');
Exit;
end;
begin
if (not(Result)) then
PlayerFailed('Failed at OpenTheBank');
end;
end;


function DepositItem: Boolean;
var
IA, FV, SC, Depositing: Integer;
begin
if (not LoggedIn) then
Exit;
if (not(BankScreen)) then
OpenTheBank;
Result := False;
Writeln('Depositing..');
FindNormalRandoms;
if (not(InvEmpty)) then
begin
Writeln('Found items in inventory.');
FV := ItemAmount('inv', 'dtm', FilledVial, []);
SC := ItemAmount('inv', 'dtm', SoftClay, []);
IA := FV + SC;
IncEx(Players[CurrentPlayer].Integers[1], IA);

IncEx(TotalSoftened, SC);
IncEx(TotalFilled, FV);

Stats_IncVariable('Clay (Softened)', SC);
Stats_IncVariable('Vials (Filled)', FV);

Inc(Players[CurrentPlayer].Integers[0]);
Inc(TotalBanked);
stats_IncVariable('Times Banked', 1);

MouseBox(380, 297, 412, 319, 1); //deposit all button
MarkTime(Depositing);
while (not(InvEmpty)) do
begin
Wait(10 + Random(10));
if (TimeFromMark(Depositing) > 2500) then
Break;
end;
if (InvEmpty) then
begin
WriteLN('Deposited ' + IntToStr(IA) + ' items.');
Result := True;
Exit;
end else
begin
PlayerFailed('Failed depositing items');
Result := False;
Exit;
end;
end else
begin
WriteLn('No soft clay or vials to deposit, moving on to withdraw.');
Result := True;
Exit;
end;
begin
if (not(Result)) then
PlayerFailed('Failed at DepositItem');
end;
end;


function WithdrawItems: Boolean;
begin
if (not LoggedIn) then
Exit;
if (not(BankScreen)) then
OpenTheBank;
FindNormalRandoms;
Result := False;
Writeln('Withdrawing...');
case Players[CurrentPlayer].Strings[1] of
'vial', 'vials', 'vail', 'ail':
begin
if (Players[CurrentPlayer].Strings[0] = 'eb') then
begin
PlayerFailed('You can''t fill vials at edgeville bank.');
Result := False;
Exit;
end;
if (not(FindDTM(Vial, x, y, MSx1, MSy1, MSx2, MSy2))) then
begin
CloseBank;
PlayerFailed('DONE!');
Players[CurrentPlayer].Loc := 'Done!';
Result := False;
Exit;
end else
begin
Mouse(x, y, 9, 9, False);
Wait(250 + Random(50));
if ChooseOption('ll') then
begin
Result := True;
WriteLn('Withdrew vials!');
Exit;
end else
begin
PlayerFailed('Withdrawing vials failed');
Result := False;
Exit;
end;
end;
end;
'clay', 'clays', 'lay':
begin
if (not(FindDTM(Clay, x, y, MSx1, MSy1, MSx2, MSy2))) then
begin
CloseBank;
PlayerFailed('DONE!');
Players[CurrentPlayer].Loc := 'Done!';
Result := False;
Exit;
end else
begin
Mouse(x, y, 9, 9, False);
Wait(200 + Random(50));
if ChooseOption('ll') then
begin
Result := True;
WriteLn('Withdrew clay!');
Exit;
end else
begin
PlayerFailed('Withdrawing clay failed');
Result := False;
Exit;
end;
end;
end;
else
begin
PlayerFailed('Valid choices is only clay or vial.');
Result := False;
Exit;
end;
end;
end;


procedure SmartRun(Energy: integer);
var
I: string;
begin
if(not LoggedIn)then
Exit;
FindNormalRandoms;
if(GetMMLevels('Run', I) > Energy)then
SetRun(True);
end;


function WalkToFountain: Boolean;
var
VRC, EC: Integer;
begin
if (not LoggedIn) then
Exit;
FindNormalRandoms;
Players[CurrentPlayer].Loc := 'Walk2Fountain';
Result := False;
SmartRun(25 + random(20));
case Players[CurrentPlayer].Strings[0] of
'veb':
begin
VRC := AutoColor(srl_VarrockRoadColor);
if (not(DTMRotated(SetDDTM(0), x, y, MMx1, MMy1, MMx2, MMy2))) then
begin
if (not(RadialWalkTolerance(VRC, 310, 320, 60, 9, 9, 20))) then
begin
if (not(RadialWalkTolerance(VRC, 305, 325, 60, 10, 10, 20))) then
begin
Result := False;
PlayerFailed('WalkToFountain123 failed');
Exit;
end else
begin
Writeln('W2F: RadialWalk(3) ');
FindNormalRandoms;
Result := true;
end;
end else
begin
Writeln('W2F: RadialWalk(2)');
FindNormalRandoms;
Result := true;
end;
end else
begin
Writeln('W2F: DTMRotated(1)');
Mouse(x, y, 13, 13, True);
FindNormalRandoms;
Result := True;
end;

if (Result) then
begin
FindNormalRAndoms;
FFlag(25);
if (not(DTMRotated(SetDDTM(1), x, y, MMx1, MMy1, MMx2, MMy2))) then
begin
if (not(RadialWalkTolerance(VRC, 290, 315, 40, 5, 5, 10))) then
begin
if (not(RadialWalkTolerance(VRC, 285, 320, 50, 6, 6, 10))) then
begin
Result := False;
PlayerFailed('WalkToFountain456 failed');
Exit;
end else
begin
FindNormalRandoms;
Flag;
FindNormalRandoms;
Wait(2000 + Random(500));
Result := True;
Writeln('W2F: RadialWalk(6)');
end;
end else
begin
FindNormalRandoms;
Flag;
FindNormalRandoms;
Wait(2000 + Random(500));
Result := True;
Writeln('W2F: RadialWalk(5)');
end;
end else
begin
Mouse(x, y, 7, 7, True);
FindNormalRandoms;
Flag;
FindNormalRandoms;
Wait(2000 + Random(500));
Result := True;
Writeln('W2F: DTMRotated(4)');
end;
end else
begin
PlayerFailed('WalkToFountainResult failed');
Result := False
Exit;
end;
end;

'eb':
begin
EC := AutoColor(srl_VarrockRoadColor);
if (not(DTMRotated(SetDDTM(3), x, y, MMx1, MMy1, MMx2, MMy2))) then
begin
SymbolAccuracy := 0.8;
if (not(FindSymbol(x, y, 'water'))) then
begin
if (not(RadialWalkTolerance(EC, 278, 300, 52, 9, 9, 10))) then
begin
Result := False;
PlayerFailed('WalkToFountain123 failed');
Exit;
end else
begin
FindNormalRandoms;
Flag;
Wait(500 + Random(500));
FindNormalRandoms;
WriteLn('W2F: Radialwalk(3)');
Result := True;
end;
end else
begin
Mouse(x, y, 8, 8, True);
FindNormalRandoms;
Flag;
Wait(500 + Random(500));
FindNormalRandoms;
WriteLn('W2F: Findsymbol(2)');
Result := True;
end;
end else
begin
Mouse(x + 2, y + 4, 8, 8, True);
FindNormalRandoms;
Flag;
FindNormalRandoms;
Wait(500 + Random(500));
WriteLn('W2F: DTMRotated(1)');
Result := True;
Exit;
end;
end;
end;
begin
if (not(Result)) then
PlayerFailed('Failed at WalkToFountain');
end;
end;


function FindFountain(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2, FountainTime: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
case Players[CurrentPlayer].Strings[0] of
'veb':
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.01, 2.25);

if not(FindColorsTolerance(arP, 14323306, MSX1, MSY1, MSX2, MSY2, 14)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
PlayerFailed('Could not find the fountain.');
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 17.43) and (X <= 44.15) and (Y >= 17.46) and (Y <= 44.11) and (Z >= 38.02) and (Z <= 96.62) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 20, 20);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then
Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 15, 10);
Wait(100 + Random(100));
MarkTime(FountainTime);
while (not(IsUpText('ountain'))) do //had to do this because people sometimes block fountain :/
begin
FindNormalRandoms;
Wait(200 + Random(300));
if (TimeFromMark(FountainTime) > 17000) then
Break;
end;

if (IsUpText('ountain')) then
begin
Result := True;
Break;
end else
begin
PlayerFailed('Could not find the fountain uptext.');
Result := False;
Break;
Exit;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
PlayerFailed('Couldn''t find the object.');
Exit;
end;

GetMousePos(fx, fy);
end;
'eb':
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 1.22);

if not(FindColorsTolerance(arP, 3427675, MSX1, MSY1, MSX2, MSY2, 10)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 3.72) and (X <= 13.97) and (Y >= 3.77) and (Y <= 14.29) and (Z >= 1.68) and (Z <= 7.67) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 30, 30);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 15, 15);
Wait(150 + Random(100));
if (IsUpText('ell')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
PlayerFailed('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;
end;
end;


function DoWorkOnItem: Boolean;
var
Softening, Mx, My, Fx, Fy, Filling, Tries, UpTextWait: Integer;
begin
if (not LoggedIn) then
Exit;
FindNormalRandoms;
Result := False;
GameTab(Tab_Inv);
FindNormalRAndoms;
WriteLn('Softening or Filling...');
if ExistsItem(1) then
begin
MouseBox(565, 218, 590, 238, 3);//invy spot 1
FindNormalRandoms;
Wait(400 + Random(300));
MarkTime(UpTextWait);
while (not(IsUpText('lay'))) and (not(IsUpText('ial'))) do
begin
Wait(150 + random(50));
FindNormalRandoms;
if (TimeFromMark(uptextwait) > 3000) then
Break;
end;
if (TimeFromMark(uptextwait) > 3000) then
begin
PlayerFailed('Inventory is messed up. Please report error.');
Result := False;
Exit;
end else
begin
GetMousePos(Mx, My);
Mouse(Mx, My, 0, 0, True);
FindNormalRandoms;
Tries := 0;
repeat
if (not(FindFountain(Fx, Fy))) then
begin
Writeln('Could not find fountain. Walking failed.');
FindNormalRandoms;
Inc(Tries);
end;
Wait(Random(200));
until (Tries > 5) or (FindFountain(Fx, Fy));
if (tries > 5) then
begin
PlayerFailed('Could not find fountain or well. Walking failed.');
Result := False;
Exit;
end else
begin
Mouse(Fx, Fy, 0, 0, False);
Wait(100 + Random(100));
if (not(ChooseOption('Use'))) then
begin
PlayerFailed('Could not find chooseoption for fountain or well');
Result := False;
Exit;
end;
FindNormalRandoms;
Flag;
//softening
if FindDTM(Clay, x, y, MIx1, MIy1, MIx2, MIy2) then
begin
FindNormalRandoms;
Wait(800 + Random(500));
MouseBox(235, 398, 284, 451, 3);
Wait(250 + Random(250));
if (not(IsUpText('Make All'))) then
begin
PlayerFailed('Could not find the softening screen');
Result := False;
Exit;
end else
begin
GetMousePos(Mx, My);
FindNormalRandoms;
Mouse(Mx, My, 0, 0, True);
FindNormalRandoms;
Players[CurrentPlayer].Loc := 'Fountain';
MarkTime(Softening);
Wait(2000 + Random(1000));
FindNormalRandoms;
repeat
FindNormalRandoms;
Wait(500 + Random(500));
if (TimeFromMark(Softening) > 45000) then
begin
WriteLn('Took too long to soften clay, breaking');
PlayerFailed('Failed to soften clay.');
Result := False;
Break;
Exit;
end;
until (not(FindDTM(Clay, x, y, MIx1, MIy1, MIx2, MIy2)));
if (not(FindDTM(Clay, x, y, MIx1, MIy1, MIx2, MIy2))) then
begin
WriteLn('Done softening.');
FindNormalRandoms;
Result := True;
Exit;
end;
end;
end else
//filling
begin
if FindDTM(Vial, x, y, MIx1, MIy1, MIx2, MIy2) then
begin
MarkTime(Filling);
while FindDTM(Vial, x, y, MIx1, MIy1, MIx2, MIy2) do
begin
Wait(500 + Random(500));
FindNormalRandoms;
if (TimeFromMark(Filling) > 25000) then
Break;
end;

if (not(FindDTM(Vial, x, y, MIx1, MIy1, MIx2, MIy2))) then
begin
Result := True;
Exit;
end else
begin
PlayerFailed('Did not fill vials correctly');
Result := False;
LogOut;
end;
end;
end;
end;
end;
end else
begin
PlayerFailed('Inventory error. Please report.');
Result := False;
Exit;
end;
begin
if (not(Result)) then
PlayerFailed('Failed at DoWorkOnItem');
end;
end;


function WalkToBank: Boolean;
var
VRC, Walking: Integer;
begin
if (not LoggedIn) then
Exit;
FindNormalRandoms;
Players[CurrentPlayer].Loc := 'Walk2Bank';
Result := False;
SmartRun(35 + random(20));
case Players[CurrentPlayer].Strings[0] of
'veb':
begin
VRC := AutoColor(srl_VarrockRoadColor);
if (not(DTMRotated(SetDDTM(2), x, y, MMx1, MMy1, MMx2, MMy2))) then
begin
if (not(RadialWalkTolerance(VRC, 100, 125, 60, 9, 9, 10))) then
begin
if (not(RadialWalkTolerance(VRC, 90, 130, 65, 10, 10, 10))) then
begin
Result := False;
PlayerFailed('WalkToBank123 failed');
Exit;
end else
begin
Writeln('W2B: RadialWalk(3)');
FindNormalRandoms;
Result := true;
end;
end else
begin
writeln('W2B: RadialWalk(2)');
FindNormalRandoms;
Result := true;
end;
end else
begin
Writeln('W2B: DTMRotated(1)');
Mouse(x - 5, y, 13, 13, True);
Result := True;
end;

if (Result) then
begin
FindNormalRAndoms;
MarkTime(Walking);
repeat
Wait(500 + Random(500));
FindNormalRandoms;
if (TimeFromMark(Walking) > 10000) then
Break;
until (DTMRotated(VEBankers, x, y, MMx1, MMy1, MMx2, MMy2));

if (not(DTMRotated(VEBankers, x, y, MMx1, MMy1, MMx2, MMy2))) then
begin
if (not(DTMRotated(VEBanker2, x, y, MMx1, MMy1, MMx2, MMy2))) then
begin
SymbolAccuracy := 0.5;
if (not(FindSymbol(x, y, 'bank'))) then
begin
PlayerFailed('Could not walk to the bank.');
Result := False;
Exit;
end else
begin
Mouse(x, y, 8, 8, True);
FindNormalRandoms;
FFlag(5);
FindNormalRandoms;
Wait(2000 + Random(500));
WriteLn('W2B: Symbol(6)');
Result := True;
Exit;
end;
end else
begin
Mouse(x, y, 6, 6, True);
FindNormalRandoms;
FFlag(5);
FindNormalRandoms;
Wait(2000 + Random(500));
WriteLn('W2B: DTMRotated(5)');
Result := True;
Exit;
end;
end else
begin
Mouse(x - 7, y, 7, 6, True);
FindNormalRandoms;
FFlag(5);
FindNormalRandoms;
Wait(2000 + Random(500));
WriteLn('W2B: DTMRotated(4)');
Result := True;
Exit;
end;
end else
begin
PlayerFailed('WalkToBankResult failed');
Result := False
Exit;
end;
end;
'eb':
begin
if (not(DTMRotated(EBankers, x, y, MMx2, MMy2, MMx1, MMy1))) then
begin
SymbolAccuracy := 0.5;
if (not(FindSymbol(x, y, 'bank'))) then
begin
PlayerFailed('Could not walk to the bank.');
Result := False;
Exit;
end else
begin
Mouse(x, y, 8, 8, True);
FindNormalRandoms;
FFlag(4);
FindNormalRandoms;
Wait(1000 + Random(500));
WriteLn('W2B: Symbol(2)');
Result := True;
Exit;
end;
end else
begin
Mouse(x, y, 7, 7, True);
FindNormalRandoms;
FFlag(4);
FindNormalRandoms;
Wait(1000 + Random(500));
WriteLn('W2B: DTMRotated(1)');
Result := True;
Exit;
end;
end;
end;
begin
if (not(Result)) then
PlayerFailed('Failed at WalkToBank');
end;
end;

procedure ProgressReport;
var
i : integer;
Active : string;
begin
//ClearDebug;
WriteLn('[=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]');
WriteLn('[ King''s Clay Softener and Vial Filler ]');
WriteLn('[ Version 1.0 ]');
WriteLn('[ Progress Report ]');
WriteLn('[=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]');
WriteLn('[ ' + PadR('Worked for ' + TimeRunning, 56) + ']');
WriteLn(PadR('[ Banked ' + IntToStr(TotalBanked) + ' loads!', 58) + ']');
if (TotalSoftened > 0) then
begin
WriteLn(PadR('[ Softened ' + IntToStr(TotalSoftened) + ' clay!', 58) + ']');
WriteLn(PadR('[ Softening ' + IntToStr(Round((TotalSoftened * 3600000) / GetTimeRunning)) + ' clay per hour!', 58) + ']');
end;
if (TotalFilled > 0) then
begin
WriteLn(PadR('[ Filled ' + IntToStr(TotalFilled) + ' vials!', 58) + ']');
WriteLn(PadR('[ Filling ' + IntToStr(Round((TotalFilled * 3600000) / GetTimeRunning)) + ' vials per hour!', 58) + ']');
end;
if (Broke > 0) then
begin
WriteLn(PadR('[ Took ' + IntToStr(Broke) + ' break(s)!', 58) + ']');
WriteLn(PadR('[ Total break time is ' + IntToStr(TotBreak / 60000) + ' minutes!', 58) + ']');
end;
WriteLn('[=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]');
WriteLn('[ Individual Report ]');
WriteLn('[=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]');
Writeln('[ [#] [Nick] | A | Banked | Items | Location ]');
for i := 0 to High(Players) do
begin
if Players[i].Active then
Active := 'T'
else
Active := 'F';

WriteLn(PadR('[ [' + IntToStr(i) + //number
'] ['+ PadR(Players[i].Nick, 4) + //nick
'] | ' + PadR((Active), 2) + //active
'| ' + PadR(IntToStr(Players[i].Integers[0]), 7) + // banked
'| ' + PadR(IntToStr(Players[i].Integers[1]), 6) + // items
'| ' + Players[i].Loc, 57) + ' ]'); // location
end;
WriteLn('[=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]');
end;


begin
//ClearDebug;
Smart_Server := SMARTWorld;
Smart_Members := SMARTMembers;
Smart_Signed := SMARTSigned;
SetupSRL;
Wait(2000);
ActivateClient;
DeclarePlayers;
Wait(2000);
SoftClay := DTMFromString('m1gAAAHic42JgYEhjZmCIB+JsIC4B4nwoOwUqHgnEsUA8hZGBoRuKJwHxTCCej4RnAPEEIA614wGaykQQ6zIQBxiJxAgAAAHrCuw=');

Clay := DTMFromString('mwQAAAHic42RgYOhlZmDoB+J2IO4A4j4gngrFs4B4EhDvZmRgOADEe4F4BxBvB+KtQLwTygaJt+R7AU1jwot1GQgDRiIwHAAArYMNSQ==');

Vial := DTMFromString('mwQAAAHic42RgYNjJzMCwDYg3AfEGIN4KxPuA+DAQ7wfiPUC8l5GBYQsjhD4ExMegGMTeBcSbgTg6Jh5oGhNerMxAGDASgeEAAKUrDq0=');

FilledVial := DTMFromString('mrAAAAHic42BgYLBmZmCwAGJTIDYCYksgdoJiOyB+xMjAcAOI7wPxMyB+DcQvgfghEF8H4oLyFUBTmHBiZQb8gJEAhgEAPJQK0Q==');

VEBankers := DTMFromString('78DA632C646660B8C480024A8B0B19FE03694' +
'6289FB116A8E60684CD04157BFB9681811F594D25116A4A895053488' +
'49A1C22D46410560300E4611701');

VEBanker2:= DTMFromString('mQwAAAHicY2ZgYJjEBMHTgLgFyO+F4trGSoa3bxnA+D+QzwXFjEgYCACA1Qmj');

EBankers := DTMFromString('mbQAAAHicY2VgYKhiYmCoBOIyJBwCFI8B4gQgzgDiAiDOzEpl+POHCQX/B4pzoWEmNMzIAAUAqlwOnQ==');

if (StatsUser = '') then
begin
WriteLn('You should register with SRL stats.');
WriteLn('Using script''s stats.');
SetupSRLStats(71, '283', 'stats');
end;
SetupSRLStats(71, StatsUser, StatsPass);
AddOnTerminate('FreeAllDTM');
AddOnTerminate('ProgressReport');
MarkTime(Start);
repeat
if (not Logged) then
LogInPlayer;
Wait(2000 + Random(1000));
SetAngle(True);
ToDo := LoadsToDo + Random(3);
for Loads := 1 to ToDo do
begin
if (OpenTheBank) then
begin
if (DepositItem) then
begin
ProgressReport;
Stats_Commit;
if (WithdrawItems) then
begin
if (WalkToFountain) then
begin
if (DoWorkOnItem) then
begin
if (not(WalkToBank)) then
begin
LogOut;
end;
end else
LogOut;
end else
LogOut;
end else
LogOut;
end else
LogOut;
end else
LogOut;
end;
Logged:= FindColor(x, y, 16777215, 439, 491, 440, 492);

if Logged then
Players[CurrentPlayer].Active := True
else
PlayerFailed('Mainloop failed.');

if (PlayersActive < 2) then
begin
if TakeBreaks then
begin
LogOut;
BreakTime := ((BreakFor + Random(5)) * 60000);
WriteLn('Breaking for '+ IntToStr(BreakTime / 60000) +' minute(s)!');
MarkTime(Breaking);
Timeleft := BreakTime;
repeat
Wait(60000);
Timeleft := (Timeleft - 60000);
WriteLn('Breaking for '+ IntToStr(Timeleft / 60000) +' more minute(s)!');
until (TimeFromMark(Breaking) > BreakTime);

Inc(Broke);
IncEx(TotBreak, BreakTime);
Wait(Random(15000));
NextPlayer(True);
end;
end;

until AllPlayersInactive;
end.

IPwnz

2011-04-06 21:46:32

Good script and application overall, I'm voting yes. I have a few small notes for you though:

You can shorten this up:
MouseBox(380, 297, 412, 319, 1);  //deposit all button
to
DepositAll;

SmartRun is unnecessary, RunEnergy does the exact same thing. :)

In DoWorkOnItem SRL has you covered again where you didn't think it did:
MouseBox(565, 218, 590, 238, 3);//invy spot 1
to
InvMouse(InvSlot, Action: Byte) : boolean;

Also, you look for the clay softening box with just a mousebox, it would be safer to check for the new chat box stuff before you move the mouse down there, like so ("How" may not be the words you need to look for in clay softening/vial filling, but that's what it is for bar smelting):
Result := GetTextAtEx(14, 352, 5, SmallChars, True, False, 0, 0, 16777215, 3, True, tr_Letters) = 'How';
if not Result and
(FindColorSpiralTolerance(x, y, 2070783, MCX1, MCY1, MCX2, MCY2, 2)) then
Result := True; //orange text checker

Having this is just a waste of a line:
FindNormalRandoms; //unneeded line
repeat
FindNormalRandoms;

King of the Nites

2011-04-06 22:36:26

From: IPwnz
Good script and application overall, I'm voting yes. I have a few small notes for you though:

You can shorten this up:
MouseBox(380, 297, 412, 319, 1);  //deposit all button
to
DepositAll;

Thanks! And yea I was pretty sure there was something for this, thanks for pointing me in the right direction :)

From: IPwnz

SmartRun is unnecessary, RunEnergy does the exact same thing. :)

Had no clue of that, you're saving me some lines!

From: IPwnz

In DoWorkOnItem SRL has you covered again where you didn't think it did:
MouseBox(565, 218, 590, 238, 3);//invy spot 1
to
InvMouse(InvSlot, Action: Byte) : boolean;

I seemed to be having problems with that function. It appeared to only click the the like outer edge of the inventory spot. So I just made my own mousebox.

From: IPwnz

Also, you look for the clay softening box with just a mousebox, it would be safer to check for the new chat box stuff before you move the mouse down there, like so ("How" may not be the words you need to look for in clay softening/vial filling, but that's what it is for bar smelting):
Result := GetTextAtEx(14, 352, 5, SmallChars, True, False, 0, 0, 16777215, 3, True, tr_Letters) = 'How';
if not Result and
(FindColorSpiralTolerance(x, y, 2070783, MCX1, MCY1, MCX2, MCY2, 2)) then
Result := True; //orange text checker

Thank you very much for this. I am terrible with text finding stuff, I posted a thread, and someone suggested what I did in my script, so I did it.

From: IPwnz

Having this is just a waste of a line:
FindNormalRandoms; //unneeded line
repeat
FindNormalRandoms;

Thanks for the spotting :)

~King of the Nites

Bad Boy JH

2011-04-07 09:13:20

a bit sloppy, but you're using failsafes, and advanced procedures, easy yes.

King of the Nites

2011-04-12 22:37:37

From: Bad Boy JH
a bit sloppy, but you're using failsafes, and advanced procedures, easy yes.


Thanks!

And where and how can I fix my sloppiness?? :)

Bebe

2011-04-13 00:50:54

Yes.

Blumblebee

2011-04-13 00:54:24

Its been a long time since I've seen a DDTM, totally forgot about them :p Yes from me, I like your presence on the forums, code's pretty good, and all that jazz. Good Luck

Rich

2011-04-13 06:08:01

- DTMs
- DDTMs
- TPAs
- Colour walking
- Multiplayer
- Failsafes
- Anti randoms

No antiban?

Yes.

WT-Fakawi

2011-04-13 10:07:52

In! Welcome!