Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking For Monorail/Train/Cable Car Script

Sam Portocarrero
Jesus Of Suburbia
Join date: 23 May 2004
Posts: 316
12-17-2004 18:41
After many weeks of searching I have found no such available script for this.


Wanted -

1) Script that would work to propel a vehicle down a cable/rail/track.
(Example) Monorail, Train, Trolley, Cable Car, Roller Coaster, etc

2) The script would have to include the ability to stop at multiple "stations" along it's route and able to take grades/curves easily.

3) Needed are the scripts for both the vehicle and the track(if necessary)

4) The vehicle may be carrying as many as 15 people at a time, if possible, will need to be fairly stable under these conditions.

5) This script needs to have all permissions available, all credit will be given to it's creator.

6) I know these scripts do already exist, and I do know your time is valuable, but please... keep all prices reasonable.

7)* This script will not be resold. (Although It will be used in custom order builds)

* The scripter can resell/open source this script at will



If you are interested in this project, please send me an intelligent IM (Sam Portocarrero), or Email me at [email]sam.portocarrero@gmail.com[/email]

Thanks,
- Sam
Dominion Corporation - Second Life Division
_____________________
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
12-17-2004 18:49
Head over to Phobos and you'll find an automated public transport winding through the streets and underground on a scripted loop. That script is probably what you want, but you'll need to check with Hank Ramos on it's availability.

Edited since the thread resurfaced: The city in Phobos was destroyed long ago.
Dale Zephyr
Registered User
Join date: 23 Sep 2004
Posts: 36
12-17-2004 19:17
Working examples of what you describe are also on Paradise (Tram) and FairChang Island (Cable Car). I have no idea who scripted them but you might check it out with the owners of those islands. Both follow a track/cable and make stops at pre-determined locations.
Postmark Jensen
is not a jerk.
Join date: 23 May 2004
Posts: 281
12-18-2004 04:12
There is a scripter that has created a train that follows tracks, but the tracks can be moved and repositioned at any time and the train just keeps following them. The train was dynamically reading it's environment to determine where to go. It brought tears to my eyes, it was that cool. AND I CAN'T REMEBER HIS NAME!

The event was on Fairchang island, so maybe you could take with the guy who hosts contests. He won 1st place so someone should remember who he was...
Athos Murphy
Building Hermit
Join date: 9 Jul 2003
Posts: 73
12-20-2004 13:46
I gotta say, making a railway or trolley that crosses sim borders is the Mount Everest of movement scripts. The Great Second Life Railway has gone through eight scripters in more than a year; the latest scripts (by Phinz Phaeton and Garth Fairlight) are pretty close!

We are all looking forward to: Havok 2 (which will help with the collison physics) and a fix to the 'joint' system (Andrewwwwww ... )
_____________________
-- Athos Murphy

GSLR Proprietor
Kazenojin Pilot
SLRA Official
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
12-20-2004 14:42
From: Athos Murphy
I gotta say, making a railway or trolley that crosses sim borders is the Mount Everest of movement scripts. The Great Second Life Railway has gone through eight scripters in more than a year; the latest scripts (by Phinz Phaeton and Garth Fairlight) are pretty close!

We are all looking forward to: Havok 2 (which will help with the collison physics) and a fix to the 'joint' system (Andrewwwwww ... )


Yeah, I'd like joints to be fixed so I can link up multiple cars on my subway. Moving across sims isn't a probelm though, just have to add the appropriate cross-over prims.
_____________________
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
05-26-2005 13:12
We're interested in building a subway for our group project. While searching for a script that could be used to create a simple subway, I found this old thread. Because no follow-up information was provided, I thought I'd resurrect it to see if something out there exists.

Is there an open-source script out there available for us to extend? This is strictly noncommercial and all changes will be returned to the author or be published as open source.

Any information provided would be much appreciated. :)

~Ulrika~
_____________________
Chik-chik-chika-ahh
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
05-26-2005 14:57
I might be able to finagle something for this, depending on complexity and such. Could you post a few more specifics about it here?

I could probably do it for free, if you direct people to give me a positive rating. :)
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
05-26-2005 16:34
From: Keknehv Psaltery
I might be able to finagle something for this, depending on complexity and such. Could you post a few more specifics about it here?

I could probably do it for free, if you direct people to give me a positive rating. :)
Sure!

I'd like a vehicle to move along a track (or give the illusion of moving along a track) around a sim. The vehicle will have to translate and rotate in all three dimensions. It seems like the best way to do it is with a script that communicates with tracks to determine their orientation and then moves forward to match that orientation.

I'd prefer something quite basic and light weight with no bells and whistles. I'd prefer to add those myself later. I'd also like to keep the script open source. I'm also willing to pay and/or provide you with ample positive ratings. :D

Before you start though, I want to make sure that the script doesn't already exist out there in an open-source format. A programmer's time is precious and I'd hate to waste it where it's not needed. :)

~Ulrika~
_____________________
Chik-chik-chika-ahh
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
05-26-2005 17:37
Hmmm... I'll see what I can do for this. I have an idea of how to manage it.

By open source, do you mean modify rights?
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
05-26-2005 17:59
From: Keknehv Psaltery
Hmmm... I'll see what I can do for this. I have an idea of how to manage it.

By open source, do you mean modify rights?
Yes! Not just for me but for the whole of SL. Naturally, you'd become the keeper of the code and I'd refer folks to you without sharing the code myself.

Once you get an idea how complicated this will be, let me know what kind of compensation you'd like. I don't like starving coders (they have those sad puppy-dog eyes) and I always pay for a job well done. :D

~Ulrika~
_____________________
Chik-chik-chika-ahh
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
05-26-2005 18:50
I have just the thing.

Place a notecard and this script into the train, notecard first. Name the notecard "Coords". The Z axis is forward, the Y should be up.

The notecard format:
CODE
F<177.873, 237.20699, 3>3

F - Flat movement
Vector - Location to go to
3 - Speed

-------


C<177.873,216.686,2>22.109[50]0{PI_BY_TWO}

C - Corner (Clockwise)
Vector: Central axis
22.109: Radius
50: Number of frames to animate in the rotation
0: Start rotation of Z
PI_BY_TWO: End rotation of Z

-------


D<177.873,216.686,2>22.109[50]PI{0}

D - Corner (Counter-Clockwise)
(See Clockwise Corner)

-------


Stop

Causes train to stop for number of seconds specified

-------


!<177.873,216.686,2>22.109[50]0{PI_BY_TWO}-20

Not Implemented. For banked corners


An example notecard:

CODE
F<177.873, 237.20699, 3>3
C<177.873,216.686,2>22.109[50]0{PI_BY_TWO}
F<199.952,204.350,2.5>3
F<199.94298, 194.25351, 3.65220>3
F<199.94298, 183.97993, 5.60668>3
F<200.25533, 133.52556, 19.91790>3
F<199.88342, 124.76534, 21.25000>3
F<200.00000, 70.00000, 21.25000>3
Stop
F<200.00000, 60.00000, 21.25000>3
C<180.00000, 60.00000, 20.25000>20[50]PI_BY_TWO{PI}
F<140.00000, 40.00000, 21.25000>3
Stop
F<100.00000, 40.00000, 21.25000>3
C<95.00000, 50.00000, 20.25000>10[25]PI{3.926990817}
F<40.76227, 90.23656, 21.25000>3
C<47.777,97.276,20.25>10[25]3.926990817{4.71238898}
F<37.47700, 115.00000, 21.25000>3
C<47.47700, 115.00000, 20.25000>10[25]4.71238898{5.497787144}
F<57.17350, 138.54254, 21.25000>3
D<50.10245, 145.61360, 20.25000>10[25]5.497787144{4.71238898}
F<60.00000, 160.00000, 21.25000>3
Stop
F<60.00000, 175.00000, 21.25000>3
F<61.67082, 183.90002, 19.45028>3
F<69.40126, 193.78409, 15.97233>3
F<85.65138, 211.79961, 7.41054>3
F<102.13223, 226.12514, 3.27127>3
F<111.09530, 233.88222, 2.70276>3
F<121.20643, 237.20699, 2.70276>3
F<160.873, 237.20699, 3>3
Stop


