Difference between revisions of "Template:Function"

From Savage Game Design Wiki
Jump to navigation Jump to search
(Add parameter 10, version category and example result)
(Add default Return Value)
 
(15 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
-->__NOTOC__<!--
 
-->__NOTOC__<!--
 
-->__NOEDITSECTION__<!--
 
-->__NOEDITSECTION__<!--
-->{{DISPLAYTITLE:{{#ifeq: {{uc:{{FULLPAGENAME}}}} | TEMPLATE:FUNCTION | {{FULLPAGENAMEE}} | {{PAGENAMEE}} }} }}<!--
+
-->{{DISPLAYTITLE:{{#ifeq: {{uc:{{FULLPAGENAME}}}} | TEMPLATE:FUNCTION | {{FULLPAGENAMEE}} | {{PAGENAMEE}} }}}}<!--
-->{{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]]
+
{| class="topinformation"
 +
| [[:Category:Functions|← back to Functions]]
 +
| {{#if:{{{v|}}}|Introduced in {{vn}} [[:Category:Introduced in v{{{v}}}|v'''{{{v}}}''']]}}{{#if:{{{author|}}}|<br>by {{{author}}}}}
 +
|
 +
  {| class="argeff"
 +
| Argument(s): || {{#switch:{{{a|}}}|l|loc|local= '''{{Color|blue|local}}'''|g|glob|global= '''{{Color|darkorange|global}}'''|n/a}}
 +
|-
 +
| Effect(s):  || {{#switch:{{{e|}}}|l|loc|local= '''{{Color|blue|local}}'''|g|glob|global= '''{{Color|red|global}}'''|'''''{{Color|grey|unknown}}'''''}}
 +
{{#ifeq:{{{n|}}}|server|
 +
{{!}}-
 +
{{!}} Execution: {{!}}{{!}} '''{{Color|green|Server only}}'''
 +
}}
 +
|}
 +
|}
 
{{#if:{{{v|}}}{{{d|}}}|
 
{{#if:{{{v|}}}{{{d|}}}|
 
<h2 id="Description">Description</h2>
 
<h2 id="Description">Description</h2>
{{#if:{{{v|}}}|* introduced in {{vn}} v'''{{{v}}}'''}}
+
{{#if:{{{d|}}}|{{{d}}}}}
{{#if:{{{d|}}}|* {{{d}}}}}
 
 
}}
 
}}
 
{{#if:{{{s|}}}|
 
{{#if:{{{s|}}}|
 
<h2 id="Syntax">Syntax</h2>
 
<h2 id="Syntax">Syntax</h2>
 +
<dl>
 
<dt>Syntax</dt>
 
<dt>Syntax</dt>
 
<dd>{{{s}}}</dd>
 
<dd>{{{s}}}</dd>
 
{{#if:{{{p1n|}}}|
 
{{#if:{{{p1n|}}}|
 
<dt>Parameters</dt>
 
<dt>Parameters</dt>
<dd>{{{p1n}}}{{#if:{{{p1t|}}}|<nowiki/>: {{{p1t}}}}}{{#if:{{{p1d|}}}{{{p1v|}}}|<nowiki/> - {{#if:{{{p1v|}}}|<nowiki/> (Optional, default <code>{{{p1v}}}</code>)}}{{#if:{{{p1d|}}}|<nowiki/> {{{p1d}}}}}}}</dd><!--
+
{{Function/parameter|{{{p1n|}}}|{{{p1t|}}}|{{{p1d|}}}|{{{p1v|}}}}}<!--
-->{{#if:{{{p2n|}}}|<dd>{{{p2n}}}{{#if:{{{p2t|}}}|<nowiki/>: {{{p2t}}}}}{{#if:{{{p2d|}}}{{{p2v|}}}|<nowiki/> - {{#if:{{{p2v|}}}|<nowiki/> (Optional, default <code>{{{p2v}}}</code>)}}{{#if:{{{p2d|}}}|<nowiki/> {{{p2d}}}}}}}</dd>}}<!--
+
-->{{Function/parameter|{{{p2n|}}}|{{{p2t|}}}|{{{p2d|}}}|{{{p2v|}}}}}<!--
-->{{#if:{{{p3n|}}}|<dd>{{{p3n}}}{{#if:{{{p3t|}}}|<nowiki/>: {{{p3t}}}}}{{#if:{{{p3d|}}}{{{p3v|}}}|<nowiki/> - {{#if:{{{p3v|}}}|<nowiki/> (Optional, default <code>{{{p3v}}}</code>)}}{{#if:{{{p3d|}}}|<nowiki/> {{{p3d}}}}}}}</dd>}}<!--
+
-->{{Function/parameter|{{{p3n|}}}|{{{p3t|}}}|{{{p3d|}}}|{{{p3v|}}}}}<!--
-->{{#if:{{{p4n|}}}|<dd>{{{p4n}}}{{#if:{{{p4t|}}}|<nowiki/>: {{{p4t}}}}}{{#if:{{{p4d|}}}{{{p4v|}}}|<nowiki/> - {{#if:{{{p4v|}}}|<nowiki/> (Optional, default <code>{{{p4v}}}</code>)}}{{#if:{{{p4d|}}}|<nowiki/> {{{p4d}}}}}}}</dd>}}<!--
+
-->{{Function/parameter|{{{p4n|}}}|{{{p4t|}}}|{{{p4d|}}}|{{{p4v|}}}}}<!--
-->{{#if:{{{p5n|}}}|<dd>{{{p5n}}}{{#if:{{{p5t|}}}|<nowiki/>: {{{p5t}}}}}{{#if:{{{p5d|}}}{{{p5v|}}}|<nowiki/> - {{#if:{{{p5v|}}}|<nowiki/> (Optional, default <code>{{{p5v}}}</code>)}}{{#if:{{{p5d|}}}|<nowiki/> {{{p5d}}}}}}}</dd>}}<!--
+
-->{{Function/parameter|{{{p5n|}}}|{{{p5t|}}}|{{{p5d|}}}|{{{p5v|}}}}}<!--
-->{{#if:{{{p6n|}}}|<dd>{{{p6n}}}{{#if:{{{p6t|}}}|<nowiki/>: {{{p6t}}}}}{{#if:{{{p6d|}}}{{{p6v|}}}|<nowiki/> - {{#if:{{{p6v|}}}|<nowiki/> (Optional, default <code>{{{p6v}}}</code>)}}{{#if:{{{p6d|}}}|<nowiki/> {{{p6d}}}}}}}</dd>}}<!--
+
-->{{Function/parameter|{{{p6n|}}}|{{{p6t|}}}|{{{p6d|}}}|{{{p6v|}}}}}<!--
-->{{#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>}}<!--
+
-->{{Function/parameter|{{{p7n|}}}|{{{p7t|}}}|{{{p7d|}}}|{{{p7v|}}}}}<!--
-->{{#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>}}<!--
+
-->{{Function/parameter|{{{p8n|}}}|{{{p8t|}}}|{{{p8d|}}}|{{{p8v|}}}}}<!--
-->{{#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>}}<!--
+
-->{{Function/parameter|{{{p9n|}}}|{{{p9t|}}}|{{{p9d|}}}|{{{p9v|}}}}}<!--
-->{{#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>}}
+
-->{{Function/parameter|{{{p10n|}}}|{{{p10t|}}}|{{{p10d|}}}|{{{p10v|}}}}}
 
}}
 
}}
 +
<dt>Return value</dt>
 +
<dd>{{DataType|{{{r1t|}}}}}{{#if:{{{r1d|}}}|<nowiki> - </nowiki>{{{r1d}}}}}</dd>
 +
</dl>
 
}}
 
}}
{{#if:{{{r1t|}}}{{{r1d|}}}|
 
<h2 id="ReturnValue">Return Value</h2>
 
{{#if:{{{r1t|}}}|{{{r1t}}}{{#if:{{{r1d|}}}|<nowiki> - </nowiki>}}}}{{{r1d|}}}
 
|}}
 
 
{{#if:{{{x1|}}}|
 
{{#if:{{{x1|}}}|
 
<h2 id="Examples">Examples</h2>
 
<h2 id="Examples">Examples</h2>
<dt>Example 1:</dt><dd>{{{x1}}}</dd>
+
<dl>
{{#if:{{{x2|}}}|<dt>Example 2:</dt><dd>{{{x2}}}</dd>}}
+
<dt>Example 1</dt><dd>{{{x1}}}</dt>
{{#if:{{{x3|}}}|<dt>Example 3:</dt><dd>{{{x3}}}</dd>}}
+
{{#if:{{{x2|}}}|<dt>Example 2</dt><dd>{{{x2}}}</dd>}}
{{#if:{{{x4|}}}|<dt>Example 4:</dt><dd>{{{x4}}}</dd>}}
+
{{#if:{{{x3|}}}|<dt>Example 3</dt><dd>{{{x3}}}</dd>}}
{{#if:{{{x5|}}}|<dt>Example 5:</dt><dd>{{{x5}}}</dd>}}
+
{{#if:{{{x4|}}}|<dt>Example 4</dt><dd>{{{x4}}}</dd>}}
{{#if:{{{x6|}}}|<dt>Example 6:</dt><dd>{{{x6}}}</dd>}}
+
{{#if:{{{x5|}}}|<dt>Example 5</dt><dd>{{{x5}}}</dd>}}
{{#if:{{{x7|}}}|<dt>Example 7:</dt><dd>{{{x7}}}</dd>}}
+
{{#if:{{{x6|}}}|<dt>Example 6</dt><dd>{{{x6}}}</dd>}}
{{#if:{{{x8|}}}|<dt>Example 8:</dt><dd>{{{x8}}}</dd>}}
+
{{#if:{{{x7|}}}|<dt>Example 7</dt><dd>{{{x7}}}</dd>}}
{{#if:{{{x9|}}}|<dt>Example 9:</dt><dd>{{{x9}}}</dd>}}
+
{{#if:{{{x8|}}}|<dt>Example 8</dt><dd>{{{x8}}}</dd>}}
{{#if:{{{x10|}}}|<dt>Example 10:</dt><dd>{{{x10}}}</dd>}}
+
{{#if:{{{x9|}}}|<dt>Example 9</dt><dd>{{{x9}}}</dd>}}
 +
{{#if:{{{x10|}}}|<dt>Example 10</dt><dd>{{{x10}}}</dd>}}
 +
</dl>
 +
}}
 +
{{#ifeq: {{uc:{{FULLPAGENAME}}}} | TEMPLATE:FUNCTION | |
 +
{{DEFAULTSORT:{{#replace:{{uc:{{PAGENAMEE}}}}|VN_FNC_|}}}}
 +
[[Category:Functions]]
 +
{{#if:{{{v|}}}|[[Category:Introduced in v{{{v}}}]]}}<!--
 +
-->{{#if:{{{g1|}}}|[[Category:Function Group: {{{g1}}}]]}}<!--
 +
-->{{#if:{{{g2|}}}|[[Category:Function Group: {{{g2}}}]]}}<!--
 +
-->{{#if:{{{g3|}}}|[[Category:Function Group: {{{g3}}}]]}}<!--
 +
-->{{#if:{{{g4|}}}|[[Category:Function Group: {{{g4}}}]]}}<!--
 +
-->{{#if:{{{g5|}}}|[[Category:Function Group: {{{g5}}}]]}}
 
}}
 
}}
</div></includeonly><noinclude>
+
</div></includeonly><noinclude><!--
 +
 
 +
 
 +
DOCUMENTATION STARTS HERE
 +
 
 +
 
 +
-->
 
Shows a [[:Category:Functions|Function]] page, adds it to the [[:Category:Functions]] page and the [[:Category:Introduced in]].
 
Shows a [[:Category:Functions|Function]] page, adds it to the [[:Category:Functions]] page and the [[:Category:Introduced in]].
  
Line 55: Line 83:
 
{| class="wikitable"
 
{| class="wikitable"
 
! Argument !! Name !! Description
 
! Argument !! Name !! Description
 +
|-
 +
| author || Author || function's author(s)
 
|-
 
|-
 
| v || Version || {{vn}}'s version.<br>'''Note:''' '''not''' {{arma3}} version!
 
| v || Version || {{vn}}'s version.<br>'''Note:''' '''not''' {{arma3}} version!
 +
|-
 +
| a || Arguments locality || l, loc or local for local arguments, g, glob or global for global arguments
 +
|-
 +
| e || Effect(s) locality || same as ''a'' for effect(s) locality
 +
|-
 +
| n || Network || <q>server</q> if this function is server-side only - anything else will be discarded
 +
|-
 +
| g1..g5 || Group || Function's group (weapon, vehicle, module, etc)
 
|-
 
|-
 
| 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>
 
|-
 
|-
| s || Syntax || e.g <code>[unit, 45] call [[<nowiki/>VN_fnc_setDir]];</code>
+
| s || Syntax || e.g <q>&lt;code&gt;[unit, 45] call [[<nowiki/>VN_fnc_setDir]];&lt;/code&gt;</q>
 
|-
 
|-
 
! colspan="3" | Parameters - p1..10
 
! colspan="3" | Parameters - p1..10
Line 66: Line 104:
 
| 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 - see [[Template:DataType]] for possible values.
+
| p1t || Parameter 1 '''t'''ype || {{DataType|string}}, {{DataType|number}}, etc.<br>'''Note:''' no need to use wiki formatting (like <code>[[<nowiki/>String]]</code>) - simply type s, str 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>
Line 74: Line 112:
 
! colspan="3" | Return value - r1..5
 
! colspan="3" | Return value - r1..5
 
|-
 
|-
| r1t || Returned value '''t'''ype || e.g [[Number]] - same note as ''p1t''
+
| r1t || Returned value '''t'''ype || e.g {{DataType|number}} - same note as ''p1t''
 
|-
 
|-
 
| r1d || Returned value '''d'''escription || e.g <q>Angle set</q>
 
| r1d || Returned value '''d'''escription || e.g <q>Angle set</q>
Line 80: Line 118:
 
! colspan="3" | Examples - x1..10
 
! colspan="3" | Examples - x1..10
 
|-
 
|-
| x1 || Example 1 || e.g <code>[player, 45] call [[VN_fnc_setDir]]</code>.<br>'''Note:''' be sure to use the HTML <tt>&lt;code&gt;</tt> tags around code.
+
| x1 || Example 1 || e.g <q>&lt;code&gt;[player, 45] call [[<nowiki/>VN_fnc_setDir]]&lt;/code&gt;</q>.<br>'''Note:''' be sure to use the HTML <tt>&lt;code&gt;&lt;/code&gt;</tt> tags around code.
 
|}
 
|}
  
Line 89: Line 127:
 
<pre>
 
<pre>
 
{{Function
 
{{Function
 +
 +
|author= author
  
 
|v= 1.00
 
|v= 1.00
  
|d= DESCRIPTION
+
|a= argumentsLocality
  
|s= [] spawn [[FUNCTION]]
+
|e= effectsLocality
 +
 
 +
|n= serverOnly
 +
 
 +
|g1= group
 +
 
 +
|d= description
 +
 
 +
|s= [] call [[FUNCTION]]
  
 
|p1n= identifier
 
|p1n= identifier
Line 117: Line 165:
 
<pre>
 
<pre>
 
{{Function
 
{{Function
 +
 +
|author= John Doe
  
 
|v= 1.00
 
|v= 1.00
 +
 +
|a= loc
 +
 +
|e= global
 +
 +
|n= server
 +
 +
|g1= Command Group
  
 
|d= Sets provided unit's direction.
 
|d= Sets provided unit's direction.
  
|s= [unit, direction] spawn [[VN_fnc_setDir]]
+
|s= [unit, direction] call [[VN_fnc_setDir]]
  
 
|p1n= unit
 
|p1n= unit
Line 148: Line 206:
 
<div style="border: 0.25em solid lightgrey; margin: 0 4em; padding: 2em">
 
<div style="border: 0.25em solid lightgrey; margin: 0 4em; padding: 2em">
 
{{Function
 
{{Function
 +
 +
|author= John Doe
  
 
|v= 1.00
 
|v= 1.00
 +
 +
|a= loc
 +
 +
|e= global
 +
 +
|n= server
 +
 +
|g1= Command Group
  
 
|d= Sets provided unit's direction.
 
|d= Sets provided unit's direction.
  
|s= [unit, direction] spawn [[VN_fnc_setDir]]
+
|s= [unit, direction] call '''VN_fnc_setDir'''
  
 
|p1n= unit
 
|p1n= unit
Line 168: Line 236:
 
|r1d= set direction
 
|r1d= set direction
  
|x1= <code>[player, 45] call [[VN_fnc_setDir]];</code>
+
|x1= <code>[player, 45] call '''VN_fnc_setDir''';</code>
 
}}</div>
 
}}</div>
  
  
[[Category:Templates]]
+
[[Category:Templates]]</noinclude>
</noinclude>
 

Latest revision as of 22:51, 25 February 2021

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

Usage

{{Function|arg1=value}}

Argument Name Description
author Author function's author(s)
v Version S.O.G. Prairie Fire's version.
Note: not Arma 3 version!
a Arguments locality l, loc or local for local arguments, g, glob or global for global arguments
e Effect(s) locality same as a for effect(s) locality
n Network server if this function is server-side only - anything else will be discarded
g1..g5 Group Function's group (weapon, vehicle, module, etc)
d Description Function summary, e.g Sets provided unit's direction.
s Syntax e.g <code>[unit, 45] call [[VN_fnc_setDir]];</code>
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, str 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 <code>[player, 45] call [[VN_fnc_setDir]]</code>.
Note: be sure to use the HTML <code></code> tags around code.

Template

{{Function

|author= author

|v= 1.00

|a= argumentsLocality

|e= effectsLocality

|n= serverOnly

|g1= group

|d= description

|s= [] call [[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

|author= John Doe

|v= 1.00

|a= loc

|e= global

|n= server

|g1= Command Group

|d= Sets provided unit's direction.

|s= [unit, direction] call [[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 Introduced in S.O.G. Prairie Fire v1.00
by John Doe
Argument(s): local
Effect(s): global
Execution: Server only

Description

Sets provided unit's direction.

Syntax

Syntax
[unit, direction] call 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;