|
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
|
05-05-2007 02:31
Hacked two scripts together thinking it would work but...well it doesn't work. I get an error at sensor(integer det) Any help? Oh, and how can I get it to follow who I choose and not just is the close one. This is controled on and off from a seperate prim. integer chan = -27296;
default { state_entry() { llListen(chan, "", NULL_KEY, ""); }
listen( integer channel, string name, key id, string message ) { if ( message == "On" ) { llSensorRepeat("","",AGENT,10,PI,.1); } sensor(integer det)
{
vector pos = llDetectedPos(0); llLookAt(pos,1,1);
} else if ( message == "Off" ) { llSensorRemove(); } } }
|
|
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
|
05-05-2007 03:16
You have your code all mixed up, the sensor should be in the default state, but not in the listener event: integer chan = -27296;
default{ state_entry(){ llListen(chan, "", NULL_KEY, ""); }
listen( integer channel, string name, key id, string message ){ if ( message == "On" ){ llSensorRepeat("",NULL_KEY,AGENT,10,PI,.1); } else if ( message == "Off" ){ llSensorRemove(); } } sensor(integer det){ vector pos = llDetectedPos(0); llLookAt(pos,1,1); } }
To have it follow the person you choose, you need to add their key or name in the sensor call. As you have it, it's scanning for all agents.
|