Re: [nbos] [AS] Creating Routes
NBOS Support
Fri Feb 23rd, 2007
At 12:21 AM 2/23/2007, you wrote:
>I have two system objects loaded in the script and I would like to create a
>route between the two.

Assuming you have 2 body objects (body1, body2) - both MUST be root objects
of their system - you can make a route like this:

Set Sector = GetCurrentSector()

Route = CreateRoute()
route.Name = "My Route Name"
route.Red = 1 'route colors go from 0 to 1, not 0 to 255
route.blue = 1
route.green = 1
Route.LineWidth = 1
Route.LineStyle = 1

wp = CreateWaypoint()
wp.Body = body1
wp.ID = body1.IDString
wp.x = body1.x
wp.y = body1.y
wp.z = body1.z

Route.AddWaypoint wp

wp = CreateWaypoint()
wp.Body = body2
wp.ID = body2.IDString
wp.x = body2.x
wp.y = body2.y
wp.z = body2.z

Route.AddWaypoint wp

Sector.AddRoute Route

There's a much larger example in the XML Import script. Thats a very good
script to look at as it creates an entire sector - including routes,
subsectors, etc - from external data

Ed

_______________________________________________
Nbossoftware mailing list


Copyright © 2003-2007, NBOS Software. All rights reserved. 'Fractal Mapper', 'ScreenMonkey', 'Character Sketcher', 'Inspiration Pad', 'Fractal World Explorer', 'Goblin API', 'AstroSynthesis' are trademarks of NBOS Software. 'Dwarven Beserker' art by V. Shane.
Member contributed resources