LSL Protocol/AutoBahn
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Autobahn public and private roads (Tested Version 1)
The Autobahn is a automatic vehicle system designed so that scripts can steer for you with you controlling the speed and lane. It uses a series of named prims that each having extra information in the name field.
Because the vehicle flies based on the prim information, the vehicle can be any direction. Even upside down! :eek:
With each prim holding the key to the next prim, the vehicle only needs to use llKey2Name to find the next section.
The road
You can build two types of Autobahn roads.
1) Simple roads where the road is mostly flat and you don't have complex overpasses. The target position is always above the prim a set distance making it easy to drop a update script into an existing road.
2) Roads where the road controls the rotation of the vehicle. This makes great roller coasters.
The prim name holds a key of the next road prim for each lane so that the vehicle can use llKey2Name to get the next prim's data. The prim name also holds the road target position and rotation so that the vehicle only has to use a scanner when it first starts.
Each lane is composed of prims named """PublicRoad""" Followed by data and choices of next keys
Fields are separated by ";" symbols to make it easier for the script to parse the string using llParseStringKeepNulls
- Version number = 1
- This Lane number = 1
- Maximum recommended speed in m/s (optional)
- Descriptive road name (optional)
- Lane target position <X,Y,Z>. This is 1m above the road surface so that the vehicle does not have to process the rotation if it is built with a 1m high center.
- Lane Rotation <x,y,z,s> or blank for a simple Autobahn Road section. ZERO_ROTATION is defined as upright and pointing east.
- key for next prim of lane 1
- key for next prim of lane 2(optional)
- key for next prim of lane 3(optional)
- key for more lanes...
You can force vehicle to change lanes by leaving the key for that lane blank. The vehicle should move to the nearest valid lane.
Making a simple Autobahn Road section
A simple section sets the "lane rotation" setting to blank and allows the vehicle to decide what direction to drive in the lanes. This allows for existing roads to updated to use the autobahn system by dropping a script into them.
Example:
Name "" "PublicRoad;0;1;20;Simple Road;" + (string)(llGetPos() + <0.,0.,1.5>) + ";" + (string)NextKey; ""
where the key is the key of the next prim.
Making a Autobahn Road section
Getting the rotation correct is important since the vehicle uses this to orientate itself on to the road.
Since the name actually controls the road direction, you can make the prim any direction and modify the road update script
Scripts
This script works as long as the forward direction is correct for the scanner to see the next road segment.
- The self replicating road script updates the road and leaves the road unscripted using llSetRemoteScriptAccessPin. It allows you to remove them using the "/65 remove" command and then allows you to update them again by dropping the script into one prim and giving it the "/65 update" command. The settings are stored in the names of the inventory items.
- The car script uses a scanner to find the first prim and then uses llKey2Name to navigate.
Notes
The vector and keys are at the end since the update script can replace them when the the editor truncates them.
As of 1.13 the editor truncates the name field to fit in the edit box when the prim it edited.
Pipe symbols and other symbols don't work in the description field since it's like a filename (V1.12) As of 1.12 you can't read the description of other objects! So the protocol only uses the name