A little late but this is how I solved it... I place a new script in the car and define multiple states in it. For each state I use a llSensorRepeat in passive mode to search for a named (unscripted) prim. I set the script to scan every 5 seconds, when it detects the target is within 1m it will execute the command I specified then change to a NEW state. llSensorRepeat will now scan for the next prim. You can have a state for EACH stop. This example could be used for a TOUR TRAM ride... I used invisible unscripted prims, each uniquely named. You can also have it scan for scripted prims... change PASSIVE to ACTIVE for that. You may need to adjust range and time intervals accordingly.
default
{
state_entry()
{
llSensorRepeat("Stop-1-PRIM", "" ,PASSIVE, 1.0, PI, 5.0 );
//1.0 is the range in meters, PI is 360 degree scan, 5.0 is a 5 second interval
}
sensor (integer num_detected)
{
string message ="Our first stop on this tour takes us to this beautiful organic vegetable farm";
llSay(PUBLIC_CHANNEL, message);
state two;
}
}
state two
{
state_entry()
{
llSensorRepeat("Stop-2-PRIM", "" ,PASSIVE, 1.0, PI, 5.0 );
}
sensor (integer num_detected)
{
string message ="Our next stop on the tour takes use to the raw sewage dump which just opened across the street! The organic farmers are FURIOUS!";
llSay(PUBLIC_CHANNEL, message);
state default; // returns you to the default state or you could specify a third state and KEEP GOING...
}
}
// I hope this code snippet helps!
liked(1)