Jump to content

Train script


Drega Riddler
 Share

You are about to reply to a thread that has been inactive for 4706 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello all,

 

I am working on a simple train (one carriage, lots of seats but not many visitors expected) that is non-physical and does not use a track, i want it to go from co-ordinate to co-ordinate. I've had a look around and found a few scripts, but i'm not that great or experienced with them and thus far have only been able to give myself headaches. Would anybody be able to offer any help with this?

Much obliged.

Link to comment
Share on other sites

You can get help at the Virtual Railway Consortium

http://www.virtualrailwayconsortium.org/

On this website you will find more information about this Second LifeTM group and its goals. 

The Virtual Railway Consortium consists of members that enjoy the diverse railway and other transportation resources in Second life.

Here is the slurl to the HQ:

http://slurl.com/secondlife/Tuliptree/96/142/30)

Contact Moundsa Mayo or Stryker Jenkins

Or check the  builders forum:

 http://vrcforum.niceboards.org/f9-rail-and-train-builders-forum

Link to comment
Share on other sites

Why don't you want it to be physical?  The usual way to make such things is to have them call llMove2Target to move to a series of destinations, which either the script knows beforehand or which are specified by beacons which it detects en route.

That makes it far easier to control the speed, since physics functions are for moving objects about the sim.

The alternative, for a non-physical object, is repeatedly to call llSetPrimitiveParams to follow a similar course, but it means calling it repeatedly. on a very short timer, if the movement isn't to be very fast and jerky.  

This is because physical movement actually moves the object between points on a sim, passing through intermediate ones, in the same way an avatar might walk or fly, while non-physical movement actually picks up the object from the sim at point A and replaces it at point B, and the sim tries, more or less successfully, to interpolate the apparent movement between the two points.  And unless you're repeatedly moving it very short distances over very short times -- fractions of a metre every fraction of a second -- it never looks right over long distances.

Link to comment
Share on other sites

 


Drega Riddler wrote:

Well, the reason for not being physical is that i am going to have no track, so if it were physical it would just fall correct?

I don't really understand.   Why should it, unless you set it to phantom while it's physical and not moving?    Certainly if you set it to phantom and then stop llMove2Target without turning off physics first it goes through the floor, as I have many times proved without intending to, but so long as you're careful about doing stuff in the right order it should be ok.

The main advantage to having tracks, other than the cosmetic ones, is that it's an easy way to place the beacons the train has to look for.  But you're going to need to set those somehow in any case.

 

Link to comment
Share on other sites

If thats the case, i may go with it then. I can set beacons in the stations i have set along the route without an issue. And by fall i mean the train itself would fall when i set it to Physical, not Phantom. I just want it on an endless loop going from station to station with an interval of 30 seconds waiting at each point.

Link to comment
Share on other sites

In that case, so long as you're careful about what order you turn things on and off, I think llMove2Target should do what you want.   When I'm stopping stuff, I always turn physics off first, before I do anything else, and when I'm starting I always turn it on right at the end of calculating everying, just before I start moving again.  And if I'm making the object phantom, then I don't do that, if I can help it, until I'm actually moving.

The not_at_target event, which is called constantly while you're moving, is a very good place to check if you're where you think you should be and to take any necessary corrective action.

As a general point, I would suggest putting a listener in your moving physical object when you're testing it , though, that either turns physics off and uses posjump to bring the object back home, or simply kills it, and having a simple prim by you, which calls something like llRegionSay(some channel, "where the **** did you go?") when you touch it.    I have learned this the hard way.

Link to comment
Share on other sites

it's possible to program a route without beacons, using just coordinates in the script, and as long as the train rests on something it's fine to be physical (although the Caledon rail trains are not, but they also use track detection). if you're using vehicle based  scripts you don't even have to worry about having something to like a flor or the ground to rest on (as the wonderful CAT airships prove.

the main benefit to tracks and beacons is that it's harder for the train (or w/e) to get lost along the way (a problem at region crossings mostly)

Link to comment
Share on other sites

 


Void Singer wrote:

it's possible to program a route without beacons, using just coordinates in the script, and as long as the train rests on something it's fine to be physical (although the Caledon rail trains are not, but they also use track detection). if you're using vehicle based  scripts you don't even have to worry about having something to like a flor or the ground to rest on (as the wonderful CAT airships prove.

the main benefit to tracks and beacons is that it's harder for the train (or w/e) to get lost along the way (a problem at region crossings mostly)

Or you can do a hybrid approach.  I scripted a train recently that uses temporary beacons for setup. They signal their positions to the train, which memorizes them and uses them to follow the track, long after I have deleted the temporary beacons to save on prims.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4706 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...