Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: Simple follow script for pets or other objects

Dan Colville
Registered User
Join date: 28 Jul 2006
Posts: 26
09-24-2008 01:35
vector offset =<-1,2,1>;

startup()
{
vector pos = llGetPos();
llSetStatus(STATUS_ROTATE_Z,TRUE);
llSetStatus(STATUS_PHYSICS, TRUE);
key id = llGetOwner();
llSensorRemove();
llSensorRepeat("",llGetOwner(),AGENT,10,2*PI,.1);
}

default
{
state_entry()
{
startup();


}

on_rez(integer start_param)
{
startup();
}

sensor(integer total_number)
{
vector pos = llDetectedPos(0);
llMoveToTarget(pos+offset*llDetectedRot(360),.3);
llLookAt(pos, .1 , 1);
}
}

if someone want's to add more comments then go ahead.

This post has now been corrected. Thanks for bringing this error to my attention.
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Library bump
09-24-2008 05:20
:)
_____________________
i've got nothing. ;)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-24-2008 07:25
that looks very incomplete
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Dan Colville
Registered User
Join date: 28 Jul 2006
Posts: 26
09-24-2008 16:22
test it. it works
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
09-25-2008 01:51
From: Dan Colville
vector offset =<-1,2,1>;// where you want the object to be located from you player

startup()
{
vector pos = llGetPos();
llSetStatus(STATUS_ROTATE_Z,TRUE);
llSetStatus(STATUS_PHYSICS, TRUE);
key id = llGetOwner();
llSensorRemove();
llSensorRepeat("",llGetOwner(),AGENT,200,2*PI,.1);
}

if someone want's to add more comments then go ahead.

From: Ruthven Willenov
that looks very incomplete

From: Dan Colville
test it. it works

No way:( Who are you fooling?
_____________________
From Studio Dora
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-25-2008 05:49
no it doesn't work.

#1 there's no default state specified
#2 there's nothing there for the sensor to use
#3 for the object to follow, it needs llMoveToTarget in a sensor function

so, YOU try it. it doesn't compile
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
09-25-2008 06:08
As a function its nice, but there is a lot missing, Not Dans fault
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
09-25-2008 06:42
EDIT: TY Dan!
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
09-25-2008 06:52
I was asumming something had got lost in translation :)
Dan Colville
Registered User
Join date: 28 Jul 2006
Posts: 26
09-26-2008 04:04
Omg Im sorry people. I just thought that it had copied the script over correctly and that i was right and everyone else was wrong but as it turns out it was my fault. I made a mistake i did not copy over the full script I will now correct my original post to have the full script.

I must apologise for my error. If I had not read your reply's i would not have realized that i had made this error.
bwild Parx
Registered User
Join date: 11 Jul 2008
Posts: 1
Works for me
09-30-2008 22:19
Of course i had to tweak it for my kitty. Here's my patch:

--- follow 2008-09-30 21:58:08.000000000 -0400
+++ follow.diff 2008-09-30 21:59:13.000000000 -0400
@@ -1,3 +1,6 @@
-vector offset =<-1,2,1>;
+
+//vector offset =<-1,2,1>;
+
+vector offset =<-1,-2,-3.5>;

startup()
@@ -17,4 +20,6 @@
startup();

+ //acknowlege master
+llSay(0, "Meow!";);

}
@@ -23,4 +28,6 @@
{
startup();
+//be cute.
+ llSay(0, "Purrr...";);
}

@@ -30,4 +37,5 @@
llMoveToTarget(pos+offset*llDetectedRot(360),.3);
llLookAt(pos, .1 , 1);
+
}
}
Michaela Kuhn
00 44 00 26 00 4D
Join date: 29 May 2007
Posts: 257
10-04-2008 00:28
llMoveToTarget(pos+offset*llDetectedRot(360),.3);

llDetectedRot(360) Why you want to detect rotation of 360th avatar/object? *think*
If nothing is detected rot = ZERO_ROTATION
_____________________

[asm]ldi rmp,0xAA mov rm1,rmp ldi rmp,0x55 mov rm2,rmp[/asm]