SRL Archive - RS3 Help

Why Isn't my bot walking to sps coords?


beefman

2014-07-03 20:59:17

[ATTACH=CONFIG]23489[/ATTACH]
My bot cannot find the coords/walking to it. It's also not waiting 15 - 30 seconds before it uses the procedure coords();

Could someone help me please??


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
TreeCount: integer; //global variable
CraftCount: integer;

procedure ChopTree();
var
x, y: integer;
begin // colour, tol CTS, hue, sat
if mainscreen.findObject(x, y, 529679, 6, colorSetting(2, 0.65, 9.02), mainscreen.playerPoint, 86, 50, 40, ['down Ever','last','ever'], MOUSE_LEFT) then
begin
writeLn('Yay we clicked a tree');
end;
if tabBackPack.waitForShift(randomRange(3000,6000)) then
writeLn('We got a log');
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));
5 : randomCompass(10, 30, true);
end;
end;


procedure CutShafts();
begin
tabBackpack.Open;
if tabBackpack.isFull() then
begin
tabBackpack.mouseSlot(RandomRange(2 ,5), MOUSE_LEFT);
CraftCount := CraftCount + 1 ;
end;

if (CraftCount = 1) then
begin
wait(randomRange(700,1400));
Mouse(285, 209, 20, 20, MOUSE_LEFT);
wait(randomRange(700,1400));
productionScreen.clickStart();
mouseOffClient(OFF_CLIENT_RANDOM);
Shaft_antiBan();
wait(randomRange(49000,53000));
end;

if (CraftCount > 1) then
begin
wait(randomRange(700,1400));
productionScreen.clickStart();
Shaft_antiBan();
wait(randomRange(49000,53000));
end;
end;
procedure Coords();
begin
if (randomRange(15000,30000)) then
begin
SPS.walkToPos(point(randomRange(206, 157), randomRange(212,174)));
WriteLn('Walking to coords');
end;
end;






// main loop
begin
disableSRLDebug := true;
smartEnableDrawing := true;
setupSRL();
SPS.setup('Map', RUNESCAPE_OTHER);
spsAnyAngle := false;
declarePlayers();

if not isLoggedIn() then
begin
players[currentPlayer].login();

minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
mainScreen.setZoom(true)
end;
repeat
repeat
chopTree();
Coords();
until tabBackpack.isFull();
CutShafts();
until false
end.




Turpinator

2014-07-04 02:02:14

From: beefman
[ATTACH=CONFIG]23489[/ATTACH]
My bot cannot find the coords/walking to it. It's also not waiting 15 - 30 seconds before it uses the procedure coords();


is this your entire map? larger. make it larger.

beefman

2014-07-04 05:39:17

From: Turpinator
is this your entire map? larger. make it larger.


I've updated the map and coords. It's still not working and the " if (randomRange(15000,30000)) then" isn't working ever.
I want it to do this. "if between 15 seconds and 30 seconds then".
[ATTACH=CONFIG]23492[/ATTACH]

The Mayor

2014-07-04 06:13:15

From: beefman
I've updated the map and coords. It's still not working and the " if (randomRange(15000,30000)) then" isn't working ever.
I want it to do this. "if between 15 seconds and 30 seconds then".
[ATTACH=CONFIG]23492[/ATTACH]


randomRange just returns a number, in your case something between 15000 and 30000. What are you trying to do? It's like saying "if 24563 then"

beefman

2014-07-04 06:42:06

From: The Mayor
randomRange just returns a number, in your case something between 15000 and 30000. What are you trying to do? It's like saying "if 24563 then"


I'm trying to do this ;

every 15 seconds to 30 seconds (A random number between 15 and 30 seconds so its not bot like)
walk to coords

I'm hoping this will help my bot from randomly running out of the sps map and can't find it's way back.
Unless you've got a better suggestion for stopping the bot running away? I'm open for suggestions

cosmasjdz

2014-07-04 13:49:34

if you need to wait certain amount of time just use wait functions its like this:

procedure waitandwalk();
begin
wait(random(15000,30000));
walktocoords;
end;


also you can use ttimemarker functions but wait is enough in your case.