The actual code. This was made prior to learning good standards for string usage, so expect a lot of spahm.

CODE
///////////////////////////////WARNING//////////////////////////////////////

// UNCOMMENTED CODE SHALL FOLLOW. Good Luck figuring it out\\


integer data_mode = 0; // Ignore this
integer numLines = 0; // Specify number of notecard lines here. This makes things faster
float stopTime = 15.0; // Delay when train makes a stop

iterateCurve(vector center,float radius,integer numIter,string start,string end)
{
float theStart;
float theEnd;
if(start == "PI_BY_TWO") theStart = PI_BY_TWO;
else if(start == "PI") theStart = PI;
else if(start == "TWO_PI") theStart = TWO_PI;
else theStart = (float)start;
if(end == "PI_BY_TWO") theEnd = PI_BY_TWO;
else if(end == "PI") theEnd = PI;
else if(end == "TWO_PI") theEnd = TWO_PI;
else theEnd = (float)end;
llMoveToTarget(center + <radius * llSin(theStart),radius * llCos(theStart),1>,0.3);
theStart += PI / numIter;
llLookAt(center + <radius * llSin(theStart),radius * llCos(theStart),1>,0.3,0.3);
llSleep(0.2);
if(theStart < theEnd) iterateCurve(center,radius,numIter,(string)theStart,(string)theEnd);
}
iterateCurve2(vector center,float radius,integer numIter,string start,string end)
{
float theStart;
float theEnd;
if(start == "PI_BY_TWO") theStart = PI_BY_TWO;
else if(start == "PI") theStart = PI;
else if(start == "TWO_PI") theStart = TWO_PI;
else theStart = (float)start;
if(end == "PI_BY_TWO") theEnd = PI_BY_TWO;
else if(end == "PI") theEnd = PI;
else if(end == "TWO_PI") theEnd = TWO_PI;
else theEnd = (float)end;
llMoveToTarget(center - <radius * llSin(theStart),radius * llCos(theStart),-1>,0.3);
theStart -= (PI / numIter);
llLookAt(center - <radius * llSin(theStart),radius * llCos(theStart),-1>,0.3,0.3);
llSleep(0.2);
if(theStart > theEnd) iterateCurve2(center,radius,numIter,(string)theStart,(string)theEnd);
}

iterateMajor(vector center,float radius,integer numIter,string start,string end,float zDiff)
{
float theStart;
float theEnd;
if(start == "PI_BY_TWO") theStart = PI_BY_TWO;
else if(start == "PI") theStart = PI;
else if(start == "TWO_PI") theStart = TWO_PI;
else theStart = (float)start;
if(end == "PI_BY_TWO") theEnd = PI_BY_TWO;
else if(end == "PI") theEnd = PI;
else if(end == "TWO_PI") theEnd = TWO_PI;
else theEnd = (float)end;
llMoveToTarget(center + <radius * llSin(theStart),radius * llCos(theStart),1> + <0,0,zDiff / numIter>,0.3);
theStart += PI / numIter;
llLookAt(center + <radius * llSin(theStart),radius * llCos(theStart),1> + <0,0,zDiff / numIter>,0.3,0.3);
llSleep(0.2);
if(theStart < theEnd) iterateMajor(center,radius,numIter,(string)theStart,(string)theEnd,zDiff);
}

