Hehe... This looks fun. laugh

Commercial games written in major programming languages often have pathfinding problems. It should be interesting if mIRC scripting can handle pathfinding well enough.

Without doing the code, I'd try this sort of thing.

1) Check if a straight path works. If so, it's easy. If not, continue.

2) Find the first thing in your path. Find the right and left edges of the object (you should have these values already).

3) Calculate distance in straight line from the starting point to the right edge of that object. Then see if there is a straight line from there to your targe. If there is, then calculate total distance from start to right edge to target.

If not, keep that information, but try the left edge of the object. If there is a straight line from there, then calculate the total distance from the start to the left edge to the target.

Assuming that there is a straight line from either edge to the target, then determine which distance is shorter and use that.

If there is not a straight line from the edges, then you need to repeat this for the next object(s) in your path. Check both edges, find distance, etc.

Code:
                     (t)

                  <------>

                     (s)


In this example (I can't draw well here, but you'll get the idea), you can see (s) = start, (t) = target, and the <-----> is the wall. This one is easy... go from start to left corner to target. Then from start to right corner to target. Find shortest path.

HINT: By "edge" I am not regerring to the front corners of an object as that won't work well. You need to go in a line that touches a front corner and stops halfway between the front and back of the object.


Invision Support
#Invision on irc.irchighway.net