Simba Code:
program UltimateBurner;
{$DEFINE SMART}
{$i SRL/SRL.scar}
{$i SRL/SRL/misc/stats.simba}
{$i SRL/SRL/misc/reports.scar}
{$i Reflection/Reflection.simba}
Var
BreakRounds,TotalBreaks,StartXP: Integer;
Const
SRLStats_Username = '';
SRLStats_Password = '';
BreakIn = 50; //How long before we take a break? (minutes)
BreakFor = 10; //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
FALADOR_EAST_BANK = 0;
VARROCK_WEST_BANK = 1;
VARROCK_EAST_BANK = 2;
DRAYNOR_BANK = 3;
procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
with Players[0] Do
begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
Integers[0] := FALADOR_EAST_BANK; // Any of supported locations
Strings[1] := 'Maple logs'; // Log to burn (Be sure you name it exactly as it is named in RS
Strings[2] := 'farming'; // LampSkill
Active := True;
// Do not touch these!
Integers[50]:= 0; // Start XP
Integers[51]:= 0; // Logs burned
Integers[52]:= 0; // Next break
Integers[53]:= 0; // Gained XP
Extendeds[0]:= 0; // Logs per Hour
Extendeds[1]:= 0; // XP per Hour
end;
end;
type
TBurn = record
BankName: String;
BankTile: TTile;
StartTile: TTileArray;
end;
const
VERSION = '0.3';
FIRE_ID = 2732;
TINDERBOX_ID = 590;
var
NextFireStart: Integer;
BurnInfo: Array of TBurn;
TinderboxPos: Integer; // Tinderbox index in inventory
TotalLogsBurned, TotalXP: Integer;
var
StartFirePos: TTile;
P: TPoint;
Procedure CheckStats;
begin
if ((SRLStats_Username = '') And (SRLStats_Password = '')) then
begin
case MessageBox('No Stats account entered, would you like to set one up?','SRL Stats',mbYesNoCancel) of
mrYes:
begin
OpenWebPage('http://stats.villavu.com/register');
TerminateScript;
end;
mrNo:
begin
SetupSRLStats(94,'Anonymous','anon1337');
Exit;
end;
mrCancel: TerminateScript;
end;
end else
SetupSRLStats(94,SRLStats_Username,SRLStats_Password);
end;
procedure InitScript;
begin
NextFireStart := 0;
SetLength(BurnInfo, 4);
with BurnInfo[0] do
begin
BankName := 'feb';
BankTile := Tile(3013, 3356);
StartTile := [Tile(3033, 3360), Tile(3033, 3361), Tile(3033, 3362), Tile(3033, 3363), Tile(3033, 3364)];
end;
with BurnInfo[1] do
begin
BankName := 'vwb';
BankTile := Tile(3185, 3437);
StartTile := [Tile(3209, 3430), Tile(3209, 3429), Tile(3209, 3428)];
end;
with BurnInfo[2] do
begin
BankName := 'veb';
BankTile := Tile(3254, 3421);
StartTile := [Tile(3270, 3430), Tile(3270, 3429), Tile(3270, 3428), Tile(3270, 3427)];
end;
with BurnInfo[3] do
begin
BankName := 'db';
BankTile := Tile(3094, 3243);
StartTile := [Tile(3098, 3250), Tile(3097, 3249), Tile(3097, 3248), Tile(3097, 3247)];
end;
CheckStats;
end;
procedure StartPlayer;
var
item: TInvItem;
Me: TMe;
begin
Me := GetMe;
LampSkill := Players[CurrentPlayer].Strings[2];
R_ItemExists(TINDERBOX_ID, item);
if (item.Slot = 0) then
begin
WriteLn('Tinderbox not found in the inventory! Put it in the inventory (any pos).');
NextPlayer(False);
StartPlayer;
Exit;
end;
TinderboxPos := item.Slot;
if (Players[CurrentPlayer].Integers[50] = 0) then
Players[CurrentPlayer].Integers[50] := R_GetSkillExperience(SKILL_FIREMAKING);
TotalXP := TotalXP - (R_GetSkillExperience(SKILL_FIREMAKING) - Players[CurrentPlayer].Integers[50]);
ClickNorth(True);
StartXP := Me.Experience[SKILL_FIREMAKING];
end;
procedure StopPlayer(Active: Boolean);
begin
TotalXP := TotalXP + (R_GetSkillExperience(SKILL_FIREMAKING) - Players[CurrentPlayer].Integers[50]);
NextPlayer(True);
StartPlayer;
end;
procedure AntiBan;
begin
R_FindRandoms;
case Random(10000) of
0..10: IdleTime(RandomRange(1000, 2000), 500, 0.5);
11..20: HoverSkill('firemaking', False);
21..30: HoverSkill('random', False);
31..40: PickUpMouse;
41..50: Wait(RandomRange(1000, 10000));
end;
end;
{*******************************************************************************
Function WebWalk(T: TTile): Boolean;
By: JuKKa
Edit: enoyhs. It breaks the code if it gets into random, because it is still
trying to walk to specified tile. Also added timeout.
Description: Walks blindly using WindPath!
*******************************************************************************}
function r_WebWalkEx(T: TTile): Boolean;
var
i, Tries: Integer;
M, P: TPoint;
CTRLPoints: TPointArray;
begin
P := TileToPoint(T);
Tries := 0;
repeat
M := GetMyPos;
CtrlPoints := r_WindPath(M.x, M.y, P.X, P.Y, 5.0, 2.5, 0.0, 0.0, 4.5, 2.5);
for i := High(CtrlPoints) downto 0 do
begin
// Should check for randoms and exit if failed
if (R_FindRandoms) and (not LoggedIn) then
Exit;
if WalkToTile(Tile(CtrlPoints[i].x, CtrlPoints[i].y),0, 10) then
begin
Result := i = High(CtrlPoints);
Break;
end;
end;
Inc(Tries);
// Each attempt to WalkToTile can take up to 60 seconds, so we SHOULD reach
// and destination, within 10 attemts, which is more than generous.
until (Result) or (Tries > 10);
end;
procedure WalkToTileEx(Tile: TTile; Precise: Boolean);
begin
if (LoggedIn) and (DistanceFrom(Tile) > 5) then
begin
r_WebWalkEx(Tile);
while (LoggedIn) and ((FlagPresent) or (not IsIdle)) do
Wait(RandomRange(50, 100));
end;
if (LoggedIn) and (Precise = True) and (GetMyPos <> Tile) then
begin
if (TileOnMS(Tile, GetTileHeight(Tile)) = True) then
begin
P := TileToMS(Tile, GetTileHeight(Tile));
MMouse(P.x - 1, P.y - 1, 2, 2);
Wait(RandomRange(300, 500));
GetMousePos(P.x, P.y);
Mouse(P.x, P.y, 0, 0, IsUpText('alk here'));
Wait(RandomRange(60, 80));
ChooseOption('alk here');
end else
begin
WalkToTile(Tile, GetTileHeight(Tile), 0);
end;
while (LoggedIn) and ((FlagPresent) or (not IsIdle)) do
Wait(RandomRange(50, 100));
end;
end;
procedure ItBurns;
var
i, T, xAdj: Integer;
GroundObj: TRSObject;
item: TInvItem;
StartTile: TTileArray;
begin
StartTile := BurnInfo[Players[CurrentPlayer].Integers[0]].StartTile;
for i := 1 to 28 do
begin
AntiBan;
if (i < 1) or (i = TinderboxPos) or (not ExistsItem(i))
or (Pos(Lowercase(Players[CurrentPlayer].Strings[1]), Lowercase(GetItemNameAt(i))) = 0) then
continue;
// Let's find valid place to light our fire
GroundObj := GetInteractableAt(GetMyPos);
if (GroundObj.ID <> -1) then
begin
StartFirePos := GetMyPos;
xAdj := 0;
T := 1;
while (GroundObj.ID <> -1) and (T < 30) do
begin
if (T mod Length(StartTile) = 0) then
Inc(xAdj);
NextFireStart := (NextFireStart + 1) mod Length(StartTile);
GroundObj := GetInteractableAt(Tile(StartFirePos.x + xAdj, StartTile[NextFireStart].y));
Inc(T);
end;
WalkToTileEx(Tile(StartFirePos.x + xAdj, StartTile[NextFireStart].y), True);
Dec(i);
Continue;
end;
// Let's do the burning!
StartFirePos := GetMyPos;
if (not ItemActivated(TinderboxPos)) then
begin
InvMouse(TinderboxPos, 1);
Wait(RandomRange(10, 30))
end;
InvMouse(i, 1);
T := 0;
while (GetMyPos = StartFirePos) and (T < 30) do
begin
Wait(RandomRange(50, 80));
if (IsIdle) then
Inc(T);
end;
if (T >= 30) then
begin
if (GetItemIDAt(TinderboxPos) <> TINDERBOX_ID) then
begin
R_ItemExists(TINDERBOX_ID, item);
TinderboxPos := item.Slot;
end;
WalkToTileEx(StartTile[NextFireStart], True);
Dec(i);
end else
begin
stats_IncVariable(Players[CurrentPlayer].Strings[1] + ' Burned', 1);
Inc(Players[CurrentPlayer].Integers[51]);
Inc(TotalLogsBurned);
end;
Wait(RandomRange(20, 50));
end;
end;
procedure WithdrawLogs;
var i: Integer;
Item: TBankItem;
begin
WalkToTileEx(BurnInfo[Players[CurrentPlayer].Integers[0]].BankTile, False);
While IsMoving do //Make sure we're not still walking while trying to find a booth
Wait(100);
R_OpenBankBooth(BurnInfo[Players[CurrentPlayer].Integers[0]].BankName);
WaitFunc(@BankScreen, 100, 5000);
if (InvCount <> 1) then
R_DepositAllBut(TINDERBOX_ID);
if (not R_WithdrawItemEx(Players[CurrentPlayer].Strings[1], 0, i, False)) then
begin
if (BankScreen) and (not R_ItemExistsInBank(Players[CurrentPlayer].Strings[1], Item)) then
begin
StopPlayer(False);
end;
end;
Wait(RandomRange(800, 1000));
if (InvFull) then
Inc(Players[CurrentPlayer].Banked);
end;
procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx,my);
Pic := BitmapFromString(mx,my,'');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], UpChars, H);
for B := 0 to High(TTP) do
begin
try
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
except
end;
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;
procedure ProgressReport;
var Exp: integer;
Me: TMe;
begin
Me := GetMe;
Exp := Me.Experience[SKILL_FIREMAKING] - StartXP;
ClearDebug;
PrintOnSmart(['Ultimate Burner ' + VERSION + ' ~ By enoyhs'],Point(20, 25), 16777215, 8388736);
PrintOnSmart(['Running for: ' + TimeRunning,
'Burning: '+Players[CurrentPlayer].Strings[1],
'Experience: ' + GroupDigits(Exp, ','),
'XP/H: ' + GroupDigits(Round(Exp / (GetTimeRunning / 3600000.0)), ',')
], Point(20,55), 16777215, 8388736);
WriteLn('=== Ultimate Burner ' + VERSION + ' ~ By enoyhs =======');
WriteLn(' Experience gained: '+GroupDigits(Me.Experience[SKILL_FIREMAKING] - StartXP, ','));
WriteLn(' Burning : '+Players[CurrentPlayer].Strings[1]);
WriteLn(' XP/H : '+GroupDigits(
Round((Me.Experience[SKILL_FIREMAKING] - StartXP) / (GetTimeRunning/3600000.0)), ',') );
WriteLn(' Time running : '+TimeRunning);
WriteLn('====================================');
WriteLn('');
Stats_Commit;
end;
{*******************************************************************************
function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
By: Echo_
Description: Takes brakes according to the minute values entered
*******************************************************************************}
function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
var
w,x,y,z,y2,
RealBTime: integer;
begin
if not LoggedIn then Exit;
w := (BreakIn * 60000);
x := (BreakFor * 60000);
y := RandomRange(-randBreakIn * 60000, randBreakIn * 60000);
z := RandomRange(-randBreakFor * 60000, randBreakFor * 60000);
y2 := RandomRange(-randBreakIn,randBreakIn);
if (HowManyPlayers = 1) then
begin
if (GetTimeRunning < ((w) + (y) + BreakRounds)) then Exit
else
if (GetTimeRunning > ((w) + (y) + BreakRounds)) then
begin
RealBTime := ((x+z)/60000);
Writeln('Taking a break for about ' + IntToStr(RealBTime) + ' minutes.');
if R_OpenBankBooth(BurnInfo[Players[CurrentPlayer].Integers[0]].BankName) then
CloseBank;
Logout;
Wait((x) + (z));
Writeln('Logging in.');
LoginPlayer;
Result := LoggedIn;
R_FindRandoms;
Wait(RandomRange(3000,4000)); //Give time to load before continuing script
IncEx(BreakRounds, (w) + (x));
IncEx(TotalBreaks, 1);
Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.');
end;
end;
end;
begin
Smart_Signed := true;
Smart_Members := false;
Smart_Server := 103;
SetupSRL;
DeclarePlayers;
InitScript;
AddOnTerminate('ProgressReport');
ClearDebug;
LogInPlayer;
StartPlayer;
ProgressReport;
while (PlayersActive > 0) do
begin
if (LoggedIn) then
begin
R_FindRandoms;
if (R_InvCount <> 1) then
begin
WalkToTileEx(BurnInfo[Players[CurrentPlayer].Integers[0]].StartTile[NextFireStart], True);
ItBurns;
end;
WithdrawLogs;
end;
ProgressReport;
BreakHandler(BreakIn,BreakFor,Bir,Bfr);
end;
end.