Simba Code:
program SWFletch;
{$DEFINE SMARTManager}
// SMARTManager Restarter
procedure SMARTManager;
var
ioPath: string;
ioFile: Integer;
begin
ioPath := 'C:\Users\Abhishek\Downloads\TmpScripts\369511.crashed';
try
ioFile := RewriteFile(ioPath, False);
except
Writeln('SmartManager Failed!');
end;
CloseFile(ioFile);
end;
{*******************************************************************************
program SWFletch;
by; Er1k - edits by Harry
Description: Lightweight generic bow fletcher/shafter/headless arrow maker
Keep logs in first bank slot. Have more than enough.
Version: 1.02 - fixed knife for Bonfire update (May 10 2012)
*******************************************************************************}
{$DEFINE SRL5}
{$DEFINE SMART}
{$I SRL/SRL/misc/SMART.simba}
{$I SRL/SRL.simba}
//{$DEFINE DEBUG} //uncomment if you need debug info
//{$DEFINE DEBUG_DRAW} //uncomment if you need debug info
{$IFDEF DEBUG_DRAW}
{$I SRL/SRL/misc/debug.simba}
{$I SRL/SRL/misc/paintsmart.simba}
{$ENDIF}
const
NumbOfPlayers= 1;
StartPlayer= 0;
WatchaDoing = 'long'; // long, shaft, headless - keep it at long
SRLStats_Username = '';
SRLStats_Password = '';
YourBasicProfits = 55; // how much gp profit per log? (70 gp=maple long u's)
//SMART Setup
SmartWorld = 0;
Members = True;
SignedClient = True;
HighDetail = False;
var startXP: integer;
var dtm,StatsTimer,gountil,stacksize,profitz: integer;
procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
with Players[0] do
begin
Name := 'Username22';
Pass := 'trdafge';
Nick := 'ffe';
Pin := '1169';
Active := True;
Member := True;
end;
end;
procedure DoLogin;
var t: integer;
begin
MarkTime(t);
while (not LoggedIn) do
begin
wait(2000+Random(2000));
if LogInPlayer then
break;
wait(10000+random(500));
if (TimeFromMark(t) > 180000) then
begin
writeln('Failed to login after 180s... Terminating');
TerminateScript;
end;
end;
end;
procedure WaitTillStationary;
begin
if not LoggedIn then Exit;
repeat
wait(200+random(50));
until not IsMoving;
end;
procedure ProgressReport(var startXP: integer);
var gain,profithr: integer;
begin
gain := GetXPBarTotal- startXP;
{$IFDEF DEBUG}
{$ENDIF}
writeln('Time running: ' + TimeRunning);
writeln('Exp Gained: ' + IntToStr(gain));
writeln('Est XP/Hr: ' + toStr(Round(((gain) / (GetTimeRunning / 1000)) * 3600)));
writeLn('Profit Gained: '+toStr(Profitz));
profithr:= Round(((profitz) / (GetTimeRunning / 1000)) * 3600);
writeLn('Profit/Hr: '+toStr(profithr));
end;
function InvFullEx: boolean;
var i, X, Y: Integer;
TB: TBox;
begin
Result:=False;
for i:=1 to 28 do
begin
TB := InvBox(I);
if not FindColor(x, y, srl_outline_black, TB.x1, TB.y1, TB.x2, TB.y2) then
Exit;
end;
Result:=True;
end;
function BankScreenEx(pin: string): boolean;
var t: integer;
begin
MarkTime(t);
repeat
if PinScreen then
InPin(pin);
if BankScreen then
break;
wait(100);
until TimeFromMark(t) > 5000;
Result:= BankScreen;
end;
function BankAndWithdraw: boolean;
var v: TVariantArray;
begin
Result:=False;
if (WatchaDoing = 'headless') then
begin
Result := True;
Exit;
end;
if OpenBankChest(SRL_BANK_SW) then
begin
v:=[players[currentplayer].Pin];
if WaitFuncEx('BankScreenEx', v, 200, 3000) then
begin
DepositAll;
while getBankItemAmount(0, 0) = 0 do
wait(200);
if GetBankItemAmount(0, 0) < 29 then
begin
writeln('Out of materials - Logout');
Logout;
TerminateScript;
end;
Withdraw(0, 0, 0);
incEx(Profitz,yourBasicProfits*28);
// if WaitFunc(@InvFullEx, 200, 3000) then
Result:=CloseBank;
end;
end;
end;
function watDo:boolean;
begin
Result := False;
if (GetColor(263, 448)=2070783) then // knifens
begin
MouseBox(226, 406, 296, 453, 1);
Wait(1000+Random(2000));
end;
if (WatchaDoing = 'headless') then // todo: stack count for headless is messed up- might infinite loop
begin
if (GetColor(145, 371)=16777215) then // 15 headless
begin
stacksize := GetAmountBox(InvBox(2));
if (random(2)=0) then
gountil := (stacksize-120)
else
gountil := (stacksize-105);
if (stacksize<14) then
begin
repeat
WriteLn('You have not enough stack in your slot2. Fix this.');
Wait(60000);
until false;
end;
writeln('We have '+toStr(stacksize)+' feathers/shafts. We will go until '+toStr(gountil)+'.');
MouseBox(219, 405, 297, 453, 1);
Result := True;
Wait(100+Random(1000));
end;
end else
if (GetColor(147, 365)=16777215) then // what to make
begin
if (WatchaDoing = 'long') then
MouseBox(222, 405, 300, 453, 1) else // longs
if (WatchaDoing = 'shaft') then
MouseBox(71, 401, 149, 457, 1) else // shafts
writeLn(WatchaDoing+' is invalid!');
Result := True;
Wait(100+Random(1000));
end;
end;
procedure RandomRClickH; // phantombmx/EvilChicken - removed inv clicking
var
M: Byte;
Inv: Boolean;
bx,by: integer;
begin
if (not LoggedIn) then exit;
M := MouseSpeed;
MouseSpeed := 7 + Random(25);
bx := Random(MIX2);
by := Random(MIY2);
if PointInBox(point(bx,by),inttobox(MSX1,MSY1,msx2,msy2)) then
begin
Mouse(bx, by, 0, 0, False);
if (Random(3) > 0) then
Inv := ChooseOption('xamine');
if (not Inv) then ChooseOption('ancel');
end
else
MMouse(bx, by, 0, 0);
MouseSpeed := M;
end;
procedure AntiBan_Short(disg:string; waitz:integer);
begin
while (waitz > 0) do
begin
status(disg+': '+tostr(waitz)+'ms');
case (Random(200)) of
0: begin RandomRClickH; Inc(Players[CurrentPlayer].Integers[2]); end;
//1: begin MouseSpeed := MOUSE_SPEED + Random(MOUSE_SPEED_RANDOMNESS); Inc(Players[CurrentPlayer].Integers[2]); end;
2: begin if (Random(2) = 0) then PickUpMouse; Inc(Players[CurrentPlayer].Integers[2]); end;
3..200: begin
wait(1);
end;
end;
Wait(100+random(500));
waitz:=waitz-(100+random(500));
end;
end;
procedure Fletch;
var x, y, t{, dtm}: integer;
v: TVariantArray;
begin
if (WatchaDoing <> 'headless') then
MMouseItem(1);
if (WatchaDoing <> 'headless') then
WaitFunc(@InvFullEx, 100, 3000)
else
MouseItem(2, mouse_left);
MouseItem(1, mouse_left);
wait(10+Random(100));
// DTM := DTMFromString('mwQAAAHic42RgYOhjYmDoBeJpQDwTiGcA8VwofxIQdwHxa0YGhkdAfB+InwLxSyD+AMSfgfgLEH8HYlN9AaBpTHjxfwbCgJEIDAcAk5APKg==');
// v:=[2070783, 0, MCX1, MCY1, MCX2, MCY2, X, Y, 'nife', StatChars, ClickLeft];
// if WaitFuncEx('FindTextTPAEx', v, 200, 3000) then
// wait(500);
// v:=[2070783, 0, MCX1, MCY1, MCX2, MCY2, X, Y, 'long', StatChars, ClickLeft];
if WaitFunc(@watDo, 100, 10000) then
begin
MarkTime(t);
repeat
AntiBan_Short('antibane',1000+Random(1000));
if (TimeFromMark(StatsTimer) > 360000) then // 6 minutes.
begin
Stats_Commit;
MarkTime(StatsTimer);
WriteLn('<! Sent stats in!');
end;
findspinticket;
if (WatchaDoing <> 'headless') then
if not FindDTM(dtm, x, y, MIX1, MIY1, MIX2, MIY2) then
break;
if (WatchaDoing = 'headless') then
if (GetAmountBox(InvBox(2)) <= gountil) then
Break;
until TimeFromMark(t) > 120000;
end;
// FreeDTM(dtm);
end;
procedure DoWork;
var action: string;
begin
action:= 'bank';
while LoggedIn do
begin
case action of
'bank': begin if BankAndWithdraw then action:= 'work';
ProgressReport(startXP);
end;
'work': begin Fletch; action:='bank'; end;
end;
end;
end;
begin
Smart_Server := SmartWorld;
Smart_Members := Members;
Smart_Signed := SignedClient;
Smart_SuperDetail := HighDetail;
setupSRL;
SRL_Procs[srl_OnRSUpdate] := @SMARTManager; // On rs update call smartmanager restart
if (SRLStats_Username = '') then
SetupSRLStats(1051, 'Anonymous', 'anon1337')
else
SetupSRLStats(1051, SRLStats_Username, SRLStats_Password);
SmartSetRefresh(20);
if (WatchaDoing <> 'long') and (WatchaDoing <> 'shaft') and (WatchaDoing <> 'headless') then
begin
WriteLn('Wrong value for const WatchaDoing. Bye bye!');
Wait(60000);
TerminateScript;
end;
DeclarePlayers;
DoLogin;
if (WatchaDoing <> 'headless') then
begin
Wait(4000+Random(4000));
SetAngle(SRL_ANGLE_HIGH);
Wait(4000+Random(4000));
SetAngle(SRL_ANGLE_HIGH);
end;
ToggleXPBar(true);
startXP:=getXPBarTotal;
ProgressReport(startXP);
dtm:= DTMFromString('mwQAAAHic42RgYOhjYmDoBeJpQDwTiGcA8VwofxIQdwHxa0YGhkdAfB+InwLxSyD+AMSfgfgLEH8HYlN9AaBpTHjxfwbCgJEIDAcAk5APKg==');
DoWork;
FreeDTM(dtm);
WriteLN('We ended lol wat');
SmartgetFieldObject(1488,'crash'); // will crash SMART (and Simba).
Wait(5000);
end.