SRL Archive - Archive

Geo - SRL Member Application


Geo

2011-04-26 20:35:39

How Long have You Played Runescape?
5 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
PHP, xHTML, CSS, MySQL.


Are you a member of any other communities?
No.


Tell us about yourself…
From: Geo
I'm not very good at talking about myself, but here goes nothing..

I'm Daniel and I'm 18. I'm interested anything that floats my boat. For example I like fishing, football/soccer, programming, learning something new every day.

I recently graduated High School and I'm currently waiting for my citizenship/ Work authorization so I can start working and hopefully enroll in college.

I started programming/coding at 13 in IRC using MSL making way to many Aliases, haha. I was intrigued how someone built a bot, like RuneScript, from nothing and it really made me want to find out how to do that by myself. So, I kept bugging my friend on IRC to teach me and finally he did after 2-3 months I managed to get my first script working.

After that I started to move onto web development and runescape botting. I joined when Villavu was SRL-Forums.com in 2007 and was a noob at everything. I attempted to learn SRL/SCAR but was to incompetent and didn't even understand how Writeln(); worked.

I went inactive in 2008 and gave up on RS botting and focused on learning HTML/CSS/PHP within 2 years I'd become profficient in CSS/HTML and started to focus more on PHP I built a bunch of websites that didn't really go anywhere I also started to build a "Mafia wars" style game which I kind of put off after a while to begin another project and never got around to working on it again.

Check it out if you want:
http://fimbored.com/code/

NOTE: It's kind of messy.

After that I came back to Villavu and have been lurking for the past 2 months feeding my brain and testing/messing with different functions/procedures and actually started to understand what they did.

And now I'm here. :)



Please show us one (or multiple) of your scripts.
program PortSarimJailChopper;
//{$DEFINE SPS}
{$DEFINE SMART}
{$i srl/srl.scar}
{$i srl/srl/misc/paintsmart.scar}
{$i srl/srl/misc/stats.simba}
{$i reflection/reflection.simba}

var
a, Ma, p, i, j, k, x1, y1, x2, y2, GTr, rr, t, s, u, v, w, x,
GST, GCT, GFT, CutWillows, WillowsCut,
TimesBanked, SwitchAConvert : integer;
MyTPA, MyTPA0, MyTPA1, MyTPA2, MyTPA3 : TPointArray;
MyPoint : TPoint;
IsEquip : string;

const
{User Const------------------------------------------------------------------}
Switch = True; //Do you wish for your characters to Switch after x minutes or run until false?
SwitchA = 60; //How long until switching characters, in minutes.
Resting = False; //Rest if run energy is <25% after banking?
PaintDebug = False; {Do you want to see the colours the script is finding as it runs.
Can be stopped at anytime using the "Disable debug" button in SMART.
WARNING: this may cause memory leaks, Use only if necessary.}


{Script Starts here----------------------------------------------------------}


procedure DeclarePlayers;
Begin
HowManyPlayers := 2; //How many players in the script.
CurrentPlayer := 0; //Current player in the Players array.
NumberOfPlayers(HowManyPlayers);//Don't change.

with Players[0] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;//Active?
Pin := ''; //Bank Pin
IsEquip := 'I'; //Is your hatchet in your Inv(I) or is it Equiped(E)?
End;

with Players[1] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;//Active?
Pin := ''; //Bank Pin
IsEquip := 'I'; //Is your hatchet in your Inv(I) or is it Equiped(E)?
End;

{with Players[2] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True; //Active?
Pin := ''; //Bank Pin
End;}
End;

{Script Procedures/Functions---------------------------------------------------}

Function iDebug(status : string) : string;
Begin
Writeln('[' + Players[CurrentPlayer].Name + '] :::: ' + status);
End;

Function SwitchTime: Boolean;
Begin
if (HowManyPlayers <= 1) then
Begin
Result := False;
Exit;
End;
if (not Switch) then
Exit else
SwitchAConvert := SwitchA * 60000 + Random(300000);
GST := t + SwitchAConvert;
GCT := GetSystemTime;
GFT := GST - GCT;
if (GFT <= 0) then
Begin
Result := True;
End else
Result := False;
//iDebug(GFT);
End;

Procedure EndPlayer;
Begin
iDebug('Player is stuck in a random or lost, setting player to False.');
//Players[CurrentPlayer].Active := False;
Logout;
//iDebug('Logging in: ' + Players[CurrentPlayer].Name);
NextPlayer(False);
s := 1;
End;

Procedure SwitchPlayer;
Begin
MarkTime(t);
GCT := GetSystemTime;
SwitchAConvert := SwitchA * 60000 + Random(300000);
iDebug('Switching players.');
Logout;
Wait(500+Random(250));
NextPlayer(true);
iDebug('Logging in player: ' + Players[CurrentPlayer].Name);
Inc(p);
s := 1;
Exit;
End;

Procedure ProgressReport;
Begin
if (IsEquip = 'I') then
CutWillows := 27 else
CutWillows := 28;
WillowsCut := CutWillows + WillowsCut;
Inc(TimesBanked);

ClearDebug;
Writeln('*----------------------------------------------*');
Writeln('* Jail Chopper[Willows] *');
Writeln('* v0.1 | Created by Geo *');
Writeln('*----------------------------------------------*');
Writeln(' Current Player: ' + Players[CurrentPlayer].Name);
Writeln(' -------------------------------------------- ');
Writeln(' Running for ' + TimeRunning);
Writeln(' Switching in ' + MsToTime(GFT, Time_Formal));
Writeln(' Times Switched: ' + IntToStr(p));
Writeln(' Willows Cut: ' + IntToStr(WillowsCut) + ' | Times Banked: ' + IntToStr(TimesBanked));
Writeln('*----------------------------------------------*');
End;

