// Wolf Rail engine - put this in the ROOT prim of your engine. Touch it (you, the owner) to start or stop the train. // The region drives the train along the guide prims (objects named exactly "Guide", each one's red arrow, its +X, // along the line; a guide whose description has "station" in it is a station stop; one described "stop" ends the run). // Every carriage joins with the Wolf Rail carriage script and the same train name. They are placed behind the engine // by the region, across region borders too, so they never lose the train. // Uses the wolf-rail plugin through wolfCall("train.start", ...). Wolf Territories, 2026. Copy, change and share freely. string TRAIN = "My train"; // the same name in every carriage; up to 64 letters, no | float SPEED = 8.0; // metres a second between stations (up to 30) integer TURNBACK = FALSE; // wolf-rail 1.3: TRUE for a train with a cab at both ends (a DMU, a high-speed set): at a // platform's stop guide it changes ends by itself and goes back out the way it came default { touch_start(integer n) { if (llDetectedKey(0) != llGetOwner()) return; // ["state", speed now, line speed, region, vehicles, engine, why]: is it running? list info = wolfCall("train.info", [TRAIN]); if (info != [] && llList2String(info, 0) != "stopped") { wolfCall("train.speed", [TRAIN, 0.0]); // 0 brakes it to a stand llOwnerSay(TRAIN + " is stopping."); return; } // the sizes are taken from the engine itself; give them for a better fit, e.g. "bogie", 4.3, "ride", 2.3 list r = wolfCall("train.start", [TRAIN, SPEED, "announce", TRUE, "turnback", TURNBACK]); if (r == []) llOwnerSay("Could not start " + TRAIN + ": " + wolfGetLastError()); else llOwnerSay(TRAIN + " " + llList2String(r, 1) + ". Touch again to stop it."); } }