Difference between revisions of "User:Strife Onizuka/Sandbox/Switch/Template:Test"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{LSL Header}} __NOTOC__ <noinclude>
__NOTOC__ <noinclude>
<pre>
See [[{{FULLPAGENAME}}/docs]] for documentation.
{{LSL_Function
 
|func
{{#vardefine:also_header|header}}
|func_id
{{#vardefine:also_events|events}}
|func_sleep
{{#vardefine:also_tests|tests}}
|func_energy
{{#vardefine:also_articles|articles}}
|sort
{{#vardefine:also_functions|functions}}
|func_desc
{{#vardefine:also_footer|footer}}
|func_footnote
{{{{FULLPAGENAME}}}}
|return_type
 
|return_text
</noinclude><includeonly>{{#vardefine:t|{{#pos:{{lc:{{PAGENAMEE}}}}|{{lc:{{#var:name}}}}}}}}{{#vardefine:t|{{#if:{{#var:t}}|{{#var:t}}|-1}}}}{{#ifexpr:not {{#var:t}} and {{#ifeq:{{#sub:{{ucfirst:{{#var:name}}}}|0|1}}|{{#sub:{{#var:name}}|0|1}}|0|1}}|{{lowercase}}}} {{#if:{{#var:P_Rendered}}||
|p1_type|p1_name|p1_desc
{{#vardefine:P_Rendered|t}} {{#if:{{#var:self}}|| __NOEDITSECTION__ }} {{#var:header}}
|p2_type|p2_name|p2_desc
{{{!}} width="100%"
|p3_type|p3_name|p3_desc
{{!}}-
|p4_type|p4_name|p4_desc
{{!}} valign="top" {{!}} <div id="box">
|p5_type|p5_name|p5_desc
== {{#var:header_title}} ==
|p6_type|p6_name|p6_desc
<div style="padding: 0.5em">{{#if:{{#var:header_floater}}|<div id="box" style="float:right;">{{#var:header_floater}}</div>}}
|p7_type|p7_name|p7_desc
{{#var:header_text}}
|p8_type|p8_name|p8_desc
{{#if:{{#var:header_floater}}|<div style="clear:right;" ></div>}}
|p9_type|p9_name|p9_desc
</div></div>
|p10_type|p10_name|p10_desc
{{!}}-
|p11_type|p11_name|p11_desc
{{!}}{{ #if: {{#var:spec}} |  
|p12_type|p12_name|p12_desc
<div id="box">
|constants
== {{#if:{{#var:T_Specification}}|{{#var:T_Specification}}|Specification}} ==
|spec
<div style="padding: 0.5em">
|caveats
{{#var:spec}}
|examples
</div></div>
|helpers
}}
|also_header
{{!}}-
|also_functions
{{!}}{{ #if: {{#var:constants_nb}} | {{#var:constants_nb}}| }}{{ #if: {{#var:constants}} |  
|also_tests
<div id="box">
|also_events
== {{#if:{{#var:T_Constants}}|{{#var:T_Constants}}|Constants}} ==
|also_articles
{{#var:constants}}
|also_footer
</div>
|notes
}}
|mode
{{!}}-
|deprecated
{{!}}{{ #if: {{#var:caveats}}|<div id="box">
|location
== {{#if:{{#var:T_Caveats}}|{{#var:T_Caveats}}|Caveats}} ==
|inventory
<div style="padding: 0.5em">
|permission
{{#var:caveats}}
|negative_index
</div></div>}}
|cat1
{{!}}-
|cat2
{{!}}{{ #if: {{#if:{{#var:deprecated}}||t}}{{#var:examples}} |
|cat3
<div id="box">
|cat4
== {{#if:{{#var:T_Examples}}|{{#var:T_Examples}}|Examples}} ==
|cat5
<div style="padding: 0.5em">
|cat6
{{ #if: {{#var:examples}} | {{#var:examples}} | }}
</div>
</div>
}}
{{!}}-
{{!}}{{ #if: {{#var:helpers}} |  
<div id="box">
== {{#if:{{#var:T_Useful_Snippets}}|{{#var:T_Useful_Snippets}}|Useful Snippets}} ==
<div style="padding: 0.5em">
{{#var:helpers}}
</div>
</div>
}}
}}
</pre>
{{!}}-
{{!}}{{ #if: {{#if:{{#var:deprecated}}||t}}{{#var:notes}} |
<div id="box">
== {{#if:{{#var:T_Notes}}|{{#var:T_Notes}}|Notes}} ==
<div style="padding: 0.5em">
{{ #if: {{#var:notes}} | {{#var:notes}} }}
</div>
</div>
}}
{{!}}-
{{!}}{{ #if: {{#var:also_footer}}{{#var:also_functions}}{{#var:also_events}}{{#var:also_articles}}{{#var:also_tests}}{{#var:also_header}}|
<div id="box">
== {{#if:{{#var:T_See_Also}}|{{#var:T_See Also}}|See_Also}} ==
<div style="padding: 0.5em">
{{ #if: {{#var:also_header}} | {{#var:also_header}}<br /> |}}{{ #if: {{#var:also_events}} |


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.
=== {{#if:{{#var:T_Also_Events}}|{{#var:T_Also_Events}}|Events}} ===
{{#var:also_events}} | }}{{ #if: {{#var:also_functions}} |


{| {{Prettytable}}
=== {{#if:{{#var:T_Also_Functions}}|{{#var:T_Also_Functions}}|Functions}} ===
!parameter
{{#var:also_functions}} | }}{{ #if: {{#var:also_tests}} |
!desc
!example
|-
|func
|Function name
|-
|func_id
|{{LSLG|Function ID}}
|1.0
|-
|func_sleep
|{{LSLG|Delay}}
|0.0
|-
|func_energy
|{{LSLG|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
|-
|p2_type
|second parameter type
|-
|p2_name
|second parameter name
|-
|p2_desc
|second parameter desc
|
|-
|...
|
|
|-
|p12_type
|twelfth parameter type
|
|-
|p12_name
|twelfth parameter name
|-
|p12_desc
|twelfth parameter 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.
|
|-
|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.
|-
|permission
|Set to the PERMISSION_* flag that the function requires. It will amend the appropriate fields to show this requirement (without all the haste of doing it yourself)
|PERMISSION_CHANGE_LINKS
|-
|negative_index
|'true', 'false' or nothing. If set to true or false then it amends the appropriate fields so that the function is marked as supporting or not supporting negative indexes.
|true
|-
|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.
|-
|inventory
|set to the name of the parameter that is an inventory item name. It makes a nice message in caveats about missing inventory items.
|}


=== {{#if:{{#var:T_Also_Tests}}|{{#var:T_Also_Tests}}|Tests}} ===
{{#var:also_tests}} | }}{{ #if: {{#var:also_articles}} |
=== {{#if:{{#var:T_Also_Articles}}|{{#var:T_Also_Articles}}|Articles}} ===
{{#var:also_articles}} | }} {{#var:also_footer}}
</div></div>
}}
{{!}}-
{{!}}{{#if:{{#var:location}}|
<div id="box">
<div id="box">
{{#vardefine:p_i_desc|int}}
== {{#if:{{#var:T_Source_Location}}|{{#var:T_Source_Location}}|Source Location}} ==
{{{{FULLPAGENAME}}
<div style="padding: 0.5em">
|func=MyFunction
{{#var:location}}
|func_id=-1
</div></div>
|func_sleep=100.5
|func_energy=0.0
|func_desc=A fictitious function
|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
|permission=PERMISSION_FLAG
|negative_index=true
|location=location
}}
}}
</div>
{{!}}}
</noinclude><includeonly>{{#vardefine:func_id|{{{func_id|}}}}}{{#vardefine:p1_name|{{{p1_name|}}}}}{{#vardefine:p1_type|{{{p1_type|}}}}}{{#vardefine:p1_desc|{{#var:p_{{#var:p1_name}}_desc}}{{{p1_desc|}}}}}{{#vardefine:p2_name|{{{p2_name|}}}}}{{#vardefine:p2_type|{{{p2_type|}}}}}{{#vardefine:p2_desc|{{#var:p_{{#var:p2_name}}_desc}}{{{p2_desc|}}}}}{{#vardefine:p3_name|{{{p3_name|}}}}}{{#vardefine:p3_type|{{{p3_type|}}}}}{{#vardefine:p3_desc|{{#var:p_{{#var:p3_name}}_desc}}{{{p3_desc|}}}}}{{#vardefine:p4_name|{{{p4_name|}}}}}{{#vardefine:p4_type|{{{p4_type|}}}}}{{#vardefine:p4_desc|{{#var:p_{{#var:p4_name}}_desc}}{{{p4_desc|}}}}}{{#vardefine:p5_name|{{{p5_name|}}}}}{{#vardefine:p5_type|{{{p5_type|}}}}}{{#vardefine:p5_desc|{{#var:p_{{#var:p5_name}}_desc}}{{{p5_desc|}}}}}{{#vardefine:p6_name|{{{p6_name|}}}}}{{#vardefine:p6_type|{{{p6_type|}}}}}{{#vardefine:p6_desc|{{#var:p_{{#var:p6_name}}_desc}}{{{p6_desc|}}}}}{{#vardefine:p7_name|{{{p7_name|}}}}}{{#vardefine:p7_type|{{{p7_type|}}}}}{{#vardefine:p7_desc|{{#var:p_{{#var:p7_name}}_desc}}{{{p7_desc|}}}}}{{#vardefine:p8_name|{{{p8_name|}}}}}{{#vardefine:p8_type|{{{p8_type|}}}}}{{#vardefine:p8_desc|{{#var:p_{{#var:p8_name}}_desc}}{{{p8_desc|}}}}}{{#vardefine:p9_name|{{{p9_name|}}}}}{{#vardefine:p9_type|{{{p9_type|}}}}}{{#vardefine:p9_desc|{{#var:p_{{#var:p9_name}}_desc}}{{{p9_desc|}}}}}{{#vardefine:p10_name|{{{p10_name|}}}}}{{#vardefine:p10_type|{{{p10_type|}}}}}{{#vardefine:p10_desc|{{#var:p_{{#var:p10_name}}_desc}}{{{p10_desc|}}}}}{{#vardefine:p11_name|{{{p11_name|}}}}}{{#vardefine:p11_type|{{{p11_type|}}}}}{{#vardefine:p11_desc|{{#var:p_{{#var:p11_name}}_desc}}{{{p11_desc|}}}}}{{#vardefine:p12_name|{{{p12_name|}}}}}{{#vardefine:p12_type|{{{p12_type|}}}}}{{#vardefine:p12_desc|{{#var:p_{{#var:p12_name}}_desc}}{{{p12_desc|}}}}}{{#vardefine:return_type|{{#var:return_type}}{{{return_type|}}} }}{{#vardefine:return_text|{{#var:return_text}}{{{return_text|}}} }}{{#vardefine:name|{{{func}}}}}{{#vardefine:constants_nb|{{#var:constants_nb}}{{{constants|}}}}}{{#vardefine:spec|{{{spec|}}}}}{{#vardefine:examples|{{#var:examples}}{{{examples|}}}}}{{#vardefine:helpers|{{#var:helpers}}{{{helpers|}}}}}{{#vardefine:also_header|{{#var:also_header}}{{{also_header|}}}}}{{#vardefine:also_tests|{{#var:also_tests}}{{{also_tests|}}}}}{{#vardefine:also_events|{{#var:also_events}}{{{also_events|}}}}}{{#vardefine:also_functions|{{#var:also_functions}}{{{also_functions|}}}}}{{#vardefine:also_articles|{{#var:also_articles}}{{{also_articles|}}}}}{{#vardefine:also_footer|{{#var:also_footer}}{{{also_footer|}}}}}{{#vardefine:notes|{{#var:notes}}{{{notes|}}}}}{{#vardefine:mode|{{#var:mode}}{{{mode|}}}}}{{#vardefine:self|{{#var:self}}{{{self|}}}}}{{#vardefine:type|function}}{{#vardefine:template}}{{#vardefine:caveats|{{#ifexpr:{{{func_sleep|0.0}}}> 0.0|*This function causes the script to sleep for {{{func_sleep|}}} seconds.}}{{#if:{{#var:caveats}}|
{{#var:footer}} }}</includeonly>
{{#var:caveats}}}}
{{{caveats|}}}}}{{#vardefine:location|{{#var:location}}{{{location|}}}}}{{#vardefine:sort|{{#if:{{#var:sort}}|{{#var:sort}}|{{#if:{{{sort|}}}|{{{sort}}}|{{#ifeq:{{#sub:{{#var:name}}|0|2}}|ll|{{#sub:{{#var:name}}|2}}|{{#var:name}}}}}}}}}}{{#vardefine:return_end|<nowiki>;</nowiki>}}{{#vardefine:header_footnote|{{#var:header_footnote}}{{{func_footnote|}}}{{{func_footer|}}}}}{{#vardefine:header_desc|{{#var:header_desc}}{{{func_desc|}}}}}{{#ifeq:{{#var:mode}}|god|{{{{#ifeq:{{#var:mode}}|god|LSL_Generic/god|!}}|}} }}{{#ifeq:{{#var:mode}}|request|{{{{#ifeq:{{#var:mode}}|request|LSL_Generic/request|!}}|}} }}{{#if:{{{deprecated|}}}{{{depreciated|}}}|{{{{#if:{{{deprecated|}}}{{{depreciated|}}}|LSL_Generic/deprecated|!}}|{{{deprecated|}}}{{{depreciated|}}}|}}}}{{#if:{{{inventory|}}}|{{{{#if:{{{inventory|}}}|LSL_Function/inventory|!}}|{{{inventory|}}}|}}}}{{#if:{{{permission|}}}|{{{{#if:{{{permission|}}}|LSL_Function/permission|!}}|{{{permission|}}}|}}}}{{#if:{{{negative_index|}}}|{{{{#if:{{{negative_index|}}}|LSL_Function/negative_index|!}}|{{{negative_index|}}}|}}}}{{#if:{{#var:func_id}}{{#var:mode}}||
<div id="box" style="background:red;">
&nbsp;&nbsp;'''Don't delete the 'func_id''''
<div style="padding: 0.5em;background:#ffffff;">
''func_id is a bit of technical information that should not be removed as it is pertinent to anyone writing an LSL compiler or decompiler, so you go and revert the page or set the value properly right now :P.''</div></div>{{#if:{{{self|}}}|| {{LSLC|FixMe}} }} }}{{#if:{{{also|}}}|
<div id="box" style="background:yellow;">
&nbsp;&nbsp;''' 'also' Tag Removed'''
<div style="padding: 0.5em;background:#ffffff;">
''(Please use 'also_header','also_events','also_functions','also_articles', or 'also_footer')''</div></div>{{#if:{{{self|}}}|| {{LSLC|FixMe}} }} }}{{#if:{{#if:{{#var:return_type}}|{{#var:return_text}}}}{{{func_desc|}}}||
<div id="box" style="background:yellow;">
&nbsp;&nbsp;''' 'return_text' and 'func_desc' can both not be undefined'''
<div style="padding: 0.5em;background:#ffffff;">
''(Please use 'return_text' or 'func_desc' to describe the functions actions.)''</div></div>{{#if:{{{self|}}}|| {{LSLC|FixMe}} }} }}{{#vardefine:header_floater|<table><tr>
<td> {{HoverText|{{#var:func_id}}|The function index number.}}
<td> {{LSLG|Function ID}}
</tr><tr>
<td> {{HoverText|{{{func_sleep|}}}|The number of seconds this script will sleep after executing this function.}}
<td> {{LSLG|Delay}}
</tr><tr>
<td> {{HoverText|{{{func_energy|}}}|The quantity of energy consumed by this function.}}
<td> {{LSLG|Energy}}
</tr></table>}}{{#vardefine:header_text|{{LSL Generic/Text}}}}{{#vardefine:header_title|Function: {{LSL Generic/Title}}}}{{LSL Generic}}{{#if:{{#var:self}}|| {{#ifeq:{{#var:mode}}|request|| {{LSLC|Functions|{{#var:sort}}}} {{#if:{{#var:examples}}||{{LSLC|Needs Example|{{#var:sort}}}}}} {{#ifeq:{{#var:negative_index}}|true|{{LSLC|Negative Index|{{#var:sort}}}}}}}} {{#if:{{{cat1|}}}|{{LSLC|{{{cat1}}}|{{#var:sort}}}}}} {{#if:{{{cat2|}}}|{{LSLC|{{{cat2}}}|{{#var:sort}}}}}} {{#if:{{{cat3|}}}|{{LSLC|{{{cat3}}}|{{#var:sort}}}}}} {{#if:{{{cat4|}}}|{{LSLC|{{{cat4}}}|{{#var:sort}}}}}} {{#if:{{{cat5|}}}|{{LSLC|{{{cat5}}}|{{#var:sort}}}}}} {{#if:{{{cat6|}}}|{{LSLC|{{{cat6}}}|{{#var:sort}}}}}} }}</includeonly>

Revision as of 13:45, 21 February 2007

See User:Strife Onizuka/Sandbox/Switch/Template:Test/docs for documentation.




{{{{FULLPAGENAME}}}}