Difference between revisions of "LSL Editing Primer"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(29 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Help|Wiki=*}}
{{LSL Header}}
{{LSL Header}}


Line 4: Line 5:


In the LSL Portal area of the wiki there are several templates in use for standardizing appearance and making editing easier.
In the LSL Portal area of the wiki there are several templates in use for standardizing appearance and making editing easier.
In addition to these template there are many class specific templates. These templates inject blocks of common content into the articles that share something in common, be it a parameter with common restrictions or common functionality.


== General Templates ==
== General Templates ==
Line 14: Line 17:
!example
!example
|-
|-
|<nowiki>{{</nowiki>[[Template:LSLG|LSLG]]<nowiki>|page|text}}</nowiki>
|<nowiki>{{</nowiki>[[Template:LSLC|LSLC]]<nowiki>|category|sort}}</nowiki>
|Links between pages<br/>Use for pages in the LSL_ pseudo-namespace.<br/>if '''text''' is omitted then it defaults to '''page'''
|Adds a page to a group<br/>Use instead of <nowiki>[[Category:LSL name|name]]</nowiki><br/>sort is optional.
|<nowiki>{{LSLG|llAbs|integer absolute value}}</nowiki><br/>{{LSLG|llAbs|integer absolute value}}<br/><nowiki>{{LSLG|llAbs}}</nowiki><br/>{{LSLG|llAbs}}
|-
|<nowiki>{{</nowiki>[[Template:LSLC|LSLC]]<nowiki>|page|sort}}</nowiki>
|Adds a page to a group<br/>Use instead of <nowiki>[[Category:LSL name|name]]</nowiki><br/>sort is optional, the template will try to calculate it.
|
|
|-
|-
Line 35: Line 34:
|-
|-
|<nowiki>{{</nowiki>[[Template:LSL Hex|LSL_Hex]]<nowiki>|hex|int}}</nowiki>
|<nowiki>{{</nowiki>[[Template:LSL Hex|LSL_Hex]]<nowiki>|hex|int}}</nowiki>
|A HoverText for '''hex''' showing the '''int''' with a short standard description.
|A HoverText for '''hex''' showing the '''int''' with a short standard description.<br/>If '''int''' is excluded or empty, then '''int''' is calculated from '''hex'''.
|<nowiki>{{LSL Hex|0x100|256}}</nowiki><br/>{{LSL Hex|0x100|256}}
|<nowiki>{{LSL Hex|0x100|256}}</nowiki><br/>{{LSL Hex|0x100|256}}<br/><nowiki>{{LSL Hex|0x100}}</nowiki><br/>{{LSL Hex|0x100}}
|-
|-
|<nowiki>{{</nowiki>[[Template:!|!]]<nowiki>}}</nowiki>
|<nowiki>{{</nowiki>[[Template:!|!]]<nowiki>}}</nowiki>
|Used instead of a {{HoverText|<nowiki>|</nowiki>|vertical pipe}} for when embedding them in templates parameters.
|Used instead of a {{HoverText|<nowiki>|</nowiki>|vertical pipe}} for when embedding them in templates parameters.
|<nowiki>{{!}}</nowiki><br/><nowiki>|</nowiki>
|<nowiki>{{!}}</nowiki><br/><nowiki>|</nowiki>
|-
|<nowiki>{{</nowiki>[[Template:=|=]]<nowiki>}}</nowiki>
|Used instead of a = for when you need a text equals sign that cannot interfere with templates parameters.
|<nowiki>{{=}}</nowiki><br/><nowiki>=</nowiki>
|}
|}
==Embedding Tables==
==Embedding Tables==


One of the weaknesses in MediaWiki is the difficulty in embedding tables as parameters for templates. There are a few ways around this.
One of the weaknesses in MediaWiki is the difficulty in embedding tables as parameters for templates. There are a few ways around this.