{Player Procedures/Functions---------------------------------------------------}
Function f_FindHatchet(Col1, Col2, Tol : Integer; debug2, uText: string) : Boolean;
Begin
for u := 0 to 1 do
repeat
FindColorsSpiralTolerance(x1, y1, MyTPA0, Col1, MIX1, MIY1, MIX2, MIY2, Tol);
if Length(MyTPA0) = 0 then
FindColorsSpiralTolerance(x1, y1, MyTPA0, Col2, MIX1, MIY1, MIX2, MIY2, Tol);
for i := 0 to High(MyTPA0) do
MyPoint := MyTPA0[i];
if (PaintDebug) then
Begin
iDebug('In ur computaar, paintin on ur screenz');
smart_DrawDots(MyTPA0);
End;
MMouse(MyPoint.x, MyPoint.y, 2, 3);
inc(u);
Wait(750+Random(200));
Exit;
Until(u >= 1);
if (IsUptext(uText)) then
Begin
Result := True;
//iDebug('Uptext found, exiting...');
Exit;
End;
Result := False;
Exit;
End;

Procedure FindHatchet;
Begin

for a := 0 to 1 do
Begin
repeat
Gametab(26);
Wait(700);
inc(a);
if (f_FindHatchet(1003631, 1002085, 4, +
'Uptext matches, We do indeed have a hatchet.', 'hatchet')) then
Begin
iDebug('#' + IntToStr(a) + ' ::: Hatchet not found.');
IsEquip := 'E';
s := 2;
Exit;
End;
iDebug('#' + IntToStr(a) + ' ::: Hatchet found.');
if (IsUptext('hatchet')) then exit;
until(a >= 1);
End;

for s := 0 to 1 do
Begin
repeat
Gametab(25);
Wait(700);
inc(s);
if (f_FindHatchet(1003631, 1002085, 4, +
'Uptext matches, We do indeed have a hatchet.', 'hatchet')) then
Begin
iDebug('#' + IntToStr(s) + ' ::: Hatchet isn''t in your inv');
IsEquip := 'I';
s := 2;
Exit;
End;
iDebug('#' + IntToStr(s) + ' ::: Hatchet is in your inv');
if (IsUptext('hatchet')) then exit;
Until(s >= 1);
iDebug('Hatchet not found.. Logging out..');
EndPlayer;
End;
End;

Procedure RandomCheck;
Begin
//iDebug('Checking for randoms...');
r_FindRandoms;
if (r_FindRandoms) then
Begin
k := 0;
iDebug('k :=' + IntToStr(k) + ' :: Stops char from doing nothing when out of random');
End;
Wait(250+Random(250));
End;

Function ToBank: TPointArray;
//Reflection tiles for walking to the bank.
Begin
SetLength(Result, 7);

Result[0] := Point(3029, 3175);
Result[1] := Point(3025, 3188);
Result[2] := Point(3019, 3202);
Result[3] := Point(3028, 3212);
Result[4] := Point(3029, 3226);
Result[5] := Point(3033, 3234);
Result[6] := Point(3046, 3234);
End;

Function ToWillow: TPointArray;
Begin
//Reflection tiles for the walk to the willows.
SetLength(Result, 7);

Result[0] := Point(3046, 3234);
Result[1] := Point(3033, 3234);
Result[2] := Point(3029, 3226);
Result[3] := Point(3028, 3212);
Result[4] := Point(3019, 3202);
Result[5] := Point(3025, 3188);
Result[6] := Point(3029, 3175);
End;

Procedure CheckEnergy;
Begin
r_FindRandoms;
if (Resting) then
Begin
iDebug('Resting...');
if (not RunEnergy(50)) then
RestUntil(50) else
SetRun(True);
End else
Exit;
End;

Procedure FindDbox;
Begin
//Finds the deposit box and banks the willows.
repeat
repeat
Begin
FindColorsSpiralTolerance(x1, y1, MyTPA3, 5990774, MSx1, MSy1, MSx2, MSy2, 2);
if Length(MyTPA) = 0 then
FindColorsSpiralTolerance(x1, y1, MyTPA3, 3160127, MSX1, MSY1, MSX2, MSY2, 3);
for i := 0 to High(MyTPA3) do

MyPoint := MyTPA3[i];

if (PaintDebug) then
Begin
iDebug('In ur computaar, paintin on ur screenz');
smart_DrawDots(MyTPA3);
End;
MMouse(MyPoint.x, MyPoint.y, 2, 3);
iDebug('Finding Bank deposit #1');
Wait(750+Random(200));
End;
Until(IsUpText('Deposit') or (R_DepositBoxScreen));

Begin
Mouse(MyPoint.x, MyPoint.y, 2, 3, false);
wait(200+Random(250));
ChooseOption('Deposit');
iDebug('Opening bank deposit #2');
Wait(2000+Random(250));
r_FindRandoms;
Wait(1500);
End;
Until(R_DepositBoxScreen);
iDebug('Deposit box Screen is open, banking...');

repeat
Begin
FindColorsSpiralTolerance(x1, y1, MyTPA2, 1325891, MSx1, MSy1, MSx2, MSy2, 2);
if Length(MyTPA2) = 0
then FindColorsSpiralTolerance(x1, y1, MyTPA2, 3887704, MSX1, MSY1, MSX2, MSY2, 2);
for i := 0 to High(MyTPA2) do
MyPoint := MyTPA2[i];
if (PaintDebug) then
Begin
iDebug('In ur computaar, paintin on ur screenz');
smart_DrawDots(MyTPA2);
End;
MMouse(MyPoint.x, MyPoint.y, 2, 3);
iDebug('Found Willow log TPA, checking uptext...');
Wait(750+Random(200));
End;
Begin
Mouse(MyPoint.x, MyPoint.y, 2, 3, false);
iDebug('Uptext matches, banking..');
ChooseOption('All');
Wait(2000+Random(250));
CloseWindow;
Wait(1000+Random(250));
R_DropItemsBut('hatchet');
//iDebug(InvCount);
r_FindRandoms;
End;
Wait(200);
Until(InvCount <= 1);