iterateFlat(vector end, float speed)
{
llLookAt(end,0.3,0.3);
llMoveToTarget(llGetPos() + ((speed * (end - llGetPos())) / llVecMag(end - llGetPos())),0.3);
llSleep(0.2);
if(llVecMag(llGetPos() - end) > 3) iterateFlat(end,speed);
}
default
{
state_entry()
{
llSetStatus(STATUS_PHYSICS,FALSE);
llSetStatus(STATUS_ROTATE_X,TRUE);
llSetStatus(STATUS_ROTATE_Y,TRUE);
llSetStatus(STATUS_ROTATE_Z,TRUE);
llSetStatus(STATUS_BLOCK_GRAB,TRUE);
while(llGetPos() != <177.873,216.686,2>) llSetPos(<177.873,216.686,2>);
data_mode = 1;
//llGetNumberOfNotecardLines("Coords");
numLines = 32;
llMoveToTarget(llGetPos(),0.3);
llSetStatus(STATUS_PHYSICS,TRUE);
data_mode = 2;
llSetTimerEvent(1.0);
}
on_rez(integer total_number)
{
llResetScript();
}
timer()
{
llSetTimerEvent(0.0);
integer i;
for(i = 0; i < numLines; i++) llGetNotecardLine("Coords",i);
llSetTimerEvent(0.01);
}
dataserver(key id,string stuff)
{
if(data_mode == 1)
numLines = (integer)stuff;
else
{
string type = llGetSubString(stuff,0,0);
//llSay(0,stuff);
if(type == "C") iterateCurve((vector)llGetSubString(stuff,1,llSubStringIndex(stuff,">")),(float)llGetSubString(stuff,llSubStringIndex(stuff,">") + 1,llSubStringIndex(stuff,"[") - 1),(integer)llGetSubString(stuff,llSubStringIndex(stuff,"[") + 1,llSubStringIndex(stuff,"]") - 1),llGetSubString(stuff,llSubStringIndex(stuff,"]") + 1,llSubStringIndex(stuff,"{") - 1),llGetSubString(stuff,llSubStringIndex(stuff,"{") + 1,llSubStringIndex(stuff,"}") - 1));
else if(type == "D") iterateCurve2((vector)llGetSubString(stuff,1,llSubStringIndex(stuff,">")),(float)llGetSubString(stuff,llSubStringIndex(stuff,">") + 1,llSubStringIndex(stuff,"[") - 1),(integer)llGetSubString(stuff,llSubStringIndex(stuff,"[") + 1,llSubStringIndex(stuff,"]") - 1),llGetSubString(stuff,llSubStringIndex(stuff,"]") + 1,llSubStringIndex(stuff,"{") - 1),llGetSubString(stuff,llSubStringIndex(stuff,"{") + 1,llSubStringIndex(stuff,"}") - 1));
else if(type == "F") iterateFlat((vector)llGetSubString(stuff,1,llSubStringIndex(stuff,">")),(float)llGetSubString(stuff,llSubStringIndex(stuff,">") + 1,llStringLength(stuff) - 1));
else if(type == "!") iterateMajor((vector)llGetSubString(stuff,1,llSubStringIndex(stuff,">")),(float)llGetSubString(stuff,llSubStringIndex(stuff,">") + 1,llSubStringIndex(stuff,"[") - 1),(integer)llGetSubString(stuff,llSubStringIndex(stuff,"[") + 1,llSubStringIndex(stuff,"]") - 1),llGetSubString(stuff,llSubStringIndex(stuff,"]") + 1,llSubStringIndex(stuff,"{") - 1),llGetSubString(stuff,llSubStringIndex(stuff,"{") + 1,llSubStringIndex(stuff,"}") - 1),(float)llGetSubString(stuff,llSubStringIndex(stuff,"}") + 1,llStringLength(stuff) - 1));
else llSleep(stopTime);
}
}
}
_____________________
---
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
05-27-2005 09:53
From: Jeffrey Gomez
I have just the thing.
Wow. That is some serious code. Thank you so much for posting it. I'll give it a try later in the week. :)

~Ulrika~
_____________________
Chik-chik-chika-ahh
Ulrika Zugzwang
Magnanimous in Victory
Join date: 10 Jun 2004
Posts: 6,382
06-17-2005 12:53
I'm back on the hunt for some additional code. Because of the complexity of our subway system (a track that follows curvy 3D paths), the above code is proving to be difficult to implement. Is there code available for purchase that would allow a vehicle to follow a track?

I know there are roller coasters out there. I believe that kind of code would be the best for our application. Does anyone have such code they'd be willing to share or sell?

~Ulrika~
_____________________
Chik-chik-chika-ahh
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
06-17-2005 17:23
Could always heckle me in-world to write it for you with my code. :D
_____________________
---
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
06-18-2005 01:53
Awww Jeff that is he sweetest code ever. And here I thought you were heartless :P

