removed useless _ folders
This commit is contained in:
3
OpenSim Tour Car/OpenSim Tour Car.sol
Normal file
3
OpenSim Tour Car/OpenSim Tour Car.sol
Normal file
@@ -0,0 +1,3 @@
|
||||
<Solution name="OpenSim Tour Car">
|
||||
<Project name="Opensim Tour Car" path="Opensim Tour Car\Opensim Tour Car.prj" active="true"/>
|
||||
</Solution>
|
||||
359
OpenSim Tour Car/Opensim Tour Car/Car/Multi-vehicle script.lsl
Normal file
359
OpenSim Tour Car/Opensim Tour Car/Car/Multi-vehicle script.lsl
Normal file
@@ -0,0 +1,359 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Tour
|
||||
// :NAME:OpenSim Tour Car
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-02-25 22:55:43
|
||||
// :EDITED:2015-02-25 21:55:43
|
||||
// :ID:1040
|
||||
// :NUM:1722
|
||||
// :REV:1
|
||||
// :WORLD:Opensim or Secondlife// :DESCRIPTION:
|
||||
// :DESCRIPTION:
|
||||
// Opensim Tour Boat
|
||||
// :CODE:
|
||||
// Tour car prim for Opensim - can switch the vehicle while riding
|
||||
// Put a unique name in the cars prims for each type.
|
||||
|
||||
|
||||
|
||||
integer _debug = 0;
|
||||
|
||||
integer REZ = 3454; // shouts Rex on this channel so a rezzer can produce another car, as this one will die
|
||||
float INTERVAL = 0.5; // How often to check for progress
|
||||
float TOLERANCE = 2; // how close to the destination we have to get
|
||||
float SPEED = 8.0; // speed of vehicle
|
||||
|
||||
vector TARGET = <0,0,0>; // sit position on the root prim. Ste this to <0,0,0> if you want to not to be able to sit on the base
|
||||
vector ROT = <0,0,0>; // and the rotation, if they sit
|
||||
|
||||
list lCoordinate;
|
||||
list lRotation ;
|
||||
list lText;
|
||||
list lPrim;
|
||||
|
||||
// notecard reading
|
||||
integer iIndexLines;
|
||||
integer i;
|
||||
string NOTECARD = "Route"; // the notecard for configuring
|
||||
|
||||
key kNoteCardLines; // the key of the notecard
|
||||
key kGetIndexLines; // the key of the current line
|
||||
|
||||
integer count = 0;
|
||||
|
||||
vector TargetLocation;
|
||||
rotation TargetRotation;
|
||||
|
||||
Switch(string whichPrim)
|
||||
{
|
||||
integer n = llGetNumberOfPrims();
|
||||
integer i;
|
||||
for ( i = 1; i < n; i++) {
|
||||
|
||||
if (llGetLinkName(i) == whichPrim) {
|
||||
llSetLinkAlpha(i,1.0,ALL_SIDES);
|
||||
} else {
|
||||
llSetLinkAlpha(i,0,ALL_SIDES); // 0 = transparent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Goto()
|
||||
{
|
||||
if (_debug)
|
||||
llOwnerSay("Looking at Target Location = " + (string) TargetLocation);
|
||||
|
||||
vector ownPosition = llGetPos();
|
||||
float dist = llVecDist(ownPosition, TargetLocation);
|
||||
|
||||
float rate = dist / SPEED;
|
||||
|
||||
rotation ownRotation = llGetRot();
|
||||
|
||||
llSetKeyframedMotion(
|
||||
[(TargetLocation - ownPosition) + <0.0, 0.0, -.5> * TargetRotation,
|
||||
NormRot(TargetRotation/ownRotation), rate],
|
||||
[]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
rotation NormRot(rotation Q)
|
||||
{
|
||||
float MagQ = llSqrt(Q.x*Q.x + Q.y*Q.y +Q.z*Q.z + Q.s*Q.s);
|
||||
|
||||
return
|
||||
<Q.x/MagQ, Q.y/MagQ, Q.z/MagQ, Q.s/MagQ>;
|
||||
}
|
||||
|
||||
integer locationLength;
|
||||
|
||||
|
||||
string strip( string str)
|
||||
{
|
||||
string out;
|
||||
integer i;
|
||||
|
||||
//llOwnerSay("str = " + str);
|
||||
|
||||
for ( ; i < llStringLength(str); i++)
|
||||
{
|
||||
out += llGetSubString(str,i,i);
|
||||
|
||||
out = llStringTrim(out, STRING_TRIM);
|
||||
//llOwnerSay("out = " + out + " at " + (string) i);
|
||||
}
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
string Getline(list Input, integer line)
|
||||
{
|
||||
return strip(llList2String(Input, line));
|
||||
}
|
||||
|
||||
|
||||
default
|
||||
{
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
changed( integer change )
|
||||
{
|
||||
if (change & CHANGED_INVENTORY)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
|
||||
state_entry()
|
||||
{
|
||||
|
||||
llSetLinkPrimitiveParamsFast(LINK_ROOT,
|
||||
[PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX,
|
||||
PRIM_LINK_TARGET, LINK_ALL_CHILDREN,
|
||||
PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_NONE]);
|
||||
|
||||
llSetCameraEyeOffset(<0, 5, 0> );
|
||||
llSetCameraAtOffset(<0, 0, 1>);
|
||||
|
||||
|
||||
rotation rot = llEuler2Rot(ROT * DEG_TO_RAD); // convert the degrees to radians, then convert that vector into a rotation, rot30x
|
||||
llSitTarget(TARGET, rot); // where they sit
|
||||
|
||||
|
||||
kNoteCardLines = llGetNumberOfNotecardLines(NOTECARD);
|
||||
kGetIndexLines = llGetNotecardLine(NOTECARD,0);
|
||||
|
||||
llSay (0, "Tour guide initialising. Please wait.");
|
||||
}
|
||||
|
||||
// read notecard on bootup
|
||||
dataserver(key queryid, string data)
|
||||
{
|
||||
|
||||
vector TempLocation;
|
||||
if (queryid == kNoteCardLines)
|
||||
{
|
||||
iIndexLines = (integer) data;
|
||||
}
|
||||
|
||||
if (queryid == kGetIndexLines)
|
||||
{
|
||||
if (data != EOF)
|
||||
{
|
||||
queryid = llGetNotecardLine(NOTECARD, i);
|
||||
list lLine = (llParseString2List(data, ["|"], []));
|
||||
if (_debug ) llOwnerSay("Line = " + llDumpList2String(lLine,":"));
|
||||
|
||||
TempLocation = (vector) Getline(lLine,1);
|
||||
if (TempLocation != ZERO_VECTOR)
|
||||
{
|
||||
rotation Rot = (rotation) llList2String(lLine,2);
|
||||
string text = llList2String(lLine,3);
|
||||
string primName = llList2String(lLine,4);
|
||||
|
||||
if (_debug) llOwnerSay((string)TempLocation);
|
||||
|
||||
lCoordinate += [TempLocation];
|
||||
lRotation += [Rot];
|
||||
lText += [text];
|
||||
lPrim += [primName];
|
||||
|
||||
locationLength = (llGetListLength(lCoordinate));
|
||||
integer InitPerCent = (integer) llRound(((float) locationLength / (float) iIndexLines) * 100);
|
||||
llSetText("Initialising... \n" + (string) InitPerCent + "%" , <1,1,1>, 1.0);
|
||||
if (InitPerCent == 100)
|
||||
{
|
||||
state Paused;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
state Paused;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
kGetIndexLines = llGetNotecardLine(NOTECARD,i);
|
||||
// (_debug ) llOwnerSay("Got " + (string) i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
state_exit()
|
||||
{
|
||||
llSetText("", <1,1,1>, 1.0);
|
||||
TargetLocation = llList2Vector(lCoordinate, 0); // Look at 0th
|
||||
TargetRotation = llList2Rot(lRotation, 0); // Look at 0th
|
||||
Goto();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
state Paused
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay(0,"Ready");
|
||||
}
|
||||
|
||||
link_message(integer sender,integer num,string msg, key id)
|
||||
{
|
||||
if (msg =="sit")
|
||||
{
|
||||
llWhisper(0,"Please stay seated. Waiting 10 seconds for a passenger");
|
||||
|
||||
llSleep(10.0);
|
||||
|
||||
llShout(REZ,"rez");
|
||||
state moving;
|
||||
}
|
||||
}
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
changed( integer change )
|
||||
{
|
||||
if (change & CHANGED_INVENTORY)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state moving
|
||||
{
|
||||
|
||||
state_entry()
|
||||
{
|
||||
|
||||
if (_debug) llOwnerSay("State Moving entered, is pointing to target " + (string) TargetLocation );
|
||||
|
||||
string SpeakThis = llList2String(lText, count);
|
||||
|
||||
if (llStringLength(SpeakThis))
|
||||
llSay(0,SpeakThis);
|
||||
|
||||
llSetTimerEvent(INTERVAL);
|
||||
}
|
||||
|
||||
changed(integer change)
|
||||
{
|
||||
if (change & CHANGED_LINK)
|
||||
{
|
||||
key av = llAvatarOnSitTarget();
|
||||
//llWhisper(0,"Sit by " + (string) av);
|
||||
if (av == NULL_KEY) {
|
||||
state end;
|
||||
}
|
||||
}
|
||||
if (change & CHANGED_INVENTORY)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
|
||||
if (llVecMag(llGetPos() - TargetLocation) <= TOLERANCE) {
|
||||
|
||||
if (_debug) llOwnerSay("At location: " + (string) llGetPos());
|
||||
count ++;
|
||||
|
||||
if (count >= locationLength) {
|
||||
|
||||
state end;
|
||||
|
||||
if (_debug) llOwnerSay("Restart: " + (string) TargetLocation);
|
||||
TargetLocation = llList2Vector(lCoordinate, 0); // Look at 0th
|
||||
TargetRotation = llList2Rot(lRotation, 0); // Look at 0th
|
||||
Goto();
|
||||
count = 0;
|
||||
|
||||
} else {
|
||||
TargetLocation = llList2Vector(lCoordinate, count); // Look at nth
|
||||
TargetRotation = llList2Rot(lRotation, count); // Look at nth
|
||||
string SpeakThis = llList2String(lText, count);
|
||||
|
||||
if (llStringLength(SpeakThis))
|
||||
llSay(0,SpeakThis);
|
||||
|
||||
// if the last param is a name, change any prim by that name to be visible, and any others to be invidible.
|
||||
string whichPrim = llList2String(lPrim, count);
|
||||
if (whichPrim)
|
||||
Switch(whichPrim);
|
||||
|
||||
Goto();
|
||||
if (_debug) llOwnerSay("New Target: " + (string) TargetLocation);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
state_exit()
|
||||
{
|
||||
llSetTimerEvent(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
state end
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llMessageLinked(LINK_SET,0,"DOOR OPEN","");
|
||||
|
||||
llSetTimerEvent(0);
|
||||
|
||||
key av = llAvatarOnSitTarget();
|
||||
if (av != NULL_KEY) {
|
||||
//llWhisper(0, llKey2Name(av) +", please go into the hotel and check in.");
|
||||
llUnSit(av);
|
||||
}
|
||||
llSetTimerEvent(60);
|
||||
}
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
timer()
|
||||
{
|
||||
llDie();
|
||||
}
|
||||
|
||||
}
|
||||
21
OpenSim Tour Car/Opensim Tour Car/Car/Route
Normal file
21
OpenSim Tour Car/Opensim Tour Car/Car/Route
Normal file
@@ -0,0 +1,21 @@
|
||||
// :CATEGORY:Tour
|
||||
// :NAME:OpenSim Tour Car
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2014-09-07 10:50:19
|
||||
// :EDITED:2014-09-07
|
||||
// :ID:1040
|
||||
// :NUM:1625
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Opensim Touring vehicle
|
||||
// :CODE:
|
||||
[20:17] Recorder Master: 10|<668.311157,14.524110,21.848991>|<0.000000,0.000000,0.000000,1.000000>
|
||||
[20:17] Recorder Master: 20|<635.283081,13.997888,21.848991>|<0.000000,0.000000,0.000000,1.000000>
|
||||
[20:17] Recorder Master: 30|<631.044006,14.764651,21.848991>|<0.000000,0.000000,-0.317305,0.948324>
|
||||
[20:17] Recorder Master: 40|<626.997498,20.153231,21.848991>|<0.000000,0.000000,-0.544650,0.838663>
|
||||
[20:17] Recorder Master: 50|<621.852173,23.064606,22.349892>|<0.000000,0.000000,-0.139210,0.990263>
|
||||
[20:17] Recorder Master: 60|<604.187073,24.317200,23.093729>|<0.000000,0.000000,-0.043657,0.999047>
|
||||
[20:17] Recorder Master: 70|<592.654602,25.565714,23.093729>|<0.000000,0.000000,-0.043657,0.999047>
|
||||
[20:17] Recorder Master: 80|<586.899597,27.138906,23.533955>|<0.000000,0.000000,-0.309082,0.951035>
|
||||
48
OpenSim Tour Car/Opensim Tour Car/Car/Seats.lsl
Normal file
48
OpenSim Tour Car/Opensim Tour Car/Car/Seats.lsl
Normal file
@@ -0,0 +1,48 @@
|
||||
// :SHOW:
|
||||
// :CATEGORY:Tour
|
||||
// :NAME:OpenSim Tour Car
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2015-02-25 22:55:43
|
||||
// :EDITED:2015-02-25 21:55:43
|
||||
// :ID:1040
|
||||
// :NUM:1723
|
||||
// :REV:1
|
||||
// :WORLD:Opensim or Secondlife
|
||||
// :DESCRIPTION:
|
||||
// Tour car seat for Multi-vehicle script - place this in any seat and adjust the TARGET and ROT as necessary
|
||||
// :CODE:
|
||||
|
||||
|
||||
vector TARGET = <0,0,0.1>; // sit position on the root prim. Ste this to <0,0,0> if you want to not to be able to sit on the base
|
||||
vector ROT = <0,0,0>; // and the rotation, if they sit
|
||||
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSetCameraEyeOffset(<5, 0, 0> );
|
||||
llSetCameraAtOffset(<0, 0, 1>);
|
||||
|
||||
rotation rot = llEuler2Rot(ROT * DEG_TO_RAD); // convert the degrees to radians,
|
||||
// then convert that vector into a rotation
|
||||
llSitTarget(TARGET, rot); // where they sit
|
||||
|
||||
}
|
||||
|
||||
changed( integer what )
|
||||
{
|
||||
if (what & CHANGED_LINK)
|
||||
{
|
||||
key av = llAvatarOnSitTarget();
|
||||
if (av != NULL_KEY) {
|
||||
llMessageLinked(LINK_SET,0, "Sit","");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
364
OpenSim Tour Car/Opensim Tour Car/Car/vehicle script.lsl
Normal file
364
OpenSim Tour Car/Opensim Tour Car/Car/vehicle script.lsl
Normal file
@@ -0,0 +1,364 @@
|
||||
// :SHOW:1
|
||||
// :CATEGORY:Tour
|
||||
// :NAME:OpenSim Tour Car
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2014-09-07 10:50:19
|
||||
// :EDITED:2015-05-29 11:26:03
|
||||
// :ID:1040
|
||||
// :NUM:1626
|
||||
// :REV:2
|
||||
// :WORLD:Opensim or Secondlife
|
||||
// :DESCRIPTION:
|
||||
// Tour car prim for Opensim
|
||||
// :CODE:
|
||||
|
||||
|
||||
integer _debug = 0;
|
||||
|
||||
integer REZ = 3454; // shouts Rex on this channel so a rezzer can produce another car, as this one will die
|
||||
float INTERVAL = 0.5; // How often to check for progress
|
||||
float TOLERANCE = 2; // how close to the destination we have to get
|
||||
float SPEED = 5.0; // speed of vehicle
|
||||
integer DieAtEnd = FALSE; // set to FALSE for endless loop, ser to TRUE to poof
|
||||
|
||||
vector TARGET = <0.0, -0.6,0.6>; // sit position on the root prim. Set this to <0,0,0> if you want to not to be able to sit on the base
|
||||
vector ROT = <0, 0, 180>; // and the rotation, if they sit
|
||||
|
||||
list lCoordinate;
|
||||
list lRotation ;
|
||||
list lText;
|
||||
|
||||
// notecard reading
|
||||
integer iIndexLines;
|
||||
integer i;
|
||||
string NOTECARD = "Route"; // the notecard for configuring
|
||||
|
||||
key kNoteCardLines; // the key of the notecard
|
||||
key kGetIndexLines; // the key of the current line
|
||||
|
||||
integer count = 0;
|
||||
vector startPos;
|
||||
rotation startRot;
|
||||
|
||||
vector TargetLocation;
|
||||
rotation TargetRotation;
|
||||
|
||||
|
||||
Goto()
|
||||
{
|
||||
if (_debug)
|
||||
llOwnerSay("Looking at Target Location = " + (string) TargetLocation);
|
||||
|
||||
vector ownPosition = llGetPos();
|
||||
float dist = llVecDist(ownPosition, TargetLocation);
|
||||
|
||||
float rate = dist / SPEED;
|
||||
|
||||
rotation ownRotation = llGetRot();
|
||||
|
||||
llSetKeyframedMotion(
|
||||
[(TargetLocation - ownPosition) + <0.0, 0.0, -.5> * TargetRotation,
|
||||
NormRot(TargetRotation/ownRotation), rate],
|
||||
[]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
rotation NormRot(rotation Q)
|
||||
{
|
||||
float MagQ = llSqrt(Q.x*Q.x + Q.y*Q.y +Q.z*Q.z + Q.s*Q.s);
|
||||
|
||||
return
|
||||
<Q.x/MagQ, Q.y/MagQ, Q.z/MagQ, Q.s/MagQ>;
|
||||
}
|
||||
|
||||
integer locationLength;
|
||||
|
||||
|
||||
string strip( string str)
|
||||
{
|
||||
string out;
|
||||
integer i;
|
||||
|
||||
//llOwnerSay("str = " + str);
|
||||
|
||||
for ( ; i < llStringLength(str); i++)
|
||||
{
|
||||
out += llGetSubString(str,i,i);
|
||||
|
||||
out = llStringTrim(out, STRING_TRIM);
|
||||
//llOwnerSay("out = " + out + " at " + (string) i);
|
||||
}
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
string Getline(list Input, integer line)
|
||||
{
|
||||
return strip(llList2String(Input, line));
|
||||
}
|
||||
|
||||
|
||||
default
|
||||
{
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
changed( integer change )
|
||||
{
|
||||
if (change & CHANGED_INVENTORY)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
|
||||
state_entry()
|
||||
{
|
||||
llSetLinkPrimitiveParamsFast(LINK_ROOT,
|
||||
[PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX,
|
||||
PRIM_LINK_TARGET, LINK_ALL_CHILDREN,
|
||||
PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_NONE]);
|
||||
|
||||
llSetCameraEyeOffset(<2, 5, 2> );
|
||||
llSetCameraAtOffset(<0, 0, 1>);
|
||||
|
||||
|
||||
rotation rot = llEuler2Rot(ROT * DEG_TO_RAD); // convert the degrees to radians, then convert that vector into a rotation, rot30x
|
||||
llSitTarget(TARGET, rot); // where they sit
|
||||
|
||||
|
||||
kNoteCardLines = llGetNumberOfNotecardLines(NOTECARD);
|
||||
kGetIndexLines = llGetNotecardLine(NOTECARD,0);
|
||||
|
||||
llSay (0, "Tour guide initialising. Please wait.");
|
||||
}
|
||||
|
||||
// read notecard on bootup
|
||||
dataserver(key queryid, string data)
|
||||
{
|
||||
vector TempLocation;
|
||||
if (queryid == kNoteCardLines)
|
||||
{
|
||||
iIndexLines = (integer) data;
|
||||
}
|
||||
|
||||
if (queryid == kGetIndexLines)
|
||||
{
|
||||
if (data != EOF)
|
||||
{
|
||||
queryid = llGetNotecardLine(NOTECARD, i);
|
||||
list lLine = (llParseString2List(data, ["|"], []));
|
||||
if (_debug ) llOwnerSay("Line = " + llDumpList2String(lLine,":"));
|
||||
|
||||
TempLocation = (vector) Getline(lLine,1);
|
||||
if (TempLocation != ZERO_VECTOR)
|
||||
{
|
||||
rotation Rot = (rotation) llList2String(lLine,2);
|
||||
string text = llList2String(lLine,3);
|
||||
|
||||
if (_debug) llOwnerSay((string)TempLocation);
|
||||
|
||||
lCoordinate += [TempLocation];
|
||||
lRotation += [Rot];
|
||||
lText += [text];
|
||||
|
||||
locationLength = (llGetListLength(lCoordinate));
|
||||
integer InitPerCent = (integer) llRound(((float) locationLength / (float) iIndexLines) * 100);
|
||||
llSetText("Initialising... \n" + (string) InitPerCent + "%" , <1,1,1>, 1.0);
|
||||
if (InitPerCent == 100)
|
||||
{
|
||||
state Paused;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state Paused;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
kGetIndexLines = llGetNotecardLine(NOTECARD,i);
|
||||
// (_debug ) llOwnerSay("Got " + (string) i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
state_exit()
|
||||
{
|
||||
llSetText("", <1,1,1>, 1.0);
|
||||
TargetLocation = llList2Vector(lCoordinate, 0); // Look at 0th
|
||||
TargetRotation = llList2Rot(lRotation, 0); // Look at 0th
|
||||
startPos = TargetLocation;
|
||||
startRot= TargetRotation;
|
||||
llSetRegionPos(TargetLocation);
|
||||
llSetRot(TargetRotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
state Paused
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay(0,"Ready");
|
||||
}
|
||||
|
||||
link_message(integer sender,integer num,string msg, key id)
|
||||
{
|
||||
if (msg =="sit")
|
||||
{
|
||||
llSay(0,"Please stay seated. Waiting 10 seconds for a passenger");
|
||||
llSleep(10.0);
|
||||
llShout(REZ,"rez");
|
||||
state moving;
|
||||
}
|
||||
}
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
changed( integer change )
|
||||
{
|
||||
if (change & CHANGED_INVENTORY)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
if (change & CHANGED_LINK)
|
||||
{
|
||||
key av = llAvatarOnSitTarget();
|
||||
//llWhisper(0,"Sit by " + (string) av);
|
||||
if (av) //evaluated as true if not NULL_KEY or invalid
|
||||
{
|
||||
llSay(0,"Please stay seated. Waiting 10 seconds for a passenger");
|
||||
llSleep(10.0);
|
||||
|
||||
llShout(REZ,"rez");
|
||||
|
||||
state moving;
|
||||
} else {
|
||||
state end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state moving
|
||||
{
|
||||
|
||||
state_entry()
|
||||
{
|
||||
|
||||
if (_debug) llOwnerSay("State Moving entered, is pointing to target " + (string) TargetLocation );
|
||||
|
||||
string SpeakThis = llList2String(lText, count);
|
||||
|
||||
if (llStringLength(SpeakThis))
|
||||
llSay(0,SpeakThis);
|
||||
|
||||
llSetTimerEvent(INTERVAL);
|
||||
}
|
||||
|
||||
changed(integer change)
|
||||
{
|
||||
if (change & CHANGED_LINK)
|
||||
{
|
||||
key av = llAvatarOnSitTarget();
|
||||
//llWhisper(0,"Sit by " + (string) av);
|
||||
if (av) //evaluated as true if not NULL_KEY or invalid
|
||||
{
|
||||
//tate moving;
|
||||
}
|
||||
else
|
||||
{
|
||||
state end;
|
||||
}
|
||||
}
|
||||
if (change & CHANGED_INVENTORY)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
|
||||
if (llVecMag(llGetPos() - TargetLocation) <= TOLERANCE) {
|
||||
|
||||
if (_debug) llOwnerSay("At location: " + (string) llGetPos());
|
||||
count ++;
|
||||
|
||||
if (count >= locationLength) {
|
||||
state end;
|
||||
} else {
|
||||
TargetLocation = llList2Vector(lCoordinate, count); // Look at nth
|
||||
TargetRotation = llList2Rot(lRotation, count); // Look at nth
|
||||
string SpeakThis = llList2String(lText, count);
|
||||
|
||||
if (llStringLength(SpeakThis))
|
||||
llSay(0,SpeakThis);
|
||||
|
||||
Goto();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
state_exit()
|
||||
{
|
||||
llSetTimerEvent(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
state end
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llMessageLinked(LINK_SET,0,"DOOR OPEN","");
|
||||
|
||||
llSetTimerEvent(0);
|
||||
|
||||
key av = llAvatarOnSitTarget();
|
||||
if (av) {//evaluated as true if not NULL_KEY or invalid
|
||||
llWhisper(0, llKey2Name(av) +", please go into the hotel and check in.");
|
||||
llUnSit(av);
|
||||
}
|
||||
llMessageLinked(LINK_SET,0,"unsit","");
|
||||
llSetTimerEvent(5);
|
||||
}
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
llSetTimerEvent(0);
|
||||
state Paused;
|
||||
}
|
||||
|
||||
|
||||
state_exit()
|
||||
{
|
||||
TargetLocation = startPos;
|
||||
TargetRotation = startRot;
|
||||
llSetRegionPos(startPos);
|
||||
llSetRot(TargetRotation);
|
||||
count = 0;
|
||||
}
|
||||
|
||||
}
|
||||
18
OpenSim Tour Car/Opensim Tour Car/Opensim Tour Car.prj
Normal file
18
OpenSim Tour Car/Opensim Tour Car/Opensim Tour Car.prj
Normal file
@@ -0,0 +1,18 @@
|
||||
<Project name="Opensim Tour Car" guid="d2a143ca-20c8-42d7-adf5-9955e4245417">
|
||||
<Object name="Car" guid="6c87b986-eab3-4c79-926f-6a13458ff3b5" active="true">
|
||||
<Script name="Multi-vehicle script.lsl" guid="fbaa311f-364f-4020-bb82-c2f11d59b28a">
|
||||
</Script>
|
||||
<Notecard name="Route" guid="faf88835-bcda-4c3c-b2d0-2ad5da4153e9">
|
||||
</Notecard>
|
||||
<Script name="Seats.lsl" guid="c282ed8a-5e0e-4315-b082-48c056421df8">
|
||||
</Script>
|
||||
<Script name="vehicle script.lsl" guid="9e2b76bc-1beb-4e2d-86dc-a9c469650994">
|
||||
</Script>
|
||||
</Object>
|
||||
<Object name="Route Prim" guid="e0447094-4ea9-4165-8387-44e758fee79b">
|
||||
<Script name="#10 prim.lsl" guid="25c4e2fe-1b94-408b-9d40-bd03649c2444">
|
||||
</Script>
|
||||
<Script name="Recorder.lsl" guid="098d27e1-b1ed-458c-b892-264fc02ce767">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
82
OpenSim Tour Car/Opensim Tour Car/Route Prim/#10 prim.lsl
Normal file
82
OpenSim Tour Car/Opensim Tour Car/Route Prim/#10 prim.lsl
Normal file
@@ -0,0 +1,82 @@
|
||||
// :CATEGORY:Tour
|
||||
// :NAME:OpenSim Tour Car
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2014-09-07 10:50:19
|
||||
// :EDITED:2014-09-07
|
||||
// :ID:1040
|
||||
// :NUM:1627
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Tour Routing prim for Opensim
|
||||
// :CODE:
|
||||
|
||||
|
||||
// WAYPOINT #10 PRIM SCRIPT
|
||||
// When rezzed, does a llRegionSay on channel 300 of the word "number". Other #10 prims hear this
|
||||
// chats 10||Description on channel 300 when it hears 'number' on 300.
|
||||
// remembers the highest number it hears and sets the name to 10+ that number
|
||||
|
||||
|
||||
integer wanted = 0;
|
||||
integer debugger = 1;
|
||||
|
||||
list prims;
|
||||
|
||||
|
||||
debug(string message)
|
||||
{
|
||||
if (debugger)
|
||||
llOwnerSay(message);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(300,"","","");
|
||||
wanted++;
|
||||
llRegionSay(300,"number");
|
||||
llSetTimerEvent(5.0); // 5 seconds to hear from all prims
|
||||
llOwnerSay("Setting coordinates");
|
||||
}
|
||||
|
||||
listen(integer channel,string name, key id, string message)
|
||||
{
|
||||
if (message == "die")
|
||||
llDie();
|
||||
|
||||
else if (message =="where")
|
||||
llRegionSay(300,llGetObjectDesc() + "|" + (string) llGetPos() + "|" + (string) llGetRot());
|
||||
|
||||
else if (message =="number")
|
||||
llRegionSay(300,llGetObjectDesc());
|
||||
|
||||
else if (wanted)
|
||||
{
|
||||
prims += (integer) message; // add to memory list
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
wanted = 0;
|
||||
prims = llListSort(prims,1,0); // sort descending
|
||||
integer num = (integer) llList2Integer(prims,0); // get highest number
|
||||
llSetObjectDesc((string) (num + 10)); // leave room for more prims to be added
|
||||
llSetText((string)(num + 10),<1,1,1>,1.0);
|
||||
llOwnerSay("Desc set to " + llGetObjectDesc());
|
||||
|
||||
llSetTimerEvent(0);
|
||||
}
|
||||
|
||||
on_rez(integer p)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
121
OpenSim Tour Car/Opensim Tour Car/Route Prim/Recorder.lsl
Normal file
121
OpenSim Tour Car/Opensim Tour Car/Route Prim/Recorder.lsl
Normal file
@@ -0,0 +1,121 @@
|
||||
// :CATEGORY:Tour
|
||||
// :NAME:OpenSim Tour Car
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2014-09-07 10:50:19
|
||||
// :EDITED:2014-09-07
|
||||
// :ID:1040
|
||||
// :NUM:1628
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// Tour recordwer. Touch this after placing #10 prims
|
||||
// :CODE:
|
||||
|
||||
|
||||
osMakeNotecard(string notecardName, string contents) {
|
||||
llOwnerSay("Make Notecard " + notecardName + "Contents:" + (string) contents);
|
||||
}
|
||||
|
||||
|
||||
|
||||
integer wanted = 0;
|
||||
integer debugger =1;
|
||||
list prims;
|
||||
|
||||
|
||||
debug(string message)
|
||||
{
|
||||
if (debugger)
|
||||
llOwnerSay(message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
string left(string src, string divider) {
|
||||
integer index = llSubStringIndex( src, divider );
|
||||
if(~index)
|
||||
return llDeleteSubString( src, index , -1);
|
||||
return src;
|
||||
}
|
||||
|
||||
string right(string src, string divider) {
|
||||
integer index = llSubStringIndex( src, divider );
|
||||
if(~index)
|
||||
return llDeleteSubString( src, 0, index + llStringLength(divider) - 1);
|
||||
return src;
|
||||
}
|
||||
|
||||
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSetText("Click after setting up all tour prims.", <1.0, 1.0, 1.0>, 2.0);
|
||||
llListen(300,"","","");
|
||||
}
|
||||
|
||||
touch_start(integer n)
|
||||
{
|
||||
llOwnerSay("Please wait");
|
||||
prims = [];
|
||||
wanted ++;
|
||||
llRegionSay(300,"where");
|
||||
}
|
||||
|
||||
listen(integer channel,string name, key id, string message)
|
||||
{
|
||||
debug(llGetObjectName() + " heard " + message);
|
||||
if (wanted)
|
||||
{
|
||||
list msg = llParseString2List(message,["|"],[""]);
|
||||
integer aname = (integer) llList2String(msg,0);
|
||||
vector dest = (vector) llList2String (msg,1);
|
||||
rotation arot = (rotation) llList2String(msg,2);
|
||||
integer isthere = llListFindList(prims,[aname]);
|
||||
|
||||
if (isthere > -1)
|
||||
{
|
||||
llOwnerSay("Error, there are two prims named " + aname + ". Please make sure each prim is uniquely numbered from - to N in sequence from the start prim to the finish prim. Gaps in the sequence are allowed.");
|
||||
}
|
||||
|
||||
if (wanted)
|
||||
{
|
||||
prims += (integer) aname;
|
||||
prims += (vector) dest;
|
||||
prims += (rotation) arot;
|
||||
|
||||
}
|
||||
llSetTimerEvent(10.0);
|
||||
}
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
wanted = 0;
|
||||
llSetTimerEvent(0);
|
||||
integer i = 0;
|
||||
|
||||
prims = llListSort(prims,3,1);
|
||||
string out;
|
||||
|
||||
for (i = 0; i < llGetListLength(prims); i+=3)
|
||||
{
|
||||
integer primnum = llList2Integer(prims,i);
|
||||
vector loc = llList2Vector(prims,i+1);
|
||||
rotation arot = llList2Rot(prims,i+2);
|
||||
out += (string) primnum + "|" + (string) loc + "|" + (string) arot +"|\n";
|
||||
}
|
||||
osMakeNotecard("Route",out);
|
||||
llOwnerSay("The Route notecard is ready");
|
||||
|
||||
|
||||
}
|
||||
|
||||
on_rez(integer p)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user