View Full Version : Sps Walk isn't working.
beefman
07-09-2014, 12:04 AM
Hey,
I'm trying to get my script to teleport to edgeville and walk from there until it reaches some evergreen trees. It teleports to edgeville fine but when it comes to walking to the trees... It either messes up and goes in a different direction or does nothing.
Here's my script
procedure failsafe();
var
b: TBox;
begin
writeln('Recovering lost player - lodetone teleporting');
mouseCircle(minimap.button[MM_BUTTON_LODESTONE].center.x, minimap.button[MM_BUTTON_LODESTONE].center.y,
minimap.button[MM_BUTTON_LODESTONE].radius, MOUSE_LEFT);
if waitLodestoneOpen(5000) then
begin
writeLn('Lodestone Screen is open');
b := intToBox(312, 120, 328, 138);
mouseBox(b, MOUSE_LEFT);
wait(randomRange(13000, 16000));
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
wait(randomRange(350, 750));
sps.walkPath(PathToLocation);
end;
end;
begin
PathToLocation := [Point(254, 87), Point(252, 118), Point(248, 157), Point(243, 190), Point(238, 212), Point(232, 241), Point(223, 275), Point(211, 299), Point(196, 327)];
failsafe();
end.
Here's my sps map
http://i59.tinypic.com/34xp741.png
KeepBotting
07-09-2014, 11:58 AM
I would venture to guess it's because you haven't called sps.setup() anywhere, though this doesn't look like the whole script so I can't be sure.
post the whole script and we can help you better, or if I was right about sps.setup(), just look it up in the include, the function is documented pretty well and is easy to understand
beefman
07-09-2014, 12:06 PM
I would venture to guess it's because you haven't called sps.setup() anywhere, though this doesn't look like the whole script so I can't be sure.
post the whole script and we can help you better, or if I was right about sps.setup(), just look it up in the include, the function is documented pretty well and is easy to understand
Whole script
program scriptTemplate;
{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;
var
CraftCount: integer;
timer: TTimeMarker;
RoTimer: TTimeMarker; //declared it here
ShaftCount: integer;
teleportCount: integer;
PathToLocation: TPointArray;
procedure ChopTree();
var
x, y: integer;
begin // colour, tol CTS, hue, sat
if mainscreen.findObject(x, y, 1983028, 12, colorSetting(2, 0.10, 0.45), mainscreen.playerPoint, 74, 50, 50, ['down Ever','last','ever'], MOUSE_LEFT) then
writeLn('Clicking Tree') //this is the exception for the semicolon because it is followed by an else statement
if tabBackPack.waitForShift(randomRange(4000, 6000)) then
begin
writeLn('Tree cut. We got a log.');
end;
if RoTimer.getTime() > randomRange(10000 ,22000) then
begin
randomCompass(60, 360, false);
RoTimer.reset();
RoTimer.start()
end;
end;
procedure Shaft_antiBan();
begin
Case Random(6) of
0 : hoverSkill(SKILL_WOODCUTTING);
1 : mouseOffClient(OFF_CLIENT_RANDOM);
2 : randomGameTab(true);
3 : randomRClickItem();
4 : sleepAndMoveMouse(1000 + random(2000));
end;
end;
procedure CutShafts();
begin
tabBackpack.Open;
writeLn('Crafting logs into shafts.')
if tabBackpack.isFull() then
begin
tabBackpack.mouseSlot(RandomRange(2 ,5), MOUSE_LEFT);
CraftCount := CraftCount + 1 ;
ShaftCount := ShaftCount + 405;
end;
if (CraftCount = 1) then
begin
wait(randomRange(1000,2300));
Mouse(285, 209, 20, 20, MOUSE_LEFT);
wait(randomRange(700,1400));
productionScreen.clickStart();
mouseOffClient(OFF_CLIENT_RANDOM);
Shaft_antiBan();
wait(randomRange(46000,50000));
end;
if (CraftCount > 1) then
begin
wait(randomRange(1000, 2300));
productionScreen.clickStart();
Shaft_antiBan();
wait(randomRange(46000,50000));
end;
end;
function isInCorrectArea(): Boolean;
var
myPos: TPoint;
correctArea: TBox;
begin
if timer.getTime() > randomRange(400 ,600) then
begin
spsAnyAngle := false;
myPos := sps.getPlayerPos();
correctArea := IntToBox(143, 236, 225, 410);
result := PointInBox(myPos, correctArea);
timer.reset();
timer.start()
if result = true then
begin
Writeln('in box');
teleportCount := 0;
end;
if result = false then
begin
spsAnyAngle := false;
Writeln('Not in box');
SPS.walkToPos(point(randomRange(143 ,255), randomRange(236 ,410)));
teleportCount := teleportCount + 1 ;
end;
end;
end;
procedure Path();
var
PathToLocation: TPointArray;
begin
if not isLoggedIn() then
exit;
PathToLocation := [Point(254, 92), Point(250, 108), Point(247, 123), Point(247, 136), Point(247, 148), Point(244, 162), Point(240, 175), Point(240, 189), Point(236, 205), Point(231, 218), Point(227, 227), Point(223, 242), Point(216, 254), Point(206, 271), Point(203, 284), Point(197, 301), Point(194, 316)];
if SPS.walkPath(PathToLocation) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the Location');
end;
function waitLodestoneOpen(time: integer = 1000): boolean;
var
x, y: integer;
t: TTimeMarker;
begin
t.start();
repeat
if not isLoggedIn() then
exit(false);
wait(100);
if findColorTolerance(x, y, 1448263, intToBox(35, 25, 235, 55), 14) then
exit(true);
until t.getTime() > time;
end;
procedure failsafe();
var
b: TBox;
begin
writeln('Recovering lost player - lodetone teleporting');
mouseCircle(minimap.button[MM_BUTTON_LODESTONE].center.x, minimap.button[MM_BUTTON_LODESTONE].center.y,
minimap.button[MM_BUTTON_LODESTONE].radius, MOUSE_LEFT);
if waitLodestoneOpen(5000) then
begin
writeLn('Lodestone Screen is open');
b := intToBox(312, 120, 328, 138);
mouseBox(b, MOUSE_LEFT);
wait(randomRange(13000, 16000));
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
wait(randomRange(350, 750));
sps.walkPath(PathToLocation);
wait(randomRange(350, 750));
end;
end;
// main loop
begin
disableSRLDebug := true;
smartEnableDrawing := false;
setupSRL();
PathToLocation := [Point(254, 87), Point(252, 118), Point(248, 157), Point(243, 190), Point(238, 212), Point(232, 241), Point(223, 275), Point(211, 299), Point(196, 327)];
SPS.setup('Maps', RUNESCAPE_OTHER);
declarePlayers();
if not isLoggedIn() then
begin
players[currentPlayer].login();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setZoom(true)
end;
timer.start();
RoTimer.start();
repeat
repeat
chopTree();
isInCorrectArea();
if teleportCount > 2 then
failsafe();
until tabBackpack.isFull();
CutShafts();
writeLn('You have crafted ' + intToStr(ShaftCount) + ' shafts');
writeln(msToTime(getTimeRunning(), TIME_FORMAL));
until false;
end.
KeepBotting
07-09-2014, 01:38 PM
Whole script
program scriptTemplate;
{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;
var
CraftCount: integer;
timer: TTimeMarker;
RoTimer: TTimeMarker; //declared it here
ShaftCount: integer;
teleportCount: integer;
PathToLocation: TPointArray;
procedure ChopTree();
var
x, y: integer;
begin // colour, tol CTS, hue, sat
if mainscreen.findObject(x, y, 1983028, 12, colorSetting(2, 0.10, 0.45), mainscreen.playerPoint, 74, 50, 50, ['down Ever','last','ever'], MOUSE_LEFT) then
writeLn('Clicking Tree') //this is the exception for the semicolon because it is followed by an else statement
if tabBackPack.waitForShift(randomRange(4000, 6000)) then
begin
writeLn('Tree cut. We got a log.');
end;
if RoTimer.getTime() > randomRange(10000 ,22000) then
begin
randomCompass(60, 360, false);
RoTimer.reset();
RoTimer.start()
end;
end;
procedure Shaft_antiBan();
begin
Case Random(6) of
0 : hoverSkill(SKILL_WOODCUTTING);
1 : mouseOffClient(OFF_CLIENT_RANDOM);
2 : randomGameTab(true);
3 : randomRClickItem();
4 : sleepAndMoveMouse(1000 + random(2000));
end;
end;
procedure CutShafts();
begin
tabBackpack.Open;
writeLn('Crafting logs into shafts.')
if tabBackpack.isFull() then
begin
tabBackpack.mouseSlot(RandomRange(2 ,5), MOUSE_LEFT);
CraftCount := CraftCount + 1 ;
ShaftCount := ShaftCount + 405;
end;
if (CraftCount = 1) then
begin
wait(randomRange(1000,2300));
Mouse(285, 209, 20, 20, MOUSE_LEFT);
wait(randomRange(700,1400));
productionScreen.clickStart();
mouseOffClient(OFF_CLIENT_RANDOM);
Shaft_antiBan();
wait(randomRange(46000,50000));
end;
if (CraftCount > 1) then
begin
wait(randomRange(1000, 2300));
productionScreen.clickStart();
Shaft_antiBan();
wait(randomRange(46000,50000));
end;
end;
function isInCorrectArea(): Boolean;
var
myPos: TPoint;
correctArea: TBox;
begin
if timer.getTime() > randomRange(400 ,600) then
begin
spsAnyAngle := false;
myPos := sps.getPlayerPos();
correctArea := IntToBox(143, 236, 225, 410);
result := PointInBox(myPos, correctArea);
timer.reset();
timer.start()
if result = true then
begin
Writeln('in box');
teleportCount := 0;
end;
if result = false then
begin
spsAnyAngle := false;
Writeln('Not in box');
SPS.walkToPos(point(randomRange(143 ,255), randomRange(236 ,410)));
teleportCount := teleportCount + 1 ;
end;
end;
end;
procedure Path();
var
PathToLocation: TPointArray;
begin
if not isLoggedIn() then
exit;
PathToLocation := [Point(254, 92), Point(250, 108), Point(247, 123), Point(247, 136), Point(247, 148), Point(244, 162), Point(240, 175), Point(240, 189), Point(236, 205), Point(231, 218), Point(227, 227), Point(223, 242), Point(216, 254), Point(206, 271), Point(203, 284), Point(197, 301), Point(194, 316)];
if SPS.walkPath(PathToLocation) then
minimap.waitPlayerMoving()
else
writeLn('We failed to walk to the Location');
end;
function waitLodestoneOpen(time: integer = 1000): boolean;
var
x, y: integer;
t: TTimeMarker;
begin
t.start();
repeat
if not isLoggedIn() then
exit(false);
wait(100);
if findColorTolerance(x, y, 1448263, intToBox(35, 25, 235, 55), 14) then
exit(true);
until t.getTime() > time;
end;
procedure failsafe();
var
b: TBox;
begin
writeln('Recovering lost player - lodetone teleporting');
mouseCircle(minimap.button[MM_BUTTON_LODESTONE].center.x, minimap.button[MM_BUTTON_LODESTONE].center.y,
minimap.button[MM_BUTTON_LODESTONE].radius, MOUSE_LEFT);
if waitLodestoneOpen(5000) then
begin
writeLn('Lodestone Screen is open');
b := intToBox(312, 120, 328, 138);
mouseBox(b, MOUSE_LEFT);
wait(randomRange(13000, 16000));
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
wait(randomRange(350, 750));
sps.walkPath(PathToLocation);
wait(randomRange(350, 750));
end;
end;
// main loop
begin
disableSRLDebug := true;
smartEnableDrawing := false;
setupSRL();
PathToLocation := [Point(254, 87), Point(252, 118), Point(248, 157), Point(243, 190), Point(238, 212), Point(232, 241), Point(223, 275), Point(211, 299), Point(196, 327)];
SPS.setup('Maps', RUNESCAPE_OTHER);
declarePlayers();
if not isLoggedIn() then
begin
players[currentPlayer].login();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setZoom(true)
end;
timer.start();
RoTimer.start();
repeat
repeat
chopTree();
isInCorrectArea();
if teleportCount > 2 then
failsafe();
until tabBackpack.isFull();
CutShafts();
writeLn('You have crafted ' + intToStr(ShaftCount) + ' shafts');
writeln(msToTime(getTimeRunning(), TIME_FORMAL));
until false;
end.
I see that you've not declared an accuracy or tolerance for your SPS map. Try looking a bit more into the usage of sps.setup() and add those parameters
beefman
07-09-2014, 02:11 PM
I see that you've not declared an accuracy or tolerance for your SPS map. Try looking a bit more into the usage of sps.setup() and add those parameters
Is this what you mean? Something like this?
sps.setup('Map', RUNESCAPE_OTHER, 4, 500.0, 0.40);
KeepBotting
07-09-2014, 02:24 PM
Is this what you mean? Something like this?
sps.setup('Map', RUNESCAPE_OTHER, 4, 500.0, 0.40);
Yes, you'll need to adjust those values depending on your map
Ashaman88
07-09-2014, 02:28 PM
how did you come up with your path? You should debug where it thinks you are.
do something like this
repeat
map_upstairs.debugPlayerPos;
wait(1000);
until false;
That's what i do. Then I just have it running and walk around my area so I can make sure my map is good
beefman
07-09-2014, 02:28 PM
Yes, you'll need to adjust those values depending on your map
What do those numbers mean? I got it from another script
KeepBotting
07-09-2014, 02:32 PM
What do those numbers mean? I got it from another script
Read the documentation for the function in the include file, I don't know off the top of my head
beefman
07-09-2014, 02:37 PM
how did you come up with your path? You should debug where it thinks you are.
do something like this
repeat
map_upstairs.debugPlayerPos;
wait(1000);
until false;
That's what i do. Then I just have it running and walk around my area so I can make sure my map is good
I made my path with sps_path_generator.
I've turned on 'disableSRLDebug := false' which outputs playerpos. I can't say it's always 100% accurate but i think that's just sps as it's not accurate itself.
For example it saids. 'Not in box'. When it is.
Not in box
Ashaman88
07-09-2014, 02:38 PM
I made my path with sps_path_generator.
I've turned on 'disableSRLDebug := false' which outputs playerpos. I can't say it's always 100% accurate but i think that's just sps as it's not accurate itself.
You should try what I said so you can see exactly what it's seeing. Everytime I've used SPS (besides desert areas) it works great
beefman
07-09-2014, 02:43 PM
You should try what I said so you can see exactly what it's seeing. Everytime I've used SPS (besides desert areas) it works great
Okay, i'll with give what you said a go, Where should i place the script? in the main?. I'll report back
beefman
07-09-2014, 02:53 PM
how did you come up with your path? You should debug where it thinks you are.
do something like this
repeat
map_upstairs.debugPlayerPos;
wait(1000);
until false;
That's what i do. Then I just have it running and walk around my area so I can make sure my map is good
Exception in Script: Unknown declaration "map_upstairs" at line 201, column 3
map_upstairs.debugPlayerPos;
Ashaman88
07-09-2014, 02:55 PM
Exception in Script: Unknown declaration "map_upstairs" at line 201, column 3
map_upstairs.debugPlayerPos;
well yeah you need to use whatever TSPS area you're using - I just threw that in as an example
var
map_underground, map_above_ground: TSPSArea;
begin
map_underground.setup('underground', RUNESCAPE_OTHER);
map_above_ground.setup('aboveground', RUNESCAPE_SURFACE);
writeln(map_above_ground.getPlayerPos());
writeln(map_underground.getPlayerPos());
end.
beefman
07-09-2014, 03:08 PM
well yeah you need to use whatever TSPS area you're using - I just threw that in as an example
var
map_underground, map_above_ground: TSPSArea;
begin
map_underground.setup('underground', RUNESCAPE_OTHER);
map_above_ground.setup('aboveground', RUNESCAPE_SURFACE);
writeln(map_above_ground.getPlayerPos());
writeln(map_underground.getPlayerPos());
end.
I've added it into the mainscript but it isn't doing anything?
var
Maps: TSPSArea;
begin.
repeat
repeat
repeat
chopTree();
Maps.debugPlayerPos;
wait(1000);
until false;
isInCorrectArea();
if teleportCount > 2 then
failsafe();
until tabBackpack.isFull();
CutShafts();
writeLn('You have crafted ' + intToStr(ShaftCount) + ' shafts');
writeln(msToTime(getTimeRunning(), TIME_FORMAL));
until false;
end.
beefman
07-09-2014, 04:28 PM
It teleports and then instead of walking to location it moves it's mouse here.
http://i59.tinypic.com/29cwg1d.png
beefman
07-10-2014, 01:03 AM
Read the documentation for the function in the include file, I don't know off the top of my head
You should try what I said so you can see exactly what it's seeing. Everytime I've used SPS (besides desert areas) it works great
Okay, so i got the walk to location working using the sps walk path. I made my map a little bit bigger. However, my sps map is very inaccurate! :( It keeps thinking it's inside the box when it's no where near it!
Any advice?? :(
Ashaman88
07-10-2014, 02:26 AM
What is it saying? Are you printing the point it think's it's at? The debug sps dealio will show you visually where it thinks you are.
And for you to use the maps variable correctly you would need to do maps.setup or w/e for your sps map
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.