Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

PortRing - Automatically create a ring of teleporters

Neo Rebus
Registered User
Join date: 10 Apr 2004
Posts: 59
07-25-2004 11:34
The following three scripts make up the PortRing system, used to automatically create a ring of teleporters. A teleport ring consists of a central "base" and a set of "stations". The base links to the first station, and optionally to the last station or to all stations. Each station links to the previous station (if it's not the first) and the next station (if it's not the last), as well as back to the base.

The three scripts are:
  1. PortRing Creator - The main script for the system; this reads a control notecard and uses that information to create the base and each teleport station.
  2. PortRing Porter - This script goes inside the teleporter objects, and is used to set the Sit Text and Sit Target for the teleportation system.
  3. PortRing Retriever - Using the same control script as PortRing Creator, this goes around to "retrieve" the teleport stations and return them to a single spot for dispsal.


To create a teleportation system, you need to create the following objects:
  1. "Previous", "Next", and "Base" teleporter objects. These are the objects that will be placed at the base and at the various teleport stations. Each may be any arbitrary linked set of objects, and may have any name as long as all are unique. The root of the linked set must include the PortRing Porter script.
  2. "Creator" object. Once the teleporter objects are created, drop them into the Creator object, along with the PortRing Creator script.
  3. "Retriever" object. This should contain the PortRing Retriever script.
  4. Control notecard. An example is included below, after the three scripts. This notecard, when dropped onto the Creator or Retriever objects, tells them where to place or from where to retrieve the teleporter objects.


To create the system, rez the Creator object, make sure it has the PortRing Creator script and the three teleporter objects, and drop the control notecard onto it. It will pase the notecard, then delete it from its inventory and create the teleporter system.

To retrieve the teleporters, rez the Retriever object, make sure it has the PortRing Retriever script, and drop the control notecard onto it. It will go to each station to retrieve the objects and come back to the starting point to be deleted. Note that if the teleporter objects are too large, the linking will eventually fail. The retriever should make it back to its starting point where you can delete it and run another retrieval to get the rest of the teleporters.


Due to size restrictions, the scripts will be attached to this post and a follow-up post.


An example control notecard:

CODE

// PortRing controller card
// for PortRing Creater version 1.3.0
//
// This notecard contains the information that will be used to create
// a PortRing. A PortRing consists of a "base", which has a single
// "next" Porter, and a set of "stations", each of which has a Porter
// back to the "base", a "back" Porter (except for the first station),
// and a "next" Porter (except for the last station).
//
// Lines that are blank or begin with // are ignored. All other lines
// must be a comma-separated list, beginning with a keyword:
//
// PORTERS,<name-of-"back"-porter>,<"forward"-porter>,<"base"-porter>,
// <spacing>
// BASE,<location-of-base>,<heading>,<name-of-base>
// STATION,<location-of-station>,<heading>,<name-of-station>
// OPTIONS,<option>[,<option>...]
//
// There must be exactly one PORTERS line, followed by exactly one BASE
// line, followed by one or more STATION lines.
//
// Any number of OPTIONS lines may appear anywhere on the card.
//
// The PORTERS line tells the PortRingCreator and PortLinkRetriever
// objects what objects to create or retrieve for the various Porters.
// The <spacing> parameter tells the Creator how far apart to place the
// different Porters at a location.
// The BASE and STATION lines tell the Creator and Retriever where to
// create (or from where to retrieve) the porters. <location> is a
// vector containing the <x,y> location of the station, and the height-
// above-ground (z) at which to create the 'porters. <heading> is a
// compass heading, from the list below. <name> is the name of the
// base or station - the text that will appear in the teleporters that
// link to that location.
//
// Compass headings:
// N,NNE,NE,ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW
//
// The OPTIONS lines alter the behaviour of the creator. Options and
// option values are not case sensitive. The following options are known:
//
// BasePorters=FirstOnly
// BasePorters=FirstAndLast
// BasePorters=All
// Sets the 'porters that will be created at the base. The default
// is FirstOnly, meaning that one 'porter will be created, going to
// the first station. FirstAndLast adds an additional 'porter to the
// last station. All makes a 'porter for every station.
//
// RingStyle=Linear
// RingStyle=Loop
// Determines if the first and last entries will have previous/next
// 'porters that "wrap around" to each other ("Loop" style), or if
// the first and last entries will not have previous/next 'porters,
// respectively ("Linear" style).
//
// The Porter objects themselves must be placed in the PortRingCreator
// before this notecard is dropped in. The Porter objects must each
// have a copy of the PortRing Porter script.

PORTERS,Teleporter to Previous Entry,Teleporter to Next Entry,Teleporter to Base,1.0

OPTIONS,BasePorters=All,RingStyle=Loop

BASE,<160,40,0.5>,N,Base

STATION,<176,22,0.5>,S,Station 1
STATION,<100,26,0.5>,S,Station 2
STATION,<137,58,0.5>,NW,Station 3
STATION,<156,58,0.5>,NE,Station 4
  1. 1 August 2004: Updated to version 1.3.0
  2. Added parsing check for malformed vectors in the STATION lines
  3. Added RingStyle option, to allow "loop" style rings (where "back" from the 1st station takes you to the last station, and "next" from the last station takes you to the 1st station), as well as "linear" (with no "back" from 1st station and no "next" from last station).

Neo Rebus
Registered User
Join date: 10 Apr 2004
Posts: 59
07-25-2004 13:27
Second of three scripts.
  1. 1 August 2004: Updated to version 1.3.0
  2. Added RingStyle option for compatibility with PortRingCreator.
Neo Rebus
Registered User
Join date: 10 Apr 2004
Posts: 59
07-25-2004 13:28
Third of three scripts.
Neo Rebus
Registered User
Join date: 10 Apr 2004
Posts: 59
08-01-2004 18:11
Just updated the code for PortRingCreator and PortRingRetriever to version 1.3.0 - including a fix to the parser to catch some malformed vectors in the STATION lines, as well as a new option, RingStyle, allowing you to create a "Linear" PortRing (where the first and last stations do not connect to each other) or a "Loop" PortRing (where the first and last stations wrap-around to each other).
nonnux white
NN Dez!gns
Join date: 8 Oct 2004
Posts: 90
working
12-07-2004 18:36
i reported an error here... editing it. :)

is working fine... right now is rezing some ports... well the ideia is very neat

gotta keep it low cost so all peeps got something like that

cheers NN