Wait(450+Random(250));
if (SwitchTime) then
SwitchPlayer;
CheckEnergy;
ProgressReport;
End;

Procedure Findwillow;
//The procedure to find and click a willow.
Begin
x := InvCount;
GetMousePos(x2, y2);
repeat
Begin
FindColorsSpiralTolerance(x1, y1, MyTPA, 4415564, MSx1, MSy1, MSx2, MSy2, 6);
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x1, y1, MyTPA, 4485726, MSX1, MSY1, MSX2, MSY2, 7);
for i := 0 to High(MyTPA) do
//oegybedam
MyPoint := MyTPA[i];
a := InvCount;
Ma := a + 1;

if (x2 = MyPoint.x) or (y2 = MyPoint.y) then
Begin
iDebug('Mouse is in the same position, exiting..');
Wait(1500+Random(250));
Exit;
End;
if (PaintDebug) then
Begin
iDebug('In ur computaar, paintin on ur screenz');
smart_DrawDots(MyTPA);
End;
MMouse(MyPoint.x, MyPoint.y, 0, 0);
iDebug('Finding Willow#1 complete');
if (IsUpText('Oak')) then
Begin
iDebug('Both Willows gone, waiting...');
Wait(1500+Random(250));
Exit;
End;
Wait(400+Random(250));
End;
Until(IsUptext('Willow'));
Begin
for j := 0 to 5 do
repeat
Mouse(MyPoint.x, MyPoint.y, 0, 0, true);
iDebug('Clicked Willow#2 complete' + ' ::: #' + IntToStr(j));
//Writeln(MyPoint);
//iDebug('a: ' + IntToStr(a) + '** Ma:' + IntToStr(Ma));
WaitInvMinCount(Ma, 30000);
//iDebug(IntToStr(a) + '=' + IntToStr(InvCount));
Exit;
Until(InvCount > a) or (j >= 5);
if (j >= 5) then
Begin
iDebug('Clicking willow timed out. j >= 5');
Exit;
End;
RandomCheck;
End;
End;

{Failsafe Procedures/Functions-------------------------------------------------}

Function NoWillow : Boolean;
Begin
//Checks to see if stump colours are visible, if true then runs procedure FindWillow;
FindColorsSpiralTolerance(x1, y1, MyTPA1, 4876933, MSx1, MSy1, MSx2, MSy2, 2);
if Length(MyTPA1) = 0 then FindColorsSpiralTolerance(x1, y1, MyTPA1, 4810624, MSX1, MSY1, MSX2, MSY2, 2);
for i := 0 to High(MyTPA1) do

MyPoint := MyTPA1[i];

if (Length(MyTPA1) <= 1) then
Result := false else
Result := true;
//iDebug(MyTPA1);
Wait(400);
End;

Procedure DoCheck;
Begin
//Random Checks for the following:
//to see if we are at PS with a full inv. Result : Banks;
//if everything is in order then it walks to the willows.

if (InvCount >= 2) then
for w := 0 to 5 do
Begin
repeat
inc(w);
SetRun(True);
iDebug('InvCount >= 2 or = 28, Banking... #' + IntToStr(w));
WalkPath(ToBank);
if (DistanceFrom(Tile(3047, 3239)) < 7) then
Begin
iDebug('Made it to the Bank, exiting..');
FindDbox;
Exit;
End;
Until(w >= 5);
if (w >= 5) then EndPlayer;
End;

for x := 0 to 5 do
Begin
repeat
inc(x);
iDebug('Attempt ' + IntToStr(x) + ' at walking to the Willows');
WalkPath(ToWillow);
if (DistanceFrom(Tile(3028, 3175)) < 4) then
Begin
iDebug('Made it to the Willows, exiting..');
FindWillow;
Exit;
End;
Until(x >= 5);
if (x >= 5) then EndPlayer;
k := 0;
End;
End;

Procedure Antiban;
Begin
GTr := RandomRange(21,37);
rr := RandomRange(1,17);
if (rr = 5) or (rr = 15) then
Begin
Case Random(5000) of
0..1000 : RandomRClick;
1001..2000 : HoverSkill('Woodcutting', false);
2001..3000 : RandomMovement;
3001..4000 : GameTab(GTr);
4001..5000 : PickUpMouse;
End;
End;
End;

Function PlayerLost: boolean;
Begin
if(not (TileOnMM(Tile(3029, 3175)))) then
Begin
if (TileOnMM(Tile(3046, 3234))) then
Begin
Result := False;
Exit;
End;
iDebug('Tile(3046, 3234) is not on the MM. Switching Player..');
iDebug('Reason: Lost.');
Result := true;
s := 1;
Exit;
End else
Result := False;
Exit;
End;

Procedure MainLoop;
Begin
for k := 0 to 20 do
repeat
if (LobbyScreen) then
LeaveLobby;
if (not LoggedIn) then LoginPlayer else
if (PlayerLost) then
Begin
EndPlayer;
End else
Begin
if (InvCount = 28) then
Begin
DoCheck;
End else
if (k > 0) then
Begin
iDebug('oInvCount: ' + IntToStr(x) + ' :: cInvCount:' + IntToStr(invcount));
if (InvCount = x) then
Begin
Inc(k);
iDebug('Inv hasn''t grown over time, Finding Willow.');
FindWillow;
End else
End;
if (k = 0) or (NoWillow) then
Begin
if (DistanceFrom(Tile(3029, 3175)) > 5) then
Begin
DoCheck;
End else
Inc(k);
FindWillow;
End else
Inc(k);
AntiBan;
iDebug('Performing AntiBan...');
iDebug('Wait While Cutting...' + IntToStr(k));
if (InvCount = 28) then
Begin
DoCheck;
End else
LevelUp;
RandomCheck;
Wait(2000+random(650));
End;
until(k >= 20);
End;

