serajin
2013-03-29 21:20:37
How Long have You Played Runescape?
5 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C, C++, C#, Visual Basic
Are you a member of any other communities?
I am not.
Tell us about yourself…
Please show us one (or multiple) of your scripts.
5 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C, C++, C#, Visual Basic
Are you a member of any other communities?
I am not.
Tell us about yourself…
From: serajin
I'm 23 years old. I went to school and majored in Computer Animation. I took an interest in programming and took some courses at the local college. I did coding on a private RunUO Server for Ultima Online a few years ago, as well as a few pet projects and programs for myself. I enjoy playing games with my friends, currently League of Legends and Runescape, and spending time with my Fiance.
Please show us one (or multiple) of your scripts.
Currently my only 100% finished and
flawless script is my SenjuGoldSmith, which Smelts
and crafts gold ore into Gold Bracelets in Edgeville.
The longest I have run the script for is 45 hours
before my computer ran out of memory. I have
other scripts that are incomplete, as they ended
up being small pieces of other scripts, or general
tests. Including item finders, combat locators,
and a pottery crafter. Below is my Goldsmither.
I believe I gave everyone credit where credit was due. There are a few
functions that I did not write, but did modify several from other authors.
I included their names next to the function as best as I could.
program SenjuGoldSmelter;
{$Define Smart8}
{$I SRL/SRL.Simba}
{$I SRL/SRL/Misc/Debug.Simba}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
Const
Debug = False;
Timeouts = True;
{Break Settings} // From Ashman
TakeBreaks = True; // ***Do you want to take breaks?***
BreakIn = 300; // ***How long before we take a break? (minutes)***
BreakFor = 15; // ***How long will we break for? (minutes)***
Bir = 15; // ***Random minutes to add/subtract from how long until we break***
Bfr = 7; // ***Random minutes to add/subjtract from break duraction***
Var
StartTime: Int64;
StartingEXP: Integer;
EdgeBankDTM, EdgeFurnaceDTM, GoldOreDTM, GoldBarDTM, GoldBarDTM2, GoldBarMenuDTM, GoldBraceletMenuDTM: Integer; // DTMs
BreakInLocal,BreakForRandom,BreakForLocal, BreakInRandom,RealBTime,CurrentBTime,BreakRounds,TotalBreaks,Timeout,Timeout2: Integer; //Break Variables
Timer, Timer2: Integer;
afound: Extended;
x, y: Integer;
OreAvailable: Integer;
TPA: TPointArray;
GoldBarsCrafted, GoldBraceletsCrafted: Integer;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Nick := '';
//WorldInfo := [50] //Set this if you want a specific world.
Active := True;
end;
end;
{*******************************************************************************
All of these mouse movements and typing are credited to benland100 and flight.
thanks to Ashaman88 for his awesome scripts, i used his as a template
*******************************************************************************}
//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);
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 LeftClickSpot(X1, Y1, X2, Y2: Integer); //From DannyRS
var
Y1NOBanner, Y2NOBanner: Integer;
begin
Y1NOBanner:= Y1 - 50;
Y2NOBanner:= Y2 - 50;
HumanMMouse(RandomRange(X1, X2), RandomRange(Y1NOBanner, Y2NOBanner), 0, 0);
ClickMouse2(True);
end;
procedure PickOptionNumber(ToDo,XSize: Integer); //From DannyRS
var
X, Y, YAddValue, CPX, CPY: Integer;
Begin
GetMousePos(X, Y);
YAddValue:= Y + 21;
CPX:= X;
CPY:= YAddValue + (ToDo * 16);
Wait(RandomRange(100, 250));
LeftClickSpot(CPX - XSize, CPY + 51, CPX + XSize, CPY + 49 + 15);
End;
function GetMMPoints(x, y, color, width, height, tolerance: Integer; huem,
satm: Extended): TpointArray;
var
TPA: TpointArray; ATPA: T2DpointArray; l, i, p, CTS: Integer;
begin
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(huem, satm);
FindColorsSpiralTolerance(x, y, TPA, color, MMx1, MMy1, MMx2, MMy2, tolerance);
ColorToleranceSpeed(CTS);
ATPA:= TPAtoATPAEx(TPA, width, height);
for i:= 0 to High(ATPA) do
if Length(ATPA) > 5 then
begin
l:= getarraylength(Result);
SetArrayLength(Result, l + 1);
Result[l]:= MiddleTpa(ATPA[i]);
end;
if Length(result) = 0 then Exit;
for i:= 0 to High(Result) do
if rs_OnMiniMap(result[i].x, result[i].y) then Inc(p);
if p = 0 then SetArrayLength(Result, 0);
If Debug Then
WriteLn('Found: ' + IntToStr(l) + ' Result(s)');
end;
function GetMSPoints(x, y, color, width, height, tolerance: Integer; huem,
satm: Extended): TpointArray;
var
TPA: TpointArray; ATPA: T2DpointArray; l, i, p, CTS: Integer;
begin
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(huem, satm);
FindColorsSpiralTolerance(x, y, TPA, color, MSx1, MSy1, MSx2, MSy2, tolerance);
ColorToleranceSpeed(CTS);
ATPA:= TPAtoATPAEx(TPA, width, height);
for i:= 0 to High(ATPA) do
if Length(ATPA) > 5 then
begin
l:= getarraylength(Result);
SetArrayLength(Result, l + 1);
Result[l]:= MiddleTpa(ATPA[i]);
end;
if Length(result) = 0 then Exit;
for i:= 0 to High(Result) do
if not rs_OnMiniMap(result[i].x, result[i].y) then Inc(p);
if p = 0 then SetArrayLength(Result, 0);
If Debug Then
WriteLn('Found: ' + IntToStr(l) + ' Result(s)');
end;
procedure FilterTPADistTPA(var TPA1: TPointArray; const MinDist,
MaxDist: Extended; TPA2: TPointArray);
var
c, i, j, h, hh: integer;
d: extended;
mind, maxd: extended;
begin
h:= high(TPA1);
hh:= high(TPA2);
c:= 0;
mind:= sqr(MinDist);
maxd:= sqr(MaxDist);
for i:= 0 to h do
for j:= 0 to hh do
begin
d:= sqr(TPA1[i].x - TPA2[j].x) + sqr(TPA1[i].y - TPA2[j].y);
if (d >= mind) and (d <= maxd) then
begin
TPA1[c]:= TPA1[i];
inc(c);
break;
end;
end;
setlength(TPA1, c);
end;
procedure OffMM(RedTu, LeWait, rWait: Integer); // By Le Jingle, From Ashman Script
var
W, H, RX, RY, T, RT, X, Y: Integer;
begin
GetMousePos(X, Y);
if (X > 0) and (Y > 0) then
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(200));
until TimeFromMark(T) > (LeWait + RT);
end;
end;
function WaitLoggedIn(Time: Integer): Boolean;
var
T: Integer;
begin
Result:= (GetColor(472, 490) = 16777215);
if Result then
Exit;
MarkTime(T);
repeat
Wait(Random(100));
SRL_ResetNavBar;
if TimeFromMark(T) > Time then
begin
Result:=False;
Exit;
end;
until (GetColor(472, 490) = 16777215);
Result:= True;
end;
function IsWorking: Boolean;
begin
if ((CountColorTolerance(855309, 97, 77, 421, 165, 25)) > 6000) then
Result:= True;
end;
function Antiban: Boolean; // AntiBan From Ashman - Modified
var
r: Integer;
begin
r := Random(5000);
case r of
1..5:
begin
if Debug then
WriteLn('Random Movement');
RandomMovement;
end;
6..30:
begin
if Debug then
WriteLn('Checking Crafting Level');
HoverSkill('Crafting', False);
GameTab(Tab_Inv);
end;
35..60:
begin
if Debug then
WriteLn('Checking Smithing level');
HoverSkill('Smithing', False);
GameTab(Tab_Inv);
end;
100..200:
begin
if Debug then
WriteLn('Picking Up Mouse');
PickUpMouse;
end;
500..600:
begin
if Debug then
WriteLn('Sleep And Move Mouse');
SleepAndMoveMouse(RandomRange(400,500));
Result:=True;
end;
700..800:
begin
if Debug then
WriteLn('Going Off the Screen');
Wait(RandomRange(1250, 1500));
OffMM(Random(4),RandomRange(2500,4000),2000);
Result:=True;
end;
end;
end;
function FindForgeMM: Boolean;
var
TPA, TPA2: TPointArray;
ATPA: array of TPointArray;
a, x, y: integer;
begin
TPA:= GetMMPoints(x, y, 1599977, 0, 0, 0, 0.00, 0.00); //Furnace Symbol 2
TPA2:= GetMMPoints(x, y, 3030615, 0, 0, 0, 0.00, 0.00); //Furnace Symbol 3
FilterTPADistTPA(TPA, 0, 5, TPA2);
SplitTPAWrap(TPA, 50, ATPA);
if Debug then
for a:= 0 to high(ATPA) do
SMART_DrawCircle(True, MiddleTPA(ATPA[a]), 10, False, clred);
if GetArrayLength(ATPA) > 0 then
begin
HumanMMouse(MiddleTPA(ATPA[0]).x, MiddleTPA(ATPA[0]).y, 5, 5);
ClickMouse2(true);
wait(RandomRange(500, 700));
while (IsMoving) do (Wait(1));
Result:= true;
Exit;
end;
Result:= false;
end;
function FindBankMM: Boolean;
var
TPA: TPointArray;
ATPA: array of TPointArray;
a, x, y: integer;
begin
TPA:= GetMMPoints(x, y, 7198185, 0, 0, 14, 0.05, 0.49); //Furnace Symbol 2
SplitTPAWrap(TPA, 50, ATPA);
if Debug then
for a:= 0 to high(ATPA) do
SMART_DrawCircle(True, MiddleTPA(ATPA[a]), 10, False, clred);
if GetArrayLength(ATPA) > 0 then
begin
HumanMMouse(MiddleTPA(ATPA[0]).x, MiddleTPA(ATPA[0]).y, 5, 5);
ClickMouse2(true);
FFlag(0);
while (IsMoving) do (Wait(1));
Result:= true;
Exit;
end;
Result:= false;
end;
function CheckStuff: Boolean; // Modified from Ashman
begin
Result:= False;
if not WaitLoggedIn(1000) then
begin
SmartSetEnabled(False);
SmartSetEnabled(True);
if not WaitLoggedIn(1000) then
begin
LoginPlayer;
Wait(RandomRange(4000, 6000));
ClickNorth(SRL_ANGLE_HIGH);
FindNormalRandoms;
Result:= True;
end;
end;
if TimeFromMark(Timer) > 120000 then
begin
Writeln('Nothing has happened for too long, resetting focus.');
SmartSetEnabled(False);
SmartSetEnabled(True);
MarkTime(Timer);
ClickNorth(SRL_ANGLE_HIGH);
FindNormalRandoms;
end;
if Timeouts then
if TimeFromMark(Timer2)>300000 then
begin
Writeln('Nothing has happened for too long, shutting down.');
Logout;
TerminateScript;
end;
if FindSpinTicket or ExitSquealOfFortune then
if not WaitLoggedIn(1000) then
TerminateScript else
begin
ClickNorth(SRL_ANGLE_HIGH);
if Debug then
Writeln('Found squeal stuff');
Result:=True;
end;
end;
procedure CheckCraftBar;
Var
TPA: TPointArray;
x, y: Integer;
Begin
CheckStuff;
if FindDTM(GoldBarMenuDTM, x, y, 240, 55, 285, 85) then
begin
if Debug then
WriteLn('Already On The Item');
Exit;
end else
begin
TPA:= GetMSPoints(MSCX, MSCY, 6533359, 0, 0, 0, 0.00, 0.00); //MenuText Color
if not FindTextTPAEx(6533359, 0, 15, 40, 215, 60, x, y, 'Gold', UpChars, Nothing) then
begin
if Debug then
WriteLn('Not on the menu, going to the menu');
HumanMouseBox(15, 40, 215, 60);
ClickMouse2(true);
Wait(RandomRange(100, 200));
if Debug then
WriteLn(FindTextTPAEx(6533359, 0, 15, 65, 215, 175, x, y, 'Smelt', UpChars, Nothing));
HumanMMouse(x, y, 20, 2);
ClickMouse2(true);
Wait(RandomRange(1000, 1200));
end;
if FindDTM(GoldBarMenuDTM, x, y, 240, 55, 285, 85) then
begin
if Debug then
WriteLn('Already on the item, waiting for smelt');
Exit;
end else
if FindDTM(GoldBarMenuDTM, x, y, 23, 80, 222, 300) then
begin
if Debug then
WriteLn('Found the bar in the menu');
HumanMMouse(x, y, 5, 5);
ClickMouse2(true);
Exit;
end else
if not FindDTM(GoldBarMenuDTM, x, y, 23, 80, 222, 300) then
begin
if Debug then
WriteLn('Maybe mouse was covering it, trying again');
HumanMMouse(350, 180, 100, 100);
Wait(RandomRange(500, 1000));
FindDTM(GoldBarMenuDTM, x, y, 23, 80, 222, 300);
HumanMMouse(x, y, 5, 5);
ClickMouse2(true);
Exit;
end;
Wait(RandomRange(500, 1000));
end;
end;
procedure CheckCraftBracelet;
var
TPA: TPointArray;
x, y: Integer;
begin
CheckStuff;
if FindDTM(GoldBraceletMenuDTM, x, y, 240, 55, 285, 85) then
begin
if Debug then
WriteLn('Already On The Item');
Exit;
end else
begin
if Debug then
WriteLn('Not on the item, going to the menu');
TPA:= GetMSPoints(MSCX, MSCY, 6533359, 0, 0, 0, 0.00, 0.00); //MenuText Color
if not FindTextTPAEx(6533359, 0, 15, 40, 215, 60, x, y, 'Gold', UpChars, Nothing) then
begin
HumanMouseBox(15, 40, 215, 60);
ClickMouse2(true);
Wait(RandomRange(100, 200));
if Debug then
WriteLn(FindTextTPAEx(6533359, 0, 15, 65, 215, 175, x, y, 'Gold', UpChars, Nothing));
HumanMMouse(x, y, 20, 2);
ClickMouse2(true);
Wait(RandomRange(1000, 1200));
end;
HumanMouseBox(228, 85, 231, 145);
ClickMouse2(True);
if FindDTM(GoldBraceletMenuDTM, x, y, 240, 55, 285, 85) then
begin
if Debug then
WriteLn('Already on the item, waiting for craft');
Exit;
end else
if FindDTM(GoldBraceletMenuDTM, x, y, 23, 80, 222, 300) then
begin
if Debug then
WriteLn('Found the bar in the menu');
HumanMMouse(x, y, 5, 5);
ClickMouse2(true);
Exit;
end else
if not FindDTM(GoldBraceletMenuDTM, x, y, 23, 80, 222, 300) then
begin
if Debug then
WriteLn('Maybe mouse was covering it, trying again');
HumanMMouse(350, 180, 100, 100);
Wait(RandomRange(500, 1000));
if FindDTM(GoldBraceletMenuDTM, x, y, 23, 80, 222, 300) then
begin
HumanMMouse(x, y, 5, 5);
ClickMouse2(true);
Exit;
end else
begin
if Debug then
WriteLn('Couldnt find the item');
Exit;
end;
end;
Wait(RandomRange(500, 1000));
end;
end;
procedure CraftButton;
var
TPA: TPointArray;
TimeTimer: Integer;
begin
MarkTime(TimeTimer);
TPA:= GetMSPoints(MSCX, MSCY, 7755272, 20, 20, 13, 0.03, 0.49);
FilterPointsDist(TPA, 0, 100, 365, 315);
if Debug then
SMART_DrawDotsEx(True, TPA, clWhite);
if Length(TPA) > 0 then
begin
HumanMMouse(MiddleTPA(TPA).x, MiddleTPA(TPA).y, 5, 2);
Wait(RandomRange(200, 300));
ClickMouse2(true);
end;
repeat
Wait(RandomRange(1000, 1500));
AntiBan;
if TimeFromMark(TimeTimer) > 100000 then
Break;
until (IsWorking = False);
End;
procedure DTMLoad;
begin
EdgeBankDTM := DTMFromString('mrAAAAHic42BgYGAFYjUgVgBiNigfBliAWAaIdYFYHiqmCcVKULFAH3sG72IzBqVIITBOjvZleP+XE47/A9XIIWENND4jEDPhwTAAAHpLDRw=');
EdgeFurnaceDTM := DTMFromString('mlwAAAHicY2dgYDABYh0g5gZieSA2BWIlBgiQhtJcQGwExK5A7ATEQkD84cF9hsAALzA2ThBmaOudxuBTYMygHMbP8B8oL4eENZDYjEiYCQ1DAQDhRgvs');
GoldBarDTM := DTMFromString('mwQAAAHic42RgYGBnZmDgBGJBIBYDYj4gZgXiP0wMDD+BmAHIdgLS/kDsDsR2QGwFxc5A7AXEvkC8tFkcqJgJL2ZlIAwYicBwAAB12gY1');
GoldBarDTM2 := DTMFromString('mlwAAAHicY2dgYHBiYmCwB2J3IHYFYmcgDgRiEyB+AJR/BsSPgfgWEH8A4odA/AKIFzWIMcR48jJcWi4L5DGhYBEgCcOsaJgRD4YCAN+0DAY=');
GoldBarMenuDTM := DTMFromString('mlwAAAHicY2dgYOACYhYGCACxJYFYDIh5oeLCQMwJlWcFYh4gFgXiJU3iQJIRTMPYMMwPJHFhRjwYCgCaogTN');
GoldOreDTM := DTMFromString('mAAEAAHic42FgYPgKxIyMDAz/gfRPIP4MxG+B+BUQPwHil0D8B4g/APEnIJ4HxHOAeBEQLwXi1UC8AsqeD8WLgXg5EM8G4i39kkCSCSeOcDNkWNMpAaYnlYgycDHgB5JomJFEjAwAkOoX9w==');
GoldBraceletMenuDTM := DTMFromString('mlwAAAHicY2dgYOgF4j4gngrE06HsFiDuBOKJQDwfimdC5SZC2fcOyANJRjjurhBmmNEsynBpqxyDEVAEF2bEg6EAAMG1Dxo=');
end;
procedure DTMFree;
begin
FreeDTM(EdgeBankDTM);
FreeDTM(EdgeFurnaceDTM);
FreeDTM(GoldBarDTM);
FreeDTM(GoldBarDTM2);
FreeDTM(GoldOreDTM);
FreeDTM(GoldBarMenuDTM);
FreeDTM(GoldBraceletMenuDTM);
end;
procedure Setup;
begin
ClearDebug;
Smart_ClearCanvas;
if Debug then
WriteLn('Begin Setup');
{$IFDEF SIMBAMAJOR980}
SMART_SERVER := 10;
SMART_MEMBERS := TRUE;
SMART_SIGNED := TRUE;
SMART_SUPERDETAIL := FALSE;
SRL_SIXHOURFIX := TRUE;
{$ELSE}
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
{$ENDIF}
SetupSRL;
BreakInLocal := (BreakIn * 60000);
BreakForLocal := (BreakFor * 60000);
BreakInRandom := RandomRange(-BIR * 60000, BIR * 60000);
BreakForRandom := RandomRange(-BFR * 60000, BFR * 60000);
OreAvailable := 0;
GoldBarsCrafted := 0;
GoldBraceletsCrafted := 0;
DeclarePlayers;
DTMLoad;
LoginPlayer;
Wait(RandomRange(100,500));
if Debug then
Writeln('Logged into a world');
CloseAllScreens;
ClickNorth(SRL_ANGLE_HIGH);
ToggleMoneyPouch(False);
ToggleXPBar(False);
StartingEXP := GetXPBarTotal;
FindNormalRandoms;
StartTime := GetSystemTime;
if Debug then
WriteLn('End Setup');
MarkTime(Timer);
MarkTime(Timer2);
end;
function RunEdgeBank: Boolean;
var
x, y, i: integer;
TPA: TPointArray;
ATPA: array of TPointArray;
begin
if Debug then
WriteLn('Running to Bank');
Result:= False;
TPA:= GetMSPoints(MSCX, MSCY, 3219493, 3, 3, 15, 0.26, 0.91); //Banker
SplitTPAWrap(TPA, 10, ATPA);
if Debug then
for i:= 0 to high(ATPA) do
SMART_DrawCircle(True, MiddleTPA(ATPA[i]), 5, False, clPurple);
if GetArrayLength(ATPA) > 0 then
for i:= 0 to High(ATPA) do
if Length(ATPA[i]) > 7 then
begin
Result:= True;
Exit;
end;
if BankScreen then
begin
Result:= True;
Exit;
end;
for i:= 0 to 2 do
begin
if FindDTMRotated(EdgeBankDTM, x, y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, Pi/30, afound) then
begin
HumanMMouse(x, y, 2, 2);
ClickMouse2(True);
FFlag(10);
Result:= True;
while (IsMoving) do (Wait(1));
Exit;
end else
begin
if FindBankMM then
begin
Result:= True;
Exit;
end;
end;
end;
if Debug then
WriteLn('Failed to find bank, walking left, and searching again.');
HumanMMouse(590, 100, 5, 5);
ClickMouse2(true);
for i:= 0 to 2 do
begin
if FindDTMRotated(EdgeBankDTM, x, y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, Pi/30, afound)then
begin
HumanMMouse(x, y, 2, 2);
ClickMouse2(True);
FFlag(10);
Result:= True;
while (IsMoving) do (Wait(1));
Exit;
end else
begin
if FindBankMM then
begin
Result:= True;
Exit;
end else
begin
end;
end;
end;
if not FindBankMM then
begin
if Debug then
Writeln('Did not get to bank, logging in and out to reset map');
ExitToLobby;
Wait(RandomRange(2500,3500));
if Debug then
Writeln('Loging back in');
LoginPlayer;
Wait(RandomRange(2000,3000));
ClickNorth(SRL_ANGLE_HIGH);
FindNormalRandoms;
RunEdgeBank;
end;
end;
function OpenBanker: Boolean;
var
TPA: TPointArray;
ATPA: array of TPointArray;
i, a:Integer;
begin
Result:= False;
if Debug then
WriteLn('Attempting to Find Banker');
if BankScreen then
begin
Result:= True;
Exit;
end;
TPA:= GetMSPoints(MSCX, MSCY, 3219493, 3, 3, 15, 0.26, 0.91); //Banker
if Debug then
SMART_DrawDotsEx(True, TPA, ClYellow);
SplitTPAWrap(TPA,10,ATPA);
if Debug then
for a:= 0 to high(ATPA) do
SMART_DrawCircle(True, MiddleTPA(ATPA[a]), 5, False, clPurple);
if GetArrayLength(ATPA) > 0 then
for a:= 0 to High(ATPA) do
if Length(ATPA[a]) > 6 then
begin
HumanMMouse(MiddleTPA(ATPA[a]).x, MiddleTPA(ATPA[a]).y, 10, 5);
Wait(RandomRange(150, 250));
if IsUpText('to Ba') then
begin
ClickMouse2(false);
ChooseOption('ank Ba');
while (IsMoving) do (Wait(1));
if (PinScreen) then
InPin(Players[0].Pin);
Break;
end;
end;
Wait(RandomRange(500, 1000));
if BankScreen or PinScreen then
begin
FixBank;
Result:= True;
if Debug then
WriteLn('Opened Banker Using Standard Method');
MarkTime(Timer);
MarkTime(Timer2);
Exit;
end;
Wait(RandomRange(500, 1000));
if Debug then
WriteLn('Failed to open bank using standard method');
for i:=0 to 5 do
begin
if BankScreen then
begin
Result:= True;
MarkTime(Timer);
MarkTime(Timer2);
Exit;
end;
If Debug Then
WriteLn('Attempting to Find Banker Using Secondary Method');
if not OpenBankNPC() then
Result:= False;
end;
MarkTime(Timer);
MarkTime(Timer2);
end;
procedure Banking;
var
x, y: Integer;
BankSlot: TPoint;
begin
CheckStuff;
if (PinScreen) then
InPin(Players[0].Pin);
if BankScreen then
begin
if OreAvailable = 0 then
begin
FindDTM(GoldOreDTM, X, Y, MSX1, MSY1, MSX2, MSY2);
BankSlot:= Point(X, Y);
BankSlot:= MSTPointToBankPoint(BankSlot);
OreAvailable:= GetBankItemAmount(BankSlot.X, BankSlot.Y);
end;
if not InvEmpty then
begin
BankTab(1);
FixBank;
DepositAll;
Wait(RandomRange(200, 250));
FindDTM(GoldOreDTM, X, Y, MSX1, MSY1, MSX2, MSY2);
BankSlot:= Point(X, Y);
BankSlot:= MSTPointToBankPoint(BankSlot);
OreAvailable:= GetBankItemAmount(BankSlot.X, BankSlot.Y);
end;
FindDTM(GoldOreDTM, X, Y, MSX1, MSY1, MSX2, MSY2);
HumanMMouse(X, Y, 10, 10);
ClickMouse2(False);
Wait(RandomRange(150, 250));
PickOptionNumber(6, 78);
Wait(RandomRange(500, 1000));
end;
if InvEmpty then
Banking;
if OreAvailable < 29 then
begin
WriteLn('We are out of ore');
DTMFree;
TerminateScript;
end;
MarkTime(Timer);
MarkTime(Timer2);
end;
function RunToFurnace: Boolean;
var
TPA: TPointArray;
ATPA: Array of TPointArray;
x, y, a: integer;
begin
Result:= False;
if not(InvCount = 28)then
begin
Result:= False;
Exit;
end;
TPA:= GetMSPoints(MSCX, MSCY, 2110653, 3, 3, 20, 0.08, 0.38);
SplitTPAWrap(TPA, 10, ATPA);
if GetArrayLength(ATPA) > 0 then
for a:= 0 to High(ATPA) do
if Length(ATPA[a]) > 15 then
begin
Result:= True;
Exit;
end;
if Debug then
WriteLn('Running to Furnace');
if FindDTMRotated(EdgeFurnaceDTM, x, y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, Pi/30, aFound) then
begin
HumanMMouse(x, y, 2, 2);
ClickMouse2(True);
wait(randomrange(500, 7000));
FFlag(10);
while (IsMoving) do (Wait(1));
TPA:= GetMSPoints(MSCX, MSCY, 2110653, 3, 3, 20, 0.08, 0.38);
SplitTPAWrap(TPA, 10, ATPA);
if GetArrayLength(ATPA) > 0 then
for a:= 0 To High(ATPA) do
if Length(ATPA[a]) > 15 then
begin
Result:= True;
Exit;
end;
end else
begin
if FindForgeMM then
Result:= True;
Exit;
end;
end;
procedure FindFurnace;
var
TPA: TPointArray;
ATPA: array of TPointArray;
a: Integer;
begin
CheckStuff;
TPA:= GetMSPoints(MSCX, MSCY, 2110653, 3, 3, 13, 0.08, 0.38);
SplitTPAWrap(TPA, 10, ATPA);
if Debug then
for a:= 0 to High(ATPA) do
if Length(ATPA[a]) > 15 then
SMART_DrawCircle(False, MiddleTPA(ATPA[a]), 5, False, clWhite);
if GetArrayLength(ATPA) > 0 then
for a:= 0 To High(ATPA) Do
if Length(ATPA[a]) > 15 then
begin
HumanMMouse(MiddleTPA(ATPA[a]).x, MiddleTPA(ATPA[a]).y, 20, 20);
Wait(RandomRange(250, 350));
if IsUpText('lt Fu') then
begin
ClickMouse2(true);
wait(randomRange(100, 250));
FFlag(0);
while (IsMoving) do (Wait(1));
if Debug then
WriteLn('Done Walking to Furnace');
Wait(RandomRange(400, 500));
Break;
end;
end;
MarkTime(Timer);
MarkTime(Timer2);
end;
procedure ProgressReport;
var
TimeUntilBreak: Integer;
begin
TimeUntilBreak := (((BreakInLocal) + (BreakInRandom) + BreakRounds)-GetTimeRunning);
WriteLn('---------Senju Goldsmith v. 1.0---------');
WriteLn('Time elapsed: ' + TimeRunning);
WriteLn('Gold Ore Remaining In Bank: ' + IntToStr(OreAvailable));
WriteLn('');
WriteLn('Gold Bars Made: ' + IntToStr(GoldBarsCrafted));
WriteLn('Gold Bars/Hour: ' + IntToStr(Round((GoldBarsCrafted)*(3600.0 / (GetTimeRunning / 1000.0)))));
WriteLn('Smithing Experience Earned: ' + IntToStr(Round(GoldBarsCrafted*56.2)));
WriteLn('Smithing Experience/Hour: ' + IntToStr(Round((GoldBarsCrafted*56.2)*(3600.0 / (GetTimeRunning / 1000.0)))));
WriteLn('');
WriteLn('Gold Bracelets Made: ' + IntToStr(GoldBraceletsCrafted));
WriteLn('Gold Bracelets/Hour: ' + IntToStr(Round((GoldBraceletsCrafted)*(3600.0 / (GetTimeRunning / 1000.0)))));
WriteLn('Crafting Experience Earned: ' + IntToStr(Round(GoldBraceletsCrafted*25)));
WriteLn('Crafting Experience/Hour: ' + IntToStr(Round((GoldBraceletsCrafted*25)*(3600.0 / (GetTimeRunning / 1000.0)))));
WriteLn('----------------------------------------');
if TakeBreaks then
Writeln('Time until next break: '+MsToTime(TimeUntilBreak, Time_Bare));
MarkTime(Timer);
MarkTime(Timer2);
end;
function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean; //From Ashman, Modified.
var
H,M,S: Integer;
begin
if not LoggedIn then
Exit;
if not TakeBreaks then
Exit;
if (HowManyPlayers = 1) then
begin
if (GetTimeRunning < ((BreakInLocal) + (BreakInRandom) + BreakRounds)) then
Exit else
if (GetTimeRunning > ((BreakInLocal) + (BreakInRandom) + BreakRounds)) then
begin
RealBTime := ((BreakForLocal+BreakForRandom)/60000);
Writeln('Taking a break for about ' + IntToStr(RealBTime) + ' minutes.');
Logout;
MarkTime(CurrentBTime);
repeat
Wait(21000);
ConvertTime((BreakForLocal+BreakForRandom)-TimeFromMark(CurrentBTime),H,M,S);
Writeln('Breaktime left: '+IntToStr(H)+':'+IntToStr(M)+':'+IntToStr(S));
until(TimeFromMark(CurrentBTime)>(BreakForLocal+BreakForRandom));
Writeln('Logging in.');
LoginPlayer;
Wait(4000);
MarkTime(Timeout);
MarkTime(Timeout2);
Result := LoggedIn;
ClickNorth(SRL_ANGLE_HIGH);
IncEx(BreakRounds, (BreakInLocal) + (BreakForLocal));
Inc(TotalBreaks);
Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.');
BreakInLocal := (BreakIn * 60000); //W
BreakForLocal := (BreakFor * 60000); //X
BreakInRandom := RandomRange(-BIR * 60000, BIR * 60000); // Y
BreakForRandom := RandomRange(-BFR * 60000, BFR * 60000); // Z
end;
end;
end;
begin
Setup;
ActivateClient;
repeat
ProgressReport;
if FindDTM(GoldOreDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
if Debug then
WriteLN('Found Gold Ore in Inventory, Running to Furnace');
RunToFurnace;
FindFurnace;
FindDTMs(GoldOreDTM, TPA, MIX1, MIY1, MIX2, MIY2);
FilterTPADist(TPA, 30);
GoldBarsCrafted:= GoldBarsCrafted + Length(TPA);
CheckCraftBar;
CraftButton;
Wait(RandomRange(1000, 1500));
end;
if FindDTM(GoldBarDTM, x, y, MIX1, MIY1, MIX2, MIY2) or FindDTM(GoldBarDTM2, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
if Debug then
WriteLN('Found Gold Bar in Inventory, Running to Furnace');
RunToFurnace;
FindFurnace;
FindDTMs(GoldBarDTM, TPA, MIX1, MIY1, MIX2, MIY2);
FilterTPADist(TPA, 30);
GoldBraceletsCrafted:= GoldBraceletsCrafted + Length(TPA);
CheckCraftBracelet;
CraftButton;
end;
if RunEdgeBank then
if OpenBanker then
Banking;
BreakHandler(BreakIn,BreakFor,Bir,Bfr);
until(false);
DTMFree;
end.