Difference between revisions of "Template:Function"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (DataType template usage)
m (Style refresh)
Line 6: Line 6:
 
-->{{#ifeq: {{uc:{{FULLPAGENAME}}}} | TEMPLATE:FUNCTION | | [[Category:Functions]]{{#if:{{{v|}}}|[[Category:Introduced in v{{{v}}}]]}}}}<!--
 
-->{{#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]]
+
{|
 +
| style="min-width: 20em" | [[:Category:Functions|← back to Functions]]
 +
| {{#if:{{{v|}}}|Introduced in {{vn}} v'''{{{v}}}'''}}
 +
|}
 
{{#if:{{{v|}}}{{{d|}}}|
 
{{#if:{{{v|}}}{{{d|}}}|
<h2 id="Description">Description</h2>
+
<h2 style="border-left: .5em solid #380; border-bottom: .1em solid #380; padding-left: .5em" 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 style="border-left: .5em solid #380; border-bottom: .1em solid #380; padding-left: .5em" id="Syntax">Syntax</h2>
<dt>Syntax</dt>
+
<dt style="float: left">Syntax</dt>
<dd>{{{s}}}</dd>
+
<dd style="padding-left: 10em">{{{s}}}</dd>
 
{{#if:{{{p1n|}}}|
 
{{#if:{{{p1n|}}}|
<dt>Parameters</dt>
+
<dl>
<dd>{{{p1n}}}{{#if:{{{p1t|}}}|<nowiki/>: {{{p1t}}}}}{{#if:{{{p1d|}}}{{{p1v|}}}|<nowiki/> - {{#if:{{{p1v|}}}|<nowiki/> (Optional, default <code>{{{p1v}}}</code>)}}{{#if:{{{p1d|}}}|<nowiki/> {{{p1d}}}}}}}</dd><!--
+
<dt style="float: left">Parameters</dt>
-->{{#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>}}<!--
+
<dd style="padding-left: 10em">{{{p1n}}}{{#if:{{{p1t|}}}|<nowiki/>: {{DataType|{{{p1t}}}}}}}{{#if:{{{p1d|}}}{{{p1v|}}}|<nowiki/> - {{#if:{{{p1v|}}}|<nowiki/> (Optional, default <code>{{{p1v}}}</code>)}}{{#if:{{{p1d|}}}|<nowiki/> {{{p1d}}}}}}}</dd><!--
-->{{#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>}}<!--
+
-->{{#if:{{{p2n|}}}|<dd style="padding-left: 10em">{{{p2n}}}{{#if:{{{p2t|}}}|<nowiki/>: {{DataType|{{{p2t}}}}}}}{{#if:{{{p2d|}}}{{{p2v|}}}|<nowiki/> - {{#if:{{{p2v|}}}|<nowiki/> (Optional, default <code>{{{p2v}}}</code>)}}{{#if:{{{p2d|}}}|<nowiki/> {{{p2d}}}}}}}</dd>}}<!--
-->{{#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>}}<!--
+
-->{{#if:{{{p3n|}}}|<dd style="padding-left: 10em">{{{p3n}}}{{#if:{{{p3t|}}}|<nowiki/>: {{DataType|{{{p3t}}}}}}}{{#if:{{{p3d|}}}{{{p3v|}}}|<nowiki/> - {{#if:{{{p3v|}}}|<nowiki/> (Optional, default <code>{{{p3v}}}</code>)}}{{#if:{{{p3d|}}}|<nowiki/> {{{p3d}}}}}}}</dd>}}<!--
-->{{#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>}}<!--
+
-->{{#if:{{{p4n|}}}|<dd style="padding-left: 10em">{{{p4n}}}{{#if:{{{p4t|}}}|<nowiki/>: {{DataType|{{{p4t}}}}}}}{{#if:{{{p4d|}}}{{{p4v|}}}|<nowiki/> - {{#if:{{{p4v|}}}|<nowiki/> (Optional, default <code>{{{p4v}}}</code>)}}{{#if:{{{p4d|}}}|<nowiki/> {{{p4d}}}}}}}</dd>}}<!--
-->{{#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>}}<!--
+
-->{{#if:{{{p5n|}}}|<dd style="padding-left: 10em">{{{p5n}}}{{#if:{{{p5t|}}}|<nowiki/>: {{DataType|{{{p5t}}}}}}}{{#if:{{{p5d|}}}{{{p5v|}}}|<nowiki/> - {{#if:{{{p5v|}}}|<nowiki/> (Optional, default <code>{{{p5v}}}</code>)}}{{#if:{{{p5d|}}}|<nowiki/> {{{p5d}}}}}}}</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:{{{p6n|}}}|<dd style="padding-left: 10em">{{{p6n}}}{{#if:{{{p6t|}}}|<nowiki/>: {{DataType|{{{p6t}}}}}}}{{#if:{{{p6d|}}}{{{p6v|}}}|<nowiki/> - {{#if:{{{p6v|}}}|<nowiki/> (Optional, default <code>{{{p6v}}}</code>)}}{{#if:{{{p6d|}}}|<nowiki/> {{{p6d}}}}}}}</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:{{{p7n|}}}|<dd style="padding-left: 10em">{{{p7n}}}{{#if:{{{p7t|}}}|<nowiki/>: {{DataType|{{{p7t}}}}}}}{{#if:{{{p7d|}}}{{{p7v|}}}|<nowiki/> - {{#if:{{{p7v|}}}|<nowiki/> (Optional, default <code>{{{p7v}}}</code>)}}{{#if:{{{p7d|}}}|<nowiki/> {{{p7d}}}}}}}</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:{{{p8n|}}}|<dd style="padding-left: 10em">{{{p8n}}}{{#if:{{{p8t|}}}|<nowiki/>: {{DataType|{{{p8t}}}}}}}{{#if:{{{p8d|}}}{{{p8v|}}}|<nowiki/> - {{#if:{{{p8v|}}}|<nowiki/> (Optional, default <code>{{{p8v}}}</code>)}}{{#if:{{{p8d|}}}|<nowiki/> {{{p8d}}}}}}}</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>}}
+
-->{{#if:{{{p9n|}}}|<dd style="padding-left: 10em">{{{p9n}}}{{#if:{{{p9t|}}}|<nowiki/>: {{DataType|{{{p9t}}}}}}}{{#if:{{{p9d|}}}{{{p9v|}}}|<nowiki/> - {{#if:{{{p9v|}}}|<nowiki/> (Optional, default <code>{{{p9v}}}</code>)}}{{#if:{{{p9d|}}}|<nowiki/> {{{p9d}}}}}}}</dd>}}<!--
 +
-->{{#if:{{{p10n|}}}|<dd style="padding-left: 10em">{{{p10n}}}{{#if:{{{p10t|}}}|<nowiki/>: {{DataType|{{{p10t}}}}}}}{{#if:{{{p10d|}}}{{{p10v|}}}|<nowiki/> - {{#if:{{{p10v|}}}|<nowiki/> (Optional, default <code>{{{p10v}}}</code>)}}{{#if:{{{p10d|}}}|<nowiki/> {{{p10d}}}}}}}</dd>}}
 +
</dl>
 
}}
 
}}
 
}}
 
}}
 
{{#if:{{{r1t|}}}{{{r1d|}}}|
 
{{#if:{{{r1t|}}}{{{r1d|}}}|
<h2 id="ReturnValue">Return Value</h2>
+
<h2 style="border-left: .5em solid #380; border-bottom: .1em solid #380; padding-left: .5em" id="ReturnValue">Return Value</h2>
{{#if:{{{r1t|}}}|{{{r1t}}}{{#if:{{{r1d|}}}|<nowiki> - </nowiki>}}}}{{{r1d|}}}
+
{{#if:{{{r1t|}}}|{{DataType|{{{r1t}}}}}{{#if:{{{r1d|}}}|<nowiki> - </nowiki>}}}}{{{r1d|}}}
 
|}}
 
|}}
 
{{#if:{{{x1|}}}|
 
{{#if:{{{x1|}}}|
<h2 id="Examples">Examples</h2>
+
<h2 style="border-left: .5em solid #380; border-bottom: .1em solid #380; padding-left: .5em" id="Examples">Examples</h2>
<dt>Example 1:</dt><dd>{{{x1}}}</dd>
+
<dt style="float: left">Example 1:</dt><dd style="padding-left: 10em">{{{x1}}}</dd>
{{#if:{{{x2|}}}|<dt>Example 2:</dt><dd>{{{x2}}}</dd>}}
+
{{#if:{{{x2|}}}|<dt style="float: left">Example 2:</dt><dd style="padding-left: 10em">{{{x2}}}</dd>}}
{{#if:{{{x3|}}}|<dt>Example 3:</dt><dd>{{{x3}}}</dd>}}
+
{{#if:{{{x3|}}}|<dt style="float: left">Example 3:</dt><dd style="padding-left: 10em">{{{x3}}}</dd>}}
{{#if:{{{x4|}}}|<dt>Example 4:</dt><dd>{{{x4}}}</dd>}}
+
{{#if:{{{x4|}}}|<dt style="float: left">Example 4:</dt><dd style="padding-left: 10em">{{{x4}}}</dd>}}
{{#if:{{{x5|}}}|<dt>Example 5:</dt><dd>{{{x5}}}</dd>}}
+
{{#if:{{{x5|}}}|<dt style="float: left">Example 5:</dt><dd style="padding-left: 10em">{{{x5}}}</dd>}}
{{#if:{{{x6|}}}|<dt>Example 6:</dt><dd>{{{x6}}}</dd>}}
+
{{#if:{{{x6|}}}|<dt style="float: left">Example 6:</dt><dd style="padding-left: 10em">{{{x6}}}</dd>}}
{{#if:{{{x7|}}}|<dt>Example 7:</dt><dd>{{{x7}}}</dd>}}
+
{{#if:{{{x7|}}}|<dt style="float: left">Example 7:</dt><dd style="padding-left: 10em">{{{x7}}}</dd>}}
{{#if:{{{x8|}}}|<dt>Example 8:</dt><dd>{{{x8}}}</dd>}}
+
{{#if:{{{x8|}}}|<dt style="float: left">Example 8:</dt><dd style="padding-left: 10em">{{{x8}}}</dd>}}
{{#if:{{{x9|}}}|<dt>Example 9:</dt><dd>{{{x9}}}</dd>}}
+
{{#if:{{{x9|}}}|<dt style="float: left">Example 9:</dt><dd style="padding-left: 10em">{{{x9}}}</dd>}}
{{#if:{{{x10|}}}|<dt>Example 10:</dt><dd>{{{x10}}}</dd>}}
+
{{#if:{{{x10|}}}|<dt style="float: left">Example 10:</dt><dd style="padding-left: 10em">{{{x10}}}</dd>}}
 
}}
 
}}
 
</div></includeonly><noinclude>
 
</div></includeonly><noinclude>
Line 60: Line 64:
 
| 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 70:
 
| 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 || {{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.
+
| 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 80: Line 84:
 
! 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 94: Line 98:
 
|d= DESCRIPTION
 
|d= DESCRIPTION
  
|s= [] spawn [[FUNCTION]]
+
|s= [] call [[FUNCTION]]
  
 
|p1n= identifier
 
|p1n= identifier
Line 122: Line 126:
 
|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 153: Line 157:
 
|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 172:
 
|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>
  

Revision as of 12:42, 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 <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

|v= 1.00

|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

|v= 1.00

|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

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;