SRL Archive - Archive

RISK - SRL Member Application


RISK

2011-12-05 01:09:33

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


Are you affilated in anyway with Jagex LTD?
No.

Were you Referred to SRL?



What is your general programming knowledge?
Pascal


Are you a member of any other communities?
No. Not anymore.


Tell us about yourself…
From: RISK
My name is Jesse, I am seventeen years old and I have a passion for development and helping others succeed in their personal goals.



Please show us one (or multiple) of your scripts.
The first script is my RTanner script and the second one is an example of radial walking to show that I am indeed capable of radial walking.


program RTanner;
{$DEFINE SMART}
{$i SRL/SRL.scar}
{$I SPS/SPS.simba}

const
WORLD = 35;
MEMBERS = False;

// Player integers:
TANNED = 1;
TO_TAN = 2;
// Player strings:
LEATHER = 0;
// --

procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Pin := '';

Strings[LEATHER] := 'leather';
Integers[TO_TAN] := 100;

Active := True;
end;
end;

procedure Write(T: string);
begin
WriteLn(TheTime + ': ' + PadR(T, 12));
end;

procedure ExitPlayer(Message: string);
begin
Write(Message);
Players[CurrentPlayer].Active := False;
Logout;
end;

procedure SetCTS(Hue, Sat: Extended);
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat);
end;

procedure RevertCTS;
begin
SetColorSpeed2Modifiers(0.2, 0.2);
SetColorToleranceSpeed(1);
end;

function LoadDTM(DTM: string): Integer;
var dtmText : string;
begin
case Lowercase(DTM) of
'cowhide' : dtmText := 'mbQAAAHicY2VgYJjKxMCwCIjnAXEnELcDcTQjA0MUEKcCcTIQ' +
'RwDx0nnzgKqZUDAPAyZgxILBAAAq5gbJ';

'leather' : dtmText := 'mbQAAAHicY2VgYNjPxMBwBoiPAfEWIN4AxDGMEJwOxClAHAXE' +
'thacQNVMKJiVARMwYsFgAAAiUAY3';
end;

Result := DTMFromString(dtmText);
end;

function IsShopOpen: Boolean;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

Result := FindTextTPA(2070783, 10, MSX1, MSX1, MSX2, MSY2, 'What', +
'UpCharsEx', Nothing);
end;

function CanTan: Boolean;
var Tanning, leatherText, Amount : string;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

Tanning := Players[CurrentPlayer].Strings[LEATHER];
case Lowercase(Tanning) of
'leather' :
begin
leatherText := 'Soft';
Amount := '1';
end;
end;

Result := FindTextTPA(65280, 10, MSX1, MSY1, MSX2, MSY2, leatherText,
'SmallChars', Nothing) and FindTextTPA(65280, 10,
MSX1, MSY1, MSX2, MSY2, Amount, 'SmallChars',
Nothing);
end;

procedure Antiban;
begin
case Random(150) of
0 : BoredHuman;
1 .. 8 : PickUpMouse;
55 : RandomRClick;
60 .. 77 : Wait(RandomRange(1622, 3444));
end;
end;

function ClickSymbol(Symbol: string; Accuracy: Extended): Boolean;
var
X, Y : Integer;
tempAcc : Extended;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

tempAcc := SymbolAccuracy;
SymbolAccuracy := Accuracy;

if (not(FindSymbol(X, Y, Symbol))) then
begin
Write('We were unable to find the symbol ' + Symbol + '...');
Result := False;
end;

SymbolAccuracy := tempAcc;
end;

function OnEllis_Sym: Boolean; // Fail-safe for function OnEllis_SPS: Boolean;
var
X, Y : Integer;
tempAcc : Extended;
oldPos, curPos : TPoint;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

oldPos := SPS_GetMyPos;
if ((oldPos <> Point(4935, 3890))) then
begin
Write('We do not need to fix our position.');
Result := True;
Exit;
end;

tempAcc := SymbolAccuracy;
SymbolAccuracy := 0.5;

if (not(FindSymbol(X, Y, 'tanner'))) then
begin
SymbolAccuracy := tempAcc;
ExitPlayer('We were unable to fix our position by clicking the symbol...');
end;

SymbolAccuracy := tempAcc;