The Mayor

2014-07-04 15:11:02

Ok I see what you're trying to do. You need to declare a global variable that will hold the time, a TTimeMarker will do. It needs to be global because you want the time to still tick over even when you're cutting trees etc.

beefman

2014-07-04 17:23:04

From: The Mayor
Ok I see what you're trying to do. You need to declare a global variable that will hold the time, a TTimeMarker will do. It needs to be global because you want the time to still tick over even when you're cutting trees etc.


sooo, do you mean something like this?

 
var
TTimeMarker: string;

procedure Coords();
begin
if TTimeMarker (randomRange(15000,30000)) then
begin
SPS.walkToPos(point(randomRange(223, 151), randomRange(221,172)));
WriteLn('Walking to coords');
TTimeMarker := 1;
end;
end;

beefman

2014-07-04 17:30:36

Thank you, i will give that a try :)

edit: Actually, I'm not completely positive that would work. Wouldn't it stop my other part of the script from running for 15 - 30 seconds?

The Mayor

2014-07-04 18:05:11

From: beefman
sooo, do you mean something like this?

 
var
TTimeMarker: string;

procedure Coords();
begin
if TTimeMarker (randomRange(15000,30000)) then
begin
SPS.walkToPos(point(randomRange(223, 151), randomRange(221,172)));
WriteLn('Walking to coords');
TTimeMarker := 1;
end;
end;


That is the correct idea, except you actually need to declare a variable as a TTimeMarker.


program scriptTemplate;

{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;

var
TreeCount: integer;
CraftCount: integer;
timer: TTimeMarker; //declared it here

procedure ChopTree();
var
x, y: integer;
begin
if mainscreen.findObject(x, y, 529679, 6, colorSetting(2, 0.65, 9.02), mainscreen.playerPoint, 86, 50, 40, ['down Ever','last','ever'], MOUSE_LEFT) then
writeLn('Yay we clicked a tree');

if tabBackPack.waitForShift(randomRange(3000,6000)) then
writeLn('We got a log');
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));
5 : randomCompass(10, 30, true);
end;
end;

procedure CutShafts();
begin
tabBackpack.Open;

if tabBackpack.isFull() then
begin
tabBackpack.mouseSlot(RandomRange(2 ,5), MOUSE_LEFT);
CraftCount := CraftCount + 1 ;
end;

if (CraftCount = 1) then
begin
wait(randomRange(700,1400));
Mouse(285, 209, 20, 20, MOUSE_LEFT);
wait(randomRange(700,1400));
productionScreen.clickStart();
mouseOffClient(OFF_CLIENT_RANDOM);
Shaft_antiBan();
wait(randomRange(49000,53000));
end;

if (CraftCount > 1) then
begin
wait(randomRange(700,1400));
productionScreen.clickStart();
Shaft_antiBan();
wait(randomRange(49000,53000));
end;
end;


procedure Coords();
begin
if timer.getTime() > randomRange(15000,30000) then // if timer been running > 15s - 30s
begin
SPS.walkToPos(point(randomRange(206, 157), randomRange(212,174)));
WriteLn('Walking to coords');
timer.reset(); // reset timer back to 0
timer.start() // start it again
end;
end;


// main loop
begin
disableSRLDebug := true;
smartEnableDrawing := true;
setupSRL();
SPS.setup('Map', RUNESCAPE_OTHER);
spsAnyAngle := false;
declarePlayers();

if not isLoggedIn() then
begin
players[currentPlayer].login();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
mainScreen.setZoom(true)
end;

timer.start(); // start the timer initially here

repeat

repeat
chopTree();
Coords();
until tabBackpack.isFull();

CutShafts();
until false
end.

beefman

2014-07-04 18:37:06

From: The Mayor
That is the correct idea, except you actually need to declare a variable as a TTimeMarker.


program scriptTemplate;