# Write the table in HTML using <nowiki><table> & </table>, <tr> & </tr>, <td> & </td></nowiki> tags. If you go this route you must close your tags properly (or MediaWiki will do strange things).
# Write the table in HTML using <nowiki><table> & </table>, <tr> & </tr>, <th> & </th>, <td> & </td></nowiki> tags. If you go this route you must close your tags properly (or MediaWiki will do strange things).
# Use MediaWiki syntax for tables and replace every occurrence (not being used as a template separator) of '|' with <nowiki>'{{!}}'</nowiki>
# Use MediaWiki syntax for tables and replace every occurrence (not being used as a template separator) of '|' with <nowiki>'{{!}}'</nowiki>
# Wrap the table with <nowiki><div></div></nowiki> tags (doesn't always work).
# Wrap the table with <nowiki><div></div></nowiki> tags (doesn't always work).
Line 65: Line 69:
! Description
! Description
|-  
|-  
| {{LSLG|PERM_ALL}}
| [[PERM_ALL]]
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| Move/Modify/Copy/Transfer permissions
| Move/Modify/Copy/Transfer permissions
|-  
|-  
| {{LSLG|PERM_COPY}}
| [[PERM_COPY]]
| {{LSL Hex|0x00008000|32768}}
| {{LSL Hex|0x00008000|32768}}
| Copy permission
| Copy permission
|-  
|-  
| {{LSLG|PERM_MODIFY}}
| [[PERM_MODIFY]]
| {{LSL Hex|0x00004000|16384}}
| {{LSL Hex|0x00004000|16384}}
| Modify permission
| Modify permission
|-  
|-  
| {{LSLG|PERM_MOVE}}
| [[PERM_MOVE]]
| {{LSL Hex|0x00080000|524288}}
| {{LSL Hex|0x00080000|524288}}
| Move permission
| Move permission
|-  
|-  
| {{LSLG|PERM_TRANSFER}}
| [[PERM_TRANSFER]]
| {{LSL Hex|0x00002000|8192}}
| {{LSL Hex|0x00002000|8192}}
| Transfer permission
| Transfer permission
Line 92: Line 96:
<th> Description</th>
<th> Description</th>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_ALL}}</td>
<td> [[PERM_ALL]]</td>
<td> {{LSL Hex|0x7FFFFFFF|2147483647}}</td>
<td> {{LSL Hex|0x7FFFFFFF|2147483647}}</td>
<td> Move/Modify/Copy/Transfer permissions</td>
<td> Move/Modify/Copy/Transfer permissions</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_COPY}}</td>
<td> [[PERM_COPY]]</td>
<td> {{LSL Hex|0x00008000|32768}}</td>
<td> {{LSL Hex|0x00008000|32768}}</td>
<td> Copy permission</td>
<td> Copy permission</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_MODIFY}}</td>
<td> [[PERM_MODIFY]]</td>
<td> {{LSL Hex|0x00004000|16384}}</td>
<td> {{LSL Hex|0x00004000|16384}}</td>
<td> Modify permission</td>
<td> Modify permission</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_MOVE}}</td>
<td> [[PERM_MOVE]]</td>
<td> {{LSL Hex|0x00080000|524288}}</td>
<td> {{LSL Hex|0x00080000|524288}}</td>
<td> Move permission</td>
<td> Move permission</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_TRANSFER}}</td>
<td> [[PERM_TRANSFER]]</td>
<td> {{LSL Hex|0x00002000|8192}}</td>
<td> {{LSL Hex|0x00002000|8192}}</td>
<td> Transfer permission</td>
<td> Transfer permission</td>
Line 120: Line 124:
<th> Description</th>
<th> Description</th>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_ALL}}</td>
<td> [[PERM_ALL]]</td>
<td> {{LSL Hex|0x7FFFFFFF|2147483647}}</td>
<td> {{LSL Hex|0x7FFFFFFF|2147483647}}</td>
<td> Move/Modify/Copy/Transfer permissions</td>
<td> Move/Modify/Copy/Transfer permissions</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_COPY}}</td>
<td> [[PERM_COPY]]</td>
<td> {{LSL Hex|0x00008000|32768}}</td>
<td> {{LSL Hex|0x00008000|32768}}</td>
<td> Copy permission</td>
<td> Copy permission</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_MODIFY}}</td>
<td> [[PERM_MODIFY]]</td>
<td> {{LSL Hex|0x00004000|16384}}</td>
<td> {{LSL Hex|0x00004000|16384}}</td>
<td> Modify permission</td>
<td> Modify permission</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_MOVE}}</td>
<td> [[PERM_MOVE]]</td>
<td> {{LSL Hex|0x00080000|524288}}</td>
<td> {{LSL Hex|0x00080000|524288}}</td>
<td> Move permission</td>
<td> Move permission</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_TRANSFER}}</td>
<td> [[PERM_TRANSFER]]</td>
<td> {{LSL Hex|0x00002000|8192}}</td>
<td> {{LSL Hex|0x00002000|8192}}</td>
<td> Transfer permission</td>
<td> Transfer permission</td>
Line 147: Line 151:
<th> Description</th>
<th> Description</th>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_ALL}}</td>
<td> [[PERM_ALL]]</td>
<td> {{LSL Hex|0x7FFFFFFF|2147483647}}</td>
<td> {{LSL Hex|0x7FFFFFFF|2147483647}}</td>
<td> Move/Modify/Copy/Transfer permissions</td>
<td> Move/Modify/Copy/Transfer permissions</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_COPY}}</td>
<td> [[PERM_COPY]]</td>
<td> {{LSL Hex|0x00008000|32768}}</td>
<td> {{LSL Hex|0x00008000|32768}}</td>
<td> Copy permission</td>
<td> Copy permission</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_MODIFY}}</td>
<td> [[PERM_MODIFY]]</td>
<td> {{LSL Hex|0x00004000|16384}}</td>
<td> {{LSL Hex|0x00004000|16384}}</td>
<td> Modify permission</td>
<td> Modify permission</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_MOVE}}</td>
<td> [[PERM_MOVE]]</td>
<td> {{LSL Hex|0x00080000|524288}}</td>
<td> {{LSL Hex|0x00080000|524288}}</td>
<td> Move permission</td>
<td> Move permission</td>
</tr><tr>
</tr><tr>
<td> {{LSLG|PERM_TRANSFER}}</td>
<td> [[PERM_TRANSFER]]</td>
<td> {{LSL Hex|0x00002000|8192}}</td>
<td> {{LSL Hex|0x00002000|8192}}</td>
<td> Transfer permission</td>
<td> Transfer permission</td>
Line 180: Line 184:
! Description
! Description
|-  
|-  
| {{LSLG|PERM_ALL}}
| [[PERM_ALL]]
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| Move/Modify/Copy/Transfer permissions
| Move/Modify/Copy/Transfer permissions
|-  
|-  
| {{LSLG|PERM_COPY}}
| [[PERM_COPY]]
| {{LSL Hex|0x00008000|32768}}
| {{LSL Hex|0x00008000|32768}}
| Copy permission
| Copy permission
|-  
|-  
| {{LSLG|PERM_MODIFY}}
| [[PERM_MODIFY]]
| {{LSL Hex|0x00004000|16384}}
| {{LSL Hex|0x00004000|16384}}
| Modify permission
| Modify permission
|-  
|-  
| {{LSLG|PERM_MOVE}}
| [[PERM_MOVE]]
| {{LSL Hex|0x00080000|524288}}
| {{LSL Hex|0x00080000|524288}}
| Move permission
| Move permission
|-  
|-  
| {{LSLG|PERM_TRANSFER}}
| [[PERM_TRANSFER]]
| {{LSL Hex|0x00002000|8192}}
| {{LSL Hex|0x00002000|8192}}
| Transfer permission
| Transfer permission
Line 206: Line 210:
! Description
! Description
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_ALL}}
{{!}} [[PERM_ALL]]
{{!}} {{LSL Hex|0x7FFFFFFF|2147483647}}
{{!}} {{LSL Hex|0x7FFFFFFF|2147483647}}
{{!}} Move/Modify/Copy/Transfer permissions
{{!}} Move/Modify/Copy/Transfer permissions
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_COPY}}
{{!}} [[PERM_COPY]]
{{!}} {{LSL Hex|0x00008000|32768}}
{{!}} {{LSL Hex|0x00008000|32768}}
{{!}} Copy permission
{{!}} Copy permission
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_MODIFY}}
{{!}} [[PERM_MODIFY]]
{{!}} {{LSL Hex|0x00004000|16384}}
{{!}} {{LSL Hex|0x00004000|16384}}
{{!}} Modify permission
{{!}} Modify permission
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_MOVE}}
{{!}} [[PERM_MOVE]]
{{!}} {{LSL Hex|0x00080000|524288}}
{{!}} {{LSL Hex|0x00080000|524288}}
{{!}} Move permission
{{!}} Move permission
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_TRANSFER}}
{{!}} [[PERM_TRANSFER]]
{{!}} {{LSL Hex|0x00002000|8192}}
{{!}} {{LSL Hex|0x00002000|8192}}
{{!}} Transfer permission
{{!}} Transfer permission
Line 234: Line 238:
! Description
! Description
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_ALL}}
{{!}} [[PERM_ALL]]
{{!}} {{LSL Hex|0x7FFFFFFF|2147483647}}
{{!}} {{LSL Hex|0x7FFFFFFF|2147483647}}
{{!}} Move/Modify/Copy/Transfer permissions
{{!}} Move/Modify/Copy/Transfer permissions
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_COPY}}
{{!}} [[PERM_COPY]]
{{!}} {{LSL Hex|0x00008000|32768}}
{{!}} {{LSL Hex|0x00008000|32768}}
{{!}} Copy permission
{{!}} Copy permission
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_MODIFY}}
{{!}} [[PERM_MODIFY]]
{{!}} {{LSL Hex|0x00004000|16384}}
{{!}} {{LSL Hex|0x00004000|16384}}
{{!}} Modify permission
{{!}} Modify permission
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_MOVE}}
{{!}} [[PERM_MOVE]]
{{!}} {{LSL Hex|0x00080000|524288}}
{{!}} {{LSL Hex|0x00080000|524288}}
{{!}} Move permission
{{!}} Move permission
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_TRANSFER}}
{{!}} [[PERM_TRANSFER]]
{{!}} {{LSL Hex|0x00002000|8192}}
{{!}} {{LSL Hex|0x00002000|8192}}
{{!}} Transfer permission
{{!}} Transfer permission
Line 261: Line 265:
! Description
! Description
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_ALL}}
{{!}} [[PERM_ALL]]
{{!}} {{LSL Hex|0x7FFFFFFF|2147483647}}
{{!}} {{LSL Hex|0x7FFFFFFF|2147483647}}
{{!}} Move/Modify/Copy/Transfer permissions
{{!}} Move/Modify/Copy/Transfer permissions
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_COPY}}
{{!}} [[PERM_COPY]]
{{!}} {{LSL Hex|0x00008000|32768}}
{{!}} {{LSL Hex|0x00008000|32768}}
{{!}} Copy permission
{{!}} Copy permission
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_MODIFY}}
{{!}} [[PERM_MODIFY]]
{{!}} {{LSL Hex|0x00004000|16384}}
{{!}} {{LSL Hex|0x00004000|16384}}
{{!}} Modify permission
{{!}} Modify permission
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_MOVE}}
{{!}} [[PERM_MOVE]]
{{!}} {{LSL Hex|0x00080000|524288}}
{{!}} {{LSL Hex|0x00080000|524288}}
{{!}} Move permission
{{!}} Move permission
{{!}}-  
{{!}}-  
{{!}} {{LSLG|PERM_TRANSFER}}
{{!}} [[PERM_TRANSFER]]
{{!}} {{LSL Hex|0x00002000|8192}}
{{!}} {{LSL Hex|0x00002000|8192}}
{{!}} Transfer permission
{{!}} Transfer permission
Line 295: Line 299:
! Description
! Description
|-  
|-  
| {{LSLG|PERM_ALL}}
| [[PERM_ALL]]
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| Move/Modify/Copy/Transfer permissions
| Move/Modify/Copy/Transfer permissions
|-  
|-  
| {{LSLG|PERM_COPY}}
| [[PERM_COPY]]
| {{LSL Hex|0x00008000|32768}}
| {{LSL Hex|0x00008000|32768}}
| Copy permission
| Copy permission
|-  
|-  
| {{LSLG|PERM_MODIFY}}
| [[PERM_MODIFY]]
| {{LSL Hex|0x00004000|16384}}
| {{LSL Hex|0x00004000|16384}}
| Modify permission
| Modify permission
|-  
|-  
| {{LSLG|PERM_MOVE}}
| [[PERM_MOVE]]
| {{LSL Hex|0x00080000|524288}}
| {{LSL Hex|0x00080000|524288}}
| Move permission
| Move permission
|-  
|-  
| {{LSLG|PERM_TRANSFER}}
| [[PERM_TRANSFER]]
| {{LSL Hex|0x00002000|8192}}
| {{LSL Hex|0x00002000|8192}}
| Transfer permission
| Transfer permission
Line 322: Line 326:
! Description
! Description
|-  
|-  
| {{LSLG|PERM_ALL}}
| [[PERM_ALL]]
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| Move/Modify/Copy/Transfer permissions
| Move/Modify/Copy/Transfer permissions
|-  
|-  
| {{LSLG|PERM_COPY}}
| [[PERM_COPY]]
| {{LSL Hex|0x00008000|32768}}
| {{LSL Hex|0x00008000|32768}}
| Copy permission
| Copy permission
|-  
|-  
| {{LSLG|PERM_MODIFY}}
| [[PERM_MODIFY]]
| {{LSL Hex|0x00004000|16384}}
| {{LSL Hex|0x00004000|16384}}
| Modify permission
| Modify permission
|-  
|-  
| {{LSLG|PERM_MOVE}}
| [[PERM_MOVE]]
| {{LSL Hex|0x00080000|524288}}
| {{LSL Hex|0x00080000|524288}}
| Move permission
| Move permission
|-  
|-  
| {{LSLG|PERM_TRANSFER}}
| [[PERM_TRANSFER]]
| {{LSL Hex|0x00002000|8192}}
| {{LSL Hex|0x00002000|8192}}
| Transfer permission
| Transfer permission
Line 352: Line 356:
! Description
! Description
|-  
|-  
| {{LSLG|PERM_ALL}}
| [[PERM_ALL]]
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| Move/Modify/Copy/Transfer permissions
| Move/Modify/Copy/Transfer permissions
|-  
|-  
| {{LSLG|PERM_COPY}}
| [[PERM_COPY]]
| {{LSL Hex|0x00008000|32768}}
| {{LSL Hex|0x00008000|32768}}
| Copy permission
| Copy permission
|-  
|-  
| {{LSLG|PERM_MODIFY}}
| [[PERM_MODIFY]]
| {{LSL Hex|0x00004000|16384}}
| {{LSL Hex|0x00004000|16384}}
| Modify permission
| Modify permission
|-  
|-  
| {{LSLG|PERM_MOVE}}
| [[PERM_MOVE]]
| {{LSL Hex|0x00080000|524288}}
| {{LSL Hex|0x00080000|524288}}
| Move permission
| Move permission
|-  
|-  
| {{LSLG|PERM_TRANSFER}}
| [[PERM_TRANSFER]]
| {{LSL Hex|0x00002000|8192}}
| {{LSL Hex|0x00002000|8192}}
| Transfer permission
| Transfer permission
Line 376: Line 380:


