PDA

View Full Version : [Magic] Splashing Helper



Emarian
01-18-2021, 03:11 PM
This is just some simple code that checks for runes and keeps you logged in while splashing. Crude but effective, easy 1-70.

program Splasher;
{$define SMART}
{$I SRL/OSR.simba}

const
LOGIN_NAME = 'name';
LOGIN_PASS = 'yourpass';
RS_WORLD = ;
IS_MEMBER = ;
CAST_EXP = 31.5;

var
init, startrune, runeslot, ms, timer, StatsDebugTick: Int64;
arr: TIntArray;
runebox: TBox;
Antiban: TAntiban;
T1: TTimeMarker;

var
//chaos := DTMFromString('mggAAAHicY2NgYDjAxMBwDoiPAvEOIN4ExK eBWJuRgcEAiK2A2BKINYBYFYifPHwI1MUIxgYKCnA2eQAAaMgI 1g==');
chaos := DTMFromString('mggAAAHicY2NgYMhhYmCoAuIKIM4D4kQgjg NiH0YGBl8gjgDiOCCOgvKfPHwI1MWIgfkZyAEAt8MHVA==');
fire := DTMFromString('mlwAAAHicY2dgYJjKxMCwBIgXAvEsIJ4AxJ 1A3AHE+owMDFpAbAbEVkBsCcRGQKwBxCuURIG6GXFgigAAGiEG cw==');
air := DTMFromString('mlwAAAHicY2dgYHBkYmAIAGJ/IHYDYksgNgFiUyAOZGRg8AXiMCCOA+IYIA4GYm8gfvLwIVA3Iw 5MEQAA5zUG3Q==');

procedure declarePlayers();
begin
with Players.New()^ do
begin
LoginName := LOGIN_NAME;
Password := LOGIN_PASS;
IsActive := True;
IsMember := IS_MEMBER;
World := RS_WORLD;
end;
Players.SetCurrent(0);
end;

procedure TAntiban.LoseFocus(); override;
begin
SRL.LoseFocus();
WaitEx(24000, 5000);
SRL.SetFocus();
Players.GetCurrent()^.Login();
end;

procedure TAntiban.VeryShortBreak(); override;
begin
if(Random(4)=0) then SRL.LoseFocus();
WaitEx(40000,8000);
SRL.SetFocus();
Players.GetCurrent()^.Login();
Wait(100,2000, wdRight);
end;

procedure DoAntiban();
begin
if Antiban.DoAntiban() then
Players.GetCurrent()^.Login();
end;

procedure Process();
begin
//I shamelessly use slacky's progress report function because I learned by reading his stuff. Thanks go to him
ms:= GetTimeRunning;

if GetTickCount() - StatsDebugTick > 1000 then
begin
ClearDebug();
ClearDebug();
WriteLn('+---| SPLASHER |----------------------------------------');
WriteLn('|- Script Runtime : ', SRL.MsToTime(GetTimeRunning, Time_Short));
//WriteLn('|- Time Since Break : ', SRL.MsToTime(Antiban.TimeSinceBreak(), Time_Short));
WriteLn('|- Casts : ', IntToStr(startrune - SRL.GetItemAmount(runebox)));
WriteLn('|- Casts P/H : ', IntToStr(Round(3600*(startrune - SRL.GetItemAmount(runebox))/(ms/1000))));
WriteLn('|- Magic Exp : ', IntToStr(Round((startrune - SRL.GetItemAmount(runebox))*CAST_EXP)));
WriteLn('|- Magic Exp P/H : ', IntToStr(Round(3600*((startrune - SRL.GetItemAmount(runebox))*CAST_EXP)/(ms/1000))));
WriteLn('|- Times Initialized : ', IntToStr(init));
WriteLn('|- 20 Minute Timer : ', IntToStr(timer));
WriteLn('+----------------------------------------------------');
StatsDebugTick := GetTickCount();
end;

end;

procedure invWaitLoop();
var
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(200,50);
until((Inventory.IsOpen = true)) or (T.GetTime > RandomRange(60000,80000));
end;

procedure dtmcheck();
begin
if not Inventory.Contains(chaos) then
begin
Logout.ClickLogout();
TerminateScript('Out of chaos runes');
end;
if not Inventory.Contains(fire) then
begin
Logout.ClickLogout();
TerminateScript('Out of fire runes');
end;
if not Inventory.Contains(air) then
begin
Logout.ClickLogout();
TerminateScript('Out of air shafts');
end;
end;

procedure SetupAntiban();
begin
Antiban.Init(SKILL_FLETCHING);

Antiban.AddTask([@Antiban.LoseFocus, ONE_MINUTE*13, 0.60]);
Antiban.AddTask([@Antiban.VeryShortBreak, FIVE_MINUTES*7, 0.60]);
Antiban.AddBreak([RandomRange(50,80)*ONE_MINUTE, 10*ONE_MINUTE, 0.17, 0.25]);
end;

function setUp(): boolean;
begin
clearDebug;
SRL.Setup([]);
declarePlayers();
SetupAntiban();

if not SRL.isLoggedIn then
Players.LoginCurrent();

if not Inventory.IsOpen(1000) then
Gametabs.Open(tabInventory, 5);
invWaitLoop;

arr := Inventory.FindDTM(chaos);
runeslot := arr[0];
runebox := Inventory.GetSlotBox(runeslot);
startrune := SRL.GetItemAmount(runebox);

WaitEx(1000,400);

Result := True;
end;

begin
if setUp then
begin
T1.Start;
repeat
repeat
if not Inventory.IsOpen(1000) then
begin
Gametabs.Open(tabInventory, 5);
inc(init);
end;
WaitEx(4000,2000);
dtmcheck();
//DoAntiban();
{if Chatbox.HandleLevelUp() then
begin
T1.Reset;
T1.Start;
end; }
Process();
WaitEx(3000,1000); //wait for game to refresh
until(T1.GetTime > RandomRange(900000,1180000));
T1.Reset;
T1.Start;
inc(timer);
Antiban.OpenRandomTab();
until(false);
end;
end.