Log in

View Full Version : SPS Walking



okokokok
06-19-2012, 07:52 PM
Hello guys,

I finally picked up scripting again.
So I made a script, still a rough beta version.
I made all the other procedures except walking. I used to walk with sps, so i thought, why not again. But this time i can't get SPS to even walk.
If someone could help me out and tell me what to change or recommend me another walking method i'd be very thankfull :)


program EssenceMiner;
{$DEFINE SMART}
{$DEFINE SRL5}

{$i SRL\SRL.simba}
{$i SPS\SPS.simba}
{$i SRL\SRL\skill\mining.simba}


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

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Pin := '';
Players[0].Active:= True;
Players[0].BoxRewards := ['oins'];
end;

procedure AntiBan;
begin
if (not(LoggedIn)) then
Exit;
Case Random (1000) of
0..4:
begin
HoverSkill('Constitution', false);
wait(2453+Random(432));
end;
40.44:
begin
HoverSkill('Attack', false);
wait(2453+Random(432));
end;
80..84:
begin
HoverSkill('Strength', false);
wait(2453+Random(432));
end;
120..124:
begin
HoverSkill('Defence', false);
wait(2453+Random(432));
end;
150: BoredHuman;
200..203: PickUpMouse;
250..252: RandomRClick;
300..302: RandomMovement;
350..352: ExamineInv;
400..404:
begin
HoverSkill('random', false);
sleepandmovemouse(276 + Random(100));
PickUpMouse;
ChooseOption('Cancel');
SetAngle(SRL_ANGLE_HIGH);
end;
450..452: BoredHuman;
500..502: PickUpMouse;
550..552: RandomRClick;
600..602: RandomMovement;
650..652: SleepAndMoveMouse(3000 + Random(500));
end;
end;

procedure AntiRandom;
begin
FindNormalRandoms;
LampSkill := 'mining';
LevelUp;
end;

procedure SetDoorDTM;
var x, y, i: Integer;
Door: Array [0..2] of Integer;
begin
Door[0] := DTMFromString('mWAAAAHicY2FgYAhhZGAIBeJIII4B4r1AsW NAfASI9wFxeaYzQ3GaI0NhigNDdrwNAzpgRMMgAADtyQjI');
Door[1] := DTMFromString('mWAAAAHicY2FgYIhlZGAIB+JIRgj7NgMEPw TipyD5IBOG5HALMAax0QEjGgYBAO7FCJ0=');
Door[2] := DTMFromString('mWAAAAHicY2FgYAhnZGDwAeIARgj7HAMEXw Hiq0BcnukMxunRVgypkZYM6IARDYMAAPJTCNU=');
end;

procedure FreeDoorDTM;
var x, y: Integer;
Door: Array [0..2] of Integer;
begin
FreeDTM(Door[0]);
FreeDTM(Door[1]);
FreeDTM(Door[2]);
end;

procedure OpenDoor;
var x, y, i: Integer;
Door: Array [0..2] of Integer;
aFound: Extended;
begin
Door[0] := DTMFromString('mWAAAAHicY2FgYAhhZGAIBeJIII4B4r1AsW NAfASI9wFxeaYzQ3GaI0NhigNDdrwNAzpgRMMgAADtyQjI');
Door[1] := DTMFromString('mWAAAAHicY2FgYIhlZGAIB+JIRgj7NgMEPw TipyD5IBOG5HALMAax0QEjGgYBAO7FCJ0=');
Door[2] := DTMFromString('mWAAAAHicY2FgYAhnZGDwAeIARgj7HAMEXw Hiq0BcnukMxunRVgypkZYM6IARDYMAAPJTCNU=');

for i:= 0 to 2 do
If FindDTM(Door[i],x,y,MSX1,MSY1,MSX2,MSY2) then
begin
Writeln('Oh Oh Door Found');
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('Ope');
Writeln('Door opened');
Wait(1000 + random(100));
end;
end;

procedure WalkToAubury;
var x,y: Integer;
myPath: TPointArray;
begin
SetupSRL;
writeln('gonna walk')
SPS_Setup(RUNESCAPE_SURFACE,['12_7']);
myPath := [Point(4849, 2972), Point(4849, 2966), Point(4850, 2959), Point(4852, 2950), Point(4855, 2943), Point(4858, 2939), Point(4867, 2935), Point(4874, 2939), Point(4878, 2944), Point(4879, 2951), Point(4880, 2957), Point(4880, 2964), Point(4880, 2970), Point(4880, 2976), Point(4880, 2981), Point(4879, 2986), Point(4879, 2992), Point(4875, 2996), Point(4874, 3000), Point(4872, 3005), Point(4869, 3008), Point(4867, 3014), Point(4866, 3018), Point(4866, 3024), Point(4865, 3032), Point(4863, 3038), Point(4863, 3043), Point(4863, 3048), Point(4860, 3053), Point(4856, 3057), Point(4850, 3060)]
writeln('fail?');
SPS_WalkPath(myPath);
writeln('fuck yea');
Wait(1000 + Random(100));
Writeln('Fucking arrived');
end;