{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;

var
TreeCount: integer;
CraftCount: integer;
timer: TTimeMarker; //declared it here

procedure ChopTree();
var
x, y: integer;
begin
if mainscreen.findObject(x, y, 529679, 6, colorSetting(2, 0.65, 9.02), mainscreen.playerPoint, 86, 50, 40, ['down Ever','last','ever'], MOUSE_LEFT) then
writeLn('Yay we clicked a tree');

if tabBackPack.waitForShift(randomRange(3000,6000)) then
writeLn('We got a log');
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));
5 : randomCompass(10, 30, true);
end;
end;

procedure CutShafts();
begin
tabBackpack.Open;

if tabBackpack.isFull() then
begin
tabBackpack.mouseSlot(RandomRange(2 ,5), MOUSE_LEFT);
CraftCount := CraftCount + 1 ;
end;

if (CraftCount = 1) then
begin
wait(randomRange(700,1400));
Mouse(285, 209, 20, 20, MOUSE_LEFT);
wait(randomRange(700,1400));
productionScreen.clickStart();
mouseOffClient(OFF_CLIENT_RANDOM);
Shaft_antiBan();
wait(randomRange(49000,53000));
end;

if (CraftCount > 1) then
begin
wait(randomRange(700,1400));
productionScreen.clickStart();
Shaft_antiBan();
wait(randomRange(49000,53000));
end;
end;


procedure Coords();
begin
if timer.getTime() > randomRange(15000,30000) then // if timer been running > 15s - 30s
begin
SPS.walkToPos(point(randomRange(206, 157), randomRange(212,174)));
WriteLn('Walking to coords');
timer.reset(); // reset timer back to 0
timer.start() // start it again
end;
end;


// main loop
begin
disableSRLDebug := true;
smartEnableDrawing := true;
setupSRL();
SPS.setup('Map', RUNESCAPE_OTHER);
spsAnyAngle := false;
declarePlayers();

if not isLoggedIn() then
begin
players[currentPlayer].login();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
mainScreen.setZoom(true)
end;

timer.start(); // start the timer initially here

repeat

repeat
chopTree();
Coords();
until tabBackpack.isFull();

CutShafts();
until false
end.


Life saver! Thanks, once again Mayor!

Brandon

2014-07-04 19:42:01

Someone should all make an OpenCV plugin and get rid of SPS in the future.. Having the same problem with SPS as well.

One half the the map it has a set of coords going from 195 to 250 (left half X-axis).. The other half the coords are 90 to 150.. Middle has none. Lol..

The Mayor

2014-07-04 19:44:55

From: Brandon
Should all make an OpenCV plugin and get rid of SPS in the future.. Having the same problem with SPS as well.

One half the the map it has a set of coords going from 195 to 250 (left half X-axis).. The other half the coords are 90 to 150.. Middle has none. Lol..


Yeah walking really is the let down for most RS3 scripts!

Olly

2014-07-04 20:34:35

From: Brandon
Should all make an OpenCV plugin and get rid of SPS in the future.. Having the same problem with SPS as well.

One half the the map it has a set of coords going from 195 to 250 (left half X-axis).. The other half the coords are 90 to 150.. Middle has none. Lol..


;) ;). Will still support current (legacy) method for whoever wants it though. Thanks to slacky tho.. I am totally stealing it :D

beefman

2014-07-04 21:25:44

From: Brandon
Someone should all make an OpenCV plugin and get rid of SPS in the future.. Having the same problem with SPS as well.

One half the the map it has a set of coords going from 195 to 250 (left half X-axis).. The other half the coords are 90 to 150.. Middle has none. Lol..


I like the sound of that. Sps is so frustrating

Flight

2014-07-04 22:05:02

From: Olly
;) ;). Will still support current (legacy) method for whoever wants it though. Thanks to slacky tho.. I am totally stealing it :D


I'm also looking forward to this for a stable walking method in OSRS. Will the plugin be the same for both OSRS & RS3 or they must be separate?

Olly

2014-07-04 22:26:30

From: Flight
I'm also looking forward to this for a stable walking method in OSRS. Will the plugin be the same for both OSRS & RS3 or they must be separate?


I want to make a SPS system that works both in OSRS and RS3.. So they will be the same. But i'm making you a version to test with (And use maybe?) Using Slackys SimbaExt (Since it's like… 90% his stuff) but eventually it will all be in a plugin.

I give you a version forsure tomorrow!