Difference between revisions of "Send vector as on rez param"

From Second Life Wiki
Jump to navigation Jump to search
(New page: Send a vector directly to a rezzed object via 'param' in on_rez(integer param) <lsl> // // BETLOG Hax // UTC10: 20090606 2252 [SLT: 20090606 0552] // * Rez an object and pass a position ...)
 
m
Line 45: Line 45:
default
default
{  touch_start(integer num)
{  touch_start(integer num)
     {  f_deploy(llDetectedKey(0));
     {  f_deploy(llDetectedKey(0)); //NO i would NOT normally be using in a touch event. It's just for a simple example.
     }
     }
}
}

Revision as of 08:34, 6 June 2009

Send a vector directly to a rezzed object via 'param' in on_rez(integer param)

<lsl> // // BETLOG Hax // UTC10: 20090606 2252 [SLT: 20090606 0552] // * Rez an object and pass a position vector directly to it via the rez integer parameter // * vector is only accurate to nearest meter, and range limited by l+=l warppos method AND number of digits (10) in the start param //========================================================================= // LICENCE: // Creative Commons Attribution-Share Alike 3.0 license // http://creativecommons.org/licenses/by-sa/3.0/ // You can modify this script, but you must prominently state that you // used this script, credit it's original author(s), and supply this // unaltered script with your modification. //========================================================================= // SHARED CONFIGURATION //---------------------------------- // CONFIGURATION //---------------------------------- // CORE CODE //---------------------------------- f_deploy(key target) { if(llGetAgentSize(target)!= ZERO_VECTOR)

   {   vector pos = llList2Vector(llGetObjectDetails(target, ([OBJECT_POS])),0);
       string X=(string)llRound(pos.x);
               while(llStringLength(X)<3)
                   X="0"+X;
       string Y=(string)llRound(pos.y);
               while(llStringLength(Y)<3)
                   Y="0"+Y;
       string Z=(string)llRound(pos.z);
               while(llStringLength(Z)<4)
                   Z="0"+Z;
       llRezObject( 
           llGetInventoryName(INVENTORY_OBJECT, 0)//OBJECT THAT CONTAINS THE OTHER SCRIPT BELOW
           , llGetPos()
           , ZERO_VECTOR 
           , ZERO_ROTATION
           , (integer)(X+Y+Z)
       ); 
   }

} //========================================================================= default { touch_start(integer num)

   {   f_deploy(llDetectedKey(0)); //NO i would NOT normally be using in a touch event. It's just for a simple example.
   }

} //========================================================================= </lsl>


<lsl> // // BETLOG Hax // UTC10: 20090606 2252 [SLT: 20090606 0552] // * Receive a position vector directly via the rez integer parameter from the object rezzing me // * vector is only accurate to nearest meter, and range limited by l+=l warppos method AND number of digits (10) in the start param //========================================================================= // LICENCE: // Creative Commons Attribution-Share Alike 3.0 license // http://creativecommons.org/licenses/by-sa/3.0/ // You can modify this script, but you must prominently state that you // used this script, credit it's original author(s), and supply this // unaltered script with your modification. //========================================================================= // SHARED CONFIGURATION //---------------------------------- // CONFIGURATION //---------------------------------- // CORE CODE //---------------------------------- default { on_rez(integer param)

   {   if(param)//>0 is assumed
       {   string s = (string)param;
           while(llStringLength(s)<10)
               s="0"+s;
           list l=[PRIM_POSITION,<(float)llGetSubString(s,0, 2),(float)llGetSubString(s,3, 5),(float)llGetSubString(s,6, 9)>];
           l+=l;l+=l;l+=l;l+=l;l+=l;l+=l;l+=l;l+=l;l+=l;
           //20,40,80,160,320,640,1280,2560,5120 //not *actually* from <0,0,0> to <256,256,4096>... but still a long way in one jump
           llSetPrimitiveParams(l);
           llTriggerSound("55a5c332-9303-8057-61eb-657ef571ab5e", 1.0); //PingSplash
       }
   }

} //========================================================================= </lsl>