Push All Scripts

This commit is contained in:
Fred Beckhusen
2015-08-07 10:38:47 -05:00
parent 2ad9795428
commit ce47ec2f3e
8079 changed files with 2442776 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
<Solution name="Endless Loop Mover">
<Project name="Endless Loop Mover" path="Endless Loop Mover\Endless Loop Mover.prj" active="true"/>
</Solution>

View File

@@ -0,0 +1,14 @@
<Project name="Endless Loop Mover" guid="c2222c00-5f6a-4527-82ef-54e951c42e1d">
<Object name="Object" guid="f179c21f-56e1-47cb-bef5-74753a0797cb" active="true">
<Script name="10.lsl" guid="ba9c8394-496d-47b3-899b-78204e792dee">
</Script>
<Notecard name="ReadMe.txt" guid="3c69d0ee-e12f-4df2-b23f-304b689060ed">
</Notecard>
<Notecard name="Route" guid="87ac3acd-2d6f-4aa4-ad84-c9ba7d113bba">
</Notecard>
<Script name="recorder.lsl" guid="c8892685-1da9-411e-bb6e-4a02a8afc430">
</Script>
<Script name="walker.lsl" guid="0ba1bd86-3e77-428e-96f4-4b2d84d3a855">
</Script>
</Object>
</Project>

View File

@@ -0,0 +1,87 @@
// :SHOW:1
// :CATEGORY:Tour
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Movement, Walking, Teleporting
// :CREATED:2013-09-06
// :EDITED:2015-08-05 10:12:51
// :ID:1084
// :NUM:1817
// :REV:1
// :WORLD:OpenSim
// :DESCRIPTION:
// Rez this from inventory to make a route. Use the recorder to gather the route.
// :CODE:
// name this prim '10' without the double quotes. You will use the prim #10 to establish a path of waypoints to follow.
// Rez a prim ad name it '10', or any other number without the double quotes, at a spot at the beginning of the ride.
// Mark the prim as 'Phantom'. The final gadget will pass through the #10 prim on its route.
// Put the following script in it. Take a copy of that prim back into inventory.
// Left-click and drag from inventory the '10' prim at a spot nearby, in the direction you want the object to travel.
// If you use shift-copy, move it slightly, then grab the one you r left behind!
// The prim you shift copy will be in reverse order, as the original #10 moves, and leaves behind a copy.
// You canm also just drag out a new one each time you need another waypoint.
// Each prim will rename itself to the largest number found +10, about 5 seconds after it rezzes.
// Since you started with prim #10, the second prim will rename itself as #20, the next will be 30, and so on.
// When finsihes, click the tour object
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,llGetObjectName() + "|" + (string) llGetPos() + "|" + (string) llGetRot() + "|" + llGetObjectDesc());
else if (message =="number")
llRegionSay(300,llGetObjectName());
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
llSetObjectName((string) (num + 10)); // leave room for more prims to be added
llOwnerSay("Name set to " + llGetObjectName() + ". You can add text to be spoken when the tour reaches this location by adding some text to the description of this object.");
llSetTimerEvent(0);
}
on_rez(integer p)
{
llResetScript();
}
}

View File

@@ -0,0 +1,86 @@
// :SHOW:
// :CATEGORY:Tour
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Movement, Walking, Teleporting
// :CREATED:2013-09-06
// :ID:1084
// :NUM:1817
// :REV:1
// :WORLD:OpenSim
// :DESCRIPTION:
// Rez this from inventory to make a route. Use the recorder to gather the route.
// :CODE:
// name this prim '10' without the double quotes. You will use the prim #10 to establish a path of waypoints to follow.
// Rez a prim ad name it '10', or any other number without the double quotes, at a spot at the beginning of the ride.
// Mark the prim as 'Phantom'. The final gadget will pass through the #10 prim on its route.
// Put the following script in it. Take a copy of that prim back into inventory.
// Left-click and drag from inventory the '10' prim at a spot nearby, in the direction you want the object to travel.
// If you use shift-copy, move it slightly, then grab the one you r left behind!
// The prim you shift copy will be in reverse order, as the original #10 moves, and leaves behind a copy.
// You canm also just drag out a new one each time you need another waypoint.
// Each prim will rename itself to the largest number found +10, about 5 seconds after it rezzes.
// Since you started with prim #10, the second prim will rename itself as #20, the next will be 30, and so on.
// When finsihes, click the tour object
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,llGetObjectName() + "|" + (string) llGetPos() + "|" + (string) llGetRot() + "|" + llGetObjectDesc());
else if (message =="number")
llRegionSay(300,llGetObjectName());
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
llSetObjectName((string) (num + 10)); // leave room for more prims to be added
llOwnerSay("Name set to " + llGetObjectName() + ". You can add text to be spoken when the tour reaches this location by adding some text to the description of this object.");
llSetTimerEvent(0);
}
on_rez(integer p)
{
llResetScript();
}
}

