SRL Archive - Jr. Member General Help and Discussion

Lape Walker Help Pls <3


BigRedJapan

2015-03-27 01:55:05

Flight gave me a really interested function so that i would be able to pin point my locations better but its not working..


function pointsInDist(Pt1, Pt2: TPoint; Dist: Integer): Boolean;
begin
result := (distance(Pt1.X, Pt1.Y, Pt2.X, Pt2.Y) <= Dist);
end;

Ive put in:


pointsInDist(Point(231,121), Point(232,123), Walker.getMyPos(), 3);

Someone told me that I had extra points and i see that now. but how would I be able to make that box print it on MM in Smart and then make sure that my char is in that square.

The Mayor

2015-03-27 02:04:44

By the looks of things, that has nothing to do with a 'box'. It just checks if TPoint1 is within 'Dist' of TPoint2.


if pointsInDist([10, 10], [10, 15], 5) then
writeLn('Point 1 is within 5px of point 2');

BigRedJapan

2015-03-27 02:06:35

Flight lied to me then.

How would I make a box out of 2 Tpoints and check with Mypos that I am in the Box?

The Mayor

2015-03-27 04:50:47

From: Rules of Joe
Flight lied to me then.

How would I make a box out of 2 Tpoints and check with Mypos that I am in the Box?


Going by the code you posted above, I guess it would be something like:


if PointInBox(Walker.GetMyPos(), [x1, y1, x2, y2]) then
WriteLn('We are in a box, yo. Pinkman, bit*c');

3Garrett3

2015-03-27 10:00:40

From: Rules of Joe
Flight lied to me then.

How would I make a box out of 2 Tpoints and check with Mypos that I am in the Box?


Flight didn't lie to you. The quote I see from him is

"which means if you're wanting to determine you're standing on a specific tile you'll actually want to check if you're within a certain distance of that tile, as your position could vary +/-5 coordinates (depending on many variables)."

He actually specifically said it would check the distance, and the name of the function is "pointsInDist" as in points in distance.

That being said, the code Mayor posted is correct. The function I use in my scripts is:


{----------------------------------------------------------------}
{Procedure stayPut() - Ensures the player does not wander too much while chopping}
{Credit: Idea by Incurable, code based on Ross's ShaftShaver, modified by Garrett}
{----------------------------------------------------------------}

procedure stayPut();
begin
if (not pointInBox(SPS.getPlayerPos(), LOCATION_BOX)) then // Checks if getPlayerPos() is within LOCATION_BOX (a TBox)
begin
SDebug('Outside of designated area, relocating');
blindWalkOne(Walk_Box.getGaussPoint()); // Custom walking function to walk towards the center of another box
minimap.waitPlayerMoving() // Waits to stop moving
end;
end;

Flight

2015-03-27 12:17:53

From: Rules of Joe
Flight lied to me then.

How would I make a box out of 2 Tpoints and check with Mypos that I am in the Box?


I surely didn't, what I explained was to use that function to check if two points (in this case, your player's coordinate via RSWalker and 'location' tile) were within a certain distance from one another. I believe you're mixing up my suggestion with Slacky's, which suggested you check if your player's coordinate was within a 'box area'. Both will give you a better chance of determining your location more accurately than just "If myPlayerTile = LocationTile then…". As Slacky and I both explained you won't have an exact tile location, as you would with reflection, that's why it's wise to have tolerance (within distance or within a box in this case). Just as how we search for colors on the screen with tolerance rather than an exact static color, as we all know colors in RS change with condition.

An example of using the function would work like this:

function isAtBank(): Boolean;
var
bankTile : TPoint;
begin
bankTile := point(315, 210);
result := pointsInDist(Walker.GetMyPos(), bankTile, 15); // Is our current position within 15 'distance' from the bank tile?
end;

Of if you were to use a box area, as Slacky suggested, you could do something like this:

function isAtBank(): Boolean;
var
bankArea : TBox;
bankTile : TPoint;
begin
bankTile := point(315, 210);
bankArea := pointToBox(bankTile, 15); // From the 'bankTile' create a 15x15 area box
result := pointInBox(Walker.GetMyPos(), bankArea);
end;

BigRedJapan

2015-03-27 14:27:45

Dammm. I luv when you guys are mad. produces great work. Thanks! <3 Luv this Community.

BigRedJapan

2015-03-29 02:05:12

So ive used flights code..


Function FailSafeLocation: Boolean;
begin
if PointInBox(Walker.GetMyPos(), [254, 247, 250, 263]) then
WriteLn('We are in a box.');
Result := True;
end;

and i used it in my loop.

if FailSafeLocation = false then
begin
walker.blindWalk(Point(250, 254));
Wait(RandomRange(785, 985));
exit;
end;

and it doesnt work. but when its not in the box the script doesnt run witch is a good thing just bad that it doesnt walk back to the tile.

