LSL Editing Primer/pt

From Second Life Wiki
Jump to navigation Jump to search

Na área wiki do Portal LSL, existem vários gabaritos usados para padronizar a aparência e tornar a edição mais fácil.

Gabaritos de Uso Geral

Existem diversos gabaritos universais, com os nomes de gabarito mais usados sendo curtos, para facilitar a digitação.

Nome Descrição exemplo
{{LSLC|category|sort}} Adiciona uma página em um grupo
Use no lugar de [[Category:LSL name|name]]
sort é opcional.
{{LSLGC|category|text}} Faz o link a uma categoria LSL
Use no lugar de [[:Category:LSL category|text]]
se text é omitido, então o padrão é category
{{LSLGC|Math/3D|3D Math Functions}}
3D Math Functions
{{LSLGC|Math}}
Math
{{HoverText|word|description}} Quando você move o cursor sobre a palavra, mostra um "box" contendo a descrição description. {{HoverText|macacos|Uma espécie de mamíferos}}
macacos
{{LSL_Header}} Usado para páginas que não usam um gabarito que as inclua. Como categorias e esta página. {{LSL Header}}
{{LSL_Hex|hex|int}} Usa um HoverText para hex , mostrando int com uma curta descrição padrão.
Se int é excluído ou vazio, então int é calculada a partir do valode de hex.
{{LSL Hex|0x100|256}}
0x100
{{LSL Hex|0x100}}
0x100
{{!}} Usado no lugar de | quando estiver embutindo-os nos parâmetros dos gabaritos. {{!}}
|
{{=}} Usado no lugar de um = quando você precisar que o sinal textual = não interfira nos parâmetros dos gabaritos. {{=}}
=

Embutindo Tabelas

Uma das deficiências do MediaWiki é a dificuldade de se embutir tabelas como parâmetros de gabaritos. Existem poucas formas de se contornar isso.

  1. Escreva a tabela em HTML usando as tags <table> & </table>, <tr> & </tr>, <th> & </th>, <td> & </td>. Se você seguir por esse caminho, você deve fechar suas tags corretamente (ou o MediaWiki fará coisas estranhas).
  1. Use a sintaxe do MediaWiki para tabelas e troque cada ocorrência de '|' (que não esteja sendo usada como um separador de gabaritos) por '{{!}}'.
  1. Envolva a tabela com as tags <div></div> (não funciona sempre).
  • Note que você precisa jogar com os espaços em branco para que o MediaWiki mostre a tabela corretamente.
Método HTML
Antes Depois Embutida
{|{{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>

Tabela na Tabela:

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

Tabela como parâmetro de gabarito:

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
Metodo da Reposição dos Caracteres
Antes Depois Embutida
{|{{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
{{!}}}

Tabela na Tabela:

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

Tabela como parâmetro de gabarito:

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
Método das Tags Div (não funciona sempre)
Antes Depois Embutida
{|{{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>

Tabela na Tabela:

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.

  • Please do not remove information.
  • Order of 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).

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=<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_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.