Difference between revisions of "Template:Function"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
imported>DragoonWraith
(updating link)
 
(69 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
__NOTOC__
__NOTOC__
{{Beta}}
This template is used to create correctly-formatted function documentation pages. Primarily for the sake of standardizing the syntax sections.
 
This is a WIP, feedback is appreciated. To retain readability a lot of HTML comments are used, they shouldn't impact the working of the template, but could add to the confusion a bit.


  <nowiki>{{Function</nowiki>
  <nowiki>{{Function</nowiki>
  origin            = whether the function came from the CS itself or was added by OBSE.
  | origin            = whether the function came from the CS itself or was added by OBSE.
                      valid values: CS1 (TES CS 1.0), CS1.1 (TES CS 1.1), CS1.2 (TES CS 1.2), OBSE
                        valid values: CS1 (TES CS 1.0), CS1.1 (TES CS 1.1), CS1.2 (TES CS 1.2), OBSE
  summary          = description of the function
  | summary          = description of the function
  ''name''              = the name of the function. The page name is the default value.
  ''alias''            = An abbreviated version of the function name that can be
  | ''name''              = the name of the function. The page name is the default value.
                      used instead of the long name.
  | ''alias''            = An abbreviated version of the function name that can be
  ''returnVal ''        = what the function returns.
                        used instead of the long name.
  ''returnType''        = the type of the returned value.
  | ''returnVal ''        = what the function returns.
  ''referenceType''    = if appropriate, the type of reference that the function may be called
  | ''returnType''        = the type of the returned value.
                      on with the dot syntax
  | ''referenceType''    = if appropriate, the type of reference that the function may be called
  ''referenceOpt''      = if can take a reference, whether it ''must'' take a reference.
                        on with the dot syntax
  ''arguments''        = List of arguments specified using the {{[[:Template:FunctionArgument|FunctionArgument]]}} template,
  | ''referenceOpt''      = if can take a reference, whether it ''must'' take a reference.
                      or any other wiki syntax.
  | ''arguments''        = List of arguments specified using the {{[[:Template:FunctionArgument|FunctionArgument]]}} template,
  ''example''          = optionally, the function used as part of a script to serve as an example
                        or any other wiki syntax.
  ''CategoryList''      = the list of categories to which the page belongs
  | ''altName''          = the name of an alternate version of a function (e.g. the "C" Magic Effect functions)
  | ''altAlias''          = the alias of the alternate function.
  | ''altRetVal''        = the return value of the alternate function, if different. Defaults to the same as the regular function.
  | ''altRetType''        = the return type of the alternate function, if different. Defaults to the same as the regular function.
  | ''altRefType''        = if different from the regular function, the reference used by the alternate version.
  | ''altRefOpt''        = whether the alternate's reference is optional.
  | ''altArgs''          = List of arguments for the alternate version of the function.
  | ''alt2Name''          = the name of a second alternate version of a function
  | ''alt2Alias''        = the alias of any second alternate version of a function
  | ''alt2RetVal''        = the return value of the second alternate function, if different. Defaults to the same as the regular function.
  | ''alt2RetType''        = the return type of the second alternate function, if different. Defaults to the same as the regular function.
  | ''alt2RefType''        = if different from the regular function, the reference used by the second alternate version.
  | ''alt2RefOpt''        = whether the second alternate's reference is optional.
  | ''alt2Args''          = List of arguments for the second alternate version of the function.
  | ''example''          = optionally, the function used as part of a script to serve as an example
  | ''CategoryList''      = the list of categories to which the page belongs
  <nowiki>}}</nowiki>
  <nowiki>}}</nowiki>


Line 26: Line 42:


<pre>{{Function
<pre>{{Function
  |origin = CS1
  |origin = OBSE
  |summary = Plays the visuals of the specified Magic Effect on the calling reference.
  |summary = Sets the constant effect barter factor of the magic effect.
  |name = PlayMagicEffectVisuals
  |name = SetMagicEffectBarterFactor
  |alias = pme
  |alias = SetMEBarterFactor
|altName = SetMagicEffectBarterFactorC
|altAlias = SetMEBarterFactorC
  |returnVal = nothing
  |returnVal = nothing
  |returnType = void
  |returnType = void
|referenceType = [Actor, Activator]
  |arguments =  
  |arguments =  
   {{FunctionArgument
   {{FunctionArgument
   |Name = mgefID
   |Name = newBarterFactor
   |Type = ref
   |Type = float
   }}{{FunctionArgument
   }}{{FunctionArgument
   |Name = duration
   |Name = effect
   |Type = short
   |Type = chars
  |Optional = y
   }}
   }}
  |example = PlayMagicEffectVisuals FIDG
|altArgs =
  pme FTHR 10
  {{FunctionArgument
  |Name = newBarterFactor
  |Type = float
  }}{{FunctionArgument
  |Name = effectCode
  |Type = long
  }}
  |example = SetMagicEffectBarterFactor 5 FIDG
  SetMEBarterFactorC 1.5 1397247044 ; code for SHLD
}}</pre>
}}</pre>


Line 49: Line 73:


{{Function
{{Function
  |origin = CS1
  |origin = OBSE
  |summary = Plays the visuals of the specified Magic Effect on the calling reference.
  |summary = Sets the constant effect barter factor of the magic effect.
  |name = PlayMagicEffectVisuals
  |name = SetMagicEffectBarterFactor
  |alias = pme
  |alias = SetMEBarterFactor
|altName = SetMagicEffectBarterFactorC
|altAlias = SetMEBarterFactorC
  |returnVal = nothing
  |returnVal = nothing
  |returnType = void
  |returnType = void
|referenceType = [Actor, Activator]
  |arguments =  
  |arguments =  
   {{FunctionArgument
   {{FunctionArgument
   |Name = mgefID
   |Name = newBarterFactor
   |Type = ref
   |Type = float
  }}{{FunctionArgument
  |Name = effect
  |Type = chars
  }}
|altArgs =
  {{FunctionArgument
  |Name = newBarterFactor
  |Type = float
   }}{{FunctionArgument
   }}{{FunctionArgument
   |Name = duration
   |Name = effectCode
   |Type = short
   |Type = long
  |Optional = y
   }}
   }}
  |example = PlayMagicEffectVisuals FIDG
  |example = SetMagicEffectBarterFactor 5 FIDG
  pme FTHR 10
  SetMEBarterFactorC 1.5 1397247044 ; code for SHLD
}}
}}


Line 80: Line 112:
| CS1.2  = A function included in the [[The Elder Scrolls Construction Set|TES CS v1.2]].
| CS1.2  = A function included in the [[The Elder Scrolls Construction Set|TES CS v1.2]].
| OBSE = A function added by the [[:Category:Oblivion Script Extender|Oblivion Script Extender]].
| OBSE = A function added by the [[:Category:Oblivion Script Extender|Oblivion Script Extender]].
| #default = {{Error|missing function origin info}}
| #default = A function added by {{{origin | {{Error|missing function origin info}} }}}
}}
}}