Begin
Smart_Server := 152;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;

MarkTime(t);
r_SetupRandoms;
SetupSRL;
ClearDebug;
DeclarePlayers;

if (LobbyScreen) then
LeaveLobby;
if (not LoggedIn) then LoginPlayer else
iDebug('Already Logged in..');

Begin
r_SetupRandoms;
iDebug('Setup...');
SetAngle(true);
MakeCompass('N');
v := 1;
//Writeln(v);


repeat
if (LobbyScreen) then
LeaveLobby;
Wait(600);
if (not LoggedIn) then LoginPlayer;
RandomCheck;
SetAngle(true);
MakeCompass('N');
if (v <= 1) then
Begin
v := 2;
//Writeln(v);
FindHatchet;
Wait(400);
DoCheck;
End;

//Checks for a full inv;
if (InvCount = 28) then
Begin
//iDebug('InvCount = 28, banking...');
SetRun(True);
DoCheck;
End else

//Checks if the player is at Willow or Deposit Box;
if (DistanceFrom(Tile(3047, 3239)) < 7) then
Begin
RandomCheck;
DoCheck;
End else

MainLoop;
Until(AllPlayersInactive);
//Shows final progress report after AllPlayersInactive;
ProgressReport;
iDebug('Thanks for using Jail Chopper');
iDebug('Post your progress reports or bugs here: villavu.com/forum/showthread.php?p=801961');
TerminateScript;
End;
End.

Daniel

2011-04-26 22:10:18

Yes - good attitude, scripts alright (but I'm quite confident that you will improve :)), and you are active in development of the script.

Just try colour walking and better object recognition (DDTM's, proper use of TPA's, etc). :)

Good luck :)

Geo

2011-04-26 22:30:00

From: Daniel
Yes - good attitude, scripts alright (but I'm quite confident that you will improve :)), and you are active in development of the script.

Just try colour walking and better object recognition (DDTM's, proper use of TPA's, etc). :)

Good luck :)


Thanks for the reply. I've experimented with SPS(colour walking) and it's really useful. I'm definitely thinking of adding it as an option to the script.

As for object finding I was wondering if there was a good, up to date tutorial for TPAs.

Thanks.

[OFFTOPIC]Nice name :p[/OFFTOPIC]

Tniffoc

2011-04-27 00:57:09

I'm extremely inactive and therefore won't vote, but I'll leave my feedback regardless.

  1. First off, the script looks great, but one of the first things I look for in a script is following standards. You have some indenting errors in there, so just make sure to keep track of those in the future.
  2. Global variables are, well, messy? Try to avoid as extensive use of them as you have made here.
  3. This is a biggie. ATPAs at least or other, more inventive forms of color finding are almost a necessity. Plain old TPAs aren't going to get you that far in life.
  4. You could use to break out of some of those loops if an action doesn't succeed in n tries.
  5. You could scale down your random number value in Antiban
  6. I like that you used reflection with moderation instead of cluttering it all over your script.
  7. :spot: Custom debug function that prints the character's name so you don't have to keep putting it everywhere like some people do!

All in all, you NEED to learn ATPAs and outline counting and some stuff like that, and using a couple of records wouldn't hurt either (see my sig).

My vote would be yes but I'm not voting because I'm not active. Just thought I'd give you some feedback because I know that when I was applying it was cool to find out the things I was missing out on.

Good Luck!

Geo

2011-04-27 01:38:35

@Tniffoc

  1. Global variables are, well, messy? Try to avoid as extensive use of them as you have made here.
  2. Yea, sorry about that, I'll keep them to a minimum.
  3. This is a biggie. ATPAs at least or other, more inventive forms of color finding are almost a necessity. Plain old TPAs aren't going to get you that far in life.
  4. I really just tried to learn the best way to find colours. I started with DTMs and found they weren't that useful, or, I was using them wrong. Then I found TPAs and that they helped a lot more than DTMs.

    I will certainly learn/experiment with ATPAs this week.
  5. You could use to break out of some of those loops if an action doesn't succeed in n tries.
  6. I'm going to re-write the MainLoop procedure sometime tomorrow as it could do with some refining. I'll also read up on the records.

Thank you so much for taking the time to post the list I really appreciate it.

BraK

2011-04-27 01:42:22

For TPA i'd check out the intermediate section there are a few good tutorials to look at. Naum has one and I think n3ss3s does also.

~BraK

E: Here's they are Naum's and n3ss3s's

E2: Another thing you might find interesting. It's harder to put into a script but far more accurate. here's the tut for CTS2 by Prophesyofwolf

E3: oh yeah a yes from me, Good Luck

Geo

2011-04-27 02:11:02

From: BraK
For TPA i'd check out the intermediate section there are a few good tutorials to look at. Naum has one and I think n3ss3s does also.

~BraK

E: Here's they are Naum's and n3ss3s's

E2: Another thing you might find interesting. It's harder to put into a script but far more accurate. here's the tut for CTS2 by Prophesyofwolf

E3: oh yeah a yes from me, Good Luck


Thank you. I will definitely look over all of these tomorrow and experiment with them.

Rich

2011-04-27 03:10:23

Tniffoc! :eek:
/offtopic

There's definitely some room for improvement in the script, as well as some silly things like

Begin
EndPlayer;
End else
Where the begin and end aren't needed. You've got a good attitude, but I'd like you to be a bit more active.

Nevertheless, yes.

Geo

2011-04-27 03:35:04

From: Rich
Tniffoc! :eek:
/offtopic

There's definitely some room for improvement in the script, as well as some silly things like

Begin
EndPlayer;
End else
Where the begin and end aren't needed. You've got a good attitude, but I'd like you to be a bit more active.

Nevertheless, yes.


