removed useless _ folders
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<Solution name="Low_lag_Follower_script_for_animals">
|
||||
<Project name="Low_lag_Follower_script_for_animals" path="Low_lag_Follower_script_for_animals\Low_lag_Follower_script_for_animals.prj" active="true"/>
|
||||
</Solution>
|
||||
@@ -0,0 +1,8 @@
|
||||
<Project name="Low_lag_Follower_script_for_animals" guid="D8B461EE-6C00-1014-B904-200204C60A89">
|
||||
<Object name="Object" guid="D8B462DB-6C00-1014-B904-200204C60A89">
|
||||
<Script name="Low_lag_Follower_script_for_animals_1.lsl" guid="D8B4B2A1-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
<Script name="Low_lag_Follower_script_for_animals_2.lsl" guid="D8B4E0AC-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
@@ -0,0 +1,166 @@
|
||||
// :CATEGORY:Animal
|
||||
// :NAME:Low_lag_Follower_script_for_animals
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :CREATED:2011-08-04 16:17:15.970
|
||||
// :EDITED:2013-09-18 15:38:56
|
||||
// :ID:496
|
||||
// :NUM:663
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Script several linked prim sets to fly (loosely) as in a "flock" around a pre-set course. Low lag Follower script for birds, horse and other things that flock.
|
||||
//
|
||||
// You put a vector offset in the description of each "bird". They will follow that spot as an offset from a prim named 'Chaser'. The speed is controlled by a single variable in the notecard line. It can move very quickly.
|
||||
//
|
||||
// When the birds lead or follow the chaser prim, they swing wildly out. If you route has many zig zags, they would fly like a flock.
|
||||
//
|
||||
See http://phazedemesnes.blogspot.com/2011/02/herding-behaviour-in-animals-in-second.html for a description of this behavior using this script.
|
||||
//
|
||||
// This is the Follower script. It goes in multiple birds or other animal
|
||||
// :CODE:
|
||||
// Author Ferd Frederix
|
||||
|
||||
// Low lag Follower script for birds, horse and other things that flock
|
||||
|
||||
// see http://phazedemesnes.blogspot.com/2011/02/herding-behaviour-in-animals-in-second.html
|
||||
|
||||
// for this works on herds of horses.
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
// Chases after a prim named "CHaser" at a offset
|
||||
|
||||
// You must have an offset vector in this objects description like this:
|
||||
|
||||
// <1.5,2,3> follow 1.5 meters to one side, 2 in front of, and 3 meters above the Chaser ( negative numbers are behind, positive in front of)
|
||||
|
||||
|
||||
|
||||
// Copyright 2011. Licensed under the GNU open source license at
|
||||
|
||||
// http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
// Open source, you must make this script copy/tranfer AND mod and leave the headers, including this license and other attributions intact.
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
integer _debug = 0;
|
||||
|
||||
vector priorpos;
|
||||
|
||||
float INTERVAL = .050; // seconds to move
|
||||
|
||||
vector offset = < -1, 0, 1>; //1 meter behind and 1 meter above owner's center.
|
||||
|
||||
key Follower;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// movement
|
||||
|
||||
|
||||
|
||||
float DAMPING = .7; // .3
|
||||
|
||||
|
||||
|
||||
// rotation
|
||||
|
||||
float STRENGTH = 1;
|
||||
|
||||
float DAMP = .2;
|
||||
|
||||
|
||||
|
||||
/////////////// CONSTANTS ///////////////////
|
||||
|
||||
string FWD_DIRECTION = "-x";
|
||||
|
||||
vector POSITION_OFFSET ;
|
||||
|
||||
float SCAN_REFRESH = 0.2;
|
||||
|
||||
string FOLLOW = "/follow";
|
||||
|
||||
string STAY = "/stay";
|
||||
|
||||
integer FOLLOW_STOP = 5000;
|
||||
|
||||
integer FOLLOW_START = 5001;
|
||||
|
||||
float MOVETO_INCREMENT = 6.0;
|
||||
|
||||
///////////// END CONSTANTS /////////////////
|
||||
|
||||
|
||||
|
||||
///////////// GLOBAL VARIABLES ///////////////
|
||||
|
||||
|
||||
|
||||
rotation gFwdRot = <0,0,0,1>;
|
||||
|
||||
float gTau = .2;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/////////// END GLOBAL VARIABLES /////////////
|
||||
|
||||
|
||||
|
||||
rotation GetFwdRot()
|
||||
|
||||
{
|
||||
|
||||
// Special case... 180 degrees gives a math error
|
||||
|
||||
if (FWD_DIRECTION == "-x")
|
||||
|
||||
{
|
||||
|
||||
return llAxisAngle2Rot(<0, 0, 1>, PI);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
string Direction = llGetSubString(FWD_DIRECTION, 0, 0);
|
||||
|
||||
string Axis = llToLower(llGetSubString(FWD_DIRECTION, 1, 1));
|
||||
|
||||
|
||||
|
||||
vector Fwd;
|
||||
|
||||
if (Axis == "x")
|
||||
|
||||
Fwd = <1, 0, 0>;
|
||||
|
||||
else if (Axis == "y")
|
||||
|
||||
Fwd = <0, 1, 0>;
|
||||
|
||||
else
|
||||
|
||||
Fwd = <0, 0, 1>;
|
||||
|
||||
|
||||
|
||||
if (Direction == "-")
|
||||
|
||||
Fwd *= -1;
|
||||
|
||||
|
||||
|
||||
return llRotBetween(Fwd, <1, 0, 0>);
|
||||
|
||||
@@ -0,0 +1,310 @@
|
||||
// :CATEGORY:Animal
|
||||
// :NAME:Low_lag_Follower_script_for_animals
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :CREATED:2011-08-04 16:17:15.970
|
||||
// :EDITED:2013-09-18 15:38:56
|
||||
// :ID:496
|
||||
// :NUM:664
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// This Chaser Script goes into an invisible prim. Make it large and visible at first. or you will certainly have an invisible, tiny, hard to catch prim wandering your sim!
|
||||
// :CODE:
|
||||
// Primchaser script
|
||||
|
||||
// Author: Ferd Frederix
|
||||
|
||||
|
||||
|
||||
// Copyright 2011. Licensed under the GNU open source license GPLv3
|
||||
|
||||
// http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
// You must make this script copy/tranfer AND mod and leave the headers, including this license and other attributions intact.
|
||||
|
||||
// modifications are allowed, but the code must always be open. See the GPL for details on your responsibilities under this license.
|
||||
|
||||
|
||||
|
||||
// requires a notecard "named Route"
|
||||
|
||||
// Notecard format
|
||||
|
||||
|
||||
|
||||
//there are 6 columns:
|
||||
|
||||
//column 1: wait interval (floating point number) This is the numbner of seconds the prim will wait when it reads this coordinate. Must be a 0 for no wait.
|
||||
|
||||
//column 2: x coordinate (floating point number)
|
||||
|
||||
//column 3: y coordinate (floating point number)
|
||||
|
||||
//column 4: z coordinate (floating point number)
|
||||
|
||||
//column 5: a space, or text to be spoken on a chat 'CommandChannel', which is -236. This allow you to open doors, gates, and such at specifi points in the tour
|
||||
|
||||
//column 6: a command, currently only one command is used Speed: N, where N is anumber for how quickly the Chaser will go from one point to another, in seconds. 1 = 1 meter a second, 2 = 2 meters a second
|
||||
|
||||
|
||||
|
||||
// for some strange reason llParseString2List does not work without some content between the separators,
|
||||
|
||||
// Here, I use a space
|
||||
|
||||
|
||||
|
||||
//Typical notecard:
|
||||
|
||||
// 0|56|131|24| | | //goto 56,131,29
|
||||
|
||||
// 0|66|123|23| |Speed: 0.5| //goto 66,123,23 at double speed
|
||||
|
||||
// 0|76|122|22| |Speed:1| //default speed
|
||||
|
||||
// 0|84|122|22| |Speed:20| //really slow
|
||||
|
||||
// 30|97|125|23| | | //pause 30 seconds at end of tour
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
integer _debug = FALSE; // set to TRUE for progress messages
|
||||
|
||||
|
||||
|
||||
integer CommandChannel = -236; // a possible command channel to open gates, close doors, whatever
|
||||
|
||||
|
||||
|
||||
list lTimeouts = []; // storages for notecard columns
|
||||
|
||||
list lCoordinate = [];
|
||||
|
||||
list lDescriptions = [];
|
||||
|
||||
list lCommands = [];
|
||||
|
||||
|
||||
|
||||
vector priorpos;
|
||||
|
||||
|
||||
|
||||
// notecard reading
|
||||
|
||||
integer iIndexLines;
|
||||
|
||||
string NOTECARD = "Route"; // the notecard for configuring
|
||||
|
||||
|
||||
|
||||
key kNoteCardLines; // the key of the notecard
|
||||
|
||||
key kGetIndexLines; // the key of the current line
|
||||
|
||||
integer i = 0;
|
||||
|
||||
integer count = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// speed control
|
||||
|
||||
float DAMPING = 1; // 1 meters per second
|
||||
|
||||
vector TargetLocation; // where we are heading at any moment in time
|
||||
|
||||
float INTERVAL = .2; // seconds of timer tick to push us, slower = jerjier motion
|
||||
|
||||
|
||||
|
||||
string SpeakThis; // what is to be said
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// modified from the original wiki, which is basically broken
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// stripo white spaces
|
||||
|
||||
string strip( string str)
|
||||
|
||||
{
|
||||
|
||||
string out;
|
||||
|
||||
integer i;
|
||||
|
||||
|
||||
|
||||
for ( ; i < llStringLength(str); i++)
|
||||
|
||||
{
|
||||
|
||||
out += llGetSubString(str,i,i);
|
||||
|
||||
out = llStringTrim(out, STRING_TRIM);
|
||||
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
string Getline(list Input, integer line)
|
||||
|
||||
{
|
||||
|
||||
return strip(llList2String(Input, line));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default
|
||||
|
||||
{
|
||||
|
||||
on_rez(integer param)
|
||||
|
||||
{
|
||||
|
||||
llResetScript();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
state_entry()
|
||||
|
||||
{
|
||||
|
||||
llSetAlpha(1.0,ALL_SIDES);
|
||||
|
||||
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, ["|"], []));
|
||||
|
||||
|
||||
|
||||
float Timeout = (float) Getline(lLine,0); // Sleep
|
||||
|
||||
float X = (float) Getline(lLine,1);
|
||||
|
||||
float Y = (float) Getline(lLine,2);
|
||||
|
||||
float Z = (float) Getline(lLine,3);
|
||||
|
||||
|
||||
|
||||
string Msg = llList2String(lLine,4);
|
||||
|
||||
string sCommand = llList2String(lLine,5);
|
||||
|
||||
|
||||
|
||||
TempLocation.x = X;
|
||||
|
||||
TempLocation.y = Y;
|
||||
|
||||
TempLocation.z = Z;
|
||||
|
||||
|
||||
|
||||
lTimeouts += Timeout;
|
||||
|
||||
lCoordinate += TempLocation;
|
||||
|
||||
lDescriptions += Msg;
|
||||
|
||||
lCommands += sCommand;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
integer 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;
|
||||
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
kGetIndexLines = llGetNotecardLine(NOTECARD,i);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user