SRL Archive - First Scripts

Will not walk


King

2012-12-02 17:11:34

Tried creating a help thread, but no one has answered yet.

Script recognizes that the inventory is full but will not walk the path.

Program BeerBuyer;

{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}


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

with Players[0] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
Active := True;
Pin := ''; //Your pin
end;
end;

var
x, y, T: Integer;

Procedure Login;

begin
ClearDebug;
{$IFDEF SMART}
{$IFDEF SRLKING}
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}
DeclarePlayers;
LoginPlayer;
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
end;

procedure Antiban;
begin
if not LoggedIn then LoginPlayer;
Wait(250+random(50));
if not LoggedIn then Exit;
FindNormalRandoms;
case Random(90) of
2: PickUpMouse;
3: RandomMovement;
4: BoredHuman;
5: ExamineInv;
7: SetAngle(SRL_ANGLE_HIGH);
8: Wait(5000+random(2000));
end;
end;

Procedure WalkToBar;
Var
ToBar:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['Beer_Map']);
ToBar := [Point(98, 76), Point(98, 86), Point(98, 98), Point(99, 105), Point(117, 106), Point(136, 107), Point(146, 108), Point(156, 108), Point(176, 109), Point(182, 113), Point(194, 120), Point(197, 128), Point(200, 141), Point(204, 151), Point(205, 159), Point(203, 174), Point(204, 186), Point(204, 211), Point(205, 227), Point(205, 245), Point(211, 253), Point(230, 253), Point(258, 246)];
SPS_WalkPath(ToBar);
end;

Procedure WalkToBank;
Var
ToBank:TPointArray;
begin
writeln('Walking to the bank');
SPS_Setup(RUNESCAPE_SURFACE,['Beer_Map']);
ToBank := [Point(244, 252), Point(229, 254), Point(216, 254), Point(210, 246), Point(205, 220), Point(204, 198), Point(204, 171), Point(204, 158), Point(205, 146), Point(199, 128), Point(191, 120), Point(180, 111), Point(172, 109), Point(162, 109), Point(151, 109), Point(144, 107), Point(128, 106), Point(115, 106), Point(105, 106), Point(101, 102), Point(101, 93), Point(101, 85), Point(100, 78)];
SPS_WalkPath(ToBank);
end;

Procedure WalkToBankFromLoadstone;
Var
ToBank:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE,['11_7','11_6','10_6','10_7','12_7','12_6']);
ToBank := [Point(4681, 3122), Point(4682, 3101), Point(4684, 3081), Point(4683, 3062), Point(4683, 3045), Point(4680, 3026), Point(4680, 3007), Point(4678, 2994), Point(4678, 2974), Point(4674, 2959), Point(4669, 2948), Point(4654, 2937), Point(4640, 2934), Point(4626, 2934), Point(4600, 2933), Point(4588, 2931), Point(4585, 2925), Point(4584, 2917), Point(4584, 2906)];
SPS_WalkPath(ToBank);
end;

Procedure TeleportToVarrock;
begin
end;

Function AtBank:Boolean;
Begin
Wait(250+random(50));
if FindBank('vwb') then
begin
writeln('At the bank');
Result:=True;
end
else
begin
writeln('We are not at the bank Teleporting to varrock and walking there');
Result:=False;
end;
end;

function FindBartender(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
if PinScreen then InPin(Players[0].Pin);
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.28, 0.11);

if not(FindColorsTolerance(arP, 6776163, MSX1, MSY1, MSX2, MSY2, 6)) then
begin
Writeln('Cannont find bartender');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

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

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

if (X >= 8.72) and (X <= 16.40) and (Y >= 9.22) and (Y <= 17.35) and (Z >= 10.53) and (Z <= 19.95) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Talk-to')) then
begin;
Result := True;
Break;
end;
end;

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

if (i = arL + 1) then
begin
Writeln('Cannot find bartender');
Exit;
end;

GetMousePos(fx, fy);
end;

Function FindChatBartender: Boolean;
Begin
if FindColor(x, y, 2046022, 22, 365, 129, 460) then Result:= True
else Result:= False;
end;

Procedure ClickBartender;
Begin
if PinScreen then InPin(Players[0].Pin);
// if AtBar then
Begin
MarkTime(t);
repeat
if FindBartender(X, Y) then
Begin
Mouse(x, y, 0, 0, False)
wait(250+random(50));
ChooseOption('Talk-to');
end;
until(FindChatBartender or (TimeFromMark(t) > 5000));
end;
end;

Procedure BuyBeer;
Begin
ClearDebug;
if PinScreen then InPin(Players[0].Pin);
ClickBartender;
// If then
begin
wait(1200+random(50));
Mouse(259, 469, 5, 5, True);
wait(950+random(50));
Mouse(260, 395, 5, 5, True);
wait(950+random(50));
Mouse(259, 469, 5, 5, True);
wait(950+random(50));
Mouse(259, 469, 5, 5, True);
end;
end;

begin
SRL_SixHourFix := True;
SetupSRL;
DeclarePlayers;
Repeat
Login;
if not LoggedIn then LoginPlayer;
If not AtBank then TeleportToVarrock;
WalkToBar;
repeat
if InvCount=28 then WalkToBank
else
BuyBeer;
until(InvCount=28);
WalkToBank;
// DepositBeer;
Until(not LoggedIn);
end.

Ashaman88

2012-12-02 17:50:15

Have you tried running the walktobank function by itself to see if it works?

DannyRS

2012-12-02 19:19:58

Im not 100% sure but i dont think you can load a different SPS map mid code, so your procedure walk to bank will cause problems,

SPS_Setup(RUNESCAPE_SURFACE,['Beer_Map']);

This will mean that the sps map will not change from the first time this function (SPS_SetUp) gets called in code

Like Ashaman suggested, call the bank function by itself, see if it works,

I was having simular issues, but putting all the PNGs into one image and loading that in the Setup procedure and updating all the walk points fixed this for me, personally i find SPS to be very unreliable lately

King

2012-12-02 19:33:26

I will try what has been sugested, the function does work by itself. thanks guys :P Ill edit with the result.

DannyRS

2012-12-02 19:40:13

From: SRLKing
I will try what has been sugested, the function does work by itself. thanks guys :P Ill edit with the result.


Let us know how it turns out! :)

Another tip: if you make a custom SPS, and the bank is not close to where you are going to (e.g. Teleporting between places) then you can just add a little black blank space between two parts on a custom map, then add as many different places you need (if you dont understand my jibberish take a look at my soulwars SPS Map, you would have to grt the link from the code though)

GoodLuck!

King

2012-12-02 20:55:38

From: DannyRS
Im not 100% sure but i dont think you can load a different SPS map mid code, so your procedure walk to bank will cause problems,

SPS_Setup(RUNESCAPE_SURFACE,['Beer_Map']);

This will mean that the sps map will not change from the first time this function (SPS_SetUp) gets called in code

Like Ashaman suggested, call the bank function by itself, see if it works,

I was having simular issues, but putting all the PNGs into one image and loading that in the Setup procedure and updating all the walk points fixed this for me, personally i find SPS to be very unreliable lately


Suggestion worked, Thankyou!

DannyRS

2012-12-02 21:23:57

From: SRLKing
Suggestion worked, Tahnkyou!


Glad i was able to help :)