PDA

View Full Version : Radialwalk by Direction



pwnaz0r
11-21-2007, 11:04 PM
Well so many people have trouble with walking, so I decided to make this procedure. If you don't understand directions, then look it up on Wikipedia or something but I assume most should (Since the are in Runescape, North, South, East and West). Anyways, most people do not understand radialwalk and the radians, so this little procedure will walk for you by direction.


How to use the directions

this procedure is designed to find the Middle of the area you are going to search. It will then find the d (adjustment) from a 90 degree (*pure*) angle, and then divide that how many directions you give, thus decreasing the search size for every direction you give. So 'NNNN' would be more accurate than just 'N'.


Hope fully you will like. Credits go to Nielsie for helping me fix a little problem with the east :D (he added mod 360);


function Testwalk(Dir: string; Color, rx, ry: integer): boolean;
var
i, degree, d, sRadial, eRadial: integer;
begin
for i:= 1 to Length(Dir) do
begin
case Lowercase(Dir[i]) of
'n': degree:= degree+ 360;
'e': degree:= (degree+ 90) mod 360;
's': degree:= degree+ 180;
'w': degree:= degree+ 270;
else
Writeln('Invalid Direction: '+Dir[i]);
end;
end;
Writeln('Degree = '+IntToStr(degree div Length(Dir)));
d:= 90 div Length(Dir); // 90 = pure angle
sRadial:= (degree - d) mod 360;
eRadial:= (degree + d) mod 360;
Writeln('sRadial = '+IntToStr(sRadial));
Writeln('eRadial = '+IntToStr(eRadial));
result:= RadialWalk(Color, sRadial, eRadial, 60, rx, ry);
end;

Harry
11-21-2007, 11:09 PM
Dude.. thats awesome :)

Raskolnikov
11-21-2007, 11:13 PM
I like it. Radial walk was really hard to understand. I barely understand it right now. I will use this in my next upgrade of my script!.

Edit: I think my next challenge if I were you would be to make the color into an array.

Cut em2 it

pwnaz0r
11-24-2007, 07:55 AM
thank you :)

LordGregGreg
11-24-2007, 08:11 AM
Hmm, i read over it a little bit, so this may be a noobish post if I am wrong, however. Doesn't this kinda take away from some of the power of radial walking? Being about to choose whether to search from left to right, or right to left, and being abvle to manbuly enter in the exact angles you will want it to scan are the two features that made it invaluable to me...

also, i dont think your "mod 360" fix is going to work correctly. Im not sure what error you were trying to fix, but it seems like a "360 - (x)" would be more correct than "x mod 360"

other than that, it does show a good indepth understanding of how radial walk works, and a clever way to throw it into a for loop, very impresive.

Edit: ok, i double chekced my math, and "x mod 360" is BETTER than 360 - x, by far.
and you should add that on to the end of any direction tht you do not want to go above 360, not just the east.