==Functions==
==Functions==
Besides the general templates there is only one function specific template.
Besides the general templates there is only one function specific template.


[[Template:LSL Function|LSL_Function]]
[[Template:LSL Function]]<br/>
This template provides a structure to write the functions documentation over. It provides several sections. Unused sections are typically are hidden from view.
This template provides a structure to write the functions documentation over; it includes several sections.
 
Some things to keep in mind:
*Please do not remove information.
*Order of template variables does not matter.
*Most variables if not set will cause the applicable section to hide (not all sections hide).
*Unused variables do not need to be included but it is better to not removed unused variables to aid future editors.
*Please head all messages generated by the template.
*If you think a section should be added please add it to [[LSL Function Style]] (and they will shortly be added to the template) or place a comment on [[Template_talk:LSL Function]].


Please refer to [[Template:LSL Function|LSL_Function]] for a detailed explanation of it's syntax and attributes.
Please refer to [[Template:LSL Function|LSL_Function]] for a detailed explanation of it's syntax and attributes.
{|{{Prettytable}}
!Base
!Example: [[llFrand]]
|-
|<pre>
{{LSL_Function
|func
|func_id
|func_sleep
|sort
|func_desc
|func_footnote
|return_type
|return_text
|p1_type|p1_name|p1_desc
|p2_type|p2_name|p2_desc
|p3_type|p3_name|p3_desc
|p4_type|p4_name|p4_desc
|p5_type|p5_name|p5_desc
|p6_type|p6_name|p6_desc
|p7_type|p7_name|p7_desc
|p8_type|p8_name|p8_desc
|p9_type|p9_name|p9_desc
|p10_type|p10_name|p10_desc
|p11_type|p11_name|p11_desc
|p12_type|p12_name|p12_desc
|constants
|spec
|caveats
|examples
|helpers
|also_header
|also_functions
|also_tests
|also_articles
|also_events
|also_footer
|notes
|mode
|deprecated
|permission
|negative_index
|cat1
|cat2
|cat3
|cat4
|cat5
|cat6
|location
}}
</pre>
|<pre>
{{LSL_Function
|sort=Frand
|func=llFrand
|func_id=8
|func_sleep=0.0
|func_energy=10.0
|p1_type=float
|p1_name=mag
|p1_desc=Any valid float value
|return_type=float
|return_text=that is pseudo random number in the range [0.0,mag) or (mag, 0.0].
|spec=returns a pseudo random number in range [0.0, mag) or (mag, 0.0], depending upon the sign of mag.
|caveats=The random number generator is not a source of entropy.
|examples=<source lang="lsl">
default
{
    touch_start(integer total_number)
    {
        // When touched, say "Heads" with probability 0.5,
        // otherwise, say "Tails."
        if ( llFrand(1.) < .5)
            llSay(0, "Heads");
        else
            llSay(0, "Tails");
    }
}
</source>
|helpers
|also_header
|also_functions
|also_tests
|also_events
|also_articles
|also_footer
|notes=
The random number generator is not a source of entropy.
The sequence of random numbers are shared across the entire process, and not independently seeded.
Therefore, the pseudo random number generation is not suitable for any application which requires
completely predictable or completely unpredictable results.
|cat1=Math
|cat2
|cat3
|cat4
}}
</pre>
|}