I'm going to revise the script tomorrow, 3:28AM at the moment, and do some changes to it.

I'm going to be A LOT more active now free trade is back. I went inactive in 2008 and only recently made a return about ~2 months ago.

Thanks for posting. :)

WT-Fakawi

2011-04-27 05:04:39

Yessirrie!

Home

2011-04-27 05:15:52

Yupduppa :) (Yes)

~Home

Echo_

2011-04-27 17:21:29

Looks pretty good, you show decent knowledge of TPAs and have multiplayer support and a break handler.

Yes from me :)

Rich

2011-04-27 17:40:38

Oh, and can I ask what you was last known as, and whether it could be added to your signature?

Thanks!

Geo

2011-04-27 18:19:17

From: Rich
Oh, and can I ask what you was last known as, and whether it could be added to your signature?

Thanks!


I was recently known as England155, I'll update my signature now. Thanks everyone for the replies. I'm working on an update as I type to incorporate some ideas said in this thread and colour walking(SPS) and a dropping mechanism, should be ready Thursday. :spot:

noidea

2011-04-27 19:48:24

Yep. Gl :)

BraK

2011-04-28 00:05:51

From: Geo
I was recently known as England155, I'll update my signature now. Thanks everyone for the replies. I'm working on an update as I type to incorporate some ideas said in this thread and colour walking(SPS) and a dropping mechanism, should be ready Thursday. :spot:


Make sure not to update the original script at the top. Just add the revisions in a new post. Some members don't like editing during appliances. ;)

~BraK

Geo

2011-05-01 19:10:12

Sorry for the wait on the update. I've been really busy the past couple days and haven't had the time that much time to work on it.

I have added quite a bit to the script and it seems to be a lot faster than before.

What I added:
  • TPAs/ATPAs with CTS.
  • A fast dropping method (SRL dropping) or a slow, but accurate, dropping method using TPAs/ATPAs.
  • Added SPS walking, still kind of buggy but I've attempted to work out most of kinks


program PortSarimJailChopper;
{$DEFINE SMART}
{$i srl/srl.scar}
{$i srl/srl/misc/paintsmart.scar}
{$i srl/srl/misc/stats.simba}
//{$i srl/srl/core/SPS/SPS.simba} Remove the '//' to use SPS
{$i reflection/reflection.simba}

type
TStringAndInteger = record
text: String;
inc: Integer;
end;

var
x, y, i, j, k, l, s, t, GTr, rr, a, Ma,
GST, GCT, GFT, CutWillows, WillowsCut,
TimesBanked, SwitchAConvert, TimesDropped : integer;
IsEquip, WhatDo, Walking, DropSpeed: string;

const
{User Const------------------------------------------------------------------}
Switch = True; //Do you wish for your characters to Switch after x minutes or run Until false?
SwitchA = 60; //How long Until switching characters, in minutes.
Resting = False; //Rest If run energy is <25% after banking?
PaintDebug = False; {Do you want to see the colours the script is finding as it runs.
Can be stopped at anytime using the "Disable debug" button in SMART.
WARNING: this may cause memory leaks, Use only If necessary.}


{Script Starts here----------------------------------------------------------}


procedure DeclarePlayers;
Begin
HowManyPlayers := 2; //How many players in the script.
CurrentPlayer := 0; //Current player in the Players array.
NumberOfPlayers(HowManyPlayers);//Don't change.

with Players[0] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;//Active?
Pin := ''; //Bank Pin
WhatDo := 'Bank'; // Either 'drop' or 'bank'
DropSpeed := 'Fast'; //'Fast' Uses SRL drop function. / 'Slow' Uses TPAs.
Walking := 'R'; //Either Reflection(R) or Colour(C)
End;

with Players[1] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;//Active?
Pin := ''; //Bank Pin
WhatDo := 'Bank'; // Either 'drop' or 'bank'
DropSpeed := 'Fast'; //'Fast' Uses SRL drop function. / 'Slow' Uses TPAs.
Walking := 'R'; //Either Reflection(R) or Colour(C)
End;

{with Players[2] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True; //Active?
Pin := ''; //Bank Pin
WhatDo := 'drop'; // Either 'drop' or 'bank'
DropSpeed := 'Fast'; //'Fast' Uses SRL drop function. / 'Slow' Uses TPAs.
Walking := 'R'; //Either Reflection(R) or Colour(C)
End;}
End;

{Script Procedures/Functions---------------------------------------------------}

Function iDebug(status : string) : string;
Begin
Writeln('[' + Players[CurrentPlayer].Name + '] :::: ' + status);
End;

Function SwitchTime: Boolean;
Begin
If (HowManyPlayers <= 1) Then
Begin
Result := False;
Exit;
End;
If (Not (Switch)) Then Exit Else
SwitchAConvert := SwitchA * 60000 + Random(300000);
GST := t + SwitchAConvert;
GCT := GetSystemTime;
GFT := GST - GCT;
If (GFT <= 0) Then
Begin
Result := True;
Exit;
End Else
Result := False;
//iDebug(GFT);
End;

Function EndPlayer(Why : string): string;
Begin
iDebug('Player is stuck in a random or lost, setting player to False.');
iDebug('Reason: ' + Why);
Logout;
NextPlayer(False);
s := 1;
Exit;
End;

Procedure SwitchPlayer;
Begin
MarkTime(t);
GCT := GetSystemTime;
SwitchAConvert := SwitchA * 60000 + Random(300000);
iDebug('Switching players.');
Logout;
Wait(500+Random(250));
NextPlayer(true);
iDebug('Logging in player: ' + Players[CurrentPlayer].Name);
Inc(j);
s := 1;
Exit;
End;

Procedure ProgressReport;
var
Times: TStringAndInteger;
Begin

If (IsEquip = 'I') Then
CutWillows := 27 Else
CutWillows := 28;
WillowsCut := CutWillows + WillowsCut;
Inc(TimesBanked);


