SRL Archive - SRL Archives

WalkAgainstWhiteWall()


noidea

2008-12-13 04:37:07

I made a function when I was suposed to be sleeping. I worked on this from about midnoght to now (4:30 am)?

Yea, it will walk along side that skinny white wall on the rs minimap eigther going north ('n') or south ('s'). With true meaning walk on the left side of the wall, while false meaning, walk along the right side of the wall. Use like

WalkAgainstWhiteWall('s', true);



Rate, hate comments, concerns..?\


function WalkAgainstWhiteWall(s: string; Left: Boolean): Boolean;
Label rawr;
var
t, cts, x, y, h, w, m, I, f, p : Integer;
TPA : TPointArray;
ATPA : Array of TPointArray;
kk : Boolean;
begin
MakeCompass('360');
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(7.28, 12.9);
Case LowerCase(s) Of
'n': t := -60;
's': t := 60;
end;
FindColorsSpiralTolerance(MMCX, MMCY + T, TPA, 15726570, mmcx-40, MMY1, mmcx+40, MMY2, 12);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 1, 1);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
mmouse(x,y,0,0);
wait(200);
getmousepos(x,y);
p := Getcolor(x, y);
getmousepos(h,w);
wait(200);

if (getcolor(x, y) = p)then
begin
Goto Rawr
end;

if not (getcolor(x, y) = p)then
begin
for f := 0 to 4 do
begin
mmouse(h,w,0,0);
try
mmouse(x-f,y+f,0,0);
wait(200);
getmousepos(x,y);
if(getcolor(x, y) = p)then
begin
KK := True;
getmousepos(x,y);
break;
end;
except
begin
mmouse(x+f,y-f,0,0);
wait(200);
getmousepos(x,y);
if(getcolor(x, y) = p)then
begin
kk := True;
getmousepos(x,y);
break;
end;
end;
end;
end;
if (kk) then goto rawr;

rawr:
begin
getmousepos(x, y);
if (getcolor(x, y) = p)then
begin
Case Left of
True: m := -8;
False: m := 8
end;
mmouse(x + m, y, 0, 0);
getmousepos(x, y);
if not(getcolor(x, y) = p) then
begin
mouse(x, y, 3, 3, true);
wait(randomRange(200, 300));
flag;
Result := True;
exit;
end;
end;
end;
end;
end;
end;

SirPa

2008-12-13 05:26:42

Lol @
Label rawr;

Anywho i just tried this out and it works pretty nice. It does sometimes mess up because there are multiple white walls nearby (tried walking near a house, with a few buildings on the other side of the road, making me walk over).
But other then that, it works fine

Good job :p Better then anything i would make xD

~Sir

noidea

2008-12-13 08:34:11

I acctually made this for VWB and like walking to the mine, but it looked pretty cool and worked well so I though that I would present it.

Thanks for the responce

Home

2008-12-13 09:25:17

Hey thanks a lot if this works then i am able to make some multiple paths :) Thanks !

~Home

noidea

2008-12-13 13:35:59

Updated. Fixed co-ords in which the function looks.

NiCbaZ

2008-12-13 15:36:35

Does it walk right on it or slightly off the side of it like waterwalk?

n3ss3s

2008-12-13 15:38:24

Remove non-needed begins and ends for an ensexifying effect…

You could make a function that finds walls, returns an array of TPA (each TPA being a wall), then use ArcTan on a TPA's first and last index, create a path based on that which you then can distort.

noidea

2008-12-13 21:03:33

From: NiCbaZ
Does it walk right on it or slightly off the side of it like waterwalk?


Slightly off to the side.

From: n3ss3s
Remove non-needed begins and ends for an ensexifying effect…

You could make a function that finds walls, returns an array of TPA (each TPA being a wall), then use ArcTan on a TPA's first and last index, create a path based on that which you then can distort.


Sorry, I am not familiar with any thing like that :p That why I'm not a dev :p

bullzeye95

2008-12-13 21:34:59

function WalkAgainstWhiteWall(s: string; Left: Boolean): Boolean;
var
t, cts, x, y, h, w, m, I, f, p : Integer;
TPA : TPointArray;
ATPA : Array of TPointArray;
kk : Boolean;
begin
MakeCompass('360');
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(7.28, 12.9);
Case LowerCase(s) Of
'n': t := -60;
's': t := 60;
end;
FindColorsSpiralTolerance(MMCX, MMCY + T, TPA, 15726570, mmcx-40, MMY1, mmcx+40, MMY2, 12);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 1, 1);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
mmouse(x,y,0,0);
wait(200);
getmousepos(x,y);
p := Getcolor(x, y);
getmousepos(h,w);
wait(200);

if not (getcolor(x, y) = p)then
begin
for f := 0 to 4 do
begin
mmouse(h,w,0,0);
try
mmouse(x-f,y+f,0,0);
wait(200);
getmousepos(x,y);
if(getcolor(x, y) = p)then
begin
KK := True;
getmousepos(x,y);
break;
end;
except
begin
mmouse(x+f,y-f,0,0);
wait(200);
getmousepos(x,y);
if(getcolor(x, y) = p)then
begin
kk := True;
getmousepos(x,y);
break;
end;
end;
end;
end;

begin
getmousepos(x, y);
if (getcolor(x, y) = p)then
begin
Case Left of
True: m := -8;
False: m := 8
end;
mmouse(x + m, y, 0, 0);
getmousepos(x, y);
if not(getcolor(x, y) = p) then
begin
mouse(x, y, 3, 3, true);
wait(randomRange(200, 300));
flag;
Result := True;
exit;
end;
end;
end;
end;
end;
end;
Rawr was useless.

Metagen

2008-12-15 09:46:00

From: n3ss3s
Remove non-needed begins and ends for an ensexifying effect…

You could make a function that finds walls, returns an array of TPA (each TPA being a wall), then use ArcTan on a TPA's first and last index, create a path based on that which you then can distort.


OMG!!! Ensexifying is my new favorite word!!!