Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Activating a Script (Newbie Question)

Uyek Margetts
Registered User
Join date: 24 Apr 2006
Posts: 12
04-28-2006 08:54
I have been reading through the forum but still have a really fundamental scripts question.
I now know where to place scripts in the content of an object I create but I cannot figure out how to activate the script.

I was trying to use the Basic Pet Script (Follow/Face Owner) shared by Logan Bauer earlier in the library. But how do I get it running? Should my avatar touch or take the object which has this script associated with it? Do I need to input my avatar's name into the script somewhere? How can I get the scripted object to react to my avatar and follow it?

Thanks in advance for your help.

Here is Logan's script for reference:

////////////////////////////////////////////////////////////////
// Open Basic Follower/Facing Script, by Logan Bauer. //
////////////////////////////////////////////////////////////////
// OFFSET is the position of your pet in relation to it's owner's position.
// For example, in the default setting below, "vector offset =<-1,0,1>;"
// I.E. (x,y,z), the -1 puts it 1m back behind owner, the 0 means don't have
// it stay left or right, and 1 means have it stay 1m above it's owner.
// So, if you wanted the script to make it follow directly in front of you,
// and to the left, then you would change it to "vector offset =<1,1,0>;"


vector offset =<-1,0,1>;

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

default
{
state_entry()
{
startup();


}

on_rez(integer start_param)
{
startup(); }

sensor(integer total_number)
{
vector pos = llDetectedPos(0);
llMoveToTarget(pos+offset*llDetectedRot(0),.3);
llLookAt(pos, .1 , 1);
}
}
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
04-28-2006 13:11
That script should 'activate' (i.e. start running) as soon as you drop it into an object. Open up the script window from the object's inventory and make sure the 'running' check box is checked.
Uyek Margetts
Registered User
Join date: 24 Apr 2006
Posts: 12
Thanks, Ziggy. Just as you described, my problem was fixed!
05-01-2006 15:35
From: Ziggy Puff
That script should 'activate' (i.e. start running) as soon as you drop it into an object. Open up the script window from the object's inventory and make sure the 'running' check box is checked.


I checked the box and it worked.