Mouse(X, Y, 5, 5, True)
Flag;
curPos := SPS_GetMyPos;

Result := (curPos <> Point(4935, 3890));
end;

function OnEllis_SPS: Boolean; // Fixes the bug where we get stuck on Ellis
var
oldPos, curPos, newPos : TPoint;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

oldPos := SPS_GetMyPos;
if (oldPos = Point(4935, 3890)) then
begin
// Facing north: (4930, 3890) = Tile left of Ellis
// Facing north: (4940, 3890) = Tile right of Ellis
case Random(2) of
0 : newPos := Point(4930, 3890);
1 : newPos := Point(4940, 3890);
end;

if (not(SPS_WalkToPos(newPos))) then
begin
Write('SPS walking failed to walk to point: "' + ToStr(newPos) + '"...');
if (not(OnEllis_Sym)) then
ExitPlayer('We were unable to fix our position...');
end;
end;

curPos := SPS_GetMyPos;
Result := (curPos <> oldPos);
end;

function SPSWalks(Where: string): Boolean;
var
Path : TPointArray;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

case Lowercase(Where) of
'bank' : Path := [Point(4943 + Random(5), 3955 + Random(5)),
Point(4917 + Random(5), 3993 + Random(5))];

'shop' : Path := [Point(4944 + Random(5), 3955 + Random(5)),
Point(4940 + Random(5), 3896 + Random(5))];
end;

Result := SPS_WalkPath(Path);
end;

function TanHides: Boolean;
var
X, Y, R, leatherDTM : Integer;
Hide, Text : string;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;
if (not(IsShopOpen)) then ExitPlayer('The shop is not open...');

Hide := Players[CurrentPlayer].Strings[LEATHER];

case Lowercase(Hide) of
'leather' :
begin
Text := 'Soft';
leatherDTM := LoadDTM('leather');
end;
end;