Begin
If (WhatDo = 'Bank') Then
Begin
Times.text := 'Banked';
Times.inc := TimesBanked;
End Else
Times.text := 'Dropped';
Times.inc := TimesDropped;
end;

ClearDebug;
Writeln('*----------------------------------------------*');
Writeln('* Jail Chopper[Willows] *');
Writeln('* v0.1 | Created by Geo *');
Writeln('*----------------------------------------------*');
Writeln(' Current Player: ' + Players[CurrentPlayer].Name);
Writeln(' -------------------------------------------- ');
Writeln(' Running for ' + TimeRunning);
Writeln(' Switching in ' + MsToTime(GFT, Time_Formal));
Writeln(' Times Switched: ' + IntToStr(j));
Writeln(' Willows Cut: ' + IntToStr(WillowsCut) + ' | Times ' + Times.text + ': ' + IntToStr(Times.inc));
Writeln('*----------------------------------------------*');
Exit;
End;

{Player Procedures/Functions---------------------------------------------------}
//All credit to ProphesyOfWolf's tutorial for the function below. Changed it to be more dynamic.
function f_TPA(x, y, w, h, col, tol: Integer; hue, sat: Extended; upText: TStringArray; debug: String): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(hue, sat);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, col, MSX1, MSY1, MSX2, MSY2, tol);
ColorToleranceSpeed(CTS);
ATPA := SplitTPAEx(TPA, w, h); //w, h;

For I := 0 to High(ATPA) do
Begin
MiddleTPAEx(ATPA[i], x, y);
If (PaintDebug) Then SMART_DrawDotsEx(true, ATPA[i], clBlue);
MMouse(x, y, 2, 2);
Wait(300+Random(250));
If(IsUpTextMultiCustom(upText)) Then
Begin
iDebug(debug);
Result := True;
GetMousePos(x, y);
Exit;
end;
end;
end;

function f_TPAinv(x, y, col, tol: Integer; hue, sat: Extended; upText, debug: String): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(hue, sat); // hue = H/L // sat = S/L
FindColorsSpiralTolerance(x, y, TPA, col, MIX1, MIY1, MIX2, MIY2, tol);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 5, 5);

For I := 0 to High(ATPA) do
Begin
MiddleTPAEx(ATPA[i], x, y);
If (PaintDebug) Then SMART_DrawDotsEx(true, ATPA[i], clBlue);
MMouse(x, y, 2, 2);
Wait(100+Random(45));
If(IsUpText(upText)) Then
Begin
iDebug(debug);
Result := True;
Exit;
end;
end;
end;

function f_TPAnoWillow(w, h, col, tol: Integer; hue, sat: Extended; debug: String): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(hue, sat);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, col, MSX1, MSY1, MSX2, MSY2, tol);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, w, h); //w, h;

For I := 0 to High(ATPA) do
Begin
MiddleTPAEx(ATPA[i], x, y);
If (PaintDebug) Then SMART_DrawDotsEx(true, ATPA[i], clBlue);
iDebug(debug);
Result := True;
Exit;
end;
end;

Procedure FindHatchet;
Begin
for a := 0 to 1 do
Begin
Repeat
Gametab(26); //Equipment tab
Wait(700);
inc(a);
If (f_TPAinv(x, y, 929380, 4, 1.32, 0.18, 'hatchet', 'Found a Hatchet...')) Then
Begin
iDebug('#' + IntToStr(a) + ' ::: Hatchet is indeed equipped.');
IsEquip := 'E';
i := 2;
Exit;
End Else
iDebug('#' + IntToStr(a) + ' ::: No hatchet equipped.');
Until(a >= 1);
If (isUptext('hatchet')) Then Exit Else
End;
for j := 0 to 1 do
Begin
Repeat
Gametab(25); //inventory
Wait(700);
inc(j);
If (f_TPAinv(x, y, 929380, 4, 1.32, 0.18, 'hatchet', 'Found a Hatchet...')) Then
Begin
iDebug('#' + IntToStr(j) + ' ::: Hatchet is indeed in your inventory');
IsEquip := 'I';
i := 2;
Exit;
End Else
iDebug('#' + IntToStr(j) + ' ::: Hatchet isn''t in your inventory');
Until(j >= 1);
EndPlayer('Hatchet Not found.');
Exit;
End;
End;

Procedure RandomCheck;
Begin
//iDebug('Checking for randoms...');
r_FindRandoms;
Wait(250+Random(250));
End;

Function ToBank: TPointArray;
//Reflection tiles for walking to the bank.
Begin
SetLength(Result, 7);

Result[0] := Point(3029, 3175);
Result[1] := Point(3025, 3188);
Result[2] := Point(3019, 3202);
Result[3] := Point(3028, 3212);
Result[4] := Point(3029, 3226);
Result[5] := Point(3033, 3234);
Result[6] := Point(3046, 3234);
End;

Function ToWillow: TPointArray;
Begin
//Reflection tiles for the walk to the willows.
SetLength(Result, 7);

Result[0] := Point(3046, 3234);
Result[1] := Point(3033, 3234);
Result[2] := Point(3029, 3226);
Result[3] := Point(3028, 3212);
Result[4] := Point(3019, 3202);
Result[5] := Point(3025, 3188);
Result[6] := Point(3029, 3175);
End;

Procedure CheckEnergy;
Begin
r_FindRandoms;
If (Resting) Then
Begin
iDebug('Resting...');
If (Not RunEnergy(50)) Then
RestUntil(50) Else
SetRun(True);
End Else
Exit;
End;

