Template:BSLfuncinfo: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(oops, optional args are supposed to be italic, not variadic ones)
(looks like the highest # of args actually used is 7, but the engine max is 8 so I'll just go with that; it must have been my imagination that BSL supported variadic functions)
Line 6: Line 6:
!<!--arg 3 type, name, default value-->
!<!--arg 3 type, name, default value-->
!<!--arg 4 type, name, default value-->
!<!--arg 4 type, name, default value-->
!<!--arg 5 type, name, default value-->
!<!--arg 6 type, name, default value-->
!<!--arg 7 type, name, default value-->
!<!--arg 8 type, name, default value-->
|-
|-
|type:
|type:
Line 13: Line 17:
|align="center"|{{{arg3type|}}} {{#if:{{{arg3alttype|}}}|<u>or</u> {{{arg3alttype|}}}}} {{#if:{{{arg3optional|}}}|(optional)|}}
|align="center"|{{{arg3type|}}} {{#if:{{{arg3alttype|}}}|<u>or</u> {{{arg3alttype|}}}}} {{#if:{{{arg3optional|}}}|(optional)|}}
|align="center"|{{{arg4type|}}} {{#if:{{{arg4alttype|}}}|<u>or</u> {{{arg4alttype|}}}}} {{#if:{{{arg4optional|}}}|(optional)|}}
|align="center"|{{{arg4type|}}} {{#if:{{{arg4alttype|}}}|<u>or</u> {{{arg4alttype|}}}}} {{#if:{{{arg4optional|}}}|(optional)|}}
|align="center"|{{{arg5type|}}} {{#if:{{{arg5alttype|}}}|<u>or</u> {{{arg5alttype|}}}}} {{#if:{{{arg5optional|}}}|(optional)|}}
|align="center"|{{{arg6type|}}} {{#if:{{{arg6alttype|}}}|<u>or</u> {{{arg6alttype|}}}}} {{#if:{{{arg6optional|}}}|(optional)|}}
|align="center"|{{{arg7type|}}} {{#if:{{{arg7alttype|}}}|<u>or</u> {{{arg7alttype|}}}}} {{#if:{{{arg7optional|}}}|(optional)|}}
|align="center"|{{{arg8type|}}} {{#if:{{{arg8alttype|}}}|<u>or</u> {{{arg8alttype|}}}}} {{#if:{{{arg8optional|}}}|(optional)|}}
|-
|-
|{{#ifeq:{{{mac|yes}}}|no|{{#ifeq:{{{win|yes}}}|no|[[Image:Cmbox deletion.png|20px]]                                <!--if neither platform, show error icon
|{{#ifeq:{{{mac|yes}}}|no|{{#ifeq:{{{win|yes}}}|no|[[Image:Cmbox deletion.png|20px]]                                <!--if neither platform, show error icon
Line 63: Line 71:
                                                   -->}}<!--
                                                   -->}}<!--
                                                   -->{{#if:{{{arg4optional|}}}|''|}}<!--
                                                   -->{{#if:{{{arg4optional|}}}|''|}}<!--
                                                  -->{{#if:{{{arg5name|}}}|, |}}<!--
                                                 -->|{{#if:{{{arg3name|}}}| ); |}}<!--
                                                 -->|{{#if:{{{arg3name|}}}| ); |}}<!--
                                            -->}}
|style="font-size:166%; vertical-align:bottom"|{{#if:{{{arg5name|}}}<!--
                                                -->|{{#if:{{{arg5optional|}}}|''|}}<!--
                                                  -->{{{arg5name|}}}<!--
                                                  -->{{#if:{{{arg5altname|}}}<!--
                                                      -->|&nbsp;<u>or</u> {{{arg5altname|}}}<!--
                                                      -->|<!--
                                                  -->}}<!--
                                                  -->{{#if:{{{arg5optional|}}}|''|}}<!--
                                                  -->{{#if:{{{arg6name|}}}|, |}}<!--
                                                -->|{{#if:{{{arg4name|}}}| ); |}}<!--
                                            -->}}
|style="font-size:166%; vertical-align:bottom"|{{#if:{{{arg6name|}}}<!--
                                                -->|{{#if:{{{arg6optional|}}}|''|}}<!--
                                                  -->{{{arg6name|}}}<!--
                                                  -->{{#if:{{{arg6altname|}}}<!--
                                                      -->|&nbsp;<u>or</u> {{{arg6altname|}}}<!--
                                                      -->|<!--
                                                  -->}}<!--
                                                  -->{{#if:{{{arg6optional|}}}|''|}}<!--
                                                  -->{{#if:{{{arg7name|}}}|, |}}<!--
                                                -->|{{#if:{{{arg5name|}}}| ); |}}<!--
                                            -->}}
|style="font-size:166%; vertical-align:bottom"|{{#if:{{{arg7name|}}}<!--
                                                -->|{{#if:{{{arg7optional|}}}|''|}}<!--
                                                  -->{{{arg7name|}}}<!--
                                                  -->{{#if:{{{arg7altname|}}}<!--
                                                      -->|&nbsp;<u>or</u> {{{arg7altname|}}}<!--
                                                      -->|<!--
                                                  -->}}<!--
                                                  -->{{#if:{{{arg7optional|}}}|''|}}<!--
                                                  -->{{#if:{{{arg8name|}}}|, |}}<!--
                                                -->|{{#if:{{{arg6name|}}}| ); |}}<!--
                                            -->}}
|style="font-size:166%; vertical-align:bottom"|{{#if:{{{arg8name|}}}<!--
                                                -->|{{#if:{{{arg8optional|}}}|''|}}<!--
                                                  -->{{{arg8name|}}}<!--
                                                  -->{{#if:{{{arg8altname|}}}<!--
                                                      -->|&nbsp;<u>or</u> {{{arg8altname|}}}<!--
                                                      -->|<!--
                                                  -->}}<!--
                                                  -->{{#if:{{{arg8optional|}}}|''|}}<!-- no check for comma after this since this is the last possible arg
                                                -->|{{#if:{{{arg7name|}}}| ); |}}<!--
                                             -->}}
                                             -->}}
|-
|-
Line 72: Line 124:
|align="center"|{{#if:{{{arg3default|}}}|{{{arg3default|}}}|{{#if:{{{arg3name|}}}| --|}}|}}
|align="center"|{{#if:{{{arg3default|}}}|{{{arg3default|}}}|{{#if:{{{arg3name|}}}| --|}}|}}
|align="center"|{{#if:{{{arg4default|}}}|{{{arg4default|}}}|{{#if:{{{arg4name|}}}| --|}}|}}
|align="center"|{{#if:{{{arg4default|}}}|{{{arg4default|}}}|{{#if:{{{arg4name|}}}| --|}}|}}
|align="center"|{{#if:{{{arg5default|}}}|{{{arg5default|}}}|{{#if:{{{arg5name|}}}| --|}}|}}
|align="center"|{{#if:{{{arg6default|}}}|{{{arg6default|}}}|{{#if:{{{arg6name|}}}| --|}}|}}
|align="center"|{{#if:{{{arg7default|}}}|{{{arg7default|}}}|{{#if:{{{arg7name|}}}| --|}}|}}
|align="center"|{{#if:{{{arg8default|}}}|{{{arg8default|}}}|{{#if:{{{arg8name|}}}| --|}}|}}
|}</includeonly><noinclude>
|}</includeonly><noinclude>


'''BSLfunc''' allows for standardized listing of BSL functions. The assumption at the moment is that the most arguments a function can take is four; this will be raised if some functions are discovered to take more arguments.
'''BSLfunc''' allows for standardized listing of BSL functions. Since BSL allows for functions to take up to eight arguments, and each argument has to be described here by up to six parameters, this makes '''BSLfunc''' the most complex template on the wiki. However, you'll rarely need to use more than a few of these parameters to describe an average function.


Parameters:
Parameters:
Line 89: Line 145:
:You don't have to use these unless the function is <u>not</u> available and working on one platform; set the appropriate parameter(s) to "no" if that is the case.
:You don't have to use these unless the function is <u>not</u> available and working on one platform; set the appropriate parameter(s) to "no" if that is the case.


;<tt>arg1optional</tt>, <tt>arg2optional</tt>, <tt>arg3optional</tt>, <tt>arg4optional</tt>
;<tt>arg[1-8]optional</tt>
:If this argument can be omitted, set this to "yes".
:If this argument can be omitted, set this to "yes".


;<tt>arg1default</tt>, <tt>arg2default</tt>, <tt>arg3default</tt>, <tt>arg4default</tt>
;<tt>arg[1-8]default</tt>
:Optional arguments have default assumed values that are used when the argument is not used explicitly; give those values here.
:Optional arguments have default assumed values that are used when the argument is not provided; give those values here.


;<tt>arg1type</tt>, <tt>arg2type</tt>, <tt>arg3type</tt>, <tt>arg4type</tt>
;<tt>arg[1-8]type</tt>
:If these arguments to the BSL function exist, give their types here.
:If these arguments to the BSL function exist, give their types here.


;<tt>arg1name</tt>, <tt>arg2name</tt>, <tt>arg3name</tt>, <tt>arg4name</tt>
;<tt>arg[1-8]name</tt>
:If these arguments to the BSL function exist, give their names here.
:If these arguments to the BSL function exist, give their names here.


;<tt>arg1alttype</tt>, <tt>arg2alttype</tt>, <tt>arg3alttype</tt>, <tt>arg4alttype</tt>
;<tt>arg[1-8]alttype</tt>
:If a BSL function can take more than one kind of data in a given argument position, give the second argument type here.
:If a BSL function can take more than one kind of data in a given argument position, give the second argument type here.


;<tt>arg1altname</tt>, <tt>arg2altname</tt>, <tt>arg3altname</tt>, <tt>arg4altname</tt>
;<tt>arg[1-8]altname</tt>
:If a BSL function can take more than one kind of data in a given argument position, give the second argument name here.
:If a BSL function can take more than one kind of data in a given argument position, give the second argument name here.


Here's a default blank call with all parameters:
Here's a default blank call with all parameters up through the fourth argument, which will cover most built-in functions. You can copy-paste the arg4* parameters and change them to arg5*, arg6*, etc. if needed, and you can also delete any parameters you don't need when setting up a call to this template.


  <nowiki>{{</nowiki>BSLfunc
  <nowiki>{{</nowiki>BSLfunc

Revision as of 17:05, 14 November 2015


BSLfunc allows for standardized listing of BSL functions. Since BSL allows for functions to take up to eight arguments, and each argument has to be described here by up to six parameters, this makes BSLfunc the most complex template on the wiki. However, you'll rarely need to use more than a few of these parameters to describe an average function.

Parameters:

type
Return type of function; should be "int", "string", "float", "bool", or "void".
default
Default return value of function, if there is one at the time the level starts.
name
Name of function.
mac, win
You don't have to use these unless the function is not available and working on one platform; set the appropriate parameter(s) to "no" if that is the case.
arg[1-8]optional
If this argument can be omitted, set this to "yes".
arg[1-8]default
Optional arguments have default assumed values that are used when the argument is not provided; give those values here.
arg[1-8]type
If these arguments to the BSL function exist, give their types here.
arg[1-8]name
If these arguments to the BSL function exist, give their names here.
arg[1-8]alttype
If a BSL function can take more than one kind of data in a given argument position, give the second argument type here.
arg[1-8]altname
If a BSL function can take more than one kind of data in a given argument position, give the second argument name here.

Here's a default blank call with all parameters up through the fourth argument, which will cover most built-in functions. You can copy-paste the arg4* parameters and change them to arg5*, arg6*, etc. if needed, and you can also delete any parameters you don't need when setting up a call to this template.

{{BSLfunc
|type=
|default=
|name=
|mac=
|win=
|arg1optional= |arg1default= |arg1type= |arg1name= |arg1alttype= |arg1altname=
|arg2optional= |arg2default= |arg2type= |arg2name= |arg2alttype= |arg2altname=
|arg3optional= |arg3default= |arg3type= |arg3name= |arg3alttype= |arg3altname=
|arg4optional= |arg4default= |arg4type= |arg4name= |arg4alttype= |arg4altname= }}