if FindDTM(leatherDTM, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
FreeDTM(leatherDTM);
Write('We already have tanned leather in our inventory!');
Result := True;
Exit;
end;

if (not(CanTan)) then ExitPlayer('Can not tan...');

if (not(FindTextTPAEx(65280, 10, MSX1, MSY1, MSX2, MSY2, X, Y, Text,
'SmallChars', Nothing))) then
begin
FreeDTM(leatherDTM);
ExitPlayer('We were unable to tan the hides...');
end;

Mouse(X, Y, 10, 5, False);
if (not(WaitOption('All', 1050))) then
begin
FreeDTM(leatherDTM);
ExitPlayer('We were unable to tan the hides...');
end;

for R := 1 to 5 do
begin
if (FindDTM(leatherDTM, X, Y, MIX1, MIY1, MIX2, MIY2)) then
begin
Result := True;
IncEx(Players[CurrentPlayer].Integers[TANNED], 27);
Break;
end;

Wait(RandomRange(350, 550));
end;

FreeDTM(leatherDTM);

if (R = 5) then
begin
ExitPlayer('We were unable to tan the hides...');
end;
end;

function TradeEllis: Boolean;
var X, Y, R : Integer;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

if (IsShopOpen) then
begin
Result := True;
Exit;
end;

GetMousePos(X, Y);
Mouse(X, Y, 0, 0, False);

if (not(WaitOption('Trad', 1477))) then
begin
ExitPlayer('We were unable to find the option to trade Ellis...');
end;

for R := 1 to 5 do
begin
if (IsShopOpen) then
begin
Result := True;
Break;
end;

Wait(RandomRange(250, 550));
end;
end;

function MouseEllis: Boolean;
var
X, Y, R, L, H : Integer;
curPos : TPoint;
ellisTPA : TPointArray;
ellisATPA : T2DPointArray;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

if (IsShopOpen) then
begin
Write('The shop is already open.');
Result := True;
Exit;
end;

while (IsMoving) do
begin
Antiban;
Wait(RandomRange(150, 250));
end;

if (not(SPS_PosOnMM(Point(4935, 3850)))) then
begin
Write('We might be stuck in the middle of the road...');

if (not(ClickSymbol('tanner', 0.5))) then
begin
ExitPlayer('We were unable to fix our position...');
end;
end;

curPos := SPS_GetMyPos;
if (curPos = Point(4935, 3890)) then
OnEllis_SPS;

repeat
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

if (IsShopOpen) then
begin
Write('The shop is already open.');
Result := True;
Exit;
end;

SetCTS(0.01, 0.63);
FindColorsSpiralTolerance(X, Y, ellisTPA, 2246820, MSX1, MSY1, MSX2, MSY2, +
22);
RevertCTS;

ellisATPA := SplitTPAEx(ellisTPA, 10, 10);

if (Length(ellisATPA) > 0) then
begin
SortATPAFromFirstPoint(ellisATPA, Point(MSCX, MSCY));
H := High(ellisATPA);
for L := 0 to H do
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;
if (IsShopOpen) then Exit;

if (Length(ellisATPA[L]) > 15) then
begin
MiddleTPAEx(ellisATPA[L], X, Y);
MMouse(X, Y, 5, 5);
Wait(RandomRange(350, 450));

Result := WaitUpText('Talk', 1050);
end;

if (Result) then Exit;
end;
end;

Inc(R);
until((R >= 5) or (Result) or (not(LoggedIn)));

if (R >= 5) then
begin
ExitPlayer('We were unable to find Ellis...');
end;
end;

function BankHides: Boolean;
var
X, Y, I, R, L, hideDTM, leatherDTM : Integer;
Tanning : string;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

Tanning := Players[CurrentPlayer].Strings[LEATHER];

case Lowercase(Tanning) of
'leather' :
begin
hideDTM := LoadDTM('cowhide');
leatherDTM := LoadDTM('leather');
end;
end;

if (PinScreen) then
InPin(Players[CurrentPlayer].Pin);

if (not(BankScreen)) then
ExitPlayer('Unable to bank...');

for I := 1 to 2 do
begin
case (I) of
1 : // Deposits leather
begin
if (not(FindDTM(leatherDTM, X, Y, MIX1, MIY1, MIX2, MIY2))) then
begin
Write('No leather in our inventory to bank...');
FreeDTM(leatherDTM);
Continue;
end;

FreeDTM(leatherDTM);

Mouse(X, Y, 5, 5, False);
if (not(WaitOption('All', 1080))) then
ExitPlayer('We did not find the option to bank the leather...');

leatherDTM := LoadDTM('leather');

for R := 1 to 5 do
begin
if (not(FindDTM(leatherDTM, X, Y, MIX1, MIY1, MIX2, MIY2))) then
Break;

Wait(RandomRange(250, 450));
end;

FreeDTM(leatherDTM);

if (R = 5) then
begin
ExitPlayer('We were unable to bank the leather in our inventory.');
end;
end;

2 : // Withdraws hides
begin
if (not(FindDTM(hideDTM, X, Y, MSX1, MSY1, MSX2, MSY2))) then
begin
FreeDTM(hideDTM);
ExitPlayer('We have no more hides...');
end;

FreeDTM(hideDTM);

Mouse(X, Y, 5, 5, False);
if (not(WaitOption('All', 1077))) then
begin
ExitPlayer('We were unable to withdraw more hides (ChooseOption).');
end;

hideDTM := LoadDTM('cowhide');

for L := 1 to 5 do
begin
if ((FindDTM(hideDTM, X, Y, MIX1, MIY1, MIX2, MIY2))) then
begin
Result := True;
Break;
end;

Wait(RandomRange(250, 450));
end;

FreeDTM(hideDTM);

if (L = 5) then
begin
ExitPlayer('We were unable to withdraw more hides...');
end;
end;
end;
end;
end;

function RI_OpenBank: Boolean; // Opens the bank by the NPCs - Uses TPAs
var
X, Y, R, L, H, N : Integer;
bankerTPA : TPointArray;
bankerATPA : T2DPointArray;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

if ((BankScreen) or (PinScreen)) then
begin
Write('The bank is already open.');
Result := True;
Exit;
end;

while (IsMoving) do
begin
Antiban;
Wait(RandomRange(150, 350));
end;

if (not(SPS_PosOnMM(Point(4885, 4045)))) then
begin
if (not(SPSWalks('bank'))) then
ExitPlayer('We were unable to find the bank...');
end;

repeat
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

SetCTS(0.03, 0.07);
FindColorsSpiralTolerance(X, Y, bankerTPA, 3099499, MSX1, MSY1, MSX2, MSY2,
13);
RevertCTS;

bankerATPA := SplitTPAEx(bankerTPA, 15, 15);

if (Length(bankerATPA) > 0) then
begin
SortATPAFromFirstPoint(bankerATPA, Point(MSCX, MSCY));
H := High(bankerATPA);
for L := 0 to H do
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

if (Length(bankerATPA[L]) > 20) then
begin
MiddleTPAEx(bankerATPA[L], X, Y);
MMouse(X, Y, 3, 5);
if (WaitUpText('Talk', 1050)) then
begin
Mouse(X, Y, 0, 0, False);

if WaitOption('ank B', 1101) then
begin
for N := 1 to 5 do
begin
if ((BankScreen) or (PinScreen)) then
begin
Result := True;
Exit;
end;

Wait(RandomRange(350, 550));
end;
end;
end;
end;
end;
end;

Inc(R);
until((R >= 5) or (Result) or (not(LoggedIn)));

if (R >= 5) then
ExitPlayer('We were unable to open the bank...');
end;

procedure MainLoop;
var hidesTanned, hidesToTan : Integer;
begin
repeat
hidesToTan := Players[CurrentPlayer].Integers[TO_TAN];

repeat
if (SPSWalks('shop')) then
if (MouseEllis) then
if (TradeEllis) then
if (TanHides) then
if (SPSWalks('bank')) then
if (RI_OpenBank) then
BankHides;

hidesTanned := Players[CurrentPlayer].Integers[TANNED];
until((hidesTanned >= hidesToTan) or (not(LoggedIn)));

if (hidesTanned >= hidesToTan) then
ExitPlayer('Finished tanning ' + ToStr(hidesToTan) + ' hides.');

until((AllPlayersInactive));
end;

procedure Setup;
var DTM, X, Y : Integer;
begin
SMART_Server := WORLD;
SMART_Members:= MEMBERS;

SetupSRL;
DeclarePlayers;
LoginPlayer;

SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
SetAngle(True);
ClearDebug;

MainLoop;
end;

begin
Setup;
end.


program RadialWalking;
{$DEFINE SMART}
{$i SRL/SRL.scar}

const
WORLD = 35;
MEMBERS = False;

procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';

Active := True;
end;
end;

function aColor: Integer; // Finds the varrock road color/colour
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(3.89, 0.22);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 7763825, MMX1,
MMY1, MMX2, MMY2, 10);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 10.72) and (X <= 24.95) and (Y >= 11.37) and (Y <= 26.34) and +
(Z >= 11.73) and (Z <= 27.16) then
begin
Result := arC[i];
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function WalkToWestBank(Step: Integer): Boolean;
var
Color : Integer;
R : TIntegerArray;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

