Difference between revisions of "Template:LSL Const"

From Second Life Wiki
Jump to navigation Jump to search
(making hex generation smarter.)
m (Documentation)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{{#if:
<noinclude>See [[{{FULLPAGENAME}}/docs]] for documentation.
{{#vardefine:const_called|{{#expr:{{#var:const_called}} + 1}}}}
 
{{#vardefine:define|{{#ifexpr:{{#var:const_called}} = 1|define|}}}}
{|
{{#var{{#var:define}}:cvalue|}}
{|{{Prettytable}}
{{#var{{#var:define}}:hvalue|}}
|-{{Hl2}}
{{#var{{#var:define}}:comment|}}
!Example
{{#var{{#var:define}}:value|}}
!Raw Text
{{#var{{#var:define}}:type|}}
|-
{{{{#if:{{#var:define}}|:{{{1}}}|!}}|}}
||{{{{FULLPAGENAME}}|name|type|value|hex=hex|c=comment}}
{{#vardefine:define|{{#ifexpr:{{#var:const_called}} = 1|define|}}}}
|<pre>{{LSL Const|name|type|value|hex=hex|c=comment}}</pre>
{{#var{{#var:define}}:cvalue|{{#if:{{#var:cvalue}}|{{#var:cvalue}}|{{#if:{{#var:value}}|{{#var:value}}|{{#if:{{{hex|}}}|{{{{#if:{{{hex|}}}|LSL Hex/Parse|!}}|{{{hex|}}}}}|{{{3|}}}}}}}}}}}
|-
{{#var{{#var:define}}:hvalue|{{#if:{{#var:hvalue}}|{{#var:hvalue}}|{{{hex|}}}}}}}
||{{{{FULLPAGENAME}}|name|type|value|hex=hex|c=comment|nolink=*}}
{{#vardefine:c|{{#expr:({{#if:{{#var:hvalue}}|1|0}} + {{#if:{{#var:cvalue}}|1|0}}) * {{#if:{{#var:value}}|0|1}}}}}}
|<pre>{{LSL Const|name|type|value|hex=hex|c=comment|nolink=*}}</pre>
{{#var{{#var:define}}:value|{{#if:{{#var:value}}|{{#var:value}}|{{#ifeq:{{#var:c}}|2|{{{{#ifeq:{{#var:c}}|2|LSL Hex|!}}|{{#var:hvalue}}|{{#var:cvalue}}}}|{{#if:{{#var:cvalue}}|{{#var:cvalue}}|{{#var:hvalue}}}}}}}}}}
|-{{Hl2}}
{{#var{{#var:define}}:type|{{#if:{{#var:type}}|{{#var:type}}|{{{2|}}}}}}}
!Parameters
{{#var{{#var:define}}:comment|{{#if:{{#var:comment}}|{{#var:comment}}|{{{c|}}}}}}}
!Description
{{#vardefine:const_called|{{#expr:{{#var:const_called}} - 1}}}}
|-
}}{{HoverLink|1={{{1}}}|2={{#var:type}} {{{1}}}{{#if:{{#var:hvalue}}|&#32;{{=}} {{#var:hvalue}}}}{{#if:{{#var:cvalue}}|&#32;{{=}} {{#var:cvalue}}}};{{#if:{{#var:comment}}|&#47;&#47;{{#var:comment}}}}|3={{#if:{{{4|}}}|{{{4|{{{1}}}}}}|{{{1}}}}}}}</includeonly><noinclude>See [[{{FULLPAGENAME}}/docs]] for documentation.</noinclude>
|1
|link target (if 4 is not supplied, this value is used as the name as well)
|-
|2
|type
|-
|3
|value
|-
|4
|name (if excluded the value for 1 is used instead)
|-
|hex
|hex string
|-
|c
|comment
|-
|ihex
|used as the value instead of 3 and used to build 'hex' if it is not supplied
|-{{Hl2}}
!<nowiki>{{#var:</nowiki>''variable-name''<nowiki>}}</nowiki>
!Values
|-
|cname
|{{#var:cname}}
|-
|type
|{{#var:type}}
|-
|value
|{{#var:value}}
|-
|cvalue
|{{#var:cvalue}}
|-
|hvalue
|{{#var:hvalue}}
|-
|comment
|{{#var:comment}}
|}
</noinclude><includeonly>{{#if:
{{#vardefine:hvalue|{{{hex|}}}}}
{{#vardefine:cvalue|{{#if:{{{ihex|}}}|{{{ihex|}}}|{{{3|}}}}}}}
{{#vardefine:value|{{#if:{{#var:hvalue}}{{{ihex|}}}|{{LSL Hex|{{#var:hvalue}}|{{#var:cvalue}}}}|{{#var:cvalue}}}}}}
{{#vardefine:comment|{{{c|}}}}}
{{#vardefine:type|{{{2|}}}}}
{{#vardefine:cname|{{#if:{{{4|}}}|{{{4|{{{1}}}}}}|{{{1}}}}}}}
}}{{{{#if:{{{nolink|}}}|HoverText|HoverLink}}|1={{{1}}}|2={{{2|}}} {{#var:cname}}{{#if:{{#var:hvalue}}|&#32;&#61; {{#var:hvalue}}}}{{#if:{{#var:cvalue}}|&#32;&#61; {{#var:cvalue}}}};{{#if:{{{c|}}}|&nbsp;&#47;&#47;{{{c|}}}}}|3={{#var:cname}}}}</includeonly>

Latest revision as of 15:02, 12 September 2013

See Template:LSL Const/docs for documentation.

Example Raw Text
name
{{LSL Const|name|type|value|hex=hex|c=comment}}
name
{{LSL Const|name|type|value|hex=hex|c=comment|nolink=*}}
Parameters Description
1 link target (if 4 is not supplied, this value is used as the name as well)
2 type
3 value
4 name (if excluded the value for 1 is used instead)
hex hex string
c comment
ihex used as the value instead of 3 and used to build 'hex' if it is not supplied
{{#var:variable-name}} Values
cname name
type type
value hex
cvalue value
hvalue hex
comment comment