View File

@@ -0,0 +1,53 @@
// :SHOW:1
// :CATEGORY:Tour
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Movement, Walking, Teleporting
// :CREATED:2013-09-06
// :EDITED:2015-08-05 10:12:51
// :ID:1084
// :NUM:1819
// :REV:1
// :WORLD:OpenSim
// :DESCRIPTION:
// Help notecard for the walker
// :CODE:
// Open Source CC-BY-NC by Ferd Frederix
================
The walker can be set to auto start in an endless loop(default), or it can be set to wait for a NPC to sit on it. It then unsits the NPC at the end of the route, and returns to the start at high speed.
The default route I set is a square in mid-air. Rez the prim, it should start moving. Sit on it, you should start walking. In production, make the box invsiible for a NPC to appear to walk at any orientation.
'10' Box
Name this prim '10' without the double quotes. You will use the prim #10 to establish a path of waypoints to follow. It can actually be named any INTEGER such as a 0 ot the number 310, but 10 is the standard start point.
Rez this at the beginning of the ride.
The final gadget will start at the #10 prim location and rotation/
Shift-copy the 10 prim, move it slightly, then GRAB THE ONE YOU LEFT BEHIND and move it to the next place. The prim you shift-copy will be #10, the one left behind will become #20. The original #10 moves, and leaves behind a copy. This copy will automatically make it itself the next larger number.
You can also just drag out a new one each time you need another waypoint.
Each prim will rename itself to the largest number found ANYWHERE in the sim, plus 10, about 5 seconds after it rezzes. Since you started with prim #10, the second prim will rename itself as #20, the next will be 30, and so on.
When finished, click the tour object.
If you make a mistake, and need to fix it, you can move the prims around. You can renumber them. You can add more prims in between 10 and 20, just renumber them 11, 12, 13, or whatever.
==============================
Walker Prim - rez the #10 prims, and then touch the tour prim to record a route
The route prim will follow the route. Fix any issues by replacing, removing or adding the numbered prims, and touch to save
When finished, delete the Recorder script that is inside the walker as it is not needed.
The walker can be set to auto start in an endless loop(default), or it can be set to wait for a NPC to sit on it. It then unsits the NPC at the end of the route, and returns to the start at high speed.
.

View File

@@ -0,0 +1,51 @@
// :SHOW:
// :CATEGORY:Tour
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Movement, Walking, Teleporting
// :CREATED:2013-09-06
// :ID:1084
// :REV:1
// :WORLD:OpenSim
// :DESCRIPTION:
// Help notecard for the walker
// :CODE:
// Open Source CC-BY-NC by Ferd Frederix
================
The walker can be set to auto start in an endless loop(default), or it can be set to wait for a NPC to sit on it. It then unsits the NPC at the end of the route, and returns to the start at high speed.
The default route I set is a square in mid-air. Rez the prim, it should start moving. Sit on it, you should start walking. In production, make the box invsiible for a NPC to appear to walk at any orientation.
'10' Box
Name this prim '10' without the double quotes. You will use the prim #10 to establish a path of waypoints to follow. It can actually be named any INTEGER such as a 0 ot the number 310, but 10 is the standard start point.
Rez this at the beginning of the ride.
The final gadget will start at the #10 prim location and rotation/
Shift-copy the 10 prim, move it slightly, then GRAB THE ONE YOU LEFT BEHIND and move it to the next place. The prim you shift-copy will be #10, the one left behind will become #20. The original #10 moves, and leaves behind a copy. This copy will automatically make it itself the next larger number.
You can also just drag out a new one each time you need another waypoint.
Each prim will rename itself to the largest number found ANYWHERE in the sim, plus 10, about 5 seconds after it rezzes. Since you started with prim #10, the second prim will rename itself as #20, the next will be 30, and so on.
When finished, click the tour object.
If you make a mistake, and need to fix it, you can move the prims around. You can renumber them. You can add more prims in between 10 and 20, just renumber them 11, 12, 13, or whatever.
==============================
Walker Prim - rez the #10 prims, and then touch the tour prim to record a route
The route prim will follow the route. Fix any issues by replacing, removing or adding the numbered prims, and touch to save
When finished, delete the Recorder script that is inside the walker as it is not needed.
The walker can be set to auto start in an endless loop(default), or it can be set to wait for a NPC to sit on it. It then unsits the NPC at the end of the route, and returns to the start at high speed.
.