Color := aColor;

case (Step) of
1 : R := [276, 261, 56];
2 : R := [281, 264, 61];
3 : R := [276, 261, 67];
4 : R := [277, 266, 68];
end;

Result := RadialWalkTolerance(Color, R[0], R[1], R[2], 5, 5, 30);
end;

function Walk: Boolean;
var X, Y, I : Integer;
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

for I := 1 to 4 do
begin
if (not(LoggedIn)) then Exit;
FindNormalRandoms;

if (WalkToWestBank(I)) then
begin
WriteLn('Step ' + ToStr(I) + ' completed.');
Flag;
end;
end;

SymbolAccuracy := 0.5;
Result := FindSymbol(X, Y, 'bank');
SymbolAccuracy := 0.8;
end;

procedure Setup;
begin
SMART_Server := WORLD;
SMART_Members:= MEMBERS;

SetupSRL;
DeclarePlayers;
LoginPlayer;
SetAngle(True);
MakeCompass('N');
SetRun(True);

if (Walk) then
WriteLn('We have successfully walked to Varrock west bank.');
end;

begin
Setup;
end.

i luffs yeww

2011-12-05 01:13:36

Yes. :)

Flight

2011-12-05 01:22:25

The script covers plenty of the include. You've been active around the forums and judging from your cups you're helpful. I vote yes.

RISK

2011-12-05 01:36:03

Thank you both.

Hobbit

2011-12-05 01:43:21

Yes

P1nky

2011-12-05 02:06:22

Yes!

