Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

getting llSensor to....

LordHighBen Hathor
Registered User
Join date: 8 Aug 2004
Posts: 6
12-07-2004 14:25
i have been working on llSensor, and i require it to be able to take a text input in the name field, and i was thinking i could simply define a string called name and then have my script listen for names, like..
if (message == "Dance Piglet";)
{
llSensor(name, NULL_KEY, AGENT, 96, PI*2); // it is now looking for an agent, with the string name in being the agent's name, and now should have searched for the name once it recieved the input
llSay(0, llDetectedKey(0));
}
This is where i stopped thinking and started drinking tea, now, i know Sensor has searched for a value, but what do i do with the name and id now? i know say will say the detected key, but it isn't getting a detected key, i know this is no where near complete.
Dance Piglet, help me, this is my first time using llSensor and i don't know where to start.
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
12-07-2004 15:05
I think your problem is with the key component of llSensor().
llSensor(name, NULL_KEY, AGENT, 96, PI*2)
should be
llSensor(name, "", AGENT, 96, TWO_PI)

Otherwise it's looking for an agent with the name of whatever name equals, and with the key 0000-0000.... (NULL_KEY)

Edit-
After rechecking the wiki it seems that NULL_KEY should work, (i always use "";).

Also something to note is that you only need PI not PI*2 or TWO_PI to scan all around the object.
Water Rogers
Registered User
Join date: 1 May 2003
Posts: 286
12-07-2004 21:47
From: someone
if (message == "Dance Piglet";)
{
llSensor(name, NULL_KEY, AGENT, 96, PI*2); // it is now looking for an agent, with the string name in being the agent's name, and now should have searched for the name once it recieved the input
llSay(0, llDetectedKey(0));
}


Fear not, you are on the right track!

However, your problem is 'where' you are placing the code.... when you make a llSensor() or llSensorRepeat() call, it can essentially raise 2 event handlers (sensor(), and no_sensor()). You're thinking "Hey, i made this call, now say the key". You need to place the "llSay()" portion of your code in the sensor() event handler.

CODE
....  //wherever your code is above here
if( message == "Dance Piglet"){
llSensor( name, NULL_KEY, AGENT, 96, PI ); // this will raise one of the event handlers
}
}

sensor( integer n ){ // the integer "n" in this area tells us how many Piglet Dance's where found
llSay( 0, (string)llDetectedKey( 0 ) ); // if Piglet Dance is found, it will say the key here
}

no_sensor(){
llSay( 0, "Piglet Dance wasn't detected in this vicinity!" ); // if not found, it will raise here
}
.... // other code after here


So as you can see, you had the right frame of mind, just need to put it in the right places.

Hope it helps,

--Water
_____________________
From: Philip Linden

For the more technically minded - the problem is actually NOT the asset server (or 'asshat' as you prefer to affectionately call it herein).
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
12-08-2004 13:07
From: LordHighBen Hathor
...
This is where i stopped thinking and started drinking tea....


See, that's the problem, get rid of the tea and get a BEER or a shot of Mezcal (with or without the worm!)

Oh, maybe that won't fix the problem, but you'll seem to care about it a LOT less! (snicker, er, ah sorry, I just couldn't resist)
:D
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts