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 1: Line 1:
==AutoHUD constructor==
<pre>
Automatic assembly of stacked text element HUD. [Typically used to track avatars in your vicinity.]
{{LSL_Function
<br>
|func
<b>This script ONLY assembles the HUD prims and then deletes itself.</b>
|func_id
<div style="padding: 0.5em;">
|func_sleep
<lsl>
|func_energy
//
|func_desc
// BETLOG Hax
|func_footnote
// AEST: 20090113 1346 [SLT:  20090112 2046]
|return_type
// Total rewrite of a script called 'Align' by Zwagoth Klaar.
|return_text
// This script features a better layout of prims, specifically so the displayed text is over
|p1_type|p1_name|p1_desc|p1_hover
// the same prim (typically this is not the case, making touch events confusing as they have
|p2_type|p2_name|p2_desc|p2_hover
// to reference the previous linkset prim). This layout avoids that.
|p3_type|p3_name|p3_desc|p3_hover
// Optimized for finer tuned text positioning and sexy texturing.
|p4_type|p4_name|p4_desc|p4_hover
// Intended to facilitite use of an array of llDetectedTouchXX buttons on the main panel.
|p5_type|p5_name|p5_desc|p5_hover
//
|p6_type|p6_name|p6_desc|p6_hover
// WTF?: Arrays prims into a vertical array suitable for avatar-listing HUDs.
|p7_type|p7_name|p7_desc|p7_hover
// HOW?: 1] Rez a bunch of boxes 2] link them together 3] add this script to the root prim.
|p8_type|p8_name|p8_desc|p8_hover
//
|p9_type|p9_name|p9_desc|p9_hover
// LICENCE:
|p10_type|p10_name|p10_desc|p10_hover
//  Creative Commons Creative Commons Attribution-Share Alike 3.0 license
|p11_type|p11_name|p11_desc|p11_hover
//  http://creativecommons.org/licenses/by-sa/3.0/
|p12_type|p12_name|p12_desc|p12_hover
//
|constants
// ORIGINAL LICENCE :
|spec
//  GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007
|caveats
//  http://www.gnu.org/licenses/gpl-3.0.txt
|examples
//
|helpers
// ie: You can modify this script, but you must prominently state that you used this script,
|also_header
//  credit it's original author(s), and supply this unaltered script with your modification,
|also_functions
//  and/or make it available to download.
|also_tests
//----------------------------------
|also_events
// SHARED CONFIGURATION
|also_articles
integer    gPIN                    = 652212; //CHANGE ME
|also_footer
//----------------------------------
|notes
// CONFIGURATION
|mode
//
|deprecated
vector      gDisplayScale          = <0.22,0.06, 0.01>;//<0.22,0.055, 0.01>;
|location
vector      gDisplayColor          = <0.0, 0.25, 0.25>;
|cat1
float      gDisplayAlpha          = 0.5;
|cat2
//----------------------------------
|cat3
// CORE CODE
|cat4
//
|cat5
//----------------------------------
|cat6
f_initPrimLayout()
}}
{  llSetRemoteScriptAccessPin(gPIN);
</pre>
    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:
The LSL_Function template is a intermediate template for LSL_Generic, which handles the formating for both functions and events (LSL_Event is also an intermediate template). The main job of this template is to change the parameter, names & setup the right-side floater. Also makes permission requirements a part of the template.
// *******************************************************************************
 
//
{| {{Prettytable}}
// I give tech support for advanced+interesting topics only.  
|-{{Hl2}}
// Otherwise dont ask me for tech support. I won't give it.
!parameter
// But I will accept tips sent to Zwagoth Klaar :-)
!desc
//
!example
// Copyright (C) 2008 Zwagoth Klaar
|-
//
|func
// This program is free software; you can redistribute it and/or modify
|Function name
// it under the terms of the GNU General Public License as published by
|-
// the Free Software Foundation; either version 2 of the License, or
|func_id
// (at your option) any later version.
|{{LSLG|Function ID}}
//
|1.0
// This program is distributed in the hope that it will be useful,
|-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|func_sleep
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|{{LSLG|Delay}}
// GNU General Public License for more details.
|0.0
//
|-
// You should have received a copy of the GNU General Public License
|func_energy
// along with this program; if not, write to the Free Software
|{{LSLG|Energy}}
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  U
|10.0
//
|-
//default
|func_desc
//{
|Function description text.
//    state_entry()
|Gives the monkey a banana
//    {
|-
//        vector scale = <0.6,0.032, 0.01>;
|func_footnote
//        integer link;
|Function footnote (appears after the parameters text).
//        for(link = 2;link <= (llGetNumberOfPrims()+1);link++)
|Has the side effect of causing the avatar to run in circles shouting like on fire.
//        {
|-
//            llSetLinkPrimitiveParams(link, [PRIM_POSITION, ZERO_VECTOR + <0,(scale.y-0.012)*(link-1),0> ,PRIM_SIZE,scale]);
|return_type
//        }
|return type
//        llSetLinkPrimitiveParams(1, [PRIM_SIZE,(scale - <0.15,0,0>)]);
|integer
//    }
|-
//
|return_text
//    touch_start(integer total_number)
|"Returns a return_type return_text" in most cases return_text can be used instead of func_desc.
//    {
|that is a monkey
//        vector scale = <0.5,0.032, 0.01>;
|-
//        integer link;
|p1_type
//        for(link = 2;link <= (llGetNumberOfPrims()+1);link++)
|first parameter type
//        {
|-
//            llSetLinkPrimitiveParams(link, [PRIM_POSITION, ZERO_VECTOR + <0,(scale.y-0.012)*(link-1),0> ,PRIM_SIZE,scale]);
|p1_name
//        }
|first parameter name
//        llSetLinkPrimitiveParams(1, [PRIM_SIZE,(scale - <0.15,0,0>)]);
|-
//    }
|p1_desc
//}
|first parameter desc
//======================================================================================
|-
</lsl>
|p1_hover
|first parameter hover, if not included it defaults to p1_desc
|-
|p2_type
|second parameter type
|-
|p2_name
|second parameter name
|-
|p2_desc
|second parameter desc
|-
|p2_hover
|second parameter hover, if not included it defaults to p2_desc
|-
|...
|
|
|-
|p12_type
|twelfth parameter type
|
|-
|p12_name
|twelfth parameter name
|-
|p12_desc
|twelfth parameter desc
|-
|p12_hover
|twelfth parameter hover, if not included it defaults to p12_desc
|-
|constants
|constants area, no box, please use a table for this section.
|
|-
|spec
|spec box
|
|-
|caveats
|caveats box
|
|-
|examples
|examples box
|
|-
|helpers
|helper functions box
|
|-
|also_header
|also header
|
|-
|also_functions
|also functions indent
|
|-
|also_events
|also events indent
|
|-
|also_articles
|also articles indent
|
|-
|also_tests
|also tests indent
|
|-
|also_footer
|also footer
|
|-
|notes
|notes box
|
|-
|mode
|If mode equals 'god' then it is tagged as requiring godmode. If set to 'request' marks the page as a feature request. If set to 'user' avoids function being added to LSL Function Index, thus enabling usage of this template for documentation of User Functions.
|
|-
|deprecated
|Marks the function as deprecated. Set the value to the replacement functions name or 'none'. If it is not set to none and it is infact set, it will include a link to the replacement function.
|-
|self
|Special field that you only set if you don't want the function to be included in any categories.
|
|-
|cat1
|An LSL specific category and sets the proper sort. (example would add the function to the "LSL Stub" category)
|Stub
|-
|cat2
|"
|-
|cat3
|"
|-
|cat4
|"
|-
|cat5
|"
|-
|cat6
|"
|-
|sort
|not required but used to specify the sort order, if excluded the wiki will calculate this value for you.
|-
|location
|optional: location box, used to say which source file it is defined in.
|-
|history
|a box for function history
|}
 
<div id="box">
{{LSL_Function
|func=MyFunction
|func_id=-1
|func_sleep=100.5
|func_energy=0.0
|func_desc=A fictitious function{{Footnote|Footnote test}}
|func_footnote=func_footnote
|return_type=void
|return_text=(aka nadda, nothing).
|p1_type=integer|p1_name=i|p1_desc
|p2_type=float|p2_name=f|p2_desc
|p3_type=string|p3_name=s|p3_desc
|p4_type=key|p4_name=k|p4_desc
|p5_type=list|p5_name=l|p5_desc
|p6_type=vector|p6_name=v|p6_desc
|p7_type=rotation|p7_name=r|p7_desc
|constants=constants
|spec=spec
|caveats=caveats
|examples=examples
|helpers=helpers
|also_header=also_header
|also_events=*also_events
|also_functions=*also_functions
|also_articles=*also_articles
|also_tests=*also_tests
|also_footer=also_footer
|notes=notes
|mode
|self=self
|location=location
|history=history
}}
</div>
</div>

Latest revision as of 18:51, 16 January 2009

{{LSL_Function
|func
|func_id
|func_sleep
|func_energy
|func_desc
|func_footnote
|return_type
|return_text
|p1_type|p1_name|p1_desc|p1_hover
|p2_type|p2_name|p2_desc|p2_hover
|p3_type|p3_name|p3_desc|p3_hover
|p4_type|p4_name|p4_desc|p4_hover
|p5_type|p5_name|p5_desc|p5_hover
|p6_type|p6_name|p6_desc|p6_hover
|p7_type|p7_name|p7_desc|p7_hover
|p8_type|p8_name|p8_desc|p8_hover
|p9_type|p9_name|p9_desc|p9_hover
|p10_type|p10_name|p10_desc|p10_hover
|p11_type|p11_name|p11_desc|p11_hover
|p12_type|p12_name|p12_desc|p12_hover
|constants
|spec
|caveats
|examples
|helpers
|also_header
|also_functions
|also_tests
|also_events
|also_articles
|also_footer
|notes
|mode
|deprecated
|location
|cat1
|cat2
|cat3
|cat4
|cat5
|cat6
}}

The LSL_Function template is a intermediate template for LSL_Generic, which handles the formating for both functions and events (LSL_Event is also an intermediate template). The main job of this template is to change the parameter, names & setup the right-side floater. Also makes permission requirements a part of the template.

parameter desc example
func Function name
func_id Function ID 1.0
func_sleep Delay 0.0
func_energy Energy 10.0
func_desc Function description text. Gives the monkey a banana
func_footnote Function footnote (appears after the parameters text). Has the side effect of causing the avatar to run in circles shouting like on fire.
return_type return type integer
return_text "Returns a return_type return_text" in most cases return_text can be used instead of func_desc. that is a monkey
p1_type first parameter type
p1_name first parameter name
p1_desc first parameter desc
p1_hover first parameter hover, if not included it defaults to p1_desc
p2_type second parameter type
p2_name second parameter name
p2_desc second parameter desc
p2_hover second parameter hover, if not included it defaults to p2_desc
...
p12_type twelfth parameter type
p12_name twelfth parameter name
p12_desc twelfth parameter desc
p12_hover twelfth parameter hover, if not included it defaults to p12_desc
constants constants area, no box, please use a table for this section.
spec spec box
caveats caveats box
examples examples box
helpers helper functions box
also_header also header
also_functions also functions indent
also_events also events indent
also_articles also articles indent
also_tests also tests indent
also_footer also footer
notes notes box
mode If mode equals 'god' then it is tagged as requiring godmode. If set to 'request' marks the page as a feature request. If set to 'user' avoids function being added to LSL Function Index, thus enabling usage of this template for documentation of User Functions.
deprecated Marks the function as deprecated. Set the value to the replacement functions name or 'none'. If it is not set to none and it is infact set, it will include a link to the replacement function.
self Special field that you only set if you don't want the function to be included in any categories.
cat1 An LSL specific category and sets the proper sort. (example would add the function to the "LSL Stub" category) Stub
cat2 "
cat3 "
cat4 "
cat5 "
cat6 "
sort not required but used to specify the sort order, if excluded the wiki will calculate this value for you.
location optional: location box, used to say which source file it is defined in.
history a box for function history

Summary

Function: void MyFunction( integer i, float f, string s, key k, list l, vector v, rotation r );

A fictitious function[1]
Returns a void (aka nadda, nothing).

• integer i
• float f
• string s
• key k
• list l
• vector v
• rotation r

func_footnote

Newbie Notes

onlyinclude - Newbie Notes Summary
blah
blah
blah
blah
blah
blah
blah
blah
blah
blah
blah

To continue reading: Template:LSL Function/docs/Newbie Notes


To continue reading see: Newbie Notes

Specification

spec

constants

Caveats

  • This function causes the script to sleep for 100.5 seconds.caveats
All Issues ~ Search JIRA for related Bugs

Examples

examples

Useful Snippets

helpers

Notes

notes

See Also

also_header

Events

  • also_events

Functions

  • also_functions

Articles

  • also_articles

also_footer

Deep Notes

History

history
Search JIRA for related Issues

Tests

  • also_tests

Source

location

Footnotes

  1. ^ Footnote test

Signature

function void MyFunction( integer i, float f, string s, key k, list l, vector v, rotation r );