View File

@@ -0,0 +1,23 @@
// :SHOW:1
// :CATEGORY:Tour
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Movement, Walking, Teleporting
// :CREATED:2013-09-06
// :EDITED:2015-08-05 10:12:51
// :ID:1084
// :NUM:1820
// :REV:1
// :WORLD:OpenSim
// :DESCRIPTION:
// Sample route card to walk in a vertical square
// :CODE:
130|<133.538467,130.615784,23.190590>|<0.000000,0.026177,0.000000,0.999657>|
140|<133.779236,130.620636,24.137348>|<0.000000,-0.719340,0.000000,0.694658>|
150|<133.779236,130.620636,26.521872>|<0.000000,-0.719340,0.000000,0.694658>|
160|<133.310989,130.620636,27.378088>|<0.000000,-0.999962,0.000000,0.008728>|
170|<131.158035,130.620636,27.165934>|<0.000000,-0.999962,0.000000,0.008728>|
180|<130.844910,130.620636,26.573608>|<0.000000,0.700910,0.000000,0.713250>|
210|<130.844910,130.620636,24.083681>|<0.006117,0.700884,-0.006224,0.713222>|
220|<131.174484,130.620636,23.452608>|<0.008725,-0.034897,0.000152,0.999353>|

View File

@@ -0,0 +1,21 @@
// :SHOW:
// :CATEGORY:Tour
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS: Movement, Walking, Teleporting
// :CREATED:2013-09-06
// :ID:1084
// :REV:1
// :WORLD:OpenSim
// :DESCRIPTION:
// Sample route card to walk in a vertical square
// :CODE:
130|<133.538467,130.615784,23.190590>|<0.000000,0.026177,0.000000,0.999657>|
140|<133.779236,130.620636,24.137348>|<0.000000,-0.719340,0.000000,0.694658>|
150|<133.779236,130.620636,26.521872>|<0.000000,-0.719340,0.000000,0.694658>|
160|<133.310989,130.620636,27.378088>|<0.000000,-0.999962,0.000000,0.008728>|
170|<131.158035,130.620636,27.165934>|<0.000000,-0.999962,0.000000,0.008728>|
180|<130.844910,130.620636,26.573608>|<0.000000,0.700910,0.000000,0.713250>|
210|<130.844910,130.620636,24.083681>|<0.006117,0.700884,-0.006224,0.713222>|
220|<131.174484,130.620636,23.452608>|<0.008725,-0.034897,0.000152,0.999353>|

View File

@@ -0,0 +1,123 @@
// :SHOW:1
// :CATEGORY:Telepad
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2015-08-05 09:56:03
// :EDITED:2015-08-05 10:12:51
// :ID:1084
// :NUM:1818
// :REV:1
// :WORLD:Opensim
// :DESCRIPTION:
// Route Recorder Script - touch to make a route
// :CODE:
// Open Source CC-BY-NC
// Recorder script - put this in the touring prim, rez thre #10 prims, and then touch the tour prim to record a route
// the route prim will follow the route. Fix any issues by replacing, removing or adding the numbered prims, and touch to save
// When finished, delete this script as it is not needed.
integer debugger = FALSE;
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;
}
list lines;
default
{
state_entry()
{
llSetText("Click after setting up all tour prims. \nShout on channel '/300 die' to clear all prims", <1.0, 1.0, 1.0>, 2.0);
}
touch_start(integer n)
{
if (llDetectedKey(0) == llGetOwner()) {
llOwnerSay("Looking for Route Prims, please wait");
prims = [];
lines = [];
llListen(300,"","","");
llRegionSay(300,"where");
}
}
listen(integer channel,string name, key id, string message)
{
debug(llGetObjectName() + " heard " + message);
list parts = llParseString2List(message,["|"],[]);
integer l = (integer) llList2String(parts,0);
vector p = (vector) llList2String(parts,1);
rotation r = (rotation) llList2String(parts,2);
string text = llList2String(parts,3);
integer isthere = llListFindList(prims,[(integer) l]);
if (isthere > -1)
{
llOwnerSay("Error, there are two prims named " + l + ". 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.");
}
prims += (integer) l;
prims += (vector) p;
prims += (rotation) r;
prims += text;
llSetTimerEvent(5.0);
}
timer()
{
llSetTimerEvent(0);
integer i = 0;
prims = llListSort(prims,4,1);
for (i = 0; i < llGetListLength(prims); i+=4)
{
integer primnum = llList2Integer(prims,i);
vector loc = llList2Vector(prims,i+1);
rotation rot = llList2Rot(prims,i+2);
string text = llList2String(prims,i+3);
lines += [(string) primnum + "|" + (string) loc + "|" + (string) rot + "|" + text];
}
if (llGetInventoryType("Route") == INVENTORY_NOTECARD)
llRemoveInventory("Route");
osMakeNotecard("Route",lines);
llOwnerSay("Route updated");
llResetOtherScript("Walker");
llSetText("",<1,1,1>,1.0);
}
on_rez(integer p)
{
llResetScript();
}
}