procedure WalkToBank;
var x,y: Integer;
myPath: TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE, ['12_7']);
myPath := [Point(4849, 3047), Point(4848, 3054), Point(4850, 3061), Point(4856, 3058), Point(4860, 3048), Point(4864, 3040), Point(4868, 3029), Point(4870, 3019), Point(4870, 3012), Point(4874, 3003), Point(4882, 2993), Point(4881, 2982), Point(4883, 2973), Point(4882, 2968), Point(4883, 2962), Point(4879, 2951), Point(4880, 2941), Point(4867, 2935), Point(4857, 2935), Point(4851, 2940), Point(4851, 2950), Point(4851, 2961), Point(4851, 2969)];
SPS_WalkPath(myPath);
Wait(1000 + Random(100));
end;

function AuburyColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.07);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 4019035, MMX1, MMY1, MMX2, MMY2, 8);
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 >= 4.44) and (X <= 13.48) and (Y >= 4.70) and (Y <= 14.30) and (Z >= 3.14) and (Z <= 9.09) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(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;

procedure TeleportToMine;
var x,y: Integer;
begin
SetAngle(SRL_ANGLE_HIGH);
If FindObj(x,y,'Aubury',AuburyColor,5) then
begin
Writeln('Aubury Found');
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('Tele');
Writeln('Teleporting!');
Wait(3000 + Random(100));
end
else
If FindObj(x,y,'Aubury',AuburyColor,5) then
begin
Writeln('Aubury Found');
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('Tele');
Writeln('Teleporting!');
Wait(3000 + Random(100));
end
else
If FindObj(x,y,'Aubury',AuburyColor,5) then
begin
Writeln('Aubury Found');
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('Tele');
Writeln('Teleporting!');
Wait(3000 + Random(100));
end;
end;

procedure MineEssence;
var x,y,i: Integer;
Essence: Array [0..4] of Integer;

begin
Essence[0] := DTMFromString('mWAAAAHicY2FgYPgCxO+B+AMQfwfiGiCuBu J6IG4A4t2bNzPs3boVjtEBIxoGAQAlYw5f');
Essence[1] := DTMFromString('mQwAAAHicY2ZgYPgDxcyMDAxrgPRKKJ4zdR rD9AkTwTQyYETCQAAAizsJRw==');
Essence[2] := DTMFromString('mlwAAAHicY2dgYNBlZGDQBGItINYHYkMg1o Gy1zJA8AYoXgPEq4B4BRD3dbQzTO7tZZjY3c3Q09aGwscHGPFg KAAAJ4IRgw==');
Essence[3] := DTMFromString('mQwAAAHicY2ZgYNBkZGCQB2JVIE5mgOAoIK 6vqmSYMWkSw4TOTgZkwIiEgQAA8wEGZw==');
Essence[4] := DTMFromString('mQwAAAHicY2ZgYDgPxGeA+DIQ1wJxFRBXA/HerVvBeN+2bQzIgBEJAwEAsHgKXw==');

for i:= 0 to 4 do
If FindDTM(Essence[i],x,y,MSX1,MSY1,MSX2,MSY2) then
begin
SetAngle(SRL_ANGLE_HIGH);
Writeln('Essence Found');
repeat
Wait (50 + random(50));
case Random(5) of
0:
begin
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('Min');
Wait(25000 + random(4000));
end;
1:
begin
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('Min');
Wait(25000 + random(4000));
end;
2:
begin
MMouse(x,y,0,0);
Mouse(x,y,5,5,true);
Wait(25000 + random(4000));
end;
3:
begin
MMouse(x,y,0,0);
Mouse(x,y,5,5,true);
Wait(25000 + random(4000));
end;
4:
begin
MMouse(x,y,0,0);
Mouse(x,y,5,5,true);
Wait(25000 + random(4000));
end;
end;
until (InvFull);
Exit;
end;
end;

Procedure OpenBankCustom;
var x,y,i: Integer;
Booth: Array [0..1] of Integer;

begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
Booth[0] := DTMFromString('mQwAAAHicY2ZgYOBmZGDgA2IRIGYFYgYgZg Hi0hQThvx4QzCNDBiRMBAAAHhdA1w=');
Booth[1] := DTMFromString('mQwAAAHicY2ZgYGBjZGDgBWJRIP4E5L8H4m 9A3FwZz9BWncBQlB3JgAwYkTAQAAAXagb7');

If FindDTM(Booth[i],x,y,MSX1,MSY1,MSX2,MSY2) then
begin
Writeln('Booth Found');
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('ank');
Wait(3000 + random(500));
end;

if not(BankScreen) then
begin
Writeln('Bank did not open the first time')
if FindDTM(Booth[i],x,y,MSX1,MSY1,MSX2,MSY2) then
begin
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('ank');
Wait(3000 + random(500));
end;
end;

if not(BankScreen) then
begin
Writeln('Bank did not open the second time')
if FindDTM(Booth[i],x,y,MSX1,MSY1,MSX2,MSY2) then
begin
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('ank');
Wait(3000 + random(500));
end;
end;
FreeDTM(Booth[0]);
FreeDTM(Booth[1]);
end;

procedure DepositEssence;
var x,y: Integer;
begin
If (PinScreen) then
InPin(Players[0].Pin);

If (BankScreen) then
Begin
Writeln('In the Bank');
DepositAll;
Writeln('Everything Banked');
CloseBank;
end;
end;





procedure OneRun;
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_LOW);
WalkToAubury;
//OpenDoor;
//TeleportToMine;
//MineEssence;
//WalkToBank;
//OpenBankCustom;
//DepositEssence;

