Difference between revisions of "Template:Function"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (Style refresh)
(Add local/global arguments/effects parameters)
Line 8: Line 8:
 
{|
 
{|
 
| style="min-width: 20em" | [[:Category:Functions|← back to Functions]]
 
| style="min-width: 20em" | [[:Category:Functions|← back to Functions]]
| {{#if:{{{v|}}}|Introduced in {{vn}} v'''{{{v}}}'''}}
+
| style="width: 50%" | {{#if:{{{v|}}}|Introduced in {{vn}} v'''{{{v}}}'''}}
 +
| style="width: 33%" | <div style="display: inline-block; text-align: right">
 +
Argument(s): {{#switch:{{{a|}}}|l|loc|local= '''{{Color|blue|local}}'''|g|glob|global= '''{{Color|darkorange|global}}'''|'''''{{Color|grey|unknown}}'''''}}<br>
 +
Effect(s):  {{#switch:{{{e|}}}|l|loc|local= '''{{Color|blue|local}}'''|g|glob|global= '''{{Color|darkorange|global}}'''|'''''{{Color|grey|unknown}}'''''}}</div>
 
|}
 
|}
 
{{#if:{{{v|}}}{{{d|}}}|
 
{{#if:{{{v|}}}{{{d|}}}|
Line 16: Line 19:
 
{{#if:{{{s|}}}|
 
{{#if:{{{s|}}}|
 
<h2 style="border-left: .5em solid #380; border-bottom: .1em solid #380; padding-left: .5em" id="Syntax">Syntax</h2>
 
<h2 style="border-left: .5em solid #380; border-bottom: .1em solid #380; padding-left: .5em" id="Syntax">Syntax</h2>
 +
<dl>
 
<dt style="float: left">Syntax</dt>
 
<dt style="float: left">Syntax</dt>
 
<dd style="padding-left: 10em">{{{s}}}</dd>
 
<dd style="padding-left: 10em">{{{s}}}</dd>
 
{{#if:{{{p1n|}}}|
 
{{#if:{{{p1n|}}}|
<dl>
 
 
<dt style="float: left">Parameters</dt>
 
<dt style="float: left">Parameters</dt>
 
<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><!--
 
<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><!--
Line 31: Line 34:
 
-->{{#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:{{{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>}}
 
-->{{#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>}}
 +
}}
 +
{{#if:{{{r1t|}}}{{{r1d|}}}|<dt style="float: left">Return value:</dt><dd style="padding-left: 10em">{{#if:{{{r1t|}}}|{{DataType|{{{r1t}}}}}{{#if:{{{r1d|}}}|<nowiki> - </nowiki>}}}}{{{r1d|}}}</dd>}}
 
</dl>
 
</dl>
 
}}
 
}}
}}
 
{{#if:{{{r1t|}}}{{{r1d|}}}|
 
<h2 style="border-left: .5em solid #380; border-bottom: .1em solid #380; padding-left: .5em" id="ReturnValue">Return Value</h2>
 
{{#if:{{{r1t|}}}|{{DataType|{{{r1t}}}}}{{#if:{{{r1d|}}}|<nowiki> - </nowiki>}}}}{{{r1d|}}}
 
|}}
 
 
{{#if:{{{x1|}}}|
 
{{#if:{{{x1|}}}|
 
<h2 style="border-left: .5em solid #380; border-bottom: .1em solid #380; padding-left: .5em" id="Examples">Examples</h2>
 
<h2 style="border-left: .5em solid #380; border-bottom: .1em solid #380; padding-left: .5em" id="Examples">Examples</h2>
<dt style="float: left">Example 1:</dt><dd style="padding-left: 10em">{{{x1}}}</dd>
+
<dl>
 +
<dt style="float: left">Example 1:</dt><dd style="padding-left: 10em">{{{x1}}}</dt>
 
{{#if:{{{x2|}}}|<dt style="float: left">Example 2:</dt><dd style="padding-left: 10em">{{{x2}}}</dd>}}
 
{{#if:{{{x2|}}}|<dt style="float: left">Example 2:</dt><dd style="padding-left: 10em">{{{x2}}}</dd>}}
 
{{#if:{{{x3|}}}|<dt style="float: left">Example 3:</dt><dd style="padding-left: 10em">{{{x3}}}</dd>}}
 
{{#if:{{{x3|}}}|<dt style="float: left">Example 3:</dt><dd style="padding-left: 10em">{{{x3}}}</dd>}}
Line 50: Line 51:
 
{{#if:{{{x9|}}}|<dt style="float: left">Example 9:</dt><dd style="padding-left: 10em">{{{x9}}}</dd>}}
 
{{#if:{{{x9|}}}|<dt style="float: left">Example 9:</dt><dd style="padding-left: 10em">{{{x9}}}</dd>}}
 
{{#if:{{{x10|}}}|<dt style="float: left">Example 10:</dt><dd style="padding-left: 10em">{{{x10}}}</dd>}}
 
{{#if:{{{x10|}}}|<dt style="float: left">Example 10:</dt><dd style="padding-left: 10em">{{{x10}}}</dd>}}
 +
</dl>
 
}}
 
}}
</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 61: Line 69:
 
|-
 
|-
 
| 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
 
|-
 
|-
 
| 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 95: Line 107:
  
 
|v= 1.00
 
|v= 1.00
 +
 +
|a= argumentsLocality
 +
 +
|e= effectsLocality
  
 
|d= DESCRIPTION
 
|d= DESCRIPTION
Line 123: Line 139:
  
 
|v= 1.00
 
|v= 1.00
 +
 +
|a= loc
 +
 +
|e= global
  
 
|d= Sets provided unit's direction.
 
|d= Sets provided unit's direction.
Line 154: Line 174:
  
 
|v= 1.00
 
|v= 1.00
 +
 +
|a= loc
 +
 +
|e= global
  
 
|d= Sets provided unit's direction.
 
|d= Sets provided unit's direction.
Line 176: Line 200:
  
  
[[Category:Templates]]
+
[[Category:Templates]]</noinclude>
</noinclude>
 

Revision as of 00:06, 17 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!
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
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

|a= argumentsLocality

|e= effectsLocality

|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

|a= loc

|e= global

|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

Argument(s): local

Effect(s): global

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;