View File

@@ -0,0 +1,122 @@
// :SHOW:
// :CATEGORY:Telepad
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2015-08-05 09:56:03
// :ID:1084
// :NUM:1818
// :REV:1
// :WORLD:Opensim
// :DESCRIPTION:
// Route Recorder Script - touch to make a route
// :CODE:
// Open Source CC-BY-NC
// Recorder script - put this in the touring prim, rez thre #10 prims, and then touch the tour prim to record a route
// the route prim will follow the route. Fix any issues by replacing, removing or adding the numbered prims, and touch to save
// When finished, delete this script as it is not needed.
integer debugger = FALSE;
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;
}
list lines;
default
{
state_entry()
{
llSetText("Click after setting up all tour prims. \nShout on channel '/300 die' to clear all prims", <1.0, 1.0, 1.0>, 2.0);
}
touch_start(integer n)
{
if (llDetectedKey(0) == llGetOwner()) {
llOwnerSay("Looking for Route Prims, please wait");
prims = [];
lines = [];
llListen(300,"","","");
llRegionSay(300,"where");
}
}
listen(integer channel,string name, key id, string message)
{
debug(llGetObjectName() + " heard " + message);
list parts = llParseString2List(message,["|"],[]);
integer l = (integer) llList2String(parts,0);
vector p = (vector) llList2String(parts,1);
rotation r = (rotation) llList2String(parts,2);
string text = llList2String(parts,3);
integer isthere = llListFindList(prims,[(integer) l]);
if (isthere > -1)
{
llOwnerSay("Error, there are two prims named " + l + ". 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.");
}
prims += (integer) l;
prims += (vector) p;
prims += (rotation) r;
prims += text;
llSetTimerEvent(5.0);
}
timer()
{
llSetTimerEvent(0);
integer i = 0;
prims = llListSort(prims,4,1);
for (i = 0; i < llGetListLength(prims); i+=4)
{
integer primnum = llList2Integer(prims,i);
vector loc = llList2Vector(prims,i+1);
rotation rot = llList2Rot(prims,i+2);
string text = llList2String(prims,i+3);
lines += [(string) primnum + "|" + (string) loc + "|" + (string) rot + "|" + text];
}
if (llGetInventoryType("Route") == INVENTORY_NOTECARD)
llRemoveInventory("Route");
osMakeNotecard("Route",lines);
llOwnerSay("Route updated");
llResetOtherScript("Walker");
llSetText("",<1,1,1>,1.0);
}
on_rez(integer p)
{
llResetScript();
}
}

View File