end;



begin
Smart_Server := 17;
Smart_Members := false;
Smart_Signed := true;
Smart_SuperDetail := false;
clearDebug();
setupSRL;
DeclarePlayers;
if (Not(LoggedIn)) then
begin
LogInPlayer;
Wait(2500 + Random(1500));
end;
OneRun;
end.

The problem is in the procedure 'WalkToAubury' and 'WalkToBank'. This is ofcourse in east varrock for the rune essence.

Greetz and thanks in advance! :)

EDIT: Still need to change my antiban :) (Picked it up from my fighting scripts)

J J
06-19-2012, 08:37 PM
You don't need to SetupSRL in that WalkToAubury procedure. It looks similiar to my SPS walking procedures so yeah.. Make sure that you have SPS 2.0, it is much more accurate than SPS 1.0

Sometimes you need to set up more area's even though the path generator tells you to setup just one. Try this:
SPS_Setup(RUNESCAPE_SURFACE, ['12_7', '11_7']);

Another thing I saw:
procedure OpenDoor;
var x, y, i: Integer;
Door: Array [0..2] of Integer;
aFound: Extended;
begin
Door[0] := DTMFromString('mWAAAAHicY2FgYAhhZGAIBeJIII4B4r1AsW NAfASI9wFxeaYzQ3GaI0NhigNDdrwNAzpgRMMgAADtyQjI');
Door[1] := DTMFromString('mWAAAAHicY2FgYIhlZGAIB+JIRgj7NgMEPw TipyD5IBOG5HALMAax0QEjGgYBAO7FCJ0=');
Door[2] := DTMFromString('mWAAAAHicY2FgYAhnZGDwAeIARgj7HAMEXw Hiq0BcnukMxunRVgypkZYM6IARDYMAAPJTCNU=');

for i:= 0 to 2 do
If FindDTM(Door[i],x,y,MSX1,MSY1,MSX2,MSY2) then
begin
Writeln('Oh Oh Door Found');
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('Ope');
Writeln('Door opened');
Wait(1000 + random(100));
end;
end;
This means it will open the door 3 times if it finds each DTM. Put a break if it finds the dtm so it breaks the loop but it will still continue to open the door once.
Break;

okokokok
06-19-2012, 08:39 PM
You don't need to SetupSRL in that WalkToAubury procedure. It looks similiar to my SPS walking procedures so yeah.. Make sure that you have SPS 2.0, it is much more accurate than SPS 1.0

Sometimes you need to set up more area's even though the path generator tells you to setup just one. Try this:
SPS_Setup(RUNESCAPE_SURFACE, ['12_7', '11_7']);