Procedure FindDbox;
//Finds the deposit box and banks the willows
Begin
for i := 0 to 5 do
Repeat
If (f_TPA(x, y, 23, 70, 5529965, 6, 0.06, 0.04, ['bank', 'depoit', 'box'], 'Finding Deposit box complete')) Then
Begin
GetMousePos(x, y);
wait(700);
Mouse(x, y, 2, 3, false);
Wait(200+Random(250));
ChooseOption('Deposit');
//inc(i);
iDebug('Opening bank deposit box ::: #' + IntToStr(i));
Wait(450+Random(250));
If (DepositScreen) Then Break Else
End;
Until(DepositScreen);
iDebug('Deposit box Screen is open, banking...');
If (DepositScreen) Then
Repeat
If (f_TPA(x, y, 5, 5, 1325633, 1, 0.3, 2.8, ['Deposit-1','Wil','low','Logs'], 'Found the willow logs, banking')) Then
GetMousePos(x, y);
Wait(500);
Mouse(x, y, 2, 2, False);
Wait(200+Random(250));
ChooseOption('Deposit-All');
Wait(900+Random(200));
iDebug('Depositing extra items If any exist...');
Deposit(2, 28, true);
Wait(200+Random(200));
CloseWindow;
Wait(200+Random(200));
//Writeln(InvCount);
If (InvCount <= 1) Then
Begin
Wait(450+Random(250));
CheckEnergy;
ProgressReport;
If (SwitchTime) Then SwitchPlayer;
Exit;
End;
Exit;
Until(i >= 5);
If (i >= 5) Then
Begin
EndPlayer('Failed to find Deposit Box.');
Exit;
End;
End;

//Find the willow, check uptext.
Procedure Findwillow;
Begin
//Click the willow.
Begin
l := InvCount;
a := InvCount;
Ma := a + 1;
for j := 0 to 5 do
Repeat
If (f_TPA(x, y, 25, 20, 3298373, 5, 0.22, 1.48, ['Wil','low','Willow'], 'Found Willow...')) Then
Begin
//inc(j);
GetMousePos(x, y);
Mouse(x, y, 2, 2, true);
iDebug('Clicked willow successfully...' + ' ::: #' + IntToStr(j));
//iDebug('a: ' + IntToStr(a) + '** Ma:' + IntToStr(Ma));
WaitInvMinCount(Ma, 30000);
//iDebug(IntToStr(a) + '=' + IntToStr(InvCount));
Exit;
End;
Until(InvCount > a) or (j >= 5);
If (j >= 5) Then
Begin
iDebug('Clicking willow timed out, exiting...');
Exit;
End;
End;
RandomCheck;
End;

Procedure DropInv;
Begin
If (DropSpeed = 'Fast') Then
Begin
If (isEquip = 'I') Then iDebug('Beginning to drop willow logs... Hatchet in inv') Else
iDebug('Beginning to drop willow logs... Hatchet equipped');
Repeat
iDebug(isEquip);
If(isEquip = 'I') Then
Begin
for i := 1 to 28 do
Repeat
inc(i);
R_DropItem(i);
//iDebug(IntToStr(i));
Until(InvCount <= 1);
End Else
DropAll;
Until(InvCount <= 1);
End Else
If (DropSpeed = 'Slow') Then
Begin
InvCount;
l := invCount - 1;
Repeat
i := RandomRange(1,5);
If (f_TPAinv(x, y, 1325633, i, 0.3, 2.8, 'Willow', 'Found the willow logs, dropping...')) Then
GetMousePos(x, y);
Mouse(x, y, 2, 2, False);
ChooseOption('Drop');
Wait(1200+Random(50));
iDebug('cInvCount :: ' + IntToStr(InvCount) + ' ::: oInvCount ::' + IntToStr(l));
RandomCheck;
Until(InvCount < l) or (InvCount <= 1);
End;
End;

{Failsafe Procedures/Functions-------------------------------------------------}

Function NoWillow : Boolean;
Begin
//Checks to see If stump colours are visible, If true Then runs procedure FindWillow;
If (f_TPAnoWillow(5, 5, 4679296, 15, 0.05, 0.09, 'No Willow found, changing...')) Then
Result := true Else
Result := false;
End;

Procedure DoCheck;
Var
MyPath: TPointArray;
Begin
//Random Checks for the following:
//to see If we are at PS with a full inv. Result : Banks;
//If everything is in order Then it walks to the willows.

If (WhatDo = 'Bank') Then
Begin

{ ** Relflection Walking ** }
If (Walking = 'R') Then
Begin
If (InvCount >= 2) Then
for i := 0 to 5 do
Begin
Repeat
//inc(i);
SetRun(True);
iDebug('Attempt ' + IntToStr(i) + ' at walking to the Bank Deposit box.');
WalkPath(ToBank);
If (DistanceFrom(Tile(3047, 3239)) < 7) Then
Begin
iDebug('Made it to the Bank, exiting..');
Wait(500+Random(500));
FindDbox;
Exit;
End;
Until(i >= 5);
If (i >= 5) Then
Begin
EndPlayer('Failed to walk to the Willows.');
Exit;
End Else
End;
for j := 0 to 5 do
Begin
Repeat
//inc(j);
iDebug('Attempt ' + IntToStr(j) + ' at walking to the Willows.');
WalkPath(ToWillow);
If (DistanceFrom(Tile(3028, 3175)) < 4) Then
Begin
iDebug('Made it to the Willows, exiting..');
FindWillow;
Exit;
End;
Until(j >= 5);
If (j >= 5) Then
Begin
EndPlayer('Failed to walk to the Bank Deposit Box.');
Exit;
End Else
k := 0;
Exit;
End;
End Else
//End Else Walking

