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

From Second Life Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
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
// ie: You can modify this script, but you must prominently state that you used this script,
|spec
//  credit it's original author(s), and supply this unaltered script with your modification,
|caveats
//  and/or make it available to download.
|examples
//----------------------------------
|helpers
// SHARED CONFIGURATION
|also_header
integer     gPIN                    = 652212; //CHANGE ME
|also_functions
//----------------------------------
|also_tests
// CONFIGURATION
|also_events
//
|also_articles
vector      gDisplayScale          = <0.22,0.06, 0.01>;//<0.22,0.055, 0.01>;
|also_footer
vector      gDisplayColor          = <0.0, 0.25, 0.25>;
|notes
float      gDisplayAlpha          = 0.5;
|mode
//----------------------------------
|deprecated
// CORE CODE
|location
//
|cat1
//----------------------------------
|cat2
f_initPrimLayout()
|cat3
{  llSetRemoteScriptAccessPin(gPIN);
|cat4
    llSetObjectName(llGetScriptName());
|cat5
    llOwnerSay("STARTING: processing initial prim layout");
|cat6
    llSetPrimitiveParams([
}}
        PRIM_SIZE,<0.055,0.22,0.01>
</pre>
        ,PRIM_ROTATION, llEuler2Rot(<0.0, 90.0, 180.0>*DEG_TO_RAD)
 
//HALF of the CONTROL PANEL (8 main function button slots)
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.
        ,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)
{| {{Prettytable}}
//        ,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>
|-{{Hl2}}
        ,PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.5
!parameter
        ,PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1,1,0>, <0.0,0.0,0>, 0*DEG_TO_RAD
!desc
        ,PRIM_TEXTURE, 4,"0c4f66d1-048b-a66e-0c7e-0d40a0b9cd82", <1,1,0>, <0.0,0.0,0>, 270*DEG_TO_RAD
!example
    ]);
|-
    integer p;
|func
    integer link = p = llGetNumberOfPrims();
|Function name
    while(link>1)
|-
    {  llSetLinkPrimitiveParams(link, [
|func_id
            PRIM_POSITION, <(gDisplayScale.y*0.5*0.6)*(link-1), 0.0, gDisplayScale.z*(link-1)>
|{{LSLG|Function ID}}
            ,PRIM_SIZE, gDisplayScale
|1.0
            ,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>
|func_sleep
                , <1.0, 1.58750000, 0.0>, <0.0, 0.0, 0.0>
|{{LSLG|Delay}}
            ,PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.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 
|func_energy
            ,PRIM_TEXTURE, 2, "650f8650-e924-cf51-5603-a1bb03cfab59", <1,1,0>, <0,0,0>, 0*DEG_TO_RAD
|{{LSLG|Energy}}
        ]);
|10.0
        --link;
|-
    }
|func_desc
    llOwnerSay("COMPLETED: processing prim layout");
|Function description text.
    llRemoveInventory(llGetScriptName());
|Gives the monkey a banana
}
|-
//======================================================================================
|func_footnote
default
|Function footnote (appears after the parameters text).
{  on_rez(integer start_param)
|Has the side effect of causing the avatar to run in circles shouting like on fire.
    {  llResetScript();
|-
    }
|return_type
    state_entry()
|return type
    {  f_initPrimLayout();
|integer
    }
|-
}
|return_text
//======================================================================================
|"Returns a return_type return_text" in most cases return_text can be used instead of func_desc.
// ORIGINAL LICENCE :
|that is a monkey
//  GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007
|-
//  http://www.gnu.org/licenses/gpl-3.0.txt
|p1_type
//
|first parameter type
//ZWAGOTHS ORIGINAL SCRIPT:
|-
// *******************************************************************************
|p1_name
//
|first parameter name
// I give tech support for advanced+interesting topics only.
|-
// Otherwise dont ask me for tech support. I won't give it.
|p1_desc
// But I will accept tips sent to Zwagoth Klaar :-)
|first parameter desc
//
|-
// Copyright (C) 2008 Zwagoth Klaar
|p1_hover
//
|first parameter hover, if not included it defaults to p1_desc
// 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
|p2_type
// the Free Software Foundation; either version 2 of the License, or
|second parameter type
// (at your option) any later version.
|-
//
|p2_name
// This program is distributed in the hope that it will be useful,
|second parameter name
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|p2_desc
// GNU General Public License for more details.
|second parameter desc
//
|-
// You should have received a copy of the GNU General Public License
|p2_hover
// along with this program; if not, write to the Free Software
|second parameter hover, if not included it defaults to p2_desc
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  U
|-
//
|...
//default
|
//{
|
//    state_entry()
|-
//    {
|p12_type
//        vector scale = <0.6,0.032, 0.01>;
|twelfth parameter type
//        integer link;
|
//        for(link = 2;link <= (llGetNumberOfPrims()+1);link++)
|-
//        {
|p12_name
//            llSetLinkPrimitiveParams(link, [PRIM_POSITION, ZERO_VECTOR + <0,(scale.y-0.012)*(link-1),0> ,PRIM_SIZE,scale]);
|twelfth parameter name
//        }
|-
//        llSetLinkPrimitiveParams(1, [PRIM_SIZE,(scale - <0.15,0,0>)]);
|p12_desc
//    }
|twelfth parameter desc
//
|-
//    touch_start(integer total_number)
|p12_hover
//    {
|twelfth parameter hover, if not included it defaults to p12_desc
//        vector scale = <0.5,0.032, 0.01>;
|-
//        integer link;
|constants
//        for(link = 2;link <= (llGetNumberOfPrims()+1);link++)
|constants area, no box, please use a table for this section.
//        {
|
//            llSetLinkPrimitiveParams(link, [PRIM_POSITION, ZERO_VECTOR + <0,(scale.y-0.012)*(link-1),0> ,PRIM_SIZE,scale]);
|-
//        }
|spec
//        llSetLinkPrimitiveParams(1, [PRIM_SIZE,(scale - <0.15,0,0>)]);
|spec box
//    }
|
//}
|-
//======================================================================================
|caveats
</lsl>
|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 17: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 );
100.5 Forced Delay
0.0 Energy

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

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

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 );