SRL Archive - RS3 Help

Keeping player within a tbox


theholyone

2015-02-14 03:44:59

Hi,

Was just wondering if there was a way to keep current player within a tbox or something similar on the minimap in game?

so something like..


if player has moved away from box then
click (x,y)

Hate to ask without having to properly searched, but I won't be able to come back to the computer until tomorrow…

thanks in advanced and goodnight! working 36hrs with hopefully 3hrs of sleep is going to be fun

cosmasjdz

2015-02-14 05:59:07

From: theholyone
Hi,

Was just wondering if there was a way to keep current player within a tbox or something similar on the minimap in game?

so something like..


if player has moved away from box then
click (x,y)

Hate to ask without having to properly searched, but I won't be able to come back to the computer until tomorrow…

thanks in advanced and goodnight! working 36hrs with hopefully 3hrs of sleep is going to be fun


You can check if its coordinates sps.getplayerpos() which gives Tpoint is in box where you want to be.
For example code would look like:


if pointinbox(sps.getplayerpos(),BoxWhereYouWantItToBeInSpsMap) then blahblah else sps.blindwalk(PoinYouNeedToBeAt);

Other method i use for summoners is dtm. It is usefull if area is used to be small, map not always setted north as it is suspicious you everytime set norht to check if you in area and area you want to be is always visible in minimap. For this i use something similar like:


if finddtm(x,y,PosDtm,minimap.getbounds()) then
begin
if poinInBox(sps.pointToMainscreen(point(x,y),res),mainscreen.getbounds()) then mouse(res,mouse_left);
end
else failsafe();

Will post actual real code when ill be back from work at home. Real function looks like this:

function startPosition():boolean;
var
fx, fy, xb, yb,x,y: integer;
TPAB: tpointarray;
res: tpoint;
begin
if not isloggedin() then
exit;
result:=false;
inc(stpos);
if minimap.finddtm(POS_DTM, fx, fy) then //firsty tries use dtm if fails then failsafe using blindwalk
begin
smartimage.drawcross(point(fx, fy), 2, 255);
smartimage.drawcross(minimap.pointtomainscreen(point(fx, fy)), 10, 255);
writeln(distance(minimap.getcenterpoint(), point(fx, fy)));
if (distance(minimap.getcenterpoint(), point(fx, fy))) >= 12 then
begin
if (pointinbox(minimap.pointtomainscreen(point(fx, fy)), inttobox(200, 1, 575, 385)) or ((pointinbox(minimap.pointtomainscreen(point(fx, fy)), inttobox(3, 196, 211, 387))) ) )then //or (FindColorsSpiralTolerance(xb, yb, TPAB, 10326079, inttobox(265, 175, 315, 220), 6, colorSetting(2, 0.07, 0.22))))
begin
mouse(minimap.pointtomainscreen(point(fx, fy)), mouse_left);
wait(gaussrangeint(1200, 1750));
result:=true;
end else
begin
minimap.setAngle(gaussrangeint(30,60));
//result:=true;
end;
end else result:=true;
end
else //if dtm finding failed uses sps blindwalk.
begin
if (PointInBox(sps.getplayerpos(), inttobox(126, 114, 138, 134))) = false then //checks if player is within a //abox in map coordinates it should have been.
begin
Mainscreen.setAngle(ms_angle_high);
Sps_PosToMM(point(130, 126), sps.getplayerpos(), res);
if 0 >= (res.x) then
exit;
if PointInBox(minimap.pointstomainscreen([res])[0], inttobox(185, 1, 575, 388)) then
begin
mouse(minimap.pointstomainscreen([res])[0], mouse_left);
result:=true;
end
else
begin
Sps.walkPath([sps.getplayerpos(), point(130 + random( - 4, 4), 126 + random( - 4, 4))]);
end;
wait(random(785, 1486));
Minimap.waitPlayerMoving(random(1457, 2758));
result:=true;
end
else
begin
Mainscreen.setAngle(ms_angle_high);
//result:=true;
end;
end;
end;

The Mayor

2015-02-14 14:45:39

From: theholyone
Hi,

Was just wondering if there was a way to keep current player within a tbox or something similar on the minimap in game?

so something like..


if player has moved away from box then
click (x,y)

Hate to ask without having to properly searched, but I won't be able to come back to the computer until tomorrow…

thanks in advanced and goodnight! working 36hrs with hopefully 3hrs of sleep is going to be fun


https://villavu.com/forum/showthread.php?t=109380&p=1298602#post1298602

theholyone

2015-02-16 13:58:16

From: The Mayor
https://villavu.com/forum/showthread.php?t=109380&p=1298602#post1298602


Thank you so much, and again I apologize for not using the search function first.. will hopefully make up for it with the script i'm working on right now

@cosmasjdz

thanks for all the different options, just needed a simple one like the first example you gave me :)
the last one looks… scary :P

theholyone

2015-02-18 23:22:36

not sure if this is just my own stupidity but i keep getting too many parameters found @ line xxx

if pointinbox(sps.getplayerpos,670,90,694,118) then
exit
else sps.blindwalk(698,112);

cosmasjdz

2015-02-19 00:27:48

From: theholyone
not sure if this is just my own stupidity but i keep getting too many parameters found @ line xxx

if pointinbox(sps.getplayerpos,670,90,694,118) then
exit
else sps.blindwalk(698,112);





if pointinbox(sps.getplayerpos,inttobox(670,90,694,118)) then
exit
else sps.blindwalk(point(698,112))

the last one is real script real function, it always grows up by addint failsafes or making it stable enough for script to run days without little mess up.

theholyone

2015-02-19 17:57:22

From: cosmasjdz


if pointinbox(sps.getplayerpos,inttobox(670,90,694,118)) then
exit
else sps.blindwalk(point(698,112))

the last one is real script real function, it always grows up by addint failsafes or making it stable enough for script to run days without little mess up.



ah, didn't add the inttobox before coordinates,

What i did was basically noob-leveled the entire thing and just made an sps map + path so that it always goes back to roughly the same point as i stated in the sps path

will try your method as soon as I get home