Brotein
2014-01-17 18:54:12
Hey guys, creating a thread to document everything I do to update this script from pre RS3 to current. Worked on this I guess a year ago now, everything went pretty smoothly on it. Wasn't happy with the DTM for the rope, maybe I can change it this time around. Anyways here's my old code…
Here's the youtube video showing how it works(and breaks :) )
http://youtu.be/Tu8qY__oAM8
So I guess I will go and update all the code, but post updates as I redo each procedure and explain whatever changes I made or just the code in general. Stay tuned, hopefully I can get back to grips with SRL after this.
program BroteinBurthrope;
{$DEFINE SMART}
{$DEFINE SRL5}
{$i SRL/srl.simba}
{$IFDEF SMART}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
{$ENDIF}
////////////////////////////////////////////////////////////////////////////////
// Read Me!!! //
// http://www.youtube.com/watch?v=Tu8qY__oAM8 //
////////////////////////////////////////////////////////////////////////////////
// - Start this script at the beginning of the course in Burthrope. No food //
// is needed for this course. Average xp/hr is ~8,000. //
////////////////////////////////////////////////////////////////////////////////
var
x, y, obstacle, Monkey, t, XpCount, LapTotal, XpHour, StartTime, Sec: integer;
aFound: extended;
PBox: TBox;
const
ScriptVersion = '1.30';
UseAutoChecker = true;
////////////////////////////////////////////////////////////////////////////////
// Set up your Character info here!!! //
////////////////////////////////////////////////////////////////////////////////
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := 'Ignore'; //Set your player name here
Players[0].Pass := 'Ignore'; //Set your player password here
Players[0].Pin := ''; //Set your player PIN here
Players[0].Active := True;
end;
procedure SetupLogin;
begin
ClearDebug;
{$IFDEF SIMBAMAJOR980}
SMART_SERVER := 10;
SMART_MEMBERS := TRUE;
SMART_SIGNED := TRUE;
SMART_SUPERDETAIL := FALSE;
{$ELSE}
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
{$ENDIF}
SetupSRL;
DeclarePlayers;
LoginPlayer;
end;
////////////////////////////////////////////////////////////////////////////////
// Script starts here //
////////////////////////////////////////////////////////////////////////////////
// * Procedure AutoUpdateMe by Harry and Shuttleu
// * Auto-Downloads the newest version of the script when run.
procedure AutoUpdateMe;
var Neifile:integer;
OnlineVersion, NewScript, NeiFeilNennen:string;
begin
if UseAutoChecker then
begin
Writeln('Checking for latest version...');
OnlineVersion := GetPage('Ignore');
Writeln(OnlineVersion);
Writeln(ScriptVersion)
if (trim(OnlineVersion) > ScriptVersion) then
begin
Writeln('Newer Version Found!');
Writeln('Autoupdating to newer version...');
NewScript := GetPage('Ignore');
NeiFeilNennen := ScriptPath+ 'BroAgile_Burthrope_v'+OnlineVersion+'.simba';
Neifile := Rewritefile(NeiFeilNennen, true);
try
WriteFileString(Neifile, NewScript);
except
begin
Writeln('Fatal error writing to '+NeiFeilNennen+'!!');
Terminatescript;
end;
end;
CloseFile(Neifile);
Writeln('New script downloaded to '+NeiFeilNennen+'!! Please use this one!!');
TerminateScript;
end else
Writeln('You have the latest version of the script!');
end else
Writeln('!!!!! Not checking for latest version, you may be outdated!');
end;
// * Procedure SetDTMs
// * Declares DTMs to be used for the course.
// # These have been tested a lot, but please report errors if they exist.
procedure SetDTMs;
begin
Monkey := DTMFromString('mWAAAAHicY2FgYHgExK+BmIGRgeEnkOoE4i4orgHiYHcLBnkpUYbkCB+G2ztqGFKAYvxImBENgwAAJooJsA==');
end;
// * Procedure FreeTheDTMs
// * Frees the DTMs from memory.
procedure FreeTheDTMs;
begin
FreeDTM(Monkey);
end;
// * Procedure AntiBan
// * Will frequent the agility skill icon in the skills tab. Will also do
// random mouse movements and screen rotation.
// # These should be non-disruptive, but if they are please report them.
procedure AntiBan;
begin
if not(LoggedIn)then
Exit;
case Random(180)of
0: PickUpMouse;
1: RandomRClick;
2: HoverSkill('Agility', false);
3: RandomMovement;
end;
end;
// * Procedure LogColor
// * Creates TPA for Log Balance obstacle.
// * Sets camera to high North(0), searches for TPA "LogTPA", and clicks on
// random area of the log.
// * Increments course completion to (1/6).
// # Color:3487805, Hue:0.7, Sat:0.68, CTS:2, Tol:5
procedure LogColor;
var
LogTPA:TPointArray;
LogATPA:T2DPointArray;
LogBox:TBox;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.7, 0.68);
if findcolorstolerance(LogTPA, 3487805, MSX1, MSY1, MSX2, MSY2, 5) then
begin
LogATPA := SplitTPAEx(LogTPA, 30, 30);
SortATPASize(LogATPA, True);
LogBox := GetTPABounds(LogATPA[0]);
SMART_ClearCanvas;
SMART_DrawDotsEx(True, LogTPA, clYellow);
SMART_DrawBoxes(False, False ,[GetTPABounds(LogTPA)], clAqua);
SMART_DebugATPA(False,LogATPA);
Mousebox(GetTPABounds(LogATPA[0]).X1, GetTPABounds(LogATPA[0]).Y1, GetTPABounds(LogATPA[0]).X2, GetTPABounds(LogATPA[0]).Y2, 2);
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
Wait(50 + random(25));
if(isUpText('og be'))then
begin
Wait(150 + random(50));
ClickMouse2(True);
WriteLn('Found Log!');
Wait(6200 + random(100));
if FindChatBoxText('lost', 8, clBlack) then
begin
Writeln('YOU FELL! Lets try again...');
wait(3000);
LogColor;
end;
obstacle := 1;
end;
end;
end;
// * Procedure WallColor
// * Creates TPA for Wall obstacle.
// * Searches for TPA "WallTPA", and clicks on the arrow/wall.
// * Sets camera to high South during obstacle, for preperation of balance.
// * Increments course completion to (2/6).
// # Color:13356504, Hue:0.53, Sat:1.69, CTS:2, Tol:5
procedure WallColor;
var
WallTPA:TPointArray;
WallATPA:T2DPointArray;
WallBox:TBox;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.53, 1.69);
if findcolorstolerance(WallTPA, 13356504, 229, 28, 293, 114, 5) then
begin
WallATPA := SplitTPAEx(WallTPA, 10, 10);
SortATPASize(WallATPA, True);
WallBox := GetTPABounds(WallATPA[0]);
SMART_ClearCanvas;
SMART_DrawDotsEx(True, WallTPA, clYellow);
SMART_DrawBoxes(False, False ,[GetTPABounds(WallTPA)], clAqua);
SMART_DebugATPA(False,WallATPA);
Mousebox(GetTPABounds(WallATPA[0]).X1, GetTPABounds(WallATPA[0]).Y1, GetTPABounds(WallATPA[0]).X2, GetTPABounds(WallATPA[0]).Y2, 2);
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
Wait(50 + random(25));
if(isUpText('limb'))then
begin
Wait(150 + random(50));
ClickMouse2(True);
WriteLn('Found ladder!');
SetAngle(SRL_ANGLE_HIGH);
MakeCompass(180);
Wait(3800 + random(100));
obstacle := 2;
end;
end;
end;
// * Procedure BalanceColor
// * Creates and Searches TPA for Balance Beam obstacle and clicks on random
// area of ATPA[0] after boundries have been modified to click the cloest
// part of the plank.This is done because the 2nd partition has no action,
// and the third is "out of reach".
// * Sets camera high East during balance, for preperation of shields.
// * Increments course completion to (3/6).
// # Color:5072243, Hue:0.1, Sat:0.2, CTS:2, Tol:5
procedure BalanceColor;
var
BalanceTPA:TPointArray;
BalanceATPA:T2DPointArray;
BalanceBox:TBox;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.1, 0.2);
if findcolorstolerance(BalanceTPA, 5072243, MSX1, MSY1, MSX2, MSY2, 5) then
begin
BalanceATPA := SplitTPAEx(BalanceTPA, 30, 30);
SortATPASize(BalanceATPA, True);
BalanceBox := GetTPABounds(BalanceATPA[0]);
SMART_ClearCanvas;
SMART_DrawDotsEx(True, BalanceTPA, clYellow);
SMART_DrawBoxes(False, False ,[GetTPABounds(BalanceTPA)], clAqua);
SMART_DebugATPA(False,BalanceATPA);
SMART_DrawBoxes(False,false, [IntToBox(GetTPABounds(BalanceATPA[0]).X1, GetTPABounds(BalanceATPA[0]).Y1, GetTPABounds(BalanceATPA[0]).X1 + 25, GetTPABounds(BalanceATPA[0]).Y2 + 2)], clPurple);
Mousebox(GetTPABounds(BalanceATPA[0]).X1, GetTPABounds(BalanceATPA[0]).Y1, GetTPABounds(BalanceATPA[0]).X1 + 25, GetTPABounds(BalanceATPA[0]).Y2 + 2, 2);
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
Wait(150 + random(25));
if(isUpText('alanc'))then
begin
Wait(150 + random(50));
ClickMouse2(True);
WriteLn('Found Balance!');
Wait(150 + random(50));
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('E');
Wait(2700 + random(100));
obstacle := 3;
end;
end;
end;
// * Procedure ShieldColor
// * Creates TPA for Shield obstacle.
// * Searches for TPA "ShieldTPA", and clicks on lower shield.
// * Sets camera to high South during obstacle, in preperation of rope.
// * Increments course completion to (4/6).
// # Color:9801358, Hue:0.0, Sat:0.12, CTS:2, Tol:12
procedure ShieldColor;
var
ShieldTPA:TPointArray;
ShieldATPA:T2DPointArray;
ShieldBox:TBox;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.0, 0.12);
if findcolorstolerance(ShieldTPA, 9801358, MSX1, MSY1, MSX2, MSY2, 12) then
begin
ShieldATPA := SplitTPAEx(ShieldTPA, 10, 10);
SortATPASize(ShieldATPA, True);
ShieldBox := GetTPABounds(ShieldATPA[0]);
SMART_ClearCanvas;
SMART_DrawDotsEx(True, ShieldTPA, clYellow);
SMART_DrawBoxes(False, False ,[GetTPABounds(ShieldTPA)], clAqua);
SMART_DebugATPA(False,ShieldATPA);
Mousebox(GetTPABounds(ShieldATPA[0]).X1, GetTPABounds(ShieldATPA[0]).Y1, GetTPABounds(ShieldATPA[0]).X2, GetTPABounds(ShieldATPA[0]).Y2, 2);
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
Wait(50 + random(25));
if(isUpText('limb'))then
begin
Wait(150 + random(50));
ClickMouse2(True);
WriteLn('Found Shields!');
Wait(150 + random(50));
SetAngle(SRL_ANGLE_HIGH);
MakeCompass(180);
Wait(3500 + random(100));
if FindChatBoxText('footing', 8, clBlack) then
begin
Writeln('YOU FELL! Lets try again');
wait(3000);
ShieldColor;
end;
obstacle := 4;
end;
end;
end;
// * Procedure RopeColor
// * Creates TPA for Rope Swing obstacle.
// * Searches for TPA "RopeTPA", and clicks on rope.
// * Increments course completion to (5/6).
// # Color:402731, Hue:0.11, Sat:0.41, CTS:2, Tol:10
procedure RopeColor;
var
RopeTPA:TPointArray;
RopeATPA:T2DPointArray;
RopeBox:TBox;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.41);
if findcolorstolerance(RopeTPA, 402731, MSX1, MSY1, MSX2, MSY2, 10) then
begin
RopeATPA := SplitTPAEx(RopeTPA, 5, 5);
SortATPASize(RopeATPA, True);
RopeBox := GetTPABounds(RopeATPA[0]);
SMART_ClearCanvas;
SMART_DrawDotsEx(True, RopeTPA, clYellow);
SMART_DrawBoxes(False, False ,[GetTPABounds(RopeTPA)], clAqua);
SMART_DebugATPA(False,RopeATPA);
Mousebox(GetTPABounds(RopeATPA[0]).X1, GetTPABounds(RopeATPA[0]).Y1, GetTPABounds(RopeATPA[0]).X2, GetTPABounds(RopeATPA[0]).Y2, 2);
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
Wait(150 + random(25));
if(isUpText('wing'))then
begin
Wait(150 + random(50));
ClickMouse2(True);
WriteLn('Found Rope!');
Wait(3500 + random(100));
obstacle := 5;
end;
end;
end;
// * Procedure DoMonkey
// * Searches for DTM "Monkey", and clicks on monkey bars.
// * Sets camera to high North during obstacle, in preperation for checker jump.
// * Increments course completion to (6/6).
procedure DoMonkey;
begin
if FindDTMRotated(Monkey, x, y, 197, 53, 295,193, -Pi, Pi, Pi/30, aFound)then
begin
PBox := IntToBox(197, 53, 295,193);
SMART_DrawBoxEx(true, false, PBox, clRed);
MMouse(x, y, 0, 0);
Wait(300 + random(50));
if(IsUpTextMultiCustom(['ing', 'across', 'Swi', 'Swing', 'wing-', 'across', 'Swing-across']))then
begin
ClickMouse2(True);
SMART_DrawBoxEx(true, false, PBox, clGreen);
WriteLn('Found Monkey!');
Wait(450 + random(50));
SMART_ClearMS
ClickNorth(SRL_ANGLE_HIGH);
Wait(4400 + random(100));
obstacle := 6;
end;
end;
end;
// * Procedure CheckerColor
// * Creates TPA for Checker obstacle and clicks on random area of ATPA[0].
// * Updates progress report information.
// * Resets course completion to (0/6).
// # Color:5992831, Hue:0.03, Sat:0.05, CTS:2, Tol:40
procedure CheckerColor;
var
CheckerTPA:TPointArray;
CheckerATPA:T2DPointArray;
CheckerBox:TBox;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.05);
if findcolorstolerance(CheckerTPA, 5992831, MSX1, MSY1, MSX2, MSY2, 40) then
begin
CheckerATPA := SplitTPAEx(CheckerTPA, 5, 5);
SortATPASize(CheckerATPA, True);
CheckerBox := GetTPABounds(CheckerATPA[0]);
SMART_ClearCanvas;
SMART_DrawDotsEx(True, CheckerTPA, clYellow);
SMART_DrawBoxes(False, False ,[GetTPABounds(CheckerTPA)], clAqua);
SMART_DebugATPA(False,CheckerATPA);
Mousebox(GetTPABounds(CheckerATPA[0]).X1, GetTPABounds(CheckerATPA[0]).Y1, GetTPABounds(CheckerATPA[0]).X2, GetTPABounds(CheckerATPA[0]).Y2, 2);
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
Wait(300 + random(50));
if(isUpText('ump'))then
begin
Wait(200 + random(50));
ClickMouse2(True);
WriteLn('Found Checkers!');
Wait(150 + random(50));
ClickNorth(SRL_ANGLE_LOW);
Wait(750 + random(100));
obstacle := 0;
end;
end;
end;
// * Procedure DoCourse
// * Base case is off integer "obstacle" for course completion porgress.
// * If base case is met, will search for DTM/TPA of case, and execute the
// procedure of the selected case.
// * Will print status of "Looking..." or "Found" when executed.
// # This is prevent searching for DTMs that are all present on the screen, and
// will only search for the one based off progress.
// # (Case/Procedure) - (0/Log), (1/Ladder), (2/Balance), (3/Shields),
// (4/Rope), (5,Monkey), (6/Checker).
procedure DoTheCourse;
var
x, y: integer;
begin
if obstacle = 0 then
begin
WriteLn('Looking For Log...');
MarkTime(t);
repeat
LogColor;
wait(100);
if TimeFromMark(t) > 30000 then
begin
Writeln('Timed out finding log, stopping script!');
Logout;
TerminateScript;
end;
until(obstacle = 1);
end;
if obstacle = 1 then
begin
WriteLn('Looking For Ladder...');
MarkTime(t);
repeat
WallColor;
wait(100);
if TimeFromMark(t) > 30000 then
begin
Writeln('Timed out finding Wall, stopping script!');
Logout;
TerminateScript;
end;
until(obstacle = 2);
end;
if obstacle = 2 then
begin
WriteLn('Looking For Balance...');
PBox := IntToBox(186, 145, 508, 309);
SMART_DrawBoxEx(true, false, PBox, clRed);
MarkTime(t);
repeat
BalanceColor;
wait(100);
if TimeFromMark(t) > 30000 then
begin
Writeln('Timed out finding Balance, stopping script!');
Logout;
TerminateScript;
end;
until(obstacle = 3);
end;
if obstacle = 3 then
begin
WriteLn('Looking For Shields...');
MarkTime(t);
repeat
ShieldColor;
wait(100);
if TimeFromMark(t) > 30000 then
begin
Writeln('Timed out finding Shields, stopping script!');
Logout;
TerminateScript;
end;
until(obstacle = 4);
end;
if obstacle = 4 then
begin
WriteLn('Looking For Rope...');
MarkTime(t);
repeat
RopeColor;
wait(100);
if TimeFromMark(t) > 30000 then
begin
Writeln('Timed out finding Rope, stopping script!');
Logout;
TerminateScript;
end;
until(obstacle = 5);
end;
if obstacle = 5 then
begin
WriteLn('Looking For Monkey...');
MarkTime(t);
repeat
DoMonkey;
wait(100);
if TimeFromMark(t) > 30000 then
begin
Writeln('Timed out finding Monkey, stopping script!');
Logout;
TerminateScript;
end;
until(obstacle = 6);
end;
if obstacle = 6 then
begin
WriteLn('Looking For Checker...');
MarkTime(t);
repeat
CheckerColor;
wait(100);
if TimeFromMark(t) > 30000 then
begin
Writeln('Timed out finding Checker, stopping script!');
Logout;
TerminateScript;
end;
until(obstacle = 0);
IncEx(LapTotal, 1);
XpCount := LapTotal * 79;
end;
end;
procedure ProgressReport;
begin
Sec := (GetTimeRunning/1000);
XpHour := (3600*XpCount) / (Sec);
Writeln('*************Progress Report***************');
Writeln(TimeRunning);
Writeln('Laps Completed: ' + IntToStr(LapTotal));
Writeln('Xp Gained: ' + IntToStr(XpCount));
Writeln('Xp per Hour: ' + IntToStr(XpHour));
Writeln('*******************************************');
end;
// * Procedure Main
// * Sets up client and players.
// * Sets camera to high North, and sets our DTMs, and will free them when the
// script is finished.
// * Sets course completion to (0/6).
begin
AutoUpdateMe
SetupLogin;
SetupSRL;
DeclarePlayers;
ActivateClient;
LoginPlayer;
ClickNorth(SRL_ANGLE_LOW);
obstacle := 0;
SetDTMs;
repeat
DoTheCourse;
FindNormalRandoms;
AntiBan;
ProgressReport;
until(AllPlayersInactive);
FreeTheDTMs;
end.Here's the youtube video showing how it works(and breaks :) )
http://youtu.be/Tu8qY__oAM8
So I guess I will go and update all the code, but post updates as I redo each procedure and explain whatever changes I made or just the code in general. Stay tuned, hopefully I can get back to grips with SRL after this.







