|
Jenn Yoshikawa
Registered User
Join date: 14 Nov 2007
Posts: 91
|
07-27-2008 11:11
I have looked high and low at all lsl sites. So I come to you gods hehe. What I want to do is say some ones name and they will be given a dialog. Its not for spam hehe. But I have looked at the kiss and hug scripts and I got so lost on the way they set them up.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-27-2008 11:53
Nearby avatars (within 96m), or any resident logged in, or even logged out residents the next time they login? The first one is reasonably easy. The latter ones are substantially more difficult and will require at the least a request to an external database to lookup the resident's key. Here's one that will scan your immediate area (96m radius) for an avatar with the exact name you give (whole, exact, case-sensitive name) and give them a dialog that asks, "Are you a guinea pig?" and gives you their answer. This one listens on channel 3 to the owner only. integer COMMAND_CHANNEL = 3; float SENSOR_RADIUS = 96.0;
integer DIALOG_CHANNEL = -322033640; string DIALOG_MESSAGE = "Are you a guinea pig?"; list CHOICES = [ "Yes", "No" ];
string targetName = "";
default { state_entry() { llListen(COMMAND_CHANNEL, "", llGetOwner(), ""); llListen(DIALOG_CHANNEL, "", NULL_KEY, ""); }
changed(integer changes) { if (changes & CHANGED_OWNER) { llResetScript(); } }
listen(integer channel, string name, key id, string message) { if (channel == COMMAND_CHANNEL) { llSensorRemove(); targetName = message; llSensor(targetName, NULL_KEY, AGENT, SENSOR_RADIUS, PI); } else { if (llListFindList(CHOICES, [ message ]) >= 0) { llOwnerSay(name+" answers \""+message+"\"."); } } }
no_sensor() { llOwnerSay(targetName+" not found within range."); }
sensor(integer nDetected) { key target = llDetectedKey(0); llOwnerSay("Asking "+targetName+": \""+DIALOG_MESSAGE+"\""); llDialog(target, DIALOG_MESSAGE, CHOICES, DIALOG_CHANNEL); } }
|