// Wolf Rail carriage - put this in the ROOT prim of each carriage (or tender, or wagon). It joins the train of the same // name; the region then keeps it in its place behind the vehicle in front, on the line the engine ran, across region // borders too. Rez the carriages behind the engine (stopped) in the order you want, or give each an "order". // Uses the wolf-rail plugin through wolfCallAsync("train.attach", ...). Wolf Territories, 2026. Copy, change and share freely. // Rez it the way it should look: one rezzed turned round (its red arrow, +X, towards the back of the train) is seen as // facing backwards and runs that way by itself. A car that drives the train (a power car, a DMU car) has POWER TRUE; a // tender or a car of a multiple unit, coupled for good to the one in front, has UNIT TRUE. Its cab, if it has one: CAB // "front" (at its own +X end), "rear" (its -X end) or "both" - then use the Wolf Rail cab script (wolf_train_cab.lsl, HEAD // FALSE) instead, so a driver can sit in it. string TRAIN = "My train"; // the engine's train name float GAP = 0.5; // metres of space between this carriage and the one in front (0 to 10) integer POWER = FALSE; // TRUE: it drives the train too (wolf-rail 1.3) integer UNIT = FALSE; // TRUE: coupled for good to the vehicle in front (a tender, a multiple unit's car) string CAB = "none"; // where its cab is: "none", "front", "rear" or "both" string FACES = ""; // "" = as it stands; "front" or "rear" to say which way its +X points join() { // the line that matters: [train, gap] and, if you like, "order", 2 / "bogie", 6.5 / "ride", 2.1 ... list opts = [TRAIN, GAP, "power", POWER, "unit", UNIT, "cab", CAB]; if (FACES != "") opts += ["faces", FACES]; if (wolfCallAsync("train.attach", opts) == NULL_KEY) llOwnerSay("Could not join " + TRAIN + ": " + wolfGetLastError()); } default { state_entry() { join(); } on_rez(integer p) { join(); } // "ok|" or "error: " dataserver(key q, string data) { if (llGetSubString(data, 0, 5) == "error:") llOwnerSay(TRAIN + ": " + llGetSubString(data, 7, -1)); else llOwnerSay("In " + TRAIN + " as vehicle " + llList2String(llParseString2List(data, ["|"], []), 1) + "."); } }