--Jacl
_____________________
----------------------------
Taunt you with a tree filled lot? hahahahahahaha. Griefer trees! Good lord you're a drama queen. Poor poor put upon you.

-Chip Midnight
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
06-18-2005 02:51
Remind me to "show you" my Ion Beam, Jack.
_____________________
---
TXGorilla Falcone
KWKAT Planetfurry DJ
Join date: 4 May 2004
Posts: 176
10-04-2005 13:59
Ok sorry to reopen an old thread but is this able to cross sims? I am planning an airbus system of sorts and can't lay prim tracks
_____________________
Drunken Monkeys danceing on the tables.
Falling from the sky just like in a fable.
Cherry Hotaling
Registered User
Join date: 25 Feb 2007
Posts: 86
05-30-2007 10:45
Will the script listed by: Jeffrey Gomez

Go back to start again lets say the notecard takes you in a complete circle. Will it keep going around the circle forever?

I hope this is the case if not how would I code the mentioned code to go in an endless loop?

Also the script posted is not a smooth movement vehicle script right? It seems to jump from one coordinate to the next. Its also not going to the coordinate I put in the notecard.

Thanks
-Lady Cherry
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
05-31-2007 05:53
I have a Free low Lag system where each guide prim has the key of the next prim.

It's a kind of a linked list.

The road script deletes itself when you are done.

I have a free box at Charissa (240, 240) (look for a small loop of road section.)

I've also placed the protocol in the SL wiki under the protocol page.
I'll place the scripts in the SL wiki when it's done.

Current issues.
1. The inventory based settings are not done.
2. The vechical slides sideways a bit as it goes around corners.
3. Sim crossings are a problem until the "sim repeater" setting is done.

Edit: IM me and I can TP you to a pair of sims where it is being tested.
DancesWithRobots Soyer
Registered User
Join date: 7 Apr 2006
Posts: 701
Has anyone used Jeffery Gomez' scirpt?
06-25-2007 16:58
I'm using it in a subway. (It was easy once I figured out the start location is actually in the script and not the Coords notecard.) It worked better than I expected it to, even makes 90% turns in tight tunnels.

Only problem I have with it is, it seems to restart every seven and a half minutes, taking about 1 minute to make the run.

Can anyone tell me if that's adjustable in the script anywhere?

Also, I'd be interested in seeing other examples. If anyone wants a ride on my subway, send me an IM.
Jasmin Marquez
-= Money Bitch =-
Join date: 24 Sep 2005
Posts: 144
06-25-2007 21:43
Since we build San Francisco in SL and had alot of Cable Cars runnin , updated on Campin Versions too, we're in this Monorail Business of course Custom only. And i can tell ya this script is a bit laggy we use another one, you might hit me up later and i gave ya some hints ;)
_____________________
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
Dioxide DeSantis
Registered User
Join date: 2 Feb 2007
Posts: 63
10-01-2007 15:30
I tried using Jeffery's script and at first it seemed to work but now I just get a Script Run-Time Error then it says Math Error

Not sure why but it did work properly before. If I remove the script and place it back in I would say maybe 1 out of 20 times it works. Its really odd I want to update the coordinates notecard and then it stopped working went back to the original re rezed it and everything but still does not work any ideas out there or better scripts?
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
10-02-2007 16:04
From: Ulrika Zugzwang
I'm back on the hunt for some additional code. Because of the complexity of our subway system (a track that follows curvy 3D paths), the above code is proving to be difficult to implement. Is there code available for purchase that would allow a vehicle to follow a track?

I know there are roller coasters out there. I believe that kind of code would be the best for our application. Does anyone have such code they'd be willing to share or sell?

~Ulrika~


If you still need the script, I could write you it for a fee.
Dioxide DeSantis
Registered User
Join date: 2 Feb 2007
Posts: 63
10-02-2007 20:12
From: Bobbyb30 Zohari
If you still need the script, I could write you it for a fee.


I definitely would be so appreciative if you could make up a script that would work.

I dropped a note card in world to you

Dioxide