Difference between revisions of "LSL Editing Primer"
Line 379: | Line 379: | ||
[[Template:LSL Function|LSL_Function]] | [[Template:LSL Function|LSL_Function]] | ||
This template provides a structure to write the functions documentation over. It provides several sections. Unused sections are typically | This template provides a structure to write the functions documentation over. It provides several sections. Unused sections are typically hidden from view. If you don't know what a value should be or don't know what it does, don't set it or change it but do experiment. If you think there should be new sections please add them to the [[LSL Function Style]] (and they will shortly be added to the template). | ||
{|{{Prettytable}} | |||
!Base | |||
!Example | |||
|- | |||
|<br><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_footer | |||
|notes | |||
|mode | |||
|deprecated | |||
|permission | |||
|negative_index | |||
|cat1 | |||
|cat2 | |||
|cat3 | |||
|cat4 | |||
|cat5 | |||
|cat6 | |||
|location | |||
}} | |||
</pre> | |||
| | |||
{{LSLG|llFrand}}<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 | |||
|examples=<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"); | |||
} | |||
} | |||
</lsl> | |||
|helpers | |||
|also_header | |||
|also_functions | |||
|also_tests | |||
|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 | |||
}} | |||
</pre> | |||
|} | |||
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. |
Revision as of 09:04, 13 February 2007
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
In the LSL Portal area of the wiki there are several templates in use for standardizing appearance and making editing easier.
General Templates
There are several universal templates, the most used template names are short for ease of typing.
Name | Description | example |
---|---|---|
{{LSLG|page|text}} | Links between pages Use for pages in the LSL_ pseudo-namespace. if text is omitted then it defaults to page |
{{LSLG|llAbs|integer absolute value}} integer absolute value {{LSLG|llAbs}} llAbs |
{{LSLC|page|sort}} | Adds a page to a group Use instead of [[Category:LSL name|name]] sort is optional, the template will try to calculate it. |
|
{{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. | {{LSL Hex|0x100|256}} 0x100 |
{{!}} | Used instead of a | for when embedding them in 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.
- Write the table in HTML using <table> & </table>, <tr> & </tr>, <td> & </td> 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 '{{!}}'
- 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.
Before | After | Embedded | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{|{{Prettytable}} ! Permissions ! Value ! Description |- | {{LSLG|PERM_ALL}} | {{LSL Hex|0x7FFFFFFF|2147483647}} | Move/Modify/Copy/Transfer permissions |- | {{LSLG|PERM_COPY}} | {{LSL Hex|0x00008000|32768}} | Copy permission |- | {{LSLG|PERM_MODIFY}} | {{LSL Hex|0x00004000|16384}} | Modify permission |- | {{LSLG|PERM_MOVE}} | {{LSL Hex|0x00080000|524288}} | Move permission |- | {{LSLG|PERM_TRANSFER}} | {{LSL Hex|0x00002000|8192}} | Transfer permission |} |
<table {{Prettytable}}><tr> <th> Permissions</th> <th> Value</th> <th> Description</th> </tr><tr> <td> {{LSLG|PERM_ALL}}</td> <td> {{LSL Hex|0x7FFFFFFF|2147483647}}</td> <td> Move/Modify/Copy/Transfer permissions</td> </tr><tr> <td> {{LSLG|PERM_COPY}}</td> <td> {{LSL Hex|0x00008000|32768}}</td> <td> Copy permission</td> </tr><tr> <td> {{LSLG|PERM_MODIFY}}</td> <td> {{LSL Hex|0x00004000|16384}}</td> <td> Modify permission</td> </tr><tr> <td> {{LSLG|PERM_MOVE}}</td> <td> {{LSL Hex|0x00080000|524288}}</td> <td> Move permission</td> </tr><tr> <td> {{LSLG|PERM_TRANSFER}}</td> <td> {{LSL Hex|0x00002000|8192}}</td> <td> Transfer permission</td> </tr></table> |
Table in Table:
Table as template parameter:
|
Before | After | Embedded | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{|{{Prettytable}} ! Permissions ! Value ! Description |- | {{LSLG|PERM_ALL}} | {{LSL Hex|0x7FFFFFFF|2147483647}} | Move/Modify/Copy/Transfer permissions |- | {{LSLG|PERM_COPY}} | {{LSL Hex|0x00008000|32768}} | Copy permission |- | {{LSLG|PERM_MODIFY}} | {{LSL Hex|0x00004000|16384}} | Modify permission |- | {{LSLG|PERM_MOVE}} | {{LSL Hex|0x00080000|524288}} | Move permission |- | {{LSLG|PERM_TRANSFER}} | {{LSL Hex|0x00002000|8192}} | Transfer permission |} |
{{{!}}{{Prettytable}} ! Permissions ! Value ! Description {{!}}- {{!}} {{LSLG|PERM_ALL}} {{!}} {{LSL Hex|0x7FFFFFFF|2147483647}} {{!}} Move/Modify/Copy/Transfer permissions {{!}}- {{!}} {{LSLG|PERM_COPY}} {{!}} {{LSL Hex|0x00008000|32768}} {{!}} Copy permission {{!}}- {{!}} {{LSLG|PERM_MODIFY}} {{!}} {{LSL Hex|0x00004000|16384}} {{!}} Modify permission {{!}}- {{!}} {{LSLG|PERM_MOVE}} {{!}} {{LSL Hex|0x00080000|524288}} {{!}} Move permission {{!}}- {{!}} {{LSLG|PERM_TRANSFER}} {{!}} {{LSL Hex|0x00002000|8192}} {{!}} Transfer permission {{!}}} |
Table in Table:
Table as template parameter:
|
Before | After | Embedded | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{|{{Prettytable}} ! Permissions ! Value ! Description |- | {{LSLG|PERM_ALL}} | {{LSL Hex|0x7FFFFFFF|2147483647}} | Move/Modify/Copy/Transfer permissions |- | {{LSLG|PERM_COPY}} | {{LSL Hex|0x00008000|32768}} | Copy permission |- | {{LSLG|PERM_MODIFY}} | {{LSL Hex|0x00004000|16384}} | Modify permission |- | {{LSLG|PERM_MOVE}} | {{LSL Hex|0x00080000|524288}} | Move permission |- | {{LSLG|PERM_TRANSFER}} | {{LSL Hex|0x00002000|8192}} | Transfer permission |} |
<div> {|{{Prettytable}} ! Permissions ! Value ! Description |- | {{LSLG|PERM_ALL}} | {{LSL Hex|0x7FFFFFFF|2147483647}} | Move/Modify/Copy/Transfer permissions |- | {{LSLG|PERM_COPY}} | {{LSL Hex|0x00008000|32768}} | Copy permission |- | {{LSLG|PERM_MODIFY}} | {{LSL Hex|0x00004000|16384}} | Modify permission |- | {{LSLG|PERM_MOVE}} | {{LSL Hex|0x00080000|524288}} | Move permission |- | {{LSLG|PERM_TRANSFER}} | {{LSL Hex|0x00002000|8192}} | Transfer permission |} </div> |
Table in Table:
|
Functions
Besides the general templates there is only one function specific template.
LSL_Function This template provides a structure to write the functions documentation over. It provides several sections. Unused sections are typically hidden from view. If you don't know what a value should be or don't know what it does, don't set it or change it but do experiment. If you think there should be new sections please add them to the LSL Function Style (and they will shortly be added to the template).
Base | Example |
---|---|
{{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_footer |notes |mode |deprecated |permission |negative_index |cat1 |cat2 |cat3 |cat4 |cat5 |cat6 |location }} |
llFrand{{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 |examples=<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"); } } </lsl> |helpers |also_header |also_functions |also_tests |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 }} |
Please refer to LSL_Function for a detailed explanation of it's syntax and attributes.
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 provides several sections. Unused sections are typically are hidden from view.
Please refer to LSL_Event for a detailed explanation of it's syntax and attributes.
Constants
No constant specific template has been written yet, the style is still being sorted out.