|
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
|
05-13-2007 16:24
How do I get this to follow who I want. I have a script that will let me pick a name and say the name over the channel in the script below but can't seem to get the name into this script. I assume the AGENT needs to be changed to the name said on the channel. 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(); llSetPrimitiveParams([PRIM_ROTATION, <180,0,0, 1>]); } } sensor(integer det) { vector pos = llDetectedPos(0); llLookAt(pos,1,1); } }
|
|
Stavros Augustus
Registered User
Join date: 14 Nov 2005
Posts: 38
|
05-13-2007 18:22
You need to set the key datafield in llSensorRepeat to the target's key.
|
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
05-13-2007 19:25
I don't think that <180, 0, 0, 1> is a valid rotation quaternion either. The sum of the squares of the four numbers should be 1.
|
|
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
|
05-13-2007 19:55
From: BamBam Sachertorte I don't think that <180, 0, 0, 1> is a valid rotation quaternion either. The sum of the squares of the four numbers should be 1. That part works just fine so I wont mess with it.
|
|
Lucius Obviate
Evil Incarnate
Join date: 5 Dec 2006
Posts: 15
|
05-13-2007 20:55
From: Stavros Augustus You need to set the key datafield in llSensorRepeat to the target's key. What he said. Your searching for NULL_KEY in your script IE 000000-0000-0000-0000-000000000000 http://www.lslwiki.org/index.php/NULL_KEYWhat you need to do is define a global key variable IE key myKey; and set it up so that once you choose a person the sensor uses the variable myKey as the key in its search parameters.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
05-14-2007 00:51
Look at this hug script for an example of partial name look up.
_____________________
I'm back......
|
|
Phoenix Ristow
Registered User
Join date: 11 Sep 2006
Posts: 9
|
Question
05-16-2007 11:09
You said you have a script that "says" the name to this script. An object does not listen to what it says. If these scripts are in the same object this will not work.
Alternate solution:
llLinkedMessage() to send your message
llMessageLinked(LINK_SET, 0, "NAMESTRINGGOESHERE", NULL_KEY);
Followed by the link_message event handler to process your inbound message
link_message(integer sender_num, integer num, string str, key id) { //string str is your inbound avatar name }
|
|
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
|
05-16-2007 11:18
From: Phoenix Ristow You said you have a script that "says" the name to this script. An object does not listen to what it says. If these scripts are in the same object this will not work.
Alternate solution:
llLinkedMessage() to send your message
llMessageLinked(LINK_SET, 0, "NAMESTRINGGOESHERE", NULL_KEY);
Followed by the link_message event handler to process your inbound message
link_message(integer sender_num, integer num, string str, key id) { //string str is your inbound avatar name } Scripts not in same prim nor are they attached.
|
|
Nynthan Folsom
Registered User
Join date: 29 Aug 2006
Posts: 70
|
05-19-2007 03:28
llSensorRepeat takes the name of the AV as the first parameter (see http://wiki.secondlife.com/wiki/LlSensorRepeat). You need to pass the name in along with the "On" message, and pass it to llSensorRepeat. AGENT is a numeric constant that tells llSensorRepeat to sense AVs rather than objects. Also note that llSensorRepeat scans across sim-boundaries every 6 scans with unpredictable results. It's recommended that you put llSensor on a timer instead.
|