@@ -0,0 +1,265 @@
// :SHOW:1
// :CATEGORY:Telepad
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2015-08-05 09:54:56
// :EDITED:2015-08-05 10:12:51
// :ID:1084
// :NUM:1816
// :REV:1
// :WORLD:OpenSim
// :DESCRIPTION:
// Sit on this prim, it will move you to a destination and unseat you, optionally repeat forever.
// :CODE:
// Open Source CC-BY-NC
// Please keep open source Open!
integer _debug = FALSE; // print in chats what i s happening.
integer Endless = TRUE;
vector OFFSET = <0,0,0>; // if you want the tour to ride hiogher or lower or to one side...
float SPEED = 1.0; // speed of vehicle in meters per second
// Sit for the NPC
vector TARGET = <0,0,.7>;
vector ROT = <0, 0, 0>;
key av;
float INTERVAL = 0.5; // how often we check
float TOLERANCE = 1; // how close to get
vector startPos;
list lCoordinate;
list lRotation ;
list lText;
string NOTECARD = "Route"; // the notecard for configuring
integer count = 0;
vector TargetLocation;
rotation TargetRotation;
Goto(float speed)
{
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;
default
{
on_rez(integer param)
{
llResetScript();
}
state_entry()
{
if (_debug)
llOwnerSay("Reset");
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
// read the notecard
string data = osGetNotecard(NOTECARD);
list lLine = llParseString2List(data, ["\n"], []);
integer i;
integer j = llGetListLength(lLine);
for (i = 0; i < j; i++)
{
string aLine = llList2String(lLine,i);
list iList = llParseString2List(aLine, ["|"], []);
if (_debug ) llOwnerSay("Line = " + llDumpList2String(iList,":"));
vector TempLocation = (vector) llList2Vector(iList,1);
if (TempLocation != ZERO_VECTOR)
{
rotation Rot = (rotation) llList2String(iList,2);
string text = llList2String(iList,3);
if (_debug) llOwnerSay((string)TempLocation);
TempLocation += OFFSET;
lCoordinate += [TempLocation];
lRotation += [Rot];
lText += [text];
locationLength = (llGetListLength(lCoordinate));
}
}
state paused;
}
}
state paused {
state_entry()
{
if (_debug) llOwnerSay("Pause");
if (!Endless) {
av = llAvatarOnSitTarget();
if (av != NULL_KEY) {
llStopAnimation("avatar_walk");
llUnSit(av);
}
}
TargetLocation = llList2Vector(lCoordinate, 0); // Look at 0th
TargetRotation = llList2Rot(lRotation, 0); // Look at 0th
startPos = TargetLocation;
Goto(50); // go fast
count = 0;
if (Endless)
state moving;
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key av = llAvatarOnSitTarget();
if (_debug) llOwnerSay("Sit by " + (string) av);
if (av!= NULL_KEY)
{
llRequestPermissions(av,PERMISSION_TRIGGER_ANIMATION);
}
}
if (change & CHANGED_REGION_START)
{
llResetScript();
}
}
run_time_permissions(integer n)
{
if (n & PERMISSION_TRIGGER_ANIMATION) {
llStopAnimation("sit");
llStartAnimation("avatar_walk");
state moving;
}
}
}
state moving
{
state_entry()
{
if (_debug) llOwnerSay("State Moving entered, is pointing to target " + (string) TargetLocation );
count ++;
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(SPEED);
llSetTimerEvent(INTERVAL);
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
av = llAvatarOnSitTarget();
if (av == NULL_KEY) //evaluated as true if not NULL_KEY or invalid
{
state paused;
} else {
llRequestPermissions(av,PERMISSION_TRIGGER_ANIMATION);
}
}
if (change & CHANGED_REGION_START)
{
llResetScript();
}
}
run_time_permissions(integer n)
{
if (n & PERMISSION_TRIGGER_ANIMATION) {
llStopAnimation("sit");
llStartAnimation("avatar_walk");
}
}
on_rez(integer param)
{
llResetScript();
}
timer()
{
if (_debug) llOwnerSay("tick");
if (llVecMag(llGetPos() - TargetLocation) <= TOLERANCE) {
if (_debug) llOwnerSay("At location: " + (string) llGetPos());
count ++;
if (count >= locationLength) {
if (_debug) llOwnerSay("EOF");
state paused;
} else {
TargetLocation = llList2Vector(lCoordinate, count); // Look at nth
TargetRotation = llList2Rot(lRotation, count); // Look at nth
Goto(SPEED);
if (_debug) llOwnerSay("New Target: " + (string) TargetLocation);
}
}
}
state_exit()
{
llSetTimerEvent(0);
}
}

View File

