Editors Note: I picked that example because it shows creating a ship, keeping its obj variable, and using it, and also uses the controller field. (Star Weaver Dec-2010)
Functions Documentation
View Function Edit Function
Name sysCreateShip
Syntax (sysCreateShip shipclass position sovereign [controller])
Argument List shipclass: UNID of the ship to create
position: a position or a spaceobject to take the position from, or nil (works as system origin vector)
sovereign: UNID of the new ship's sovereign
[controller]: optional: AI type string, UNID of behaviour class to inherit, or behaviour lambda
Returns spaceObject: the created ship
Category ship, create, unid
Description Creates a ship of the requested class and soverign at the requested position.
Example
; [From StdAutouns.xml]
; Create the auton
(setq auton
  (sysCreateShip 
    &scAutoSentinel;
    (objGetPos gSource)
    &svFriendlyAuton;
    "auton"
    )
  )
; Escort ship
(shpOrderEscort auton gSource)
Comment Basic function to create stations in code.
When creating ships from stations, you can use gSource to refer to the station (same when creating from ships)
If you use a object for position, the ship will be created after a short delay (see here: http://neurohack.com/transcendence/forums/viewtopic.php?p=41414#p41414 )
The controller is used for adding special behaviour. Currently in use are "fleet" and "auton", but they will be replaced by behaviour classes and behaviour lambdas.