Auto-pilot for your avatar
LEGAL
Copyright 2004 Shack Dougall
Licensed under the Apache License, Version 2.0 (the "License"

you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"Personal Pilot", "Auto-pilot for your avatar" and the Liferain tree logo are trademarks of Shack Dougall
DESCRIPTION
Personal Pilot is an attachment script that provides an auto-pilot function to move an avatar around and between sims.
For your convenience, Personal Pilot is available ready-to-use for $1 on the Liferain Park Skydeck in Atis(135,160,75)
Look for the transparent box with the Liferain tree logo.
Also, you can IM or e-mail me and I'll give you a copy for free.
However, everything you need is included in this post.
What this does:
1) flys an avatar to a place in global coordinates.
ideal for short hops between sims from a telehub or within a sim as an alternative to teleporting.
But could be used for long sightseeing trips and recreation. Also, could be modified to be the "engine" in an unmanned probe.
2) heads-up hovertext display with sim name, coordinates, sim FPS, and distance to destination.
3) able to move an avatar arbitrarily high.
4) reads locations from a notecard in the object's inventory
5) reads landmarks from the object's inventory
6) maintains a travel list of destinations to which the avatar is scheduled to go. This could be used to provide a tour feature or maybe even physical flying tricks.
7) collision detection and avoidance -- detects collisions and uses avatar-assisted avoidance


9) cloaks when attached. uncloaks when unattached.
10) responds to chat commands when attached.
Included functions that I will eventually package separately:
1) llMoveToTarget engine: would be great for a slide-ways elevator that is capable of going in any direction across sim boundaries and to any height.
2) global coordinate functions, including a function for converting from a landmark's relative coords to global
3) heads-up hovertext display
What this doesn't have, but would work well with:
1) pathfinding -- for determining a path to travel from one sim to another, avoiding loaded and "missing" sims.
2) name service -- converting a sim name to a global corner coordinate and vice versa
3) location directory -- a global landmark service
3) keyboard control -- a flight or anti-grief script using llTakeControls
4) collision avoidance -- the ability to detect and avoid obstacles while in flight, perhaps with an off-world database of such objects
5) teleporting or phantom phasing -- Teleport at the beginning/end of a trip to allow exiting/entering buildings. Or engage phantom mode while traveling to pass through obstacles.
6) invisibility -- might make it less weird for people around as you phase through a building

References:
Pathfinder (Karl Longwell)
Anti-Grief Script (Siro Mfume)
Phantom Avatars (Cross Lament)
Invisibility Prim (Beatfox Xevious)
How to Make:
1) Create a cube 1.5m x 1.5m x 1.5m and make it phantom. The size doesn't have to be precise, but...
1a) it can't be too big or the prim will be too heavy to move.
1b) it can't be too small or you will be too heavy to move.
2) create a notecard and add it to the object's contents
Call it 'locations'. copy the sample locations text into this notecard.
3) Create a new script in the object and paste the pilot script into it.
4) Name the cube something meaningful, so that you will know what it is in your inventory. Like "Personal Pilot v0.1".
5) attach it and you're ready to go.
How to Use:
Once the prim is attached, it will respond to the following commands on channel 7. You can change the channel in the script.
For example, in chat you could say "/7 display off" to turn off the hovertext display. It communicates with you using llDialogs and some chat whispers.
Commands:
display on
display off
cloak
uncloak
L name
looks up a location from the locations notecard or a landmark in the attachment's contents. Then, it opens a dialog to let you go there.
up x
down x
moves the avatar up or down x meters.
g x,y,z
moves the avatar to the specified coordinates in the current sim.
reset
causes the attachment to reload its locations notecard.
Cancel
cancels a trip, if you're moving. This returns control to the avatar.
Pause
pauses a trip and lets you fly around. Opens a dialog that lets you resume
Resume
restarts a paused trip.
There are a couple more, but I'll leave that as an exercise for the reader.

Suggestions:
Start in a sim that you know.
Create a few landmarks in the sim and copy them to the pilot prim's contents. Rename the landmarks so that they are short, have no spaces, and can be typed easily.
Then, play with /7 L landmarkName.
Also, /7 up x is a good starting point.
Known problems:
1) Responds slowly after teleporting to a new area. Be patient, manual flying isn't great in these conditions either.
2) Multiple dialogs -- Sometimes more than one dialog will pop up. One of these is a result of a bug in llDialog when crossing sim boundaries. Also, sometimes it detects too many collisions and this opens more than one avoidance dialog.
Use the top dialog and "Ignore" the rest.
3) Avatar goes into falling animation -- If you want to look cool, make sure that you are flying when you engage the auto-pilot.
In fact, it's good to be flying for a number of reasons. this will also help you avoid obstacles.
4) A couple of times, it has seemed to stall right after crossing a sim boundary. But it continued normally when I hit the right or left key.
5) If something goes wrong, you could end up damped to your current position, i.e., you would be unable to move. A teleport should break you out of this or open your inventory and detach the pilot.
6) hangs if it goes into a no-script area under 15m. See 5)
7) the source is right at the 32K max size limit for scripts. I'm releasing it now because I'm about to break it into pieces and I don't know when it will be functional again.
SOURCE CODE
http://liferain.com/downloads/personal-pilot/
locations notecard:
CODE
// locations file for Personal Pilot
// entries are of the form:
// locationName : region corner : local coordinates
overlook: <260096, 258048, 0> : <10,10,65>