Simba Code:
program Alchemy;
{$define SMART}
{$I SRL/OSR.simba}
const
LOGIN_NAME = '';
LOGIN_PASS = '';
RS_WORLD = ;
IS_MEMBER = true;
var
init, startnats, natslot, ms, StatsDebugTick: Int64;
findnats: TIntArray;
natbox: TBox;
Antiban: TAntiban;
var
bolts := DTMFromString('mggAAAHicY2NgYDjExMBwHIi3APEBIN4OxGeB+BFQ7jMQvwbit0D8FIgfA3FgbgWQZMSCyQEAaCULRA==');
//bolts := DTMFromString('mggAAAHicY2NgYNjPxMBwDIg3AfFZID7HBBF7AJT7BMRvgfglEN8F4o9ALOjnASQZsWByAABEBArG'); //longbow
nats := DTMFromString('mggAAAHicY2NgYMhiYmBIAeIKIK4C4jggLgLi/YwMDCeA+DAQ7wTi3UB8EogFu0WBuhixYHIAAAtMB+Y=');
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('+---| ALCHEMY |----------------------------------------');
WriteLn('|- Script Runtime : ', SRL.MsToTime(GetTimeRunning, Time_Short));
WriteLn('|- Time Since Break : ', SRL.MsToTime(Antiban.TimeSinceBreak(), Time_Short));
WriteLn('|- Items Alched : ', IntToStr(startnats - SRL.GetItemAmount(natbox)));
WriteLn('|- Alches P/H : ', IntToStr(Round(3600*(startnats - SRL.GetItemAmount(natbox))/(ms/1000))));
//WriteLn('|- Magic Exp : ', IntToStr(alchcount*31)); // Low Level
WriteLn('|- Magic Exp : ', IntToStr((startnats - SRL.GetItemAmount(natbox))*65));
WriteLn('|- Magic Exp P/H : ', IntToStr(Round(3600*(65*(startnats - SRL.GetItemAmount(natbox)))/(ms/1000))));
WriteLn('|- Times Initialized : ', IntToStr(init));
WriteLn('+----------------------------------------------------');
StatsDebugTick := GetTickCount();
end;
end;
procedure spellWaitLoop();
var
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(200,50);
until((Spells.IsOpen = true)) or (T.GetTime > RandomRange(10000,60000));
end;
procedure invWaitLoop();
var
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(200,50);
until((Inventory.IsOpen = true)) or (T.GetTime > RandomRange(10000,60000));
end;
procedure dtmcheck();
begin
if not Inventory.Contains(bolts) then
begin
Logout.ClickLogout();
TerminateScript('Out of bolts');
end;
if not Inventory.Contains(nats) then
begin
Logout.ClickLogout();
TerminateScript('Out of nature runes');
end;
end;
procedure safety();
begin
spellWaitLoop();
if MainScreen.IsUpText(['Onyx', 'bolts', '(e)'], 1200) then
if MainScreen.IsUpText(['Alchemy', 'Cast'], 1200) then
Mouse.Click(mouse_Left);
if not Spells.IsOpen(10000) then
begin
//writeln('spells not open, opening');
inc(init);
Gametabs.Open(tabMagic, 5);
spellWaitLoop();
Mouse.Move(IntToBox(705, 245, 715, 225));
end;
if Spells.IsOpen(10000) then
begin
if not MainScreen.IsUpText(['Alchemy', 'Cast'], 1200) then
begin
//writeln('spells open but alch not detected, moving mouse');
inc(init);
Mouse.Move(IntToBox(705, 245, 715, 225));
end;
if not MainScreen.IsUpText(['Alchemy', 'Cast'], 1200) then
begin
//writeln('spells open but still no alch, failsafe');
inc(init);
Gametabs.Open(tabMagic, 5);
Mouse.Move(IntToBox(705, 245, 715, 225));
end;
end;
if not MainScreen.IsUpText('Alchemy', 1200) then
begin
Logout.ClickLogout();
TerminateScript('Alchemy not found');
end;
end;
procedure SetupAntiban();
begin
Antiban.Init(SKILL_MAGIC);
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
begin
Players.LoginCurrent();
MainScreen.setAngle(True);
end;
//Gametabs.Open(tabInventory, 5);
//Inventory.IsOpen(10000);
findnats := Inventory.FindDTM(nats);
natslot := findnats[0];
natbox := Inventory.GetSlotBox(natslot);
startnats := SRL.GetItemAmount(natbox);
//WriteLn('Found in slots: ', findnats);
Gametabs.Open(tabMagic, 5);
Spells.IsOpen(10000);
WaitEx(1000,400);
Result := True;
end;
begin
if setUp then
begin
repeat
if (not SRL.isLoggedIn) then
begin
Players.LoginCurrent();
WaitEx(750,200);
//MainScreen.setAngle(True);
WaitEx(750,200);
end;
while srl.isLoggedIn() do
begin
safety();
WaitEx(500,300);
Mouse.Click(mouse_Left);
invWaitLoop();
WaitEx(500,300);
invWaitLoop();
dtmcheck();
if MainScreen.IsUpText(['Onyx', 'bolts', '(e)'], 1200) then
if MainScreen.IsUpText(['Alchemy', 'Cast'], 1200) then
Mouse.Click(mouse_Left);
Process();
//DoAntiban();
end;
until(false);
end;
writeln('Script finished');
end.