CandiZazzles Posted July 27, 2013 Share Posted July 27, 2013 I've been working on a script for a personal project but can't seem to get it rightI need it to auto scan the sim for a certain object prim name as soon as it rezzes and I would like it to notify me via local with a TP to the exact location of the prim found even if i am off of the sim that the "scanner" is at. Any help or advice would be helpful :)default { touch_start(integer obj) { llSensor("",NULL_KEY,PASSIVE|ACTIVE,20.0,PI); } sensor(integer num_detected) { integer i; string display = ""; for(i = 0; i < num_detected; i++) { string name; name = llDetectedName (i); // or ..= llToLower (llDetectedName(i)); for caseless search if (llSubStringIndex(name, "SPECIAL OBJECT") == 0) // starts with 'SPECIAL OBJECT'? (or != -1 for anywhere) { display = name + " " + (string)llDetectedPos(i) + "\n" + display; } } if (display != "") { llOwnerSay (display); } else { llOwnerSay ("No SPEICAL OBJECT's found in " + (string)num_detected + " objects!"); } } no_sensor() { llOwnerSay("Nothing?"); } } Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted July 27, 2013 Share Posted July 27, 2013 It would be helpful to know where you're stuck Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted July 27, 2013 Share Posted July 27, 2013 You'll need to use llSensorRepeat if you want it to keep going after you've touched it and left the sim. Link to comment Share on other sites More sharing options...
LepreKhaun Posted July 27, 2013 Share Posted July 27, 2013 Unsure what you're attempting to do, but as Profaitchikenz Haiku said, you need to scan continously- the code you have is a one shot affair. Also, there is no need to gather all the info of nearby objects and then look for a specific name, just scan fot that name to begin with. That is what the first parameter of those function calls are about. Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted July 27, 2013 Share Posted July 27, 2013 I am guessing here that the OP wants to look for objects that have a format to the way they're named but keep changing the complete name, and the filtering by name alone only works for an exact match. Link to comment Share on other sites More sharing options...
CandiZazzles Posted July 27, 2013 Author Share Posted July 27, 2013 Yes, the object needs to continuously keep scanning even after it finds the certain object. The name that its searching for would never change.. and I need a function to send a landmark to the location where it found the prim even if I am away off of the sim. Link to comment Share on other sites More sharing options...
Xiija Posted July 28, 2013 Share Posted July 28, 2013 something like this...? this will send a clickable TP link to the object every 30 seconds.. you could make a list and a toggle to only be notified once per obj tho vector pos;integer num;string region;integer k;key id;default{ state_entry() { region = llEscapeURL( llGetRegionName() ); } touch_start(integer obj) { id = llDetectedKey(0); if(id == llGetOwner() ) { k = !k; if(k) { llOwnerSay("ON"); llSensorRepeat("SPECIAL OBJECT", "",PASSIVE|ACTIVE, 20.0, PI, 30.0); } else { llOwnerSay("OFF"); llSensorRemove();} } } sensor(integer num_detected) { num = num_detected; integer i; for(i = 0; i < num_detected; i++) { pos = llDetectedPos(i); llInstantMessage( llGetOwner(), "\nClick link below to Teleport to SPECIAL OBJECT \n secondlife:///app/teleport/" + region + "/"+(string)llRound(pos.x)+ "/" +(string)llRound(pos.y)+ "/" +(string)llRound(pos.z)); } } no_sensor() { llOwnerSay ("No SPEICAL OBJECT's found in " + (string)num + " objects!"); }} Link to comment Share on other sites More sharing options...
steph Arnott Posted July 28, 2013 Share Posted July 28, 2013 Im at a loss to understand why the continuous scan, why not just send an IM with a teleport SLURL? EDIT: Bad spelling. Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted July 28, 2013 Share Posted July 28, 2013 Supposing somebody was rezzing a temp_on_rezz object, or a chat-log scanner which deleted itself after a short while, or rezzed a new copy of itself a few metres away and then deleted itself? Now I've thought about it, I can see some uses for what this script is trying to do. Link to comment Share on other sites More sharing options...
CandiZazzles Posted July 28, 2013 Author Share Posted July 28, 2013 Thanks Xiija for your help! :catvery-happy: The only problem I see with that script is its searching for any owner by the name of the certain prim. I'm trying to make it to where it will only search for my objects and no one elses. Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 28, 2013 Share Posted July 28, 2013 CandiZazzles wrote: Thanks Xiija for your help! :catvery-happy: The only problem I see with that script is its searching for any owner by the name of the certain prim. I'm trying to make it to where it will only search for my objects and no one elses. In that case, you'll need to filter the results in your sensor event with an extra if test to ask if (llGetOwnerKey(llDetectedKey(0) ) == llGetOwner() ) to eliminate all detected objects that are not yours. Of course, that means the results of the no_sensor event will not always be true, since no_sensor will only fire if there are no objects of any kind detected. If it's important to have that message, you'll have to put a new flag in the sensor event to let you know when no detected objects pass the new filter. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now