Procedure Loop;
begin
if FailSafeLocation = true then
begin
Repeat
FindJudge;
Until(areTalking());
Wait(RandomRange(785, 985));
end;
if areTalking = true then
begin
ChatJudge;
end else
begin
AlreadyinGame;
end;
if getInvCount = +3 then
begin
EquipArrows;
end;
if getInvCount = +2 then
begin
Wait(RandomRange(785, 985));
SorrynoTarget;
repeat
SpamTarget;
Wait(RandomRange(785, 985));
if FindDTM(TargetView, X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
CloseTargetView;
end;
Until(areTalking());
end;
if FailSafeLocation = false then
begin
walker.blindWalk(Point(250, 254));
Wait(RandomRange(785, 985));
exit;
end;
end;

Full Loop.


Also when i make this code
Function FailSafeLocation(): Boolean;
begin
if PointInBox(Walker.GetMyPos(), [254, 247, 250, 263]) then
begin
WriteLn('We are in a box.');
Result := True;
end;
end;
all it does is click the positon and wont run the loop at all.

Flight

2015-03-29 10:37:02

Please use '
' tags instead of '[Code]'.  Anyways, I cleaned up your script, but I want to ask; what do you mean here:
[simba]
if getInvCount = +3 then
and
if getInvCount = +2 then

Run this and see if it tells you if you're at the location or if it's attempting to blind-walk there:

Function FailSafeLocation(): Boolean;
begin
result := PointInBox(Walker.GetMyPos(), toBox(254, 247, 250, 263));
end;

Procedure Loop;
begin
if FailSafeLocation then
begin
writeln('In location');
Repeat
FindJudge;
Until(areTalking()); // Possible infinite loop
Wait(RandomRange(785, 985));
end else
begin
writeln('Walking to location');
walker.blindWalk(Point(250, 254));
Wait(RandomRange(785, 985));
exit;
end;

if areTalking() then
ChatJudge
else
AlreadyinGame;

if getInvCount = +3 then // What is "+3"?
EquipArrows;

if getInvCount = +2 then // What is "+2"?
begin
Wait(RandomRange(785, 985));
SorrynoTarget;
repeat
SpamTarget;
Wait(RandomRange(785, 985));
if FindDTM(TargetView, X, Y, MSX1, MSY1, MSX2, MSY2) then
CloseTargetView;
Until(areTalking()); // Again, possible infinite loop
end;
end;

Also, let me see the map you're trying to use.

BigRedJapan

2015-03-29 12:59:58

From: Flight
Please use '
' tags instead of '[Code]'.  Anyways, I cleaned up your script, but I want to ask; what do you mean here:
[simba]
if getInvCount = +3 then
and
if getInvCount = +2 then

So The inv cout is for the arrows. When there is 3 inv it will click arrows and continue to shoot the script. when there is 2 in like coins and tickets it will go back and check to make sure the game has started then will continue to shoot the arrows at target until a chat appears.



Also, let me see the map you're trying to use.


I linked the map bellow

And your loop doesnt work, all it does is walk to the location. and clicks in the same spot until(false).

Flight

2015-03-29 13:51:39

From: Rules of Joe
I linked the map bellow

And your loop doesnt work, all it does is walk to the location. and clicks in the same spot until(false).


Your loop, I only made it readable. So based on your description I assume the debug box is saying "Walking to location"? That's the whole point I put it in there, so you'd know where in the script you're having issues. Also, you didn't answer my question of what you mean by this:

if getInvCount = +3 then
and
if getInvCount = +2 then

And try using this map piece instead:


Of course you'll need to get your location again. If you show me (precisely) where on the map the player is supposed to be standing I'll help you out with getting the box area also.

BigRedJapan

2015-03-29 14:17:08

From: Flight
Your loop, I only made it readable. So based on your description I assume the debug box is saying "Walking to location"? That's the whole point I put it in there, so you'd know where in the script you're having issues. Also, you didn't answer my question of what you mean by this:

if getInvCount = +3 then
and
if getInvCount = +2 then

If i have 3 items in my inv it will equip the arrows.

If i have 2 items in my inv it will go back and retalk to the judge to make sure i started the game.

http://prntscr.com/6mxenz

The red square is the spot

Turpinator

2015-03-29 14:38:03

From: Rules of Joe

If i have 3 items in my inv it will equip the arrows.

If i have 2 items in my inv it will go back and retalk to the judge to make sure i started the game.



if getInvCount = 3 then
and
if getInvCount = 2 then

While doing +3 does work. it is in no way proper and is confusing as hell. (and might not/probably doesnt work in other languages)

BigRedJapan

2015-03-29 14:43:46

It works fine in my script. ive tested it. the script will log out if it has more than 3 items in inv!

Now i am getting a text error from the include.

Flight

2015-03-29 16:14:03

From: Rules of Joe

http://prntscr.com/6mxenz

The red square is the spot


Try this as your area bounds:

toBox(196,253,228,276);

BigRedJapan

2015-03-29 16:31:14

nope now its just walking to the location and not running the rest of the loop.

could it be the blind walking cuasing it to keep walking to location?

and it wants to run outside the guild!