==Events==
==Events==
Line 388: Line 501:


[[Template:LSL Event|LSL_Event]]
[[Template:LSL Event|LSL_Event]]
This template provides a structure to write the event documentation over. It provides several sections. Unused sections are typically are hidden from view.
This template provides a structure to write the event documentation over; it includes several sections. Unused sections are typically hidden from view.


Please refer to [[Template:LSL Event|LSL_Event]] for a detailed explanation of it's syntax and attributes.
Please refer to [[Template:LSL Event|LSL_Event]] for a detailed explanation of its syntax and attributes.


==Constants==
==Constants==


No constant specific template has been written yet, the style is still being sorted out.
There is only one constant specific template.
 
[[Template:LSL Constant|LSL_Constant]]
This template provides a structure to write constant documentation over; it includes several sections. Unused sections are typically hidden from view.
 
Please refer to [[Template:LSL Constant|LSL_Constant]] for a detailed explanation of its syntax and attributes.

Latest revision as of 12:29, 25 January 2015

In the LSL Portal area of the wiki there are several templates in use for standardizing appearance and making editing easier.

In addition to these template there are many class specific templates. These templates inject blocks of common content into the articles that share something in common, be it a parameter with common restrictions or common functionality.

General Templates

There are several universal templates, the most used template names are short for ease of typing.

