Difference between revisions of "Noscript Avoidance"

From Pool's Closed Wiki
Jump to: navigation, search
(New page: A problem for launching followers, especially in sandboxes, is the "safe zones" with scripting disabled. The following is an avoidance subroutine you can integrate into scripts to make sur...)
 
m
 
Line 1: Line 1:
A problem for launching followers, especially in sandboxes, is the "safe zones" with scripting disabled. The following is an avoidance subroutine you can integrate into scripts to make sure your object stops before getting trapped. It will stop under these circumtances:
+
A problem for followers, especially in sandboxes, is the "safe zones" with scripting disabled. The following is an avoidance subroutine you can integrate into scripts to make sure your object stops before getting trapped. It will stop under these circumtances:
  
 
* Target goes into a noscript area.
 
* Target goes into a noscript area.

Latest revision as of 19:46, 5 August 2009

A problem for followers, especially in sandboxes, is the "safe zones" with scripting disabled. The following is an avoidance subroutine you can integrate into scripts to make sure your object stops before getting trapped. It will stop under these circumtances:

  • Target goes into a noscript area.
  • Target leaves a noscript area but that area remains between the object and the target. The object will continue to wait until it has a safe vector to the target before moving again.


<lsl>

       // You can use a normal llSensorRepeat if you don't wish to use llGetObjectDetails.
       list desu = llGetObjectDetails(gTargetKey, [OBJECT_POS]); //gTargetKey is the UUID of the current target stored as a global variable
       vector target = llList2Vector(desu, 0);
       vector here = llGetPos();
       vector distance = target - here; //Vector between object and the target
       float length = llVecMag(distance);
       vector normz = llVecNorm(distance);
       float mod_length = 4;
       if ( !(PARCEL_FLAG_ALLOW_SCRIPTS & llGetParcelFlags(target)) )
       {
           return;
       }
       while ( mod_length <= length )
       {
           integer frac_trap_check = llGetParcelFlags( here + (normz * mod_length) );
           if ( !(PARCEL_FLAG_ALLOW_SCRIPTS & frac_trap_check ) )
           {
              return;
           }
           mod_length = mod_length + 4;
       }
       
       llSetPos( pos + offset );

</lsl>