@@ -0,0 +1,264 @@
// :SHOW:
// :CATEGORY:Telepad
// :NAME:Endless Loop Mover
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2015-08-05 09:54:56
// :ID:1084
// :NUM:1816
// :REV:1
// :WORLD:OpenSim
// :DESCRIPTION:
// Sit on this prim, it will move you to a destination and unseat you, optionally repeat forever.
// :CODE:
// Open Source CC-BY-NC
// Please keep open source Open!
integer _debug = FALSE; // print in chats what i s happening.
integer Endless = TRUE;
vector OFFSET = <0,0,0>; // if you want the tour to ride hiogher or lower or to one side...
float SPEED = 1.0; // speed of vehicle in meters per second
// Sit for the NPC
vector TARGET = <0,0,.7>;
vector ROT = <0, 0, 0>;
key av;
float INTERVAL = 0.5; // how often we check
float TOLERANCE = 1; // how close to get
vector startPos;
list lCoordinate;
list lRotation ;
list lText;
string NOTECARD = "Route"; // the notecard for configuring
integer count = 0;
vector TargetLocation;
rotation TargetRotation;
Goto(float speed)
{
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;
default
{
on_rez(integer param)
{
llResetScript();
}
state_entry()
{
if (_debug)
llOwnerSay("Reset");
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
// read the notecard
string data = osGetNotecard(NOTECARD);
list lLine = llParseString2List(data, ["\n"], []);
integer i;
integer j = llGetListLength(lLine);
for (i = 0; i < j; i++)
{
string aLine = llList2String(lLine,i);
list iList = llParseString2List(aLine, ["|"], []);
if (_debug ) llOwnerSay("Line = " + llDumpList2String(iList,":"));
vector TempLocation = (vector) llList2Vector(iList,1);
if (TempLocation != ZERO_VECTOR)
{
rotation Rot = (rotation) llList2String(iList,2);
string text = llList2String(iList,3);
if (_debug) llOwnerSay((string)TempLocation);
TempLocation += OFFSET;
lCoordinate += [TempLocation];
lRotation += [Rot];
lText += [text];
locationLength = (llGetListLength(lCoordinate));
}
}
state paused;
}
}
state paused {
state_entry()
{
if (_debug) llOwnerSay("Pause");
if (!Endless) {
av = llAvatarOnSitTarget();
if (av != NULL_KEY) {
llStopAnimation("avatar_walk");
llUnSit(av);
}
}
TargetLocation = llList2Vector(lCoordinate, 0); // Look at 0th
TargetRotation = llList2Rot(lRotation, 0); // Look at 0th
startPos = TargetLocation;
Goto(50); // go fast
count = 0;
if (Endless)
state moving;
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key av = llAvatarOnSitTarget();
if (_debug) llOwnerSay("Sit by " + (string) av);
if (av!= NULL_KEY)
{
llRequestPermissions(av,PERMISSION_TRIGGER_ANIMATION);
}
}
if (change & CHANGED_REGION_START)
{
llResetScript();
}
}
run_time_permissions(integer n)
{
if (n & PERMISSION_TRIGGER_ANIMATION) {
llStopAnimation("sit");
llStartAnimation("avatar_walk");
state moving;
}
}
}
state moving
{
state_entry()
{
if (_debug) llOwnerSay("State Moving entered, is pointing to target " + (string) TargetLocation );
count ++;
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(SPEED);
llSetTimerEvent(INTERVAL);
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
av = llAvatarOnSitTarget();
if (av == NULL_KEY) //evaluated as true if not NULL_KEY or invalid
{
state paused;
} else {
llRequestPermissions(av,PERMISSION_TRIGGER_ANIMATION);
}
}
if (change & CHANGED_REGION_START)
{
llResetScript();
}
}
run_time_permissions(integer n)
{
if (n & PERMISSION_TRIGGER_ANIMATION) {
llStopAnimation("sit");
llStartAnimation("avatar_walk");
}
}
on_rez(integer param)
{
llResetScript();
}
timer()
{
if (_debug) llOwnerSay("tick");
if (llVecMag(llGetPos() - TargetLocation) <= TOLERANCE) {
if (_debug) llOwnerSay("At location: " + (string) llGetPos());
count ++;
if (count >= locationLength) {
if (_debug) llOwnerSay("EOF");
state paused;
} else {
TargetLocation = llList2Vector(lCoordinate, count); // Look at nth
TargetRotation = llList2Rot(lRotation, count); // Look at nth
Goto(SPEED);
if (_debug) llOwnerSay("New Target: " + (string) TargetLocation);
}
}
}
state_exit()
{
llSetTimerEvent(0);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB