wthomas
2019-03-13 18:39:41
How Long have You Played Runescape?
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
n/a
What is your general programming knowledge?
C, Java, Python, Pascal
Are you a member of any other communities?
RuneLite
Tell us about yourself…
Please show us one (or multiple) of your scripts.
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
n/a
What is your general programming knowledge?
C, Java, Python, Pascal
Are you a member of any other communities?
RuneLite
Tell us about yourself…
From: wthomas
I have a degree in Electronic and Computer Engineering
From the UK.
Was active here in 2013/14 around start of OSRS, Some people may recognize the name from back then. Haven't been involved really with RS since those days but came back to it once again, preferring the elegance of color based scripts compared to reflection.
[This is really for the script section below but the enforced script tags screws the formatting]
I wasnt sure if the provided script/scripts had to be released/currently working so I've put a modern/working/unreleased script in the proper box and a link to an old released/popular one here.
When you look back over old code it looks never looks too good but this one must have thousands of hours run so it cant be too bad… It did use SRL stats but that seems offline now so can't check the exact numbers on runtime/essence miner anymore.
https://villavu.com/forum/showthread.php?t=98424
The script below is a better one to look at, I threw this together over the weekend so it's not too polished and currently unreleased. It runs a simple loop of
1. Mine silver ore in crafting guild. Also will hop to avoid 'crashing' a player at the mine.
2. Teleport to Falador and smelt into Bars then into tiaras
3. Run back to guild while dropping them
It's entirely based on SRL/OSR and RSWalker for Simba 1.3 without any other external requirements.
The DiscordServer include can be removed if anyone fancies running it, this is just a simple bridge include to allow communication between the script and a discord server. I'll probably expand this and clean it up before releasing, it's very convenient to be able to checkup on the bots progress via discord on phone and respond to ingame messages manually etc.
Please show us one (or multiple) of your scripts.
program FallyGuildSilver;
{$define SMART}
{$I SRL/OSR.simba}
{$I RSWalker/Walker.simba}
{$i TDiscordServer.simba}
// v1.0
const
SMELTING_BARS = 1;
CRAFTING_TIARAS = 2;
WALKING_GUILD = 3;
ENTER_GUILD = 4;
MINING_ORES = 5;
TELEPORTING = 6;
STARTING = 7;
type
TPointerSet = record
isProc: Boolean;
proc: procedure;
func: function: Boolean;
name: string;
end;
var
RSW:TRSWalker;
DiscordServer: TDiscordServer;
Antiban: TAntiban;
DTM_BAR, DTM_ORE, DTM_TIARA, DTM_GEM, DTM_MM_PICKAXE: Integer;
PATH_FURNACE_TO_GUILD: TPointArray;
Worlds : TIntegerArray;
State, WorldIndex: Integer;
Pointers: TPointerSet;
procedure declarePlayers();
begin
with Players.New()^ do
begin
LoginName := '';
Password := '';
IsActive := True;
IsMember := False;
World := -1;
end;
Players.SetCurrent(0);
WORLDS := [500, 501, 502, 503, 504];
end;
function NearbyPlayers: Boolean;
var
TPA: TPointArray;
x, y: Integer;
FilterBox: TBox;
begin
FilterBox := Minimap.GetBounds;
if FindDTM(DTM_MM_PICKAXE,x,y, Minimap.GetBounds) then begin
FilterBox.Y2 := y;
end;
TPA := Minimap.GetDots([MMDotPlayer]);
Exit(Length(TPA.FilterBox(FilterBox)) > 1);
end;
function nextWorld:Integer;
begin
WorldIndex := (WorldIndex + 1) mod Worlds.Len;
Result := Worlds[WorldIndex];
end;
function ClickFurnace:Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
T: TTimeMarker;
begin
Result := False;
T.Start;
repeat
SRL.FindColors(TPA, CTS0(3289911, 24), Mainscreen.GetBounds);
ATPA := TPA.Split(5);
TPA := ATPA.Biggest;
if TPA.Len > 1200 then
begin
Mouse.Move(TPA.Mean);
if MainScreen.IsUpText(['Smelt Furnace']) then
begin
Mouse.Click(mouse_Left);
Exit(True);
end;
end;
RSW.WalkPath([Point(3703,2967)]);
until T.GetTime > 5000;
end;
function WaitDTMChange(DTM, timeout: Integer): boolean;
var
Start, Current: Integer;
T: TTimeMarker;
begin
T.Start;
Start := Inventory.Count(DTM);
repeat
Sleep(100);
DiscordServer.Tick;
Antiban.DoAntiban();
Current := Inventory.Count(DTM);
until (T.GetTime > timeout) or not (Current = Start);
Result := not (Current = Start);
end;
function SmeltAllOres:Boolean;
var
Fails: Integer;
begin
if Inventory.Count(DTM_ORE) = 0 then
Exit(False);
Fails := 0;
repeat
if ClickFurnace then
if Chatbox.ClickButtonId('What would you like to smelt?', 3, 'Smelt Silver bar', 5000) then
while WaitDTMChange(DTM_ORE, RandomRange(3200, 4000)) do;
Fails := Fails + 1;
until (Fails > 3) or (Inventory.Count(DTM_ORE) = 0);
Result := Inventory.Count(DTM_ORE) = 0;
end;
function MakeTiaras:Boolean;
var
Fails: Integer;
begin
if Inventory.Count(DTM_BAR) = 0 then
Exit(False);
Fails := 0;
repeat
if ClickFurnace then
begin
//TODO add Silver smithing screen support to SRL
Sleep(RandomRange(1200, 1400));
if ChooseOption.Open(IntToBox(415, 209, 449, 238), 5000) then
if ChooseOption.Select("Craft All Tiara")then
while WaitDTMChange(DTM_BAR, RandomRange(3200, 4000)) do;
end;
Fails := Fails + 1;
until (Fails > 3) or (Inventory.Count(DTM_BAR) = 0);
Result := Inventory.Count(DTM_BAR) = 0;
end;
Procedure DropTiaras(N:Integer);
var
Items: TIntegerArray;
i : Integer;
begin
Items := Inventory.FindDTM(DTM_TIARA);
Items.Reverse;
for i := 0 to N - 1 do
if Items.Len > 0 then
Inventory.DropItem(Items.Pop())
else
break;
end;
procedure MoveEventHandler(Sender: PRSWalker);
var
T: TTimeMarker;
begin
T.Start;
DiscordServer.Tick;
DropTiaras(3);
//Writeln('Completed MoveEvent callback in ' + IntToStr(T.GetTime));
end;
procedure FindFreeWorld;
var
Hops: Integer = 0;
begin
repeat
Logout.Open;
Logout.WorldSwitcher.Open();
Logout.WorldSwitcher.SwitchTo(nextWorld);
sleep(1200);
srl.IsLoggedIn
until not NearbyPlayers or (Hops > 5);
end;
procedure WalkGuild;
begin
RSW.WalkPath2(PATH_FURNACE_TO_GUILD);
RSW.WalkStep(Point(3541,3291), 0, True);
end;
function AtGuild(): boolean;
begin
Result := Distance(RSW.GetMyPos, Point(3541,3291)) < 10;
end;
function AtRocks(): boolean;
var
x,y: Integer;
begin
if FindDTM(DTM_MM_PICKAXE, x, y, Minimap.GetBounds) then
Result := Distance(Minimap.Center, Point(x, y - 5)) < 40;
end;
function EnterGuildDoor(): Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
Timeout: TTimeMarker;
x, y, i: Integer;
begin
if not AtGuild() then
WalkGuild;
Result := False;
Timeout.Start;
repeat
SRL.FindColors(TPA, CTS2(672089, 7, 0.09, 3.13), Mainscreen.GetBounds);
ATPA := TPA.Split(5);
ATPA.SortByMiddle(Mainscreen.GetBounds.Middle);
ATPA.FilterDimensions(20,20,200,200);
Smart.Image.DebugATPA(ATPA);
for i := 0 to ATPA.Len - 1 do
begin
Mouse.Move(ATPA[i].Bounds);
if MainScreen.IsUpText(['Open Guild Door', 'Door'], RandomRange(400, 600)) then
begin
Mouse.Click(mouse_left);
RSW.WaitPlayerMoving(5000);
if FindDTM(DTM_MM_PICKAXE, x, y, Minimap.GetBounds) then begin
Mouse.Click(x, y - 25, mouse_left);
Sleep(RandomRange(4200,8800));
Exit(True);
end;
end;
end;
until Timeout.GetTime > 5000;
Smart.Image.Clear;
end;
function ClickSilverRock: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
i: Integer;
begin
SRL.FindColors(TPA, CTS2(10000547, 17, 0.13, 0.15), Mainscreen.GetBounds);
ATPA := TPA.Split(5);
ATPA.FilterDimensions(25,25,70,70);
ATPA.SortByMiddle(Mainscreen.GetBounds.Middle);
smart.Image.DebugATPA(ATPA);
for i := 0 to ATPA.Len - 1 do
begin
if ATPA[i].Len < 100 then
continue;
Mouse.Move(ATPA[i].Bounds);
if MainScreen.IsUpText(['Mine Rocks', 'Rocks', 'Mine'], RandomRange(400, 600)) then
begin
Mouse.Click(mouse_left);
Smart.Image.Clear;
Exit(True);
end;
end;
Smart.Image.Clear;
Result := False;
end;
function MineSilver: Boolean;
var
Gems: TIntegerArray;
T: TTimeMarker;
begin
Result := False;
Minimap.ToggleRun(False);
T.Start;
repeat
if ClickSilverRock then
begin
WaitDTMChange(DTM_ORE, 10 * ONE_SECOND);
Gems := Inventory.FindDTM(DTM_GEM);
Inventory.DropItems(Gems);
end
else
FindFreeWorld;
until ((T.GetTime > FIVE_MINUTES) or (Inventory.isFull));
Result := Inventory.isFull;
end;
function AtFaladorTeleSpot: Boolean;
begin
Exit(Distance(RSW.GetMyPos, Point(3674, 2933)) < 50);
end;
function TeleportFalador: Boolean;
begin
Spells.MouseOver(CAST_FALADOR_TELEPORT, rndGauss);
Mouse.Click(mouse_Left);
Minimap.ToggleRun(True);
Exit(SRL.WaitFunc(@AtFaladorTeleSpot, 1000, 5000));
end;
function GetNextState(LastTransition: Boolean): Integer;
begin
Writeln('Transitioning state from : ' + IntToStr(State));
case State of
SMELTING_BARS: begin
if Inventory.Count(DTM_ORE) = 0 then
Exit(CRAFTING_TIARAS);
end;
CRAFTING_TIARAS: begin
if Inventory.Count(DTM_BAR) = 0 then
Exit(WALKING_GUILD);
end;
WALKING_GUILD: begin
if LastTransition then
Exit(ENTER_GUILD);
end;
ENTER_GUILD: begin
if AtRocks then
Exit(MINING_ORES);
end;
MINING_ORES: begin
if Inventory.IsFull then
Exit(TELEPORTING);
end;
TELEPORTING: begin
if AtFaladorTeleSpot() then
Exit(SMELTING_BARS);
end;
STARTING: begin
if Inventory.IsFull then begin
if Inventory.Count(DTM_ORE) > 0 then
if AtRocks then
Exit(TELEPORTING)
else
Exit(SMELTING_BARS);
if Inventory.Count(DTM_BAR) > 0 then
Exit(CRAFTING_TIARAS);
if Inventory.Count(DTM_TIARA) > 0 then
Exit(WALKING_GUILD);
end else begin
if Inventory.Count(DTM_TIARA) > 0 then
Exit(WALKING_GUILD);
if AtGuild then
Exit(ENTER_GUILD);
if AtRocks then
Exit(MINING_ORES);
Exit(WALKING_GUILD);
end;
end;
end;
Writeln('Failed to transition state from ' + IntToStr(State));
Exit(State);
end;
procedure loop(LastTransition: Boolean);
begin
with Pointers do
begin
State := GetNextState(LastTransition);
case State of
SMELTING_BARS:
begin
name := 'Smelting bars';
isProc := False;
Proc := nil;
Func := @SmeltAllOres;
end;
CRAFTING_TIARAS:
begin
name := 'Crafting Tiaras';
isProc := False;
Proc := nil;
Func := @MakeTiaras;
end;
WALKING_GUILD:
begin
name := 'Walking Crafting guild';
isProc := True;
Proc := @WalkGuild;
Func := nil;
end;
ENTER_GUILD:
begin
name := 'Opening Guild door';
isProc := false;
Proc := nil;
Func := @EnterGuildDoor;
end;
MINING_ORES:
begin
name := 'Mining Silver';
isProc := False;
Proc := nil;
Func := @MineSilver;
end;
TELEPORTING:
begin
name := 'Teleporting to Falador';
isProc := False;
Proc := nil;
Func := @TeleportFalador;
end;
STARTING:
begin
name := 'Starting';
isProc := False;
Proc := nil;
Func := nil;
end;
end;
end;
end;
procedure InitAntiban();
begin
Antiban.Init(SKILL_CRAFTING);
Antiban.AddTask([@Antiban.LoseFocus, ONE_MINUTE * 3]);
Antiban.AddTask([@Antiban.CheckSkill, ONE_MINUTE * 3]);
Antiban.AddTask([@Antiban.CheckStats, ONE_MINUTE * 9]);
Antiban.AddTask([@Antiban.OpenRandomTab, ONE_MINUTE * 11]);
Antiban.AddTask([@Antiban.VeryShortBreak, ONE_MINUTE * 28]);
Antiban.AddBreak([30 * ONE_MINUTE, ONE_MINUTE, 0.33]);
Antiban.AddBreak([1 * ONE_HOUR, 4 * ONE_MINUTE, 0.33]);
Antiban.AddBreak([6 * ONE_HOUR, 40 * ONE_MINUTE, 0.33]);
end;
procedure ScriptCleanup;
begin
FreeDTM(DTM_BAR);
FreeDTM(DTM_ORE);
FreeDTM(DTM_TIARA);
FreeDTM(DTM_GEM);
FreeDTM(DTM_MM_PICKAXE);
DiscordServer.Free;
end;
procedure InitScript;
begin
clearDebug();
srl.Setup([]);
DeclarePlayers();
Inventory.ShiftDrop := True;
DiscordServer.Init('127.0.0.1', '50002');
RSW.Init('world.png');
RSW.MinRunEnergy := 70;
RSW.onMoveEvent := @MoveEventHandler;
AddOnTerminate(@RSW.Free);
DTM_BAR := DTMFromString('mbQAAAHicY2VgYMhhYmDIZoLQ8UCcC8SPgeK3gfgpEL8C4g9A3Nk1FUgyMkRHJ4NpCCYBAADPOQlg');
DTM_ORE := DTMFromString('mbQAAAHicY2VgYJjJxMAwEYgnA/FCIG4H4qdA8VtA/JEBwn4OxCtWbAGSjAwlsU5gGoJJAAA2iwqL');
DTM_TIARA := DTMFromString('mWAAAAHicY2FgYMhhYmCIB+IqIM4E4hdAsftA/ASI3wLxkiXrgSQjEiYMAMpfB00=');
DTM_GEM := DTMFromString('mlwAAAHicY2dgYDjAxMCwHYh3APEJID4GxCeBeBsQ6zIyMKgCsQkQawCxBSNETB+IeUqEgLoZsWJ+dQZKAACZ1Adp');
DTM_MM_PICKAXE := DTMFromString('mggAAAHicY2NgYLjNzMBwixlCPwLiK0B8F4gvMDIwnATiQ0B8Aso+BsQMDIwMDZE6YBqGy8rKGDiBLGwYPwAAthcMlQ==');
PATH_FURNACE_TO_GUILD := [Point(3704,2964),Point(3736,2954),Point(3763,2964),Point(3791,2986),Point(3810,3011),Point(3827,3034),Point(3838,3068),Point(3840,3103),Point(3835,3133),Point(3822,3184),Point(3798,3206),Point(3771,3229),Point(3736,3246),Point(3687,3255),Point(3633,3259),Point(3588,3263),Point(3547,3264),Point(3542,3287)];
WorldIndex := 0;
AddOnTerminate(@ScriptCleanup);
InitAntiban;
State := STARTING;
end;
var
Fails, RunTime: Integer;
LastTransition : Boolean;
begin
InitScript;
RunTime := 1000 * 60 * RandomRange(60, 120);
Writeln('Script will run for ' + srl.msToTime(RunTime, Time_Short));
while (Fails > 10) or (GetTimeRunning() > RunTime) do
begin
if not srl.IsLoggedIn then
Players.LoginCurrent();
Loop(LastTransition);
LastTransition := True;
with Pointers do
begin
Writeln('[' + srl.msToTime(GetTimeRunning(), Time_Bare) + '] Entering ' + name + ' cycle.');
if isProc then
Proc()
else
LastTransition := func();
end;
Antiban.DoBreak;
if LastTransition then begin
Writeln('State Completed OK');
end
else
Fails += 1;
end;
end.