<!-- syntax starts here: -->
<!-- syntax starts here: -->
'''Syntax:'''
'''Syntax:'''
<!-- return value:
<!--
--> {{ #ifeq: {{{returnType|void}}} | void |<!-- no Return Value -->|({{ #if: {{{returnVal|}}} | {{{returnVal}}}<nowiki>:</nowiki> |}}<!--


return type (short, float, base object, ref, something else?):
Function syntax description link -->
-->{{ #ifeq: {{{returnType|missing}}} | missing | '''missing return type!''' | {{{returnType}}})&nbsp; }} }}<!--
<div id="catlinks" style="font-size: 75%; float: left; margin: -0.7em 1%; padding: 0 0.1em;">[[Help:Function syntax|What is this?]]</div>
<!--


optional reference type (actor, activator, door, etc.):
Main:
-->{{ #if: {{{referenceType|}}} | {{ #if: {{{referenceOpt|}}} | ''{{{referenceType}}}.'' | {{{referenceType}}}. }} |<!-- no Reference Type -->}}<!--
-->{{FunctionSyntax | name = {{{name|{{PAGENAME}}}}} | returnType = {{{returnType|void}}} | returnVal = {{{returnVal|}}} | referenceType = {{{referenceType|}}} | referenceOpt = {{{referenceOpt|}}} | arguments = {{{arguments|}}} }}<!--


the actual function:
Alias:
-->{{{name|{{PAGENAME}}}}}<!--
-->{{ #if: {{{alias|}}} | &nbsp;
{{FunctionSyntax | name = {{{alias}}} | returnType = {{{returnType|void}}} | returnVal = {{{returnVal|}}} | referenceType = {{{referenceType|}}} | referenceOpt = {{{referenceOpt|}}} | arguments = {{{arguments|}}} }} | <!--no alias--> }}<!--


arguments
Alternate:
-->{{ #if: {{{arguments|}}} | {{{arguments}}} |<!-- no Arguments -->}}<!--
-->{{ #if: {{{alt|{{{altName|}}}}}} | &nbsp;
 
<!-- FOR ALIAS: return value:
-->{{ #if: {{{alias|}}} | &nbsp;


{{ #ifeq: {{{returnType|void}}} | void |<!-- no Return Value -->|({{ #if: {{{returnVal|}}} | {{{returnVal}}}<nowiki>:</nowiki> |}}<!--
{{FunctionSyntax | name = {{{alt|{{{altName|}}}}}} | returnType = {{{altRetType|{{{returnType|void}}} }}} | returnVal = {{{altRetVal|{{{returnVal|}}} }}} | referenceType = {{{altRefType|{{{referenceType|}}} }}} | referenceOpt = {{{altRefOpt|{{{referenceOpt|}}} }}} | arguments = {{{altArgs|}}} }}<!--


return type (short, float, base object, ref, something else?):
Alternate Alias:
-->{{ #ifeq: {{{returnType|missing}}} | missing | '''missing return type!''' | {{{returnType}}})&nbsp; }} }}<!--
-->{{ #if: {{{altAlias|}}} | &nbsp;
{{FunctionSyntax | name = {{{altAlias}}} | returnType = {{{altRetType|{{{returnType|void}}} }}} | returnVal = {{{altRetVal|{{{returnVal|}}} }}} | referenceType = {{{altRefType|{{{referenceType|}}} }}} | referenceOpt = {{{altRefOpt|{{{referenceOpt|}}} }}} | arguments = {{{alt2Args|}}} }} | <!--no alt alias--> }} | <!--no alt--> }}<!--


optional reference type (actor, activator, door, etc.):
Second Alternate:
-->{{ #if: {{{referenceType|}}} | {{ #if: {{{referenceOpt|}}} | ''{{{referenceType}}}.'' | {{{referenceType}}}. }} |<!-- no Reference Type -->}}<!--
-->{{ #if: {{{alt2|{{{alt2Name|}}}}}} | &nbsp;


alias:
{{FunctionSyntax | name = {{{alt2|{{{alt2Name|}}}}}} | returnType = {{{alt2RetType|{{{returnType|void}}} }}} | returnVal = {{{alt2RetVal|{{{returnVal|}}} }}} | referenceType = {{{alt2RefType|{{{referenceType|}}} }}} | referenceOpt = {{{alt2RefOpt|{{{referenceOpt|}}} }}} | arguments = {{{alt2Args|}}} }}<!--
-->{{{alias}}}<!--


arguments
Second Alternate Alias:
-->{{ #if: {{{arguments|}}} | {{{arguments}}} |<!-- no Arguments -->}}|<!-- no Alias -->}}<!--
-->{{ #if: {{{alt2Alias|}}} | &nbsp;
{{FunctionSyntax | name = {{{alt2Alias}}} | returnType = {{{alt2RetType|{{{returnType|void}}} }}} | returnVal = {{{alt2RetVal|{{{returnVal|}}} }}} | referenceType = {{{alt2RefType|{{{referenceType|}}} }}} | referenceOpt = {{{alt2RefOpt|{{{referenceOpt|}}} }}} | arguments = {{{alt2Args|}}} }} | <!--no alt alias--> }} | <!--no alt--> }}<!--


short summary of the function: -->
short summary of the function: -->
Line 124: Line 155:
  {{{example}}} |<!-- no Example -->}}<!--
  {{{example}}} |<!-- no Example -->}}<!--


categorization code (needs something clever): -->{{{CategoryList|}}}</includeonly>
categorization code (needs something clever): -->{{{CategoryList|}}}</includeonly><noinclude>


[[Category:Templates|Function]]
[[Category:Templates|Function]]
[[Category:Structural Templates|Function]]
[[Category:Structural Templates|Function]]
</noinclude>

Latest revision as of 00:21, 5 January 2012


This template is used to create correctly-formatted function documentation pages. Primarily for the sake of standardizing the syntax sections.

{{Function
  | origin            = whether the function came from the CS itself or was added by OBSE.
                        valid values: CS1 (TES CS 1.0), CS1.1 (TES CS 1.1), CS1.2 (TES CS 1.2), OBSE
  | summary           = description of the function

  | name              = the name of the function. The page name is the default value.
  | alias             = An abbreviated version of the function name that can be
                        used instead of the long name.
  | returnVal         = what the function returns.
  | returnType        = the type of the returned value.
  | referenceType     = if appropriate, the type of reference that the function may be called
                        on with the dot syntax
  | referenceOpt      = if can take a reference, whether it must take a reference.
  | arguments         = List of arguments specified using the {{FunctionArgument}} template,
                        or any other wiki syntax.

  | altName           = the name of an alternate version of a function (e.g. the "C" Magic Effect functions)
  | altAlias          = the alias of the alternate function.
  | altRetVal         = the return value of the alternate function, if different. Defaults to the same as the regular function.
  | altRetType        = the return type of the alternate function, if different. Defaults to the same as the regular function.
  | altRefType        = if different from the regular function, the reference used by the alternate version.
  | altRefOpt         = whether the alternate's reference is optional.
  | altArgs           = List of arguments for the alternate version of the function.

  | alt2Name          = the name of a second alternate version of a function
  | alt2Alias         = the alias of any second alternate version of a function
  | alt2RetVal         = the return value of the second alternate function, if different. Defaults to the same as the regular function.
  | alt2RetType        = the return type of the second alternate function, if different. Defaults to the same as the regular function.
  | alt2RefType        = if different from the regular function, the reference used by the second alternate version.
  | alt2RefOpt         = whether the second alternate's reference is optional.
  | alt2Args          = List of arguments for the second alternate version of the function.

  | example           = optionally, the function used as part of a script to serve as an example
  | CategoryList      = the list of categories to which the page belongs
}}

Example

{{Function
 |origin = OBSE
 |summary = Sets the constant effect barter factor of the magic effect.
 |name = SetMagicEffectBarterFactor
 |alias = SetMEBarterFactor
 |altName = SetMagicEffectBarterFactorC
 |altAlias = SetMEBarterFactorC
 |returnVal = nothing
 |returnType = void
 |arguments = 
  {{FunctionArgument
   |Name = newBarterFactor
   |Type = float
  }}{{FunctionArgument
   |Name = effect
   |Type = chars
  }}
 |altArgs = 
  {{FunctionArgument
   |Name = newBarterFactor
   |Type = float
  }}{{FunctionArgument
   |Name = effectCode
   |Type = long
  }}
 |example = SetMagicEffectBarterFactor 5 FIDG
 SetMEBarterFactorC 1.5 1397247044 ; code for SHLD
}}

Result

A function added by the Oblivion Script Extender.

Syntax:

(nothing) SetMagicEffectBarterFactor   
(nothing) SetMEBarterFactor   
(nothing) SetMagicEffectBarterFactorC   
(nothing) SetMEBarterFactorC

Sets the constant effect barter factor of the magic effect.

Example

SetMagicEffectBarterFactor 5 FIDG
SetMEBarterFactorC 1.5 1397247044 ; code for SHLD