From: Mr Magic
I'd love a simple script for crafting Urns. Possibly in East Varrock(has closable door at pottery place) or Ardougne(walking across the log shortcut), closer is probably Varrock. The idea for it is this: start at bank, take out full inventory of soft clay(need 2 clay per urn), walk to potter's wheel, craft 14 unfired urns, use pottery oven to fire the urns, go back to bank, repeat. I'd like to make the best urns (Decorated Cooking urn). Both beforementioned places have potter's wheel and oven.
made this a long while ago maybe you can add to it, put soft clay top right bank, and make one inv of urns before using
Never added door opening(i think thats the setup)
Program UrnMaker;
{$Define SMART8}
{$I SRL/SRL.Simba}
{$I SRL/SRL/Misc/Debug.Simba}
{$I Sps/Sps.Simba}
{$i SRL/SRL/misc/reports.simba}
{$IFDEF SMART8}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
{$ENDIF}
//Setup Variables
Const
Debug = True;
WorldToUse = 31; //What World To Log Into (Recommend Low-Lag)
DMP = True; // *** If the SPS Map is Not found found,
//Download them and save them automatically,
//you should leave this as true ***
ScriptVersion = '1.0'; //Current ScriptVersion For Debug and Paint
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Pin := '';
Players[0].Nick :='';
Players[0].Active:=True;
End;
///////////////////////////////////////////////////////////////////////////////////////////
// //
// End of user setup //
// Don't touch below this line unless you know what you're doing!! //
// //
// Thanks To Ashaman For this message, yes i am that lazy! //
// //
///////////////////////////////////////////////////////////////////////////////////////////
Var
RunsMade: Integer;
StartingExperience,ExperienceEarned: Integer;
SpinTicketDTM: Integer;
ToUrn,ToBank: TPointArray;
//Import painting
Prog: Integer;
PaintArray: TStringArray;
{*******************************-CREDITS-**************************************
All of these mouse movements and typing are credited To benland100 and flight.
Ashaman88 For his edits To benland100's and flight's already great functions
Thanks also To Ashaman88 For his awesome scripts, i used one of
his as a template when i was learning To make my first script
*******************************************************************************}
//By Bandland100, modified by Ashaman88 To shift mouse speeds after every step
//
Procedure SuperWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: Extended);
Var
veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,step: Extended;
lastX,lastY,MSP,W: Integer;
sqrt2,sqrt3,sqrt5: Extended;
Begin
MSP := MouseSpeed;
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
While hypot(xs - xe, ys - ye) > 1 Do
Begin
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
If dist >= targetArea Then
Begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
End Else
Begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
If (maxStep < 3) Then
Begin
maxStep:= random(3) + 3.0;
End Else
Begin
maxStep:= maxStep / sqrt5;
End;
End;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
If hypot(veloX, veloY) > maxStep Then
Begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
End;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
case Random(50) of
1..25: W := (MSP + (Random((MSP/4))));
26..50: W := (MSP - (RandomRange((MSP/2), MSP-1)));
End;
If (W < 1) Then
W := 1;
If (lastX <> Round(xs)) Or (lastY <> Round(ys)) Then
MoveMouse(Round(xs), Round(ys));
step:= hypot(xs - lastX, ys - lastY);
//W := round((maxWait - minWait) * (step / maxStep) + minWait);
wait(W);
lastdist:= dist;
End;
If (Round(xe) <> Round(xs)) Or (Round(ye) <> Round(ys)) Then
MoveMouse(Round(xe), Round(ye));
MouseSpeed := MSP;
End;
Procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
Var
randSpeed: Extended;
X,Y,X2,Y2,j,Dist,MP: Integer;
Begin
j := MouseSpeed;
GetMousePos(X, Y);
Dist := Distance(X, Y, eX, eY);
MP := Round(Dist/150);
If MP < 0 Then
MP := 1;
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
X2 := RandomRange(eX-(j*MP), eX+(j*MP));
Y2 := RandomRange(eY-(j*MP), eY+(j*MP));
SuperWindMouse(X, Y, X2, Y2, 11, 8, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
GetMousePos(X, Y);
MMouse(eX, eY, ranX, ranY);
MouseSpeed := j;
End;
Procedure HumanMouseBox(X1, Y1, X2, Y2: Integer);
Var
FX, FY: Integer;
Begin
GaussBox(FX,FY,X1,Y1,X2,Y2);
HumanMMouse(FX,FY,0,0)
End;
{*******************************************************************************
Procedure FastClick(button: Integer);
By: Flight
Description: Quickly click the mouse.
*******************************************************************************}
Procedure FastClick(button: variant);
Var
x, y: Integer;
ibutton: Integer;
Begin
If VariantIsBoolean(button) Then
Begin
If (button) Then
iButton := mouse_left
Else
iButton := mouse_right;
End Else
iButton := button;
If (iButton = mouse_move) Then Exit;
GetMousePos(x, y);
HoldMouse(x, y, iButton);
Wait(RandomRange(60, 150));
GetMousePos(x, y);
ReleaseMouse(x, y, iButton);
End;
Procedure OffMM(RedTu, LeWait, rWait: Integer);
Var
W,H,RX,RY,T,RT: Integer;
Begin
GetClientDimensions(W,H);
H:=H+50;
RX := RandomRange(0, W);
RY := RandomRange(0, H);
Case (RedTu) Of
0..1: HumanMMouse(W/2, RandomRange(-110,-60), RX, 0);
2: HumanMMouse(RandomRange(-50,-10), H/2, 0, RY);
3: HumanMMouse(W/2, h+RandomRange(10,50), RX, 0);
4: HumanMMouse(W+RandomRange(10,50), H/2, 0, RY);
End;
RT:=(Random(rWait));
MarkTime(T);
Repeat
Wait(Random(100));
Until TimeFromMark(T)>(LeWait+RT);
End;
Procedure TypeFast(Text: String);
Var
I: Integer;
Begin
For I:=1 To Length(Text) Do
SendKeys(Text[I],RandomRange(90,140),RandomRange(90,140));
Wait(RandomRange(10,50));
End;
//
{*******************************************************************************
//
// DannyRS's Part
//
*******************************************************************************}
//
Procedure LeftClickSpot(X1, Y1, X2, Y2: Integer);
Var Y1NOBanner, Y2NOBanner: Integer;
Begin
Y1NOBanner:=Y1 - 50; Y2NOBanner:=Y2 - 50;
HumanMMouse(RandomRange(X1,X2),RandomRange(Y1NOBanner,Y2NOBanner),0,0);
Wait(9+Random(37));
FastClick(true);
Wait(124+Random(193));
End;
Procedure RightClickSpot(X1, Y1, X2, Y2: Integer);
Var Y1NOBanner, Y2NOBanner: Integer;
Begin
Y1NOBanner:=Y1 - 50; Y2NOBanner:=Y2 - 50;
HumanMMouse(RandomRange(X1,X2),RandomRange(Y1NOBanner,Y2NOBanner),0,0);
Wait(9+Random(37));
FastClick(false);
Wait(124+Random(193));
End;
Procedure ClickCurrent(ToDo: Boolean);
Var Y1NOBanner, Y2NOBanner: Integer;
Begin
Wait(9+Random(37));
If ToDo = True Then
Begin FastClick(True); End
Else If ToDo = False Then
Begin FastClick(False); End;
Wait(224+Random(193));
End;
Procedure LoginHandler;
Var Y1NOBanner, Y2NOBanner,x, y: Integer;
Begin
If (Not LoggedIn) Or (LobbyScreen) Then
Begin
If Not LoggedIn Then
LoginPlayerToLob;
If LobbyScreen Then
Begin
SelectWorld(WorldToUse);
If LobbyScreen Then
Begin
Repeat
LeftClickSpot(259, 495, 504, 525);
Wait(2500);
Until (FindColorSpiralTolerance(x, y, 143319, 703, 27, 708, 31, 40)) Or LoggedIn
End;
Wait(1224+Random(193));
End;
End;
End;
Procedure FindCustomObj(HM, SM, TOL, COL, XV, YV, S1, S2: Variant);
Var
tmpCTS, i, l, r, counter:integer;
CustomObjTPA:TPointArray;
CustomObjATPA:T2DPointArray;
x,y:integer;
Begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(HM, SM);
FindColorsTolerance(CustomObjTPA, COL, MSX1, MSY1, MSX2, MSY2, TOL);
CustomObjATPA := SplitTPAEx(CustomObjTPA, XV, YV);
SortATPASize(CustomObjATPA,True);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
L := High(CustomObjATPA)
marktime(counter);
for i := 0 to L do
begin
MiddleTPAEx(CustomObjATPA[i], x, y);
r := random(L);
HumanMMouse(x, y, 3, 5);
if(Debug)then begin Writeln('We Saw The Object'); end;
ClickCurrent(False);
If (ChooseOptionMulti([S1,S2])) then
Break;
wait(randomrange(30, 160));
if (TimeFromMark(counter) > 1500) then
begin
if(Debug)then begin Writeln('We Failed to See The Object'); end;
Break;
end;
end;
End;
Function ClickCraftAll: Boolean;
Var
xpos, ypos: Integer;
x, y: Integer;
attempts: Integer;
done: Boolean;
temprand: Integer;
Begin
done:= false;
temprand:= Random(20);
HumanMMouse(RandomRange(259,483),RandomRange(303,324),0,0);
repeat
If (Not LoggedIn)Then
Exit;
begin
if(FindColorSpiralTolerance(x, y, 8279557, 417, 280, 421, 284, 20))then
begin
if(temprand < 18)then
begin
//click craft
if(Debug)then begin Writeln('Trying to Click Craft...'); end;
Wait(5+Random(17));
FastClick(true);
Wait(1224+Random(293));
if(Debug)then begin Writeln('Moving Cursor Somewhere While Crafting'); end;
HumanMMouse(RandomRange(20,700),RandomRange(40,503),0,0);
done:= true;
end
else
begin
//Rclick craft
if(Debug)then begin Writeln('Trying to RClick Craft...'); end;
xpos:= RandomRange(259,483);
ypos := RandomRange(303,324);
HumanMMouse(xpos,ypos,0,0);
Wait(5+Random(17));
FastClick(false);
Wait(427+Random(193));
xpos:= RandomRange(xpos-67,xpos+67);
ypos := RandomRange((ypos+22),(ypos+35));
HumanMMouse(xpos,ypos,0,0);
Wait(15+Random(17));
FastClick(true);
Wait(1227+Random(193));
if(Debug)then begin Writeln('Moving Cursor Somewhere While Crafting'); end;
HumanMMouse(RandomRange(20,700),RandomRange(40,503),0,0);
done:= true;
end;
end
else
begin
if(Debug)then begin Writeln('Failed to See CraftAll'); end;
attempts:= attempts+1;
Wait(383+Random(193));
end;
end;
until (attempts > 10) or (done);
if(attempts > 10)then
begin
if(Debug)then begin
Writeln('Failed to See CraftAll Within 10 Tries'); end; Result:=False; Exit;
end
else
begin
attempts:= 0;
Result:=True;
end;
End;
Procedure WaitCrafting;
Var
xpos, ypos: Integer;
x, y: Integer;
attempts: Integer;
temprand: Integer;
done: Boolean;
Begin
repeat
begin
if(Debug)then begin Writeln('Crafting...'); end;
Wait(336+Random(197));
Case Random(20) Of
7: begin
if(Debug)then begin Writeln('Moving Cursor Somewhere While Crafting'); end;
HumanMMouse(RandomRange(20,700),RandomRange(40,503),0,0);
end;
end;
end;
until not (FindColorSpiralTolerance(x, y, 263402, 298, 177, 302, 181, 70))
repeat begin
if(Debug)then begin Writeln('waiting for EoC crafting UI to close'); end;
Wait(724+Random(393));
end; until not (FindColorSpiralTolerance(x, y, 2929149, 418, 58, 422, 62, 15))
End;
Procedure LogOutGame;
Var
xpos, ypos: Integer;
x, y: Integer;
attempts: Integer;
done: Boolean;
Begin
done:= false;
Repeat
If (Not LoggedIn)Then
Exit;
Begin
If(FindColorSpiralTolerance(x, y, 143319, 703, 28, 705, 30, 10)) And LoggedIn Then
Begin
//click x
xpos:= RandomRange(746,759);
ypos := RandomRange(3,15);
HumanMMouse(xpos,ypos,0,0);
Wait(5+Random(17));
FastClick(true);
Wait(1427+Random(193));
//click logout
xpos:= RandomRange(572,710);
ypos := RandomRange((351),(372));
HumanMMouse(xpos,ypos,0,0);
Wait(15+Random(17));
FastClick(true);
Wait(1527+Random(193));
done:= true;
End Else
Begin
attempts:= attempts+1;
Wait(263+Random(193));
End;
End;
Until (attempts > 10) Or (done);
If(attempts > 10)Then
Begin
If(Debug)Then Begin Writeln('Failed To Logout'); End; Exit;
End Else
Begin
attempts:= 0;
End;
End;
Procedure CloseBankUp;
Var
x,y: Integer;
Begin
if(FindColorSpiralTolerance(x, y, 4512575, 356, 312, 362, 318, 25))then
begin
//Close Bank
if(Debug)then begin Writeln('Closing Bank'); end;
HumanMMouse(RandomRange(482,494),RandomRange(28,41),0,0);
Wait(9+Random(37));
FastClick(true);
Wait(327+Random(283));
end;
End;
Procedure BankAllButton;
Var
xpos, ypos: Integer;
x, y: Integer;
attempts: Integer;
temprand: Integer;
done: Boolean;
Begin
done:= false;
temprand:= Random(20);
repeat
begin
IF (PinScreen) Then InPin(Players[0].Pin);
if(temprand < 18)then
begin
if(FindColorSpiralTolerance(x, y, 4512575, 358, 313, 360, 316, 20))then
begin
//Bank All
if(Debug)then begin Writeln('Banking All'); end;
HumanMMouse(RandomRange(355,382),RandomRange(299,315),0,0);
Wait(15+Random(17));
FastClick(true);
Wait(627+Random(183));
done:= true;
end
else
begin
if(Debug)then begin Writeln('failed to see bank All button'); end;
attempts:= attempts+1;
Wait(83+Random(193));
end;
end
else
begin
if(FindColorSpiralTolerance(x, y, 4512575, 358, 313, 360, 316, 20))then
begin
if(Debug)then begin Writeln('Banking All via RClick'); end;
xpos:= RandomRange(355,382);
ypos := RandomRange(299,315);
HumanMMouse(xpos,ypos,0,0);
Wait(5+Random(17));
FastClick(false);
Wait(427+Random(193));
xpos:= RandomRange(xpos-74,xpos+74);
ypos := RandomRange((ypos+22),(ypos+36));
HumanMMouse(xpos,ypos,0,0);
Wait(15+Random(17));
FastClick(true);
Wait(627+Random(193));
done:= true;
end
else
begin
if(Debug)then begin Writeln('Failed to See BankAllButton'); end;
attempts:= attempts+1;
Wait(83+Random(193));
end;
end;
end;
until (attempts > 20) or (done);
if(attempts > 20)then
begin
if(Debug)then begin Writeln('Failed to See BankAllButton after 20'); end;
SPS_WalkPath(ToBank);
Wait(1585+Random(257));
Exit;;
end
else
begin
attempts:= 0;
end;
End;
Function CheckSpinTicket: Boolean;
Var
xpos, ypos: Integer;
x, y: Integer;
attempts: Integer;
temprand: Integer;
done: Boolean;
Begin
if (FindDTM(SpinTicketDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
CloseBankUp;
if(Debug)then begin Writeln('We See a SpinTicket using'); end;
HumanMMouse(RandomRange(x-4,x+4),RandomRange(y-4,y+4),0,0);
ClickCurrent(True);
ClickCurrent(True);
Result:=True;
end else
begin
Result:=False;
end;
End;
Procedure MainLoop;
Var xpos, ypos: Integer;
Var x, y: Integer;
Var Done,UsedExit: Boolean;
Var dead: Boolean;
Var CheckIdle: Integer;
Begin
Writeln('Welcome To UrnMaker by DannyRS');
//Pause Before Start Script
Writeln('Starting in 3...');
Wait(1000);
Writeln('Starting in 2...');
Wait(1000);
Writeln('Starting in 1...');
Wait(1000);
Repeat
If Not(Debug)Then Begin ClearDebug; End;
Done := False;
If (Not LoggedIn) Or LobbyScreen Then
LoginHandler;
SPS_WalkPath(ToBank);
if (FindDTM(SpinTicketDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
CloseBankUp;
if(Debug)then begin Writeln('We See a SpinTicket using'); end;
HumanMMouse(RandomRange(x-4,x+4),RandomRange(y-4,y+4),0,0);
ClickCurrent(True);
HumanMMouse(RandomRange(x-4,x+4),RandomRange(y-4,y+4),0,0);
ClickCurrent(True);
end;
CloseBankUp;
FindCustomObj(0.17, 0.82, 12, 4007982, 5, 5, 'Bank B', 'ank B');
BankAllButton;
RightClickSpot(438, 146, 458, 160);
if (ChooseOptionMulti(['Withdraw-All','ithdraw-All'])) then
Wait(185+Random(257))
else
Continue;
SPS_WalkPath(ToUrn);
Wait(1885+Random(257));
FindCustomObj(1.20, 0.10, 2, 10066336, 5, 5, 'Form', 'Orm');
Wait(1585+Random(257));
ClickCraftAll;
WaitCrafting;
SPS_WalkPath(ToBank);
Wait(1585+Random(257));
If(Debug)Then Begin Writeln('Reached End of Main Loop'); End;
//Done:=True; //debuging only
Until Done;
End;
{*******************************-CREDIT-***************************************
All Credit To Ashaman and where ever he learned it, For the map grabbing !!
*******************************************************************************}
Procedure DownloadSPSImage(ImageName: String; Location: String);
Var
Image, Path: string;
FP: Integer;
Begin
If(Debug)Then Begin Writeln('Downloading SPS Map Image'); End;
Image:= GetPage(Location);
Path:= IncludePath + 'SPS\img\runescape_other\' + ImageName + '.png';
Path:= Trim(Path);
FP:= CreateFile(Path);
WriteFileString(FP, Image);
CloseFile(FP);
End;
Function GrabSPSMaps: Boolean;
Var
SWMap,SWName: String;
Begin
SWName:= 'URNSPS';
SWMap:= 'http://i.imgur.com/KSeSL.png';
If DMP Then
Begin
If (Not FileExists(IncludePath + 'SPS\img\runescape_other\URNSPS.png')) Then
DownloadSPSImage(SWName, SWMap);
End;
Result:= (FileExists(IncludePath + 'SPS\img\runescape_other\URNSPS.png'));
End;
Procedure RequirementsCheck;
Begin
If (Not GrabSPSMaps) Then
RaiseException(erCustomError, 'SPS Maps Do Not Exist OR They Are Named Incorrectly!');
End;
Procedure FreeGlobals;
Begin
FreeDTM(SpinTicketDTM);
End;
Procedure SetMyGlobals;
Begin
SpinTicketDTM := DTMFromString('mggAAAHicY2NgYMhlYmBIhuIyKC4GYjFGBgYhIJYBYn4oDRKbaqzL0J9ih4JXL1/MwAU0CxtmxIEhAABpRQsg');
ToUrn:= [Point(197, 133), Point(197, 146), Point(196, 152), Point(196, 159), Point(197, 163), Point(198, 171), Point(198, 176), Point(197, 184), Point(196, 189), Point(191, 193), Point(189, 199), Point(188, 203), Point(186, 211), Point(185, 215), Point(183, 220), Point(182, 226), Point(182, 233), Point(184, 239), Point(185, 245)]
ToBank:= [Point(184, 244), Point(184, 235), Point(184, 227), Point(185, 218), Point(186, 211), Point(187, 205), Point(190, 199), Point(193, 192), Point(195, 185), Point(195, 176), Point(196, 167), Point(196, 159), Point(197, 149), Point(194, 143), Point(191, 137), Point(185, 132), Point(176, 131), Point(170, 130), Point(166, 130), Point(163, 138), Point(163, 144), Point(163, 151), Point(163, 163)]
End;
Procedure Setup;
Var x,y: Integer;
Begin
{$IFDEF SIMBAMAJOR980}
SMART_SERVER := 10;
SMART_MEMBERS := TRUE;
SMART_SIGNED := TRUE;
SMART_SUPERDETAIL := FALSE;
{$ELSE}
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
{$ENDIF}
SetupSRL;
ClearDebug;
RequirementsCheck;
DeclarePlayers;
SPS_Setup(RUNESCAPE_OTHER, ['URNSPS']);
SetMyGlobals;
AddOnTerminate('FreeGlobals');
LoginHandler;
ClickNorth(SRL_ANGLE_HIGH);
SmartSetRefresh(90);
End;
Begin
Setup;
ActivateClient;
ClearDebug;
MainLoop;
LogOutGame;
End.