2 // huffware script: huff-search pointer, by fred huffhines
4 // this script is one portion of a search system. the pointer is meant to be in a child prim.
5 // it is told what to point at by the root prim.
7 // the newer version of this supports a search command that locates objects in the
8 // direction specified.
10 // attributions: started life as "Particle Script 0.4, Created by Ama Omega, 3-7-2004"
11 // some code in this script is also from: Christopher Omega.
13 // this script is licensed by the GPL v3 which is documented at: http://www.gnu.org/licenses/gpl.html
14 // do not use it in objects without fully realizing you are implicitly accepting that license.
17 // huff-search pointer API:
19 // do not redefine these constants.
20 integer HUFF_SEARCH_POINTER_HUFFWARE_ID = 10032;
21 // the unique id within the huffware system for this script.
22 string HUFFWARE_PARM_SEPARATOR = "{~~~}";
23 // this pattern is an uncommon thing to see in text, so we use it to separate
24 // our commands in link messages.
25 string HUFFWARE_ITEM_SEPARATOR = "{|||}";
26 // used to separate lists of items from each other when stored inside a parameter.
27 // this allows lists to be passed as single string parameters if needed.
28 integer REPLY_DISTANCE = 100008; // offset added to service's huffware id in reply IDs.
30 string HUFF_SEARCH_RESET = "#reset#";
31 // returns the script to its starting state.
32 // constants for controlling how searchbert presents its arms when pointing. they are the
33 // Present Arms Styles (PAS).
34 integer PAS_CENTERED = 0;
35 // original style of arm positioning for searchbert. the arms are centered at the root prim's
36 // center, and they point towards the target.
37 integer PAS_OPPOSITE_WALL = 1;
38 // the arms will be positioned so that they start at the outer wall on the opposite side of
39 // the root prim from the target, and they point towards the target. basically it looks like
40 // they've been partly sucked inside searchbert.
41 integer PAS_NEAREST_WALL = 2;
42 // contrary to the opposite wall style, this starts the arms on the sphere's wall closest to the
43 // target and points the arm toward the target. the effect is somewhat like a hedgehog.
44 integer PAS_END_CENTERED = 3;
45 // the arms originate at the center of searchbert, and point towards the targets.
46 string HUFF_SEARCH_POINT_PARTY = "#point_particles#";
47 // aim at an object and show a particle stream leading to it. parms are a UUID key for the
48 // target, the target location vector and a PAS value.
49 string HUFF_SEARCH_JUST_POINT = "#just_point#";
50 // aim at an object, but don't do any particles. parms are the target vector
52 string HUFF_SEARCH_SENSEI = "#sensor#";
53 // set up a sensor request for a search pattern. pings will cause
54 // the pattern to be sought in names of nearby objects. the parameters are:
55 // (1) the maximum range for the sensor, (2) the arc angle to use in sensing,
56 // (3) the search pattern to look for in object names, (4) the maximum number
57 // of matches to look for, (5) the type of objects to find (e.g. SENSOR_TYPE_ACTIVE
59 string HUFF_SEARCH_STOP_SENSE = "#stop_sensor#";
60 // turn off the sensor but don't totally reset.
61 string HUFF_SEARCH_PING = "#ping#";
62 // cause the searcher to actively sensor ping the targets.
63 string HUFF_SEARCH_MATCH_EVENT = "#match#";
64 // fired at the root prim when matches are found for the search term.
65 // the payload is a list of matched item pairs [item key, location].
68 // global variables...
70 // AXIS_* constants, represent the unit vector 1 unit on the specified axis.
71 vector AXIS_UP = <0.0, 0.0, 1.0>;
72 vector AXIS_LEFT = <0.0, 1.0, 0.0>;
73 vector AXIS_FWD = <1.0, 0.0, 0.0>;
75 integer MAX_LIST_LEN = 17;
76 // the maximum matches we hang onto, to avoid using too many resources.
77 // this should be no longer than the number of search arms created by
78 // the brain script, but it can be less if fewer matches are needed.
82 // global variables...
84 string search_pattern;
85 // the pattern that we are hoping to find from our sensor hits.
87 list global_matches_found;
88 // a list of keys that match the specified search terms.
90 integer our_link_number = 0;
91 // set to the number for our link if we ever see ourselves as a link greater than 1.
92 // this only happens when we have been made a sub-prim and are definitely not the root prim,
93 // so it is our key for whether the prim should die if it becomes unlinked.
95 vector original_position = <-128, -128, -128>; // default we can count on.
96 // where did this arm start out, relative to the root prim?
98 // SENSOR_TYPE_ALL: a constant that tells the sensor to look for (ACTIVE|PASSIVE|AGENT).
99 integer SENSOR_TYPE_ALL = 7;
102 // the type of objects being sought in the search.
104 // Mask Flags - set to TRUE to enable
105 integer glow = TRUE; // Make the particles glow
106 integer bounce = FALSE; // Make particles bounce on Z plane of object
107 integer interpColor = TRUE; // Go from start to end color
108 integer interpSize = TRUE; // Go from start to end size
109 integer wind = FALSE; // Particles effected by wind
110 integer followSource = TRUE; // Particles follow the source
111 integer followVel = TRUE; // Particles turn to velocity direction
113 // Choose a pattern from the following:
114 // PSYS_SRC_PATTERN_EXPLODE
115 // PSYS_SRC_PATTERN_DROP
116 // PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
117 // PSYS_SRC_PATTERN_ANGLE_CONE
118 // PSYS_SRC_PATTERN_ANGLE
119 integer pattern = PSYS_SRC_PATTERN_DROP;
121 // Select a target for particles to go towards
122 // "" for no target, "owner" will follow object owner
123 // and "self" will target this object
124 // or put the key of an object for particles to go to
125 key target = "owner";
127 // useful particle parameters.
128 float age = 14; // Life of each particle
129 float startAlpha = 1.0; // Start alpha (transparency) value
130 float endAlpha = 1.0; // End alpha (transparency) value
131 vector startSize = <0.2, 0.2, 0.2>; // Start size of particles
132 vector endSize = <0.8, 0.8, 0.8>; // End size of particles (if interpSize == TRUE)
134 // colors are now assigned dynamically per search.
135 vector startColor; // Start color of particles <R,G,B>
136 vector endColor; // End color of particles <R,G,B> (if interpColor == TRUE)
138 // unused particle parameters.
139 float maxSpeed = 2; // Max speed each particle is spit out at
140 float minSpeed = 2; // Min speed each particle is spit out at
141 string texture; // Texture used for particles, default used if blank
142 vector push = <0.0, 0.0, 0.0>; // Force pushed on particles
145 float rate = 0.08; // burst rate to emit particles, zero is fastest.
146 float radius = 1; // Radius to emit particles for BURST pattern
147 integer count = 1; // How many particles to emit per BURST
148 float outerAngle = 1.54; // Outer angle for all ANGLE patterns
149 float innerAngle = 1.55; // Inner angle for all ANGLE patterns
150 vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source
151 float life = 0; // Life in seconds for the system to make particles
154 integer precision = 2; //Adjust the precision of the generated list.
156 integer running_particles = FALSE; // is the particle system running?
158 string float2String(float in)
160 return llGetSubString((string)in, 0, precision - 7);
167 if (target == "owner") target = llGetOwner();
168 if (target == "self") target = llGetKey();
169 if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
170 if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
171 if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
172 if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
173 if (wind) flags = flags | PSYS_PART_WIND_MASK;
174 if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
175 if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
176 if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
178 // original recipe searchbert pointer...
179 // startColor = <0.92, 0.79412, 0.66863>; // Start color of particles <R,G,B>
180 // endColor = <0.0, 1.0, 0.7>; // End color of particles <R,G,B> (if interpColor == TRUE)
181 // new randomized version for colors. the current aesthetic here is to start
182 // with a relatively dark color and end on a relatively light color.
183 startColor = <randomize_within_range(0.14, 0.95, FALSE),
184 randomize_within_range(0.14, 0.95, FALSE),
185 randomize_within_range(0.14, 0.95, FALSE)>;
186 endColor = <randomize_within_range(0.28, 0.95, FALSE),
187 randomize_within_range(0.28, 0.95, FALSE),
188 randomize_within_range(0.28, 0.95, FALSE)>;
190 system_content = [ PSYS_PART_MAX_AGE, age,
191 PSYS_PART_FLAGS,flags,
192 PSYS_PART_START_COLOR, startColor,
193 PSYS_PART_END_COLOR, endColor,
194 PSYS_PART_START_SCALE, startSize,
195 PSYS_PART_END_SCALE, endSize,
196 PSYS_SRC_PATTERN, pattern,
197 PSYS_SRC_BURST_RATE, rate,
198 PSYS_SRC_ACCEL, push,
199 PSYS_SRC_BURST_PART_COUNT, count,
200 PSYS_SRC_BURST_RADIUS, radius,
201 PSYS_SRC_BURST_SPEED_MIN, minSpeed,
202 PSYS_SRC_BURST_SPEED_MAX, maxSpeed,
203 // PSYS_SRC_INNERANGLE,innerAngle,
204 // PSYS_SRC_OUTERANGLE,outerAngle,
205 PSYS_SRC_OMEGA, omega,
206 PSYS_SRC_MAX_AGE, life,
207 // PSYS_SRC_TEXTURE, texture,
208 PSYS_PART_START_ALPHA, startAlpha,
209 PSYS_PART_END_ALPHA, endAlpha
211 if (target != NULL_KEY) {
212 system_content += [ PSYS_SRC_TARGET_KEY, target ];
215 llParticleSystem(system_content);
216 running_particles = TRUE;
219 // returns TRUE if the value in "to_check" specifies a legal x or y value in a sim.
220 integer valid_sim_value(float to_check)
222 if (to_check < 0.0) return FALSE;
223 if (to_check >= 257.0) return FALSE;
227 integer outside_of_sim(vector to_check)
229 return !valid_sim_value(to_check.x) || !valid_sim_value(to_check.y);
234 // In a linked set, points a child object to the rotation.
235 // @param rot The rotation to rotate to.
236 rotation LocalRot(rotation rot)
238 rotation locRot = llGetLocalRot();
239 locRot.s = -locRot.s; // Invert local rot.
241 rotation parentRot = locRot * llGetRot();
242 parentRot.s = -parentRot.s; // Invert parent's rot.
244 return rot * parentRot;
247 // Gets the rotation to point the specified axis at the specified position.
248 // @param axis The axis to point. Easiest to just use an AXIS_* constant.
249 // @param target The target, in region-local coordinates, to point the axis at.
250 // @return The rotation necessary to point axis at target.
251 rotation getRotToPointAxisAt(vector axis, vector target)
253 return llGetRot() * llRotBetween(axis * llGetRot(), target - llGetPos());
256 // aims in the direction of the target using a rod pointing style.
257 aim_at(vector targetPos, integer point_style)
259 if (llGetLinkNumber() <= 1) return; // no root prim mods.
261 vector obj_size = (vector)llList2String(llGetLinkPrimitiveParams(LINK_ROOT, [PRIM_SIZE]), 0);
262 float radius = obj_size.x; // safe to assume for a sphere.
263 obj_size = (vector)llList2String(llGetLinkPrimitiveParams(llGetLinkNumber(), [PRIM_SIZE]), 0);
264 float arm_length = obj_size.z; // longest component.
265 // the default is to use our original placement for the intersection point.
266 vector intersect = original_position;
267 // see if they're using a different and interesting arms presentation.
268 if (point_style == PAS_OPPOSITE_WALL) {
269 intersect = <0, 0, arm_length / 2.0 - radius / 2.0>
270 * LocalRot(getRotToPointAxisAt(AXIS_UP, targetPos));
271 } else if (point_style == PAS_NEAREST_WALL) {
272 intersect = <0, 0, arm_length / 2.0 + radius / 2.0>
273 * LocalRot(getRotToPointAxisAt(AXIS_UP, targetPos));
274 } else if (point_style == PAS_END_CENTERED) {
275 intersect = <0, 0, arm_length / 2.0>
276 * LocalRot(getRotToPointAxisAt(AXIS_UP, targetPos));
278 // use the proper rotation based on the target and place the arm at the intersection
279 // point we just computed.
280 mods += [ PRIM_POS_LOCAL, intersect,
281 PRIM_ROT_LOCAL, LocalRot(getRotToPointAxisAt(AXIS_UP, targetPos)) ];
282 llSetPrimitiveParams(mods);
285 // locates the string "text" in the list to "search_in".
286 integer find_in_list(list search_in, string text)
288 integer len = llGetListLength(search_in);
290 for (i = 0; i < len; i++) {
291 if (llList2String(search_in, i) == text)
297 // points the upward axis at targetPos, and emits a particle system at targetKey.
298 // requires the UUID of the target to emit particles at, the position of the target
299 // in region-local coordinates, and the style to point the arm with.
300 point_at(key targetKey, vector targetPos, integer point_style)
302 aim_at(targetPos, point_style);
307 // variables that are established by a search and used periodically in the timer.
308 float max_range = 0.0;
309 float arc_angle = 0.0;
310 float sensor_interval = 0.0;
315 llSetTimerEvent(0.0);
322 integer debug_num = 0;
324 // a debugging output method. can be disabled entirely in one place.
325 log_it(string to_say)
328 // tell this to the owner.
329 llOwnerSay(llGetScriptName() + "[" + (string)debug_num + "] " + to_say);
330 // say this on an unusual channel for chat if it's not intended for general public.
331 // llSay(108, llGetScriptName() + "[" + (string)debug_num + "] " + to_say);
332 // say this on open chat that anyone can hear. we take off the bling for this one.
336 // returns TRUE if the "pattern" is found in the "full_string".
337 integer matches_substring(string full_string, string pattern)
338 { return (find_substring(full_string, pattern) >= 0); }
340 // returns the index of the first occurrence of "pattern" inside
341 // the "full_string". if it is not found, then a negative number is returned.
342 integer find_substring(string full_string, string pattern)
343 { return llSubStringIndex(llToLower(full_string), llToLower(pattern)); }
345 // returns TRUE if the "prefix" string is the first part of "compare_with".
346 integer is_prefix(string compare_with, string prefix)
347 { return find_substring(compare_with, prefix) == 0; }
349 // returns a number at most maximum and at least minimum.
350 // if "allow_negative" is TRUE, then the return may be positive or negative.
351 float randomize_within_range(float minimum, float maximum, integer allow_negative)
353 float to_return = minimum + llFrand(maximum - minimum);
354 if (allow_negative) {
355 if (llFrand(1.0) < 0.5) to_return *= -1.0;
360 // makes sure that we record the current link number if it's higher than 1; this
361 // is how we know that we're a sub-prim.
362 record_link_num_if_useful()
364 if (llGetLinkNumber() > 1) our_link_number = llGetLinkNumber();
368 // huffware script: auto-retire, by fred huffhines, version 2.5.
369 // distributed under BSD-like license.
370 // !! keep in mind that this code must be *copied* into another
371 // !! script that you wish to add auto-retirement capability to.
372 // when a script has auto_retire in it, it can be dropped into an
373 // object and the most recent version of the script will destroy
374 // all older versions.
376 // the version numbers are embedded into the script names themselves.
377 // the notation for versions uses a letter 'v', followed by two numbers
378 // in the form "major.minor".
379 // major and minor versions are implicitly considered as a floating point
380 // number that increases with each newer version of the script. thus,
381 // "hazmap v0.1" might be the first script in the "hazmap" script continuum,
382 // and "hazmap v3.2" is a more recent version.
384 // example usage of the auto-retirement script:
387 // auto_retire(); // make sure newest addition is only version of script.
390 // this script is partly based on the self-upgrading scripts from markov brodsky
391 // and jippen faddoul.
394 string self = llGetScriptName(); // the name of this script.
395 list split = compute_basename_and_version(self);
396 if (llGetListLength(split) != 2) return; // nothing to do for this script.
397 string basename = llList2String(split, 0); // script name with no version attached.
398 string version_string = llList2String(split, 1); // the version found.
400 // find any scripts that match the basename. they are variants of this script.
401 for (posn = llGetInventoryNumber(INVENTORY_SCRIPT) - 1; posn >= 0; posn--) {
402 //log_it("invpo=" + (string)posn);
403 string curr_script = llGetInventoryName(INVENTORY_SCRIPT, posn);
404 if ( (curr_script != self) && (llSubStringIndex(curr_script, basename) == 0) ) {
405 // found a basic match at least.
406 list inv_split = compute_basename_and_version(curr_script);
407 if (llGetListLength(inv_split) == 2) {
408 // see if this script is more ancient.
409 string inv_version_string = llList2String(inv_split, 1); // the version found.
410 // must make sure that the retiring script is completely the identical basename;
411 // just matching in the front doesn't make it a relative.
412 if ( (llList2String(inv_split, 0) == basename)
413 && ((float)inv_version_string < (float)version_string) ) {
414 // remove script with same name from inventory that has inferior version.
415 llRemoveInventory(curr_script);
422 // separates the base script name and version number. used by auto_retire.
423 list compute_basename_and_version(string to_chop_up)
425 // minimum script name is 2 characters plus a version.
426 integer space_v_posn;
427 // find the last useful space and 'v' combo.
428 for (space_v_posn = llStringLength(to_chop_up) - 3;
429 (space_v_posn >= 2) && (llGetSubString(to_chop_up, space_v_posn, space_v_posn + 1) != " v");
431 // look for space and v but do nothing else.
432 //log_it("pos=" + (string)space_v_posn);
434 if (space_v_posn < 2) return []; // no space found.
435 //log_it("space v@" + (string)space_v_posn);
436 // now we zoom through the stuff after our beloved v character and find any evil
437 // space characters, which are most likely from SL having found a duplicate item
438 // name and not so helpfully renamed it for us.
440 for (indy = llStringLength(to_chop_up) - 1; indy > space_v_posn; indy--) {
441 //log_it("indy=" + (string)space_v_posn);
442 if (llGetSubString(to_chop_up, indy, indy) == " ") {
443 // found one; zap it. since we're going backwards we don't need to
444 // adjust the loop at all.
445 to_chop_up = llDeleteSubString(to_chop_up, indy, indy);
446 //log_it("saw case of previously redundant item, aieee. flattened: " + to_chop_up);
449 string full_suffix = llGetSubString(to_chop_up, space_v_posn, -1);
450 // ditch the space character for our numerical check.
451 string chop_suffix = llGetSubString(full_suffix, 1, llStringLength(full_suffix) - 1);
452 // strip out a 'v' if there is one.
453 if (llGetSubString(chop_suffix, 0, 0) == "v")
454 chop_suffix = llGetSubString(chop_suffix, 1, llStringLength(chop_suffix) - 1);
455 // if valid floating point number and greater than zero, that works for our version.
456 string basename = to_chop_up; // script name with no version attached.
457 if ((float)chop_suffix > 0.0) {
458 // this is a big success right here.
459 basename = llGetSubString(to_chop_up, 0, -llStringLength(full_suffix) - 1);
460 return [ basename, chop_suffix ];
462 // seems like we found nothing useful.
470 state_entry() { if (llSubStringIndex(llGetObjectName(), "huffotronic") < 0) state real_default; }
471 on_rez(integer parm) { state rerun; }
473 state rerun { state_entry() { state default; } }
479 llParticleSystem([]);
480 running_particles = FALSE;
481 if (original_position == <-128, -128, -128>) {
482 original_position = (vector)llList2String
483 (llGetLinkPrimitiveParams(llGetLinkNumber(), [PRIM_POS_LOCAL]), 0);
485 // can't initialize static with another static...
486 search_type = SENSOR_TYPE_ALL;
487 llSetLinkPrimitiveParams(llGetLinkNumber(), [ PRIM_ROT_LOCAL,
488 LocalRot(<0.0, 0.0, 0.0, 1.0>) ]);
489 global_matches_found = [];
490 record_link_num_if_useful();
492 on_rez(integer parm) {
493 record_link_num_if_useful();
496 link_message(integer sender, integer num, string command, key parameters) {
497 if (num != HUFF_SEARCH_POINTER_HUFFWARE_ID) return; // not for us.
498 if (llGetLinkNumber() <= 1) return; // do nothing as root prim.
499 if (command == HUFF_SEARCH_RESET) {
500 // returns to the normal state of the object.
502 llSetLinkPrimitiveParams(llGetLinkNumber(), [ PRIM_ROT_LOCAL,
503 LocalRot(<0.0, 0.0, 0.0, 1.0>), PRIM_POS_LOCAL, original_position ]);
504 llParticleSystem([]);
505 running_particles = FALSE;
506 global_matches_found = [];
507 } else if (command == HUFF_SEARCH_POINT_PARTY) {
508 // aim at an object and show a particle stream leading to it.
510 list parsedParameters = llParseString2List(parameters, [HUFFWARE_PARM_SEPARATOR], []);
511 key targetKey = (key)llList2String(parsedParameters, 0);
512 vector targetPos = (vector)llList2String(parsedParameters, 1);
513 integer point_style = (integer)llList2String(parsedParameters, 2);
514 point_at(targetKey, targetPos, point_style);
515 } else if (command == HUFF_SEARCH_JUST_POINT) {
516 // aim at an object, but don't do any particles.
518 list parsedParameters = llParseString2List(parameters, [HUFFWARE_PARM_SEPARATOR], []);
519 vector targetPos = (vector)llList2String(parsedParameters, 0);
520 integer point_style = (integer)llList2String(parsedParameters, 1);
521 aim_at(targetPos, point_style);
522 } else if (command == HUFF_SEARCH_SENSEI) {
523 // set up a sensor request for a search pattern. pings will cause
524 // the pattern to be sought in names of nearby objects.
526 global_matches_found = []; // reset any previous matches.
527 list parsedParameters = llParseString2List(parameters, [HUFFWARE_PARM_SEPARATOR], []);
528 max_range = (float)llList2String(parsedParameters, 0);
529 arc_angle = (float)llList2String(parsedParameters, 1);
530 search_pattern = llToLower((string)llList2String(parsedParameters, 2));
531 MAX_LIST_LEN = (integer)llList2String(parsedParameters, 3);
532 search_type = (integer)llList2String(parsedParameters, 4);
533 } else if (command == HUFF_SEARCH_STOP_SENSE) {
534 // turn off the sensor but don't totally reset yet.
536 global_matches_found = [];
537 } else if (command == HUFF_SEARCH_PING) {
538 // do a little particle emission while searching, just to let them know
542 if (!running_particles) create_particles();
543 // they want to check for objects right here, right now...
544 llSensor("", NULL_KEY, search_type, max_range, arc_angle);
547 changed(integer change) {
548 if (change & CHANGED_LINK) {
549 // we have been linked or unlinked or sat upon.
550 if ( (our_link_number > 1) && (llGetLinkNumber() == 0) ) {
551 // this is now a single prim linked to nothing.
553 } else if (our_link_number <= 1) {
554 // we had no link number recorded, so let's track this if needed.
555 record_link_num_if_useful();
557 // if we were relinked, get the local position again, since it changes to relative
558 // after being linked to another prim.
559 original_position = (vector)llList2String
560 (llGetLinkPrimitiveParams(llGetLinkNumber(), [PRIM_POS_LOCAL]), 0);
563 sensor(integer num_detected) {
564 if (llGetLinkNumber() <= 1) return; // do nothing as root prim.
565 if (llGetListLength(global_matches_found) > MAX_LIST_LEN) {
566 // we have enough matches already. stop adding more.
570 list parms = []; // the full set of matches we found.
571 integer i; // loop variable.
572 integer matches_found = 0;
573 key root_key = llGetLinkKey(1);
574 for (i = 0; i < num_detected; i++) {
575 key targetKey = llDetectedKey(i);
576 string target_name = llDetectedName(i);
577 if ( (targetKey != root_key)
578 // we don't want to report our own object.
579 && matches_substring(target_name, search_pattern)
580 // check whether the current target matches our search pattern.
581 && (find_in_list(global_matches_found, targetKey) < 0) ) {
582 // make sure we haven't already reported this one.
584 //if (matches_substring(target_name, "searchbert v")) {
585 //log_it("somehow got past the is it myself check with a no-answer, my key=" + llGetKey() + " their key=" + targetKey);
588 // store the match now. even if we don't like where it's located
589 // (as in, outside our sim), we still don't want to keep matching it
590 // and looking at it.
591 global_matches_found += targetKey;
593 // the name matched the search pattern... but make sure the
594 // location is worth reporting; if it's outside the sim, we will
595 // not be able to name it or point at it properly.
596 vector location = llDetectedPos(i);
597 if (!outside_of_sim(location)) {
598 // it's a match that's inside the sim. send it along.
599 parms += [ targetKey, location ];
600 matches_found++; // we got one!
601 //log_it("match added: " + (string)targetKey);
602 // shorten lists of matches so we don't overload the brain.
603 if (llGetListLength(parms) >= 8) {
604 llMessageLinked(LINK_ROOT,
605 HUFF_SEARCH_POINTER_HUFFWARE_ID + REPLY_DISTANCE,
606 HUFF_SEARCH_MATCH_EVENT,
607 llDumpList2String(parms, HUFFWARE_PARM_SEPARATOR));
615 //log_it("sending " + (string)matches_found + " matches in message...");
616 // send message about matches back to parent.
617 llMessageLinked(LINK_ROOT, HUFF_SEARCH_POINTER_HUFFWARE_ID + REPLY_DISTANCE,
618 HUFF_SEARCH_MATCH_EVENT,
619 llDumpList2String(parms, HUFFWARE_PARM_SEPARATOR));