{ ** SPS Walking ** }
If (Walking = 'C') Then
Begin
If (InvCount = 28) Then
Begin
for i := 0 to 5 do
Begin
Repeat
SPS_Areas := ['9_5'];
MyPath := [Point(3748, 2397), Point(3725, 2354), Point(3712, 2337), +
Point(3702, 2291), Point(3731, 2260), Point(3731, 2202), Point(3753, 2163), +
Point(3816, 2161)];
iDebug('Attempt ' + IntToStr(i) + ' at walking to the Bank Deposit box.');
If SPS_PosOnMM(Point(3831, 2097)) Then
Begin
iDebug('Point(3840, 2108) is on the minimap.. At the Bank.');
Break;
End Else
SetRun(True);
If SPS_WalkPath(MyPath) Then Break;
Until(SPS_PosOnMM(Point(3831, 2097))) or (i >= 5);
If (i >= 5) Then
Begin
EndPlayer('Failed to walk to the Bank Deposit Box.');
Exit;
End Else
iDebug('Made it to the Bank.');
Wait(2500+Random(500));
FindDbox;
Exit;
End;
End Else

for j := 0 to 5 do
Begin
Repeat
SPS_Areas := ['9_5'];
MyPath := [Point(3794, 2163), Point(3756, 2166), Point(3731, 2202), +
Point(3731, 2260), Point(3702, 2291),Point(3712, 2337), Point(3721, 2352), Point(3745, 2390)];
iDebug('Attempt ' + IntToStr(j) + ' at walking to the Willows.');
If SPS_PosOnMM(Point(3766, 2438)) Then
Begin
iDebug('Point(3766, 2438) is on the minimap.. At the Willows.');
Break;
End Else
//SetRun(True);
If SPS_WalkPath(MyPath) Then Break;
Until(SPS_PosOnMM(Point(3766, 2438))) or (j >= 5);
If (i >= 5) Then
Begin
EndPlayer('Failed to walk to the Willows.');
Exit;
End Else
iDebug('Made it to the Willows.');
Wait(2500+Random(500));
FindWillow;
Exit;
End;
End Else

//end Else WhatDo
End Else
If (WhatDo = 'Drop') Then
Begin
If (InvCount = 28) Then
Begin
iDebug('Dropping Willow logs...');
Repeat
DropInv;
Until(InvCount <= 1);
iDebug('Inventory empty...');
FindWillow;
inc(TimesDropped);
If (SwitchTime) Then
SwitchPlayer Else
ProgressReport;
Exit;
End;
End Else
iDebug('WhatDo isn''t set, terminating script');
TerminateScript;
Exit;
End;

Procedure Antiban;
Begin
GTr := RandomRange(21,37);
rr := RandomRange(1,35);
If (rr = 5) or (rr = 30) Then
iDebug('Performing AntiBan');
Begin
Case Random(15) of
0..3 : RandomRClick;
3..6 : HoverSkill('Woodcutting', false);
7..9 : RandomMovement;
10..12 : GameTab(GTr);
13..15 : PickUpMouse;
End;
End;
End;

Function PlayerLost: boolean;
Begin
If(Not (TileOnMM(Tile(3029, 3175)))) Then
Begin
If (TileOnMM(Tile(3046, 3234))) Then
Begin
Result := False;
Exit;
End;
iDebug('Tile(3046, 3234) is Not on the MM. Switching Player..');
Result := true;
s := 1;
Exit;
End Else
Result := False;
Exit;
End;

Procedure MainLoop;
Begin
for k := 0 to 20 do
Repeat
If (LobbyScreen) Then LeaveLobby;
If (Not LoggedIn) Then LoginPlayer;

RandomCheck;

If (PlayerLost) Then
Begin
EndPlayer('Lost');
Break;
End;

If (InvCount = 28) Then
Begin
DoCheck;
End;

If (DistanceFrom(Tile(3029, 3175)) > 5) Then
Begin
DoCheck
Exit;
End;

If (k > 0) Then
iDebug('oInvCount: ' + IntToStr(l) + ' ::: cInvCount: ' + IntToStr(invcount));
If (InvCount = l) Then
Begin
Inc(k);
iDebug('Inv hasn''t grown over time, Finding Willow.');
FindWillow;
End Else
If (k = 0) or (NoWillow) Then
Begin
If (DistanceFrom(Tile(3029, 3175)) > 5) Then
Begin
DoCheck
Exit;
End Else
Inc(k);
FindWillow;
End Else
Inc(k);
AntiBan;
iDebug('Wait While Cutting...' + IntToStr(k));
If (InvCount = 28) Then
DoCheck Else
LevelUp;
RandomCheck;
Wait(2000+random(650));
Until(k >= 20);
End;

Begin
Smart_Server := 155;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;

Wait(500);
MarkTime(t);
r_SetupRandoms;
ClearDebug;
SetupSRL;
DeclarePlayers;

If (LobbyScreen) Then
LeaveLobby;
If (Not LoggedIn) Then LoginPlayer Else
iDebug('Already Logged in..');

Begin
r_SetupRandoms;
iDebug('Setup...');
SetAngle(true);
MakeCompass('N');
i := 1;
//Writeln(i);
Repeat
If (LobbyScreen) Then
LeaveLobby;
Wait(600);
If (Not LoggedIn) Then LoginPlayer;
RandomCheck;
SetAngle(true);
MakeCompass('N');
If (s <= 1) Then
Begin
s := 2;
//Writeln(v);
FindHatchet;
Wait(400);
DoCheck;
End;
//Checks for a full inv;
If (InvCount = 28) Then
Begin
//iDebug('InvCount = 28, banking...');
SetRun(True);
DoCheck;
End Else
//Checks If the player is at Willow or Deposit Box;
If (DistanceFrom(Tile(3047, 3239)) < 7) Then
Begin
RandomCheck;
DoCheck;
End Else
MainLoop;
Until(AllPlayersInactive);
//Show final progress report/Where to post bugs after AllPlayersInactive;
ProgressReport;
iDebug('Thanks for using Jail Chopper');
iDebug('Post your progress reports or bugs here: villavu.com/forum/showthread.php?p=801961');
TerminateScript;
End;
End.

WT-Fakawi

2011-05-02 03:32:00

In. Welcome!