Another thing I saw:
procedure OpenDoor;
var x, y, i: Integer;
Door: Array [0..2] of Integer;
aFound: Extended;
begin
Door[0] := DTMFromString('mWAAAAHicY2FgYAhhZGAIBeJIII4B4r1AsW NAfASI9wFxeaYzQ3GaI0NhigNDdrwNAzpgRMMgAADtyQjI');
Door[1] := DTMFromString('mWAAAAHicY2FgYIhlZGAIB+JIRgj7NgMEPw TipyD5IBOG5HALMAax0QEjGgYBAO7FCJ0=');
Door[2] := DTMFromString('mWAAAAHicY2FgYAhnZGDwAeIARgj7HAMEXw Hiq0BcnukMxunRVgypkZYM6IARDYMAAPJTCNU=');

for i:= 0 to 2 do
If FindDTM(Door[i],x,y,MSX1,MSY1,MSX2,MSY2) then
begin
Writeln('Oh Oh Door Found');
MMouse(x,y,0,0);
Mouse(x,y,5,5,false);
ChooseOption('Ope');
Writeln('Door opened');
Wait(1000 + random(100));
end;
end;
This means it will open the door 3 times if it finds each DTM. Put a break if it finds the dtm so it breaks the loop but it will still continue to open the door once.
Break;

Thank you very much! <3 Gonna try it out ;)

CephaXz
06-19-2012, 08:42 PM
Just set click on the maps around your area to get more areas. And you could just use InvertTPA to walk back to bank using the same path. Here's mine:


procedure WalkToAubury;
var
myPath: TPointArray;
begin
//writeln('gonna walk')
SPS_Setup(RUNESCAPE_SURFACE,['12_7', '11_7', '12_6', '11_6']);
myPath := [Point(4849, 2972), Point(4849, 2966), Point(4850, 2959), Point(4852, 2950), Point(4855, 2943), Point(4858, 2939), Point(4867, 2935), Point(4874, 2939), Point(4878, 2944), Point(4879, 2951), Point(4880, 2957), Point(4880, 2964), Point(4880, 2970), Point(4880, 2976), Point(4880, 2981), Point(4879, 2986), Point(4879, 2992), Point(4875, 2996), Point(4874, 3000), Point(4872, 3005), Point(4869, 3008), Point(4867, 3014), Point(4866, 3018), Point(4866, 3024), Point(4865, 3032), Point(4863, 3038), Point(4863, 3043), Point(4863, 3048), Point(4860, 3053), Point(4856, 3057), Point(4850, 3060)]
//myPath := [Point(4850, 2959), Point(4853, 2947), Point(4865, 2947), Point(4883, 2951), Point(4884, 2967), Point(4883, 2984), Point(4877, 3005), Point(4865, 3021), Point(4864, 3048), Point(4850, 3048)];
//writeln('fail?');
SPS_WalkPath(myPath);
writeln('fuck yea');
Wait(1000 + Random(100));
Writeln('Fucking arrived');
InvertTPA(myPath); //Invert the paths from aubury to bank
SPS_WalkPath(myPath);
end;


Above is just an example. You might want to work out on something, like making the path global or something so that you need not to declare it again in every procedure. And I find the path you made is not quite accurate, might wanna make one again.

okokokok
06-19-2012, 09:05 PM
Just set click on the maps around your area to get more areas. And you could just use InvertTPA to walk back to bank using the same path. Here's mine:


procedure WalkToAubury;
var
myPath: TPointArray;
begin
//writeln('gonna walk')
SPS_Setup(RUNESCAPE_SURFACE,['12_7', '11_7', '12_6', '11_6']);
myPath := [Point(4849, 2972), Point(4849, 2966), Point(4850, 2959), Point(4852, 2950), Point(4855, 2943), Point(4858, 2939), Point(4867, 2935), Point(4874, 2939), Point(4878, 2944), Point(4879, 2951), Point(4880, 2957), Point(4880, 2964), Point(4880, 2970), Point(4880, 2976), Point(4880, 2981), Point(4879, 2986), Point(4879, 2992), Point(4875, 2996), Point(4874, 3000), Point(4872, 3005), Point(4869, 3008), Point(4867, 3014), Point(4866, 3018), Point(4866, 3024), Point(4865, 3032), Point(4863, 3038), Point(4863, 3043), Point(4863, 3048), Point(4860, 3053), Point(4856, 3057), Point(4850, 3060)]
//myPath := [Point(4850, 2959), Point(4853, 2947), Point(4865, 2947), Point(4883, 2951), Point(4884, 2967), Point(4883, 2984), Point(4877, 3005), Point(4865, 3021), Point(4864, 3048), Point(4850, 3048)];
//writeln('fail?');
SPS_WalkPath(myPath);
writeln('fuck yea');
Wait(1000 + Random(100));
Writeln('Fucking arrived');
InvertTPA(myPath); //Invert the paths from aubury to bank
SPS_WalkPath(myPath);
end;