kingarabian

2011-12-05 02:07:34

Fuck yeah.

tico2

2011-12-05 02:48:37

Finally one of the juniors apply them self :)

Yes!

Kyle Undefined

2011-12-05 02:54:11

Took you long enough! YES! :D

RISK

2011-12-05 03:12:09

Thank you all. It means a lot to me.

Harry

2011-12-05 04:38:32

I liked your old avatar better :(

Yes.

Markus

2011-12-05 05:59:08

I was waiting for this one, too. Yes!

Sabzi

2011-12-05 07:14:18

Of course.

Dervish

2011-12-05 11:36:11

Simply from your attitude, contribution and general behaviour, its a raging yes.

Dynamite

2011-12-05 11:39:45

Change back to your old avatar and it's a yes. :)

-Boom

mixster

2011-12-05 12:43:11

RTanner:
  • ClickSymbol:
  • You don't set result to true at any point;
  • OnEllis_Sym:
  • code repetition from ClickSymbol - the whole symbol finding if SPS fails;
  • TanHides:
  • Shouldn't you check if there is leather that can be tanned rather than assuming that tanned leather means the player can't tan? Also not sure why you have to search for the DTM five times without any waiting - either add a small wait in case the tanning just hasn't happened yet or change the DTM somehow to make it less precise or only search once. It is also assumed that 27 pieces have been tanned rather than counting to see how many actually have been - may be more accurate to change it from pieces tanned to loads tanned. Also, your "R=5" check for inability to tan is wrong; if a for loop terminates, then the variable that's doing the looping is one above the maximum - it will currently trigger as unable to tan if it found the DTM on the final loop. The DTM is not freed CanTan returns false. To be honest, the code would be much neater if you freed the DTM after the first search and then just re-loaded it later on or if you loaded the DTM into a global variable at the beginning of the script and freed it at the termination of the script.
  • MouseEllis:
  • You use ClickSymbol even though it doesn't actually click or do anything, but from the context it's implied that you think ClickSymbol does. Why do you set the CTS every time in the loop when you could set it before and then reset it afterwards? Your repeat loop is very redundant as you exit the function when you set Result to True and the first thing you do in the loop is exit if the player isn't logged in, so it's pointless having them in your until part - once you remove them, you might as well make it a for loop. Similar to the last, your final check of R>=5 is pointless since you would have exited the function already if result was true and you will only get to that bit if result isn't true.
  • BankHides:
  • DTMs not freed if BankScreen returns false. There is no reason at all to encompass basically everything else in a for loop that triggers a case of large statements - it just looks ugly. You free the DTM only to then load it again a few lines down and then free it - why not just load it before the loop (which you already do) and then free it outside of the loop? Once again, you use a for loop and then check if R is 5 rather than R is 6. Similar is true for the second half of the case statement. It is also the case that hideDTM isn't freed if the banking fails (the R=5 triggered ExitPlayer.)
  • RI_OpenBank:
  • It has a lot of the same problem as MouseEllis.
  • MainLoop:
  • Bad news, you don't have a multiplayer script. CurrentPlayer is never incremented as you set the player to Inactive yourself rather than using NextPlayer(), so only the first player is run through. If there is more than one player, it will infinitely loop on running through the functions that will return false because the player isn't logged in. You don't even have any kind of logging in functionality in the main loop, so it can't be multiplayer.
  • Setup:
  • Reinforces the singleplayer nature of the script by having a solitary LoginPlayer that is run once only.

There's nothing inherently wrong with the radial walker at first glance and I'm a little bored having gone through the tanner already, so I'll just leave these here for you and others to digest.

RISK

2011-12-05 13:52:40

Thank you very much, Mixster. It means a lot to me that you'd take the time to go thru my script and look at the flaws of it. I will definitely take your post and learn from it.

Again, thank you very much.

Floor66

2011-12-05 14:55:13

I haven't been active at all lately, so I don't know how you are on the forums but scrolling through your code: yes!

Nava2

2011-12-05 14:57:21

mixster, my god man.. WHITESPACE. You code in python, you're familiar with the concept!

As I said previously, yup. :)

RISK

2011-12-05 15:07:39

Thank you both, I really appreciate your votes.

Hobbit

2011-12-05 18:39:58

In! :)