Name Description example
{{LSLC|category|sort}} Adds a page to a group
Use instead of [[Category:LSL name|name]]
sort is optional.
{{LSLGC|category|text}} Links to a LSL Category
Use instead of [[:Category:LSL category|text]]
if text is omitted then it defaults to category
{{LSLGC|Math/3D|3D Math Functions}}
3D Math Functions
{{LSLGC|Math}}
Math
{{HoverText|word|description}} When you move the cursor over this it shows a box containing description. {{HoverText|monkeys|A species of mammal}}
monkeys
{{LSL_Header}} Used for pages that don't use a template that includes it. Like categories and this page. {{LSL Header}}
{{LSL_Hex|hex|int}} A HoverText for hex showing the int with a short standard description.
If int is excluded or empty, then int is calculated from hex.
{{LSL Hex|0x100|256}}
0x100
{{LSL Hex|0x100}}
0x100
{{!}} Used instead of a | for when embedding them in templates parameters. {{!}}
|
{{=}} Used instead of a = for when you need a text equals sign that cannot interfere with templates parameters. {{=}}
=

Embedding Tables

One of the weaknesses in MediaWiki is the difficulty in embedding tables as parameters for templates. There are a few ways around this.

  1. Write the table in HTML using <table> & </table>, <tr> & </tr>, <th> & </th>, <td> & </td> tags. If you go this route you must close your tags properly (or MediaWiki will do strange things).
  2. Use MediaWiki syntax for tables and replace every occurrence (not being used as a template separator) of '|' with '{{!}}'
  3. Wrap the table with <div></div> tags (doesn't always work).
  • Note that you may need to play with the whitespace to get MediaWiki to display it properly.


HTML Method
Before After Embedded
{|{{Prettytable}}
! Permissions
! Value
! Description
|- 
| [[PERM_ALL]]
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| Move/Modify/Copy/Transfer permissions
|- 
| [[PERM_COPY]]
| {{LSL Hex|0x00008000|32768}}
| Copy permission
|- 
| [[PERM_MODIFY]]
| {{LSL Hex|0x00004000|16384}}
| Modify permission
|- 
| [[PERM_MOVE]]
| {{LSL Hex|0x00080000|524288}}
| Move permission
|- 
| [[PERM_TRANSFER]]
| {{LSL Hex|0x00002000|8192}}
| Transfer permission
|}
<table {{Prettytable}}><tr>
<th> Permissions</th>
<th> Value</th>
<th> Description</th>
</tr><tr>
<td> [[PERM_ALL]]</td>
<td> {{LSL Hex|0x7FFFFFFF|2147483647}}</td>
<td> Move/Modify/Copy/Transfer permissions</td>
</tr><tr>
<td> [[PERM_COPY]]</td>
<td> {{LSL Hex|0x00008000|32768}}</td>
<td> Copy permission</td>
</tr><tr>
<td> [[PERM_MODIFY]]</td>
<td> {{LSL Hex|0x00004000|16384}}</td>
<td> Modify permission</td>
</tr><tr>
<td> [[PERM_MOVE]]</td>
<td> {{LSL Hex|0x00080000|524288}}</td>
<td> Move permission</td>
</tr><tr>
<td> [[PERM_TRANSFER]]</td>
<td> {{LSL Hex|0x00002000|8192}}</td>
<td> Transfer permission</td>
</tr></table>

Table in Table:

Permissions Value Description
PERM_ALL 0x7FFFFFFF Move/Modify/Copy/Transfer permissions
PERM_COPY 0x00008000 Copy permission
PERM_MODIFY 0x00004000 Modify permission
PERM_MOVE 0x00080000 Move permission
PERM_TRANSFER 0x00002000 Transfer permission

Table as template parameter:

Permissions Value Description
PERM_ALL 0x7FFFFFFF Move/Modify/Copy/Transfer permissions
PERM_COPY 0x00008000 Copy permission
PERM_MODIFY 0x00004000 Modify permission
PERM_MOVE 0x00080000 Move permission
PERM_TRANSFER 0x00002000 Transfer permission
Pipe Replacement Method
Before After Embedded
{|{{Prettytable}}
! Permissions
! Value
! Description
|- 
| [[PERM_ALL]]
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| Move/Modify/Copy/Transfer permissions
|- 
| [[PERM_COPY]]
| {{LSL Hex|0x00008000|32768}}
| Copy permission
|- 
| [[PERM_MODIFY]]
| {{LSL Hex|0x00004000|16384}}
| Modify permission
|- 
| [[PERM_MOVE]]
| {{LSL Hex|0x00080000|524288}}
| Move permission
|- 
| [[PERM_TRANSFER]]
| {{LSL Hex|0x00002000|8192}}
| Transfer permission
|}
{{{!}}{{Prettytable}}
! Permissions
! Value
! Description
{{!}}- 
{{!}} [[PERM_ALL]]
{{!}} {{LSL Hex|0x7FFFFFFF|2147483647}}
{{!}} Move/Modify/Copy/Transfer permissions
{{!}}- 
{{!}} [[PERM_COPY]]
{{!}} {{LSL Hex|0x00008000|32768}}
{{!}} Copy permission
{{!}}- 
{{!}} [[PERM_MODIFY]]
{{!}} {{LSL Hex|0x00004000|16384}}
{{!}} Modify permission
{{!}}- 
{{!}} [[PERM_MOVE]]
{{!}} {{LSL Hex|0x00080000|524288}}
{{!}} Move permission
{{!}}- 
{{!}} [[PERM_TRANSFER]]
{{!}} {{LSL Hex|0x00002000|8192}}
{{!}} Transfer permission
{{!}}}

Table in Table:

Permissions Value Description
PERM_ALL 0x7FFFFFFF Move/Modify/Copy/Transfer permissions
PERM_COPY 0x00008000 Copy permission
PERM_MODIFY 0x00004000 Modify permission
PERM_MOVE 0x00080000 Move permission
PERM_TRANSFER 0x00002000 Transfer permission

Table as template parameter:

Permissions Value Description
PERM_ALL 0x7FFFFFFF Move/Modify/Copy/Transfer permissions
PERM_COPY 0x00008000 Copy permission
PERM_MODIFY 0x00004000 Modify permission
PERM_MOVE 0x00080000 Move permission
PERM_TRANSFER 0x00002000 Transfer permission
Div Tag Method (doesn't always work)
Before After Embedded
{|{{Prettytable}}
! Permissions
! Value
! Description
|- 
| [[PERM_ALL]]
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| Move/Modify/Copy/Transfer permissions
|- 
| [[PERM_COPY]]
| {{LSL Hex|0x00008000|32768}}
| Copy permission
|- 
| [[PERM_MODIFY]]
| {{LSL Hex|0x00004000|16384}}
| Modify permission
|- 
| [[PERM_MOVE]]
| {{LSL Hex|0x00080000|524288}}
| Move permission
|- 
| [[PERM_TRANSFER]]
| {{LSL Hex|0x00002000|8192}}
| Transfer permission
|}
<div>
{|{{Prettytable}}
! Permissions
! Value
! Description
|- 
| [[PERM_ALL]]
| {{LSL Hex|0x7FFFFFFF|2147483647}}
| Move/Modify/Copy/Transfer permissions
|- 
| [[PERM_COPY]]
| {{LSL Hex|0x00008000|32768}}
| Copy permission
|- 
| [[PERM_MODIFY]]
| {{LSL Hex|0x00004000|16384}}
| Modify permission
|- 
| [[PERM_MOVE]]
| {{LSL Hex|0x00080000|524288}}
| Move permission
|- 
| [[PERM_TRANSFER]]
| {{LSL Hex|0x00002000|8192}}
| Transfer permission
|}
</div>

Table in Table:

Permissions Value Description
PERM_ALL 0x7FFFFFFF Move/Modify/Copy/Transfer permissions
PERM_COPY 0x00008000 Copy permission
PERM_MODIFY 0x00004000 Modify permission
PERM_MOVE 0x00080000 Move permission
PERM_TRANSFER 0x00002000 Transfer permission

Functions

Besides the general templates there is only one function specific template.

Template:LSL Function
This template provides a structure to write the functions documentation over; it includes several sections.

Some things to keep in mind:

  • Please do not remove information.
  • Order of template variables does not matter.
  • Most variables if not set will cause the applicable section to hide (not all sections hide).
  • Unused variables do not need to be included but it is better to not removed unused variables to aid future editors.
  • Please head all messages generated by the template.
  • If you think a section should be added please add it to LSL Function Style (and they will shortly be added to the template) or place a comment on Template_talk:LSL Function.

Please refer to LSL_Function for a detailed explanation of it's syntax and attributes.

Base Example: llFrand
{{LSL_Function
|func
|func_id
|func_sleep
|sort
|func_desc
|func_footnote
|return_type
|return_text
|p1_type|p1_name|p1_desc
|p2_type|p2_name|p2_desc
|p3_type|p3_name|p3_desc
|p4_type|p4_name|p4_desc
|p5_type|p5_name|p5_desc
|p6_type|p6_name|p6_desc
|p7_type|p7_name|p7_desc
|p8_type|p8_name|p8_desc
|p9_type|p9_name|p9_desc
|p10_type|p10_name|p10_desc
|p11_type|p11_name|p11_desc
|p12_type|p12_name|p12_desc
|constants
|spec
|caveats
|examples
|helpers
|also_header
|also_functions
|also_tests
|also_articles
|also_events
|also_footer
|notes
|mode
|deprecated
|permission
|negative_index
|cat1
|cat2
|cat3
|cat4
|cat5
|cat6
|location
}}
{{LSL_Function
|sort=Frand
|func=llFrand
|func_id=8
|func_sleep=0.0
|func_energy=10.0
|p1_type=float
|p1_name=mag
|p1_desc=Any valid float value
|return_type=float
|return_text=that is pseudo random number in the range [0.0,mag) or (mag, 0.0].
|spec=returns a pseudo random number in range [0.0, mag) or (mag, 0.0], depending upon the sign of mag.
|caveats=The random number generator is not a source of entropy.
|examples=<source lang="lsl">
default
{
    touch_start(integer total_number)
    {
        // When touched, say "Heads" with probability 0.5, 
        // otherwise, say "Tails."
        if ( llFrand(1.) < .5)
            llSay(0, "Heads");
        else
            llSay(0, "Tails");
    }
}
</source>
|helpers
|also_header
|also_functions
|also_tests
|also_events
|also_articles
|also_footer
|notes=
The random number generator is not a source of entropy.

The sequence of random numbers are shared across the entire process, and not independently seeded.
Therefore, the pseudo random number generation is not suitable for any application which requires
completely predictable or completely unpredictable results.
|cat1=Math
|cat2
|cat3
|cat4
}}

Events

Besides the general templates there is only one event specific template.

LSL_Event This template provides a structure to write the event documentation over; it includes several sections. Unused sections are typically hidden from view.

Please refer to LSL_Event for a detailed explanation of its syntax and attributes.

Constants

There is only one constant specific template.

LSL_Constant This template provides a structure to write constant documentation over; it includes several sections. Unused sections are typically hidden from view.

Please refer to LSL_Constant for a detailed explanation of its syntax and attributes.