Difference between revisions of "Template:LSL Function/docs"

From Second Life Wiki
Jump to navigation Jump to search
(Undo revision 201142 by BETLOG Hax (Talk))
Line 21: Line 21:
//  Creative Commons Creative Commons Attribution-Share Alike 3.0 license
//  Creative Commons Creative Commons Attribution-Share Alike 3.0 license
//  http://creativecommons.org/licenses/by-sa/3.0/
//  http://creativecommons.org/licenses/by-sa/3.0/
//
// ORIGINAL LICENCE :
//  GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007
//  http://www.gnu.org/licenses/gpl-3.0.txt
//
//
// ie: You can modify this script, but you must prominently state that you used this script,  
// ie: You can modify this script, but you must prominently state that you used this script,  
Line 82: Line 86:
}
}
//======================================================================================
//======================================================================================
// ORIGINAL LICENCE :
 
//  GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007
//  http://www.gnu.org/licenses/gpl-3.0.txt
//
//ZWAGOTHS ORIGINAL SCRIPT:
//ZWAGOTHS ORIGINAL SCRIPT:
// *******************************************************************************
// *******************************************************************************

Revision as of 17:48, 16 January 2009

AutoHUD constructor

Automatic assembly of stacked text element HUD. [Typically used to track avatars in your vicinity.]
This script ONLY assembles the HUD prims and then deletes itself.

<lsl> // // BETLOG Hax // AEST: 20090113 1346 [SLT: 20090112 2046] // Total rewrite of a script called 'Align' by Zwagoth Klaar. // This script features a better layout of prims, specifically so the displayed text is over // the same prim (typically this is not the case, making touch events confusing as they have // to reference the previous linkset prim). This layout avoids that. // Optimized for finer tuned text positioning and sexy texturing. // Intended to facilitite use of an array of llDetectedTouchXX buttons on the main panel. // // WTF?: Arrays prims into a vertical array suitable for avatar-listing HUDs. // HOW?: 1] Rez a bunch of boxes 2] link them together 3] add this script to the root prim. // // LICENCE: // Creative Commons Creative Commons Attribution-Share Alike 3.0 license // http://creativecommons.org/licenses/by-sa/3.0/ // // ORIGINAL LICENCE : // GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 // http://www.gnu.org/licenses/gpl-3.0.txt // // ie: 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, // and/or make it available to download. //---------------------------------- // SHARED CONFIGURATION integer gPIN = 652212; //CHANGE ME //---------------------------------- // CONFIGURATION // vector gDisplayScale = <0.22,0.06, 0.01>;//<0.22,0.055, 0.01>; vector gDisplayColor = <0.0, 0.25, 0.25>; float gDisplayAlpha = 0.5; //---------------------------------- // CORE CODE // //---------------------------------- f_initPrimLayout() { llSetRemoteScriptAccessPin(gPIN);

   llSetObjectName(llGetScriptName());
   llOwnerSay("STARTING: processing initial prim layout");
   llSetPrimitiveParams([
       PRIM_SIZE,<0.055,0.22,0.01>
       ,PRIM_ROTATION, llEuler2Rot(<0.0, 90.0, 180.0>*DEG_TO_RAD)

//HALF of the CONTROL PANEL (8 main function button slots)

       ,9, 0, 0, <0.125000, 0.625000, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>

//WHOLE CONTROL PANEL (16 main function button slots) // ,9, 0, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>

       ,PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.5
       ,PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1,1,0>, <0.0,0.0,0>, 0*DEG_TO_RAD 
       ,PRIM_TEXTURE, 4,"0c4f66d1-048b-a66e-0c7e-0d40a0b9cd82", <1,1,0>, <0.0,0.0,0>, 270*DEG_TO_RAD 
   ]);
   integer p;
   integer link = p = llGetNumberOfPrims();
   while(link>1)
   {   llSetLinkPrimitiveParams(link, [
           PRIM_POSITION, <(gDisplayScale.y*0.5*0.6)*(link-1), 0.0, gDisplayScale.z*(link-1)> 
           ,PRIM_SIZE, gDisplayScale
           ,PRIM_ROTATION, llEuler2Rot(<0.0, 90.0, 90.0>*DEG_TO_RAD)
           ,9, 0, 0, <0.375000, 0.875000, 0.0>, 0.0, <0.0, 0.0, 0.0>
               , <1.0, 1.58750000, 0.0>, <0.0, 0.0, 0.0>
           ,PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.0
           ,PRIM_COLOR, 2, gDisplayColor, gDisplayAlpha
           ,PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1,1,0>, <0.0,0.0,0>, 0*DEG_TO_RAD  
           ,PRIM_TEXTURE, 2, "650f8650-e924-cf51-5603-a1bb03cfab59", <1,1,0>, <0,0,0>, 0*DEG_TO_RAD 
       ]);
       --link;
   }
   llOwnerSay("COMPLETED: processing prim layout");
   llRemoveInventory(llGetScriptName());

} //====================================================================================== default { on_rez(integer start_param)

   {   llResetScript();
   }
   state_entry()
   {   f_initPrimLayout();
   }

} //======================================================================================

//ZWAGOTHS ORIGINAL SCRIPT: // ******************************************************************************* // // I give tech support for advanced+interesting topics only. // Otherwise dont ask me for tech support. I won't give it. // But I will accept tips sent to Zwagoth Klaar :-) // // Copyright (C) 2008 Zwagoth Klaar // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 U // //default //{ // state_entry() // { // vector scale = <0.6,0.032, 0.01>; // integer link; // for(link = 2;link <= (llGetNumberOfPrims()+1);link++) // { // llSetLinkPrimitiveParams(link, [PRIM_POSITION, ZERO_VECTOR + <0,(scale.y-0.012)*(link-1),0> ,PRIM_SIZE,scale]); // } // llSetLinkPrimitiveParams(1, [PRIM_SIZE,(scale - <0.15,0,0>)]); // } // // touch_start(integer total_number) // { // vector scale = <0.5,0.032, 0.01>; // integer link; // for(link = 2;link <= (llGetNumberOfPrims()+1);link++) // { // llSetLinkPrimitiveParams(link, [PRIM_POSITION, ZERO_VECTOR + <0,(scale.y-0.012)*(link-1),0> ,PRIM_SIZE,scale]); // } // llSetLinkPrimitiveParams(1, [PRIM_SIZE,(scale - <0.15,0,0>)]); // } //} //====================================================================================== </lsl>