Difference between revisions of "Template:Function"

From Savage Game Design Wiki
Jump to navigation Jump to search
(Template creation)
 
(Add parameter 10, version category and example result)
Line 4: Line 4:
 
-->{{DISPLAYTITLE:{{#ifeq: {{uc:{{FULLPAGENAME}}}} | TEMPLATE:FUNCTION | {{FULLPAGENAMEE}} | {{PAGENAMEE}} }} }}<!--
 
-->{{DISPLAYTITLE:{{#ifeq: {{uc:{{FULLPAGENAME}}}} | TEMPLATE:FUNCTION | {{FULLPAGENAMEE}} | {{PAGENAMEE}} }} }}<!--
 
-->{{DEFAULTSORT:{{uc:{{#replace:{{PAGENAMEE}}|VN_fnc_|}}}}}}<!--
 
-->{{DEFAULTSORT:{{uc:{{#replace:{{PAGENAMEE}}|VN_fnc_|}}}}}}<!--
 +
-->{{#ifeq: {{uc:{{FULLPAGENAME}}}} | TEMPLATE:FUNCTION | | [[Category:Functions]]{{#if:{{{v|}}}|[[Category:Introduced in v{{{v}}}]]}}}}<!--
 
--><div class="function">
 
--><div class="function">
 
[[:Category:Functions|← back to Functions]]
 
[[:Category:Functions|← back to Functions]]
Line 25: Line 26:
 
-->{{#if:{{{p7n|}}}|<dd>{{{p7n}}}{{#if:{{{p7t|}}}|<nowiki/>: {{{p7t}}}}}{{#if:{{{p7d|}}}{{{p7v|}}}|<nowiki/> - {{#if:{{{p7v|}}}|<nowiki/> (Optional, default <code>{{{p7v}}}</code>)}}{{#if:{{{p7d|}}}|<nowiki/> {{{p7d}}}}}}}</dd>}}<!--
 
-->{{#if:{{{p7n|}}}|<dd>{{{p7n}}}{{#if:{{{p7t|}}}|<nowiki/>: {{{p7t}}}}}{{#if:{{{p7d|}}}{{{p7v|}}}|<nowiki/> - {{#if:{{{p7v|}}}|<nowiki/> (Optional, default <code>{{{p7v}}}</code>)}}{{#if:{{{p7d|}}}|<nowiki/> {{{p7d}}}}}}}</dd>}}<!--
 
-->{{#if:{{{p8n|}}}|<dd>{{{p8n}}}{{#if:{{{p8t|}}}|<nowiki/>: {{{p8t}}}}}{{#if:{{{p8d|}}}{{{p8v|}}}|<nowiki/> - {{#if:{{{p8v|}}}|<nowiki/> (Optional, default <code>{{{p8v}}}</code>)}}{{#if:{{{p8d|}}}|<nowiki/> {{{p8d}}}}}}}</dd>}}<!--
 
-->{{#if:{{{p8n|}}}|<dd>{{{p8n}}}{{#if:{{{p8t|}}}|<nowiki/>: {{{p8t}}}}}{{#if:{{{p8d|}}}{{{p8v|}}}|<nowiki/> - {{#if:{{{p8v|}}}|<nowiki/> (Optional, default <code>{{{p8v}}}</code>)}}{{#if:{{{p8d|}}}|<nowiki/> {{{p8d}}}}}}}</dd>}}<!--
-->{{#if:{{{p9n|}}}|<dd>{{{p9n}}}{{#if:{{{p9t|}}}|<nowiki/>: {{{p9t}}}}}{{#if:{{{p9d|}}}{{{p9v|}}}|<nowiki/> - {{#if:{{{p9v|}}}|<nowiki/> (Optional, default <code>{{{p9v}}}</code>)}}{{#if:{{{p9d|}}}|<nowiki/> {{{p9d}}}}}}}</dd>}}
+
-->{{#if:{{{p9n|}}}|<dd>{{{p9n}}}{{#if:{{{p9t|}}}|<nowiki/>: {{{p9t}}}}}{{#if:{{{p9d|}}}{{{p9v|}}}|<nowiki/> - {{#if:{{{p9v|}}}|<nowiki/> (Optional, default <code>{{{p9v}}}</code>)}}{{#if:{{{p9d|}}}|<nowiki/> {{{p9d}}}}}}}</dd>}}<!--
 +
-->{{#if:{{{p10n|}}}|<dd>{{{p10n}}}{{#if:{{{p10t|}}}|<nowiki/>: {{{p10t}}}}}{{#if:{{{p10d|}}}{{{p10v|}}}|<nowiki/> - {{#if:{{{p10v|}}}|<nowiki/> (Optional, default <code>{{{p10v}}}</code>)}}{{#if:{{{p10d|}}}|<nowiki/> {{{p10d}}}}}}}</dd>}}
 
}}
 
}}
 
}}
 
}}
Line 45: Line 47:
 
{{#if:{{{x10|}}}|<dt>Example 10:</dt><dd>{{{x10}}}</dd>}}
 
{{#if:{{{x10|}}}|<dt>Example 10:</dt><dd>{{{x10}}}</dd>}}
 
}}
 
}}
</div>
+
</div></includeonly><noinclude>
 
+
Shows a [[:Category:Functions|Function]] page, adds it to the [[:Category:Functions]] page and the [[:Category:Introduced in]].
[[Category:Functions]]</includeonly><noinclude>
 
Shows a [[:Category:Functions|Function]] page.
 
  
 
== Usage ==
 
== Usage ==
Line 56: Line 56:
 
! Argument !! Name !! Description
 
! Argument !! Name !! Description
 
|-
 
|-
| v || Version || {{vn}}'s version
+
| v || Version || {{vn}}'s version.<br>'''Note:''' '''not''' {{arma3}} version!
 
|-
 
|-
 
| d || Description || Function summary, e.g <q>Sets provided unit's direction.</q>
 
| d || Description || Function summary, e.g <q>Sets provided unit's direction.</q>
Line 66: Line 66:
 
| p1n || Parameter 1 '''n'''ame (identifier) || e.g unit, dir, etc.
 
| p1n || Parameter 1 '''n'''ame (identifier) || e.g unit, dir, etc.
 
|-
 
|-
| p1t || Parameter 1 '''t'''ype || [[String]], [[Number]], etc.<br>'''Note:''' no need to use wiki formatting (like <code>[[<nowiki/>String]]</code>) - simply type s, string or String and the template will take from there.
+
| p1t || Parameter 1 '''t'''ype || [[String]], [[Number]], etc.<br>'''Note:''' no need to use wiki formatting (like <code>[[<nowiki/>String]]</code>) - simply type s, string or String - see [[Template:DataType]] for possible values.
 
|-
 
|-
 
| p1d || Parameter 1 '''d'''escription || e.g <q>Sets unit's direction.</q>
 
| p1d || Parameter 1 '''d'''escription || e.g <q>Sets unit's direction.</q>
 
|-
 
|-
| p1v || Parameter 1 default '''v'''alue || e.g 10
+
| p1v || Parameter 1 default '''v'''alue || e.g <q>10</q>
 
|-
 
|-
 
! colspan="3" | Return value - r1..5
 
! colspan="3" | Return value - r1..5
Line 141: Line 141:
 
</pre>
 
</pre>
 
|}
 
|}
 +
 +
== Result ==
 +
 +
''Result is in a grey border to separate it from this page.''
 +
 +
<div style="border: 0.25em solid lightgrey; margin: 0 4em; padding: 2em">
 +
{{Function
 +
 +
|v= 1.00
 +
 +
|d= Sets provided unit's direction.
 +
 +
|s= [unit, direction] spawn [[VN_fnc_setDir]]
 +
 +
|p1n= unit
 +
|p1t= object
 +
|p1d= the unit to sets direction
 +
|p1v= objNull
 +
 +
|p2n= direction
 +
|p2t= number
 +
|p2d= the direction value
 +
|p2v= 0
 +
 +
|r1t= number
 +
|r1d= set direction
 +
 +
|x1= <code>[player, 45] call [[VN_fnc_setDir]];</code>
 +
}}</div>
 +
  
 
[[Category:Templates]]
 
[[Category:Templates]]
 
</noinclude>
 
</noinclude>

Revision as of 00:48, 16 May 2020

Shows a Function page, adds it to the Category:Functions page and the Category:Introduced in.

Usage

{{Function|arg1=value}}

Argument Name Description
v Version S.O.G. Prairie Fire's version.
Note: not Arma 3 version!
d Description Function summary, e.g Sets provided unit's direction.
s Syntax e.g [unit, 45] call [[VN_fnc_setDir]];
Parameters - p1..10
p1n Parameter 1 name (identifier) e.g unit, dir, etc.
p1t Parameter 1 type String, Number, etc.
Note: no need to use wiki formatting (like [[String]]) - simply type s, string or String - see Template:DataType for possible values.
p1d Parameter 1 description e.g Sets unit's direction.
p1v Parameter 1 default value e.g 10
Return value - r1..5
r1t Returned value type e.g Number - same note as p1t
r1d Returned value description e.g Angle set
Examples - x1..10
x1 Example 1 e.g [player, 45] call VN_fnc_setDir.
Note: be sure to use the HTML <code> tags around code.

Template

{{Function

|v= 1.00

|d= DESCRIPTION

|s= [] spawn [[FUNCTION]]

|p1n= identifier
|p1t= type
|p1d= description
|p1v= defaultValue

|p2n= identifier
|p2t= type
|p2d= description
|p2v= defaultValue

|r1t= type
|r1d= description

|x1= example1
}}

Example

{{Function

|v= 1.00

|d= Sets provided unit's direction.

|s= [unit, direction] spawn [[VN_fnc_setDir]]

|p1n= unit
|p1t= object
|p1d= the unit to sets direction
|p1v= objNull

|p2n= direction
|p2t= number
|p2d= the direction value
|p2v= 0

|r1t= number
|r1d= set direction

|x1= <code>[player, 45] call [[VN_fnc_setDir]];</code>
}}

Result

Result is in a grey border to separate it from this page.

← back to Functions

Description

  • introduced in S.O.G. Prairie Fire v1.00
  • Sets provided unit's direction.

Syntax

Syntax
[unit, direction] spawn VN_fnc_setDir
Parameters
unit: object - (Optional, default objNull) the unit to sets direction
direction: number - (Optional, default 0) the direction value

Return Value

number - set direction

Examples

Example 1:
[player, 45] call VN_fnc_setDir;