Above is just an example. You might want to work out on something, like making the path global or something so that you need not to declare it again in every procedure. And I find the path you made is not quite accurate, might wanna make one again.

Thanks for your help! :)

Also i have another question. Since the essence mine has 4 different forms it is pretty hard to walk. Should i make 4 different paths or?

x[Warrior]x3500
06-19-2012, 09:13 PM
^ you could use sps_getmyposition (or something like that) to get your current coordinates, then from there, you can decide which of the 4 sps paths would best suit your needs. hint: split up the sps_map into 4 sections in your head - then u can decide which mining site is best by determining if you are in one of those sections.

okokokok
06-19-2012, 09:16 PM
x3500;1051447']^ you could use sps_getmyposition (or something like that) to get your current coordinates, then from there, you can decide which of the 4 sps paths would best suit your needs. hint: split up the sps_map into 4 sections in your head - then u can decide which mining site is best by determining if you are in one of those sections.

Great idea! But how can i determine at which point i have to use that specific path. So what i mean is: Do i get to see the coördinates or?

x[Warrior]x3500
06-19-2012, 09:23 PM
by using function SPS_GetMyPos(): TPoint; you can see your x,y coords in relation to your sps map. so, just stand in the middle of the mining caverns (where the 4 tunnels meet up) and get your location there. that should be the perfect center (x,y) of the caverns, thus from that you can create your 4 boxes. 1st box is myPosX < centerX / myPosY < centerY. 2nd box is myPosX > centerX / myPosY < centerY. so on n so forth. if you can know which box you are in, then using a simple case statement, you can correct choose which path to walk

edit: when i saw 4 boxes, think of a graph with the 4 quadrants.

okokokok
06-19-2012, 09:28 PM
x3500;1051459']by using function SPS_GetMyPos(): TPoint; you can see your x,y coords in relation to your sps map. so, just stand in the middle of the mining caverns (where the 4 tunnels meet up) and get your location there. that should be the perfect center (x,y) of the caverns, thus from that you can create your 4 boxes. 1st box is myPosX < centerX / myPosY < centerY. 2nd box is myPosX > centerX / myPosY < centerY. so on n so forth. if you can know which box you are in, then using a simple case statement, you can correct choose which path to walk

edit: when i saw 4 boxes, think of a graph with the 4 quadrants.

Thanks! But I don't think you really understood what i meant. I know that there are 4 different boxes, but there are also 4 different maps.

http://i45.tinypic.com/2vlnx9t.png

As you can see these maps are different. But i guess it should be possible to do it the same as the boxes?

putonajonny
06-19-2012, 09:29 PM
Great idea! But how can i determine at which point i have to use that specific path. So what i mean is: Do i get to see the coördinates or?

In my essence miner I use 4 SPS maps, determine which one I am on, then determine which quadrant, then use that to know which mine/portal to go to... then use TPABetweenPoints to generate a path to walk :)

okokokok
06-19-2012, 09:35 PM
In my essence miner I use 4 SPS maps, determine which one I am on, then determine which quadrant, then use that to know which mine/portal to go to... then use TPABetweenPoints to generate a path to walk :)

Thanks :) Still gonna have to see if im gonna be able to pull it off in a decent amount of time :P Haven't scripted in months, so this sounds pretty hard ;)

putonajonny
06-19-2012, 10:02 PM
Thanks :) Still gonna have to see if im gonna be able to pull it off in a decent amount of time :P Haven't scripted in months, so this sounds pretty hard ;)

This works out which of the maps it is... you just need to do the same to work out which section of the map you are in... you could do it all with boxes as well, whichever you prefer...
Const
MiddleX = 252;
MiddleY = 252;

TLMX = 120;
TLMY = 120;

TRMX = 380;
TRMY = 130;

BLMX = 120;
BLMY = 374;

BRMX = 375;
BRMY = 375;

Function PathToRock : Boolean;
Var
P : TPoint;
Pos : integer;
begin

P := SPS_GetMyPos;

if(P.x > MiddleX)then
begin
if(P.y > MiddleY)then
Pos := 3
else
Pos := 1;
end
else
begin
if(P.y > MiddleY)then
Pos := 2
else
Pos := 0;
end;

end;