Difference between revisions of "Template:Function"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
imported>DragoonWraith
(I'm too tired to do this right now; reverting.)
Line 108: Line 108:
'''Syntax:'''
'''Syntax:'''
<!-- return value:
<!-- return value:
--> ({{ #ifeq: {{{returnVal|nothing}}} | nothing | | {{{returnVal}}} }}{{ #if: {{{returnType|}}} | {{ #if: {{{returnVal|}}} | : | }}{{{returnType}}} | void }})&nbsp;<!--
--> {{ #ifeq: {{{returnType|void}}} | void | (void)&nbsp; |({{ #if: {{{returnVal|}}} | {{{returnVal}}}<nowiki>:</nowiki> |}}<!--
 
return type (short, float, base object, ref, something else?):
-->{{ #ifeq: {{{returnType|missing}}} | missing | '''missing return type!''' | {{{returnType}}})&nbsp; }} }}<!--


optional reference type (actor, activator, door, etc.):
optional reference type (actor, activator, door, etc.):
Line 120: Line 123:


FOR ALIAS: return value:
FOR ALIAS: return value:
-->{{ #if: {{{alias|}}} |<br/><!--
-->{{ #if: {{{alias|}}} |<br/>{{ #ifeq: {{{returnType|void}}} | void | (void)&nbsp; |({{ #if: {{{returnVal|}}} | {{{returnVal}}}<nowiki>:</nowiki> |}}<!--
 
return value:
--> ({{ #ifeq: {{{returnVal|nothing}}} | nothing | | {{{returnVal}}} }}<!--


return type (short, float, base object, ref, something else?):
return type (short, float, base object, ref, something else?):
-->{{ #if: {{{returnType|}}} | {{#if:{{{returnVal|}}}|:|}}{{{returnType}}} | void }}<!--
-->{{ #ifeq: {{{returnType|missing}}} | missing | '''missing return type!''' | {{{returnType}}})&nbsp; }} }}<!--
 
-->)&nbsp;<!--


optional reference type (actor, activator, door, etc.):
optional reference type (actor, activator, door, etc.):
Line 140: Line 138:


FOR ALTERNATE:
FOR ALTERNATE:
-->{{ #if: {{{altName|}}} |&nbsp;<!--
-->{{ #if: {{{altName|}}} |&nbsp;


return value:
{{ #ifeq: {{{returnType|void}}} | void | (void)&nbsp; |({{ #if: {{{returnVal|}}} | {{{returnVal}}}<nowiki>:</nowiki> |}}<!--
--> ({{ #ifeq: {{{returnVal|nothing}}} | nothing | | {{{returnVal}}} }}<!--


return type (short, float, base object, ref, something else?):
return type (short, float, base object, ref, something else?):
-->{{ #if: {{{returnType|}}} | {{#if:{{{returnVal|}}}|:|}}{{{returnType}}} | void }}<!--
-->{{ #ifeq: {{{returnType|missing}}} | missing | '''missing return type!''' | {{{returnType}}})&nbsp; }} }}<!--
 
-->)&nbsp;<!--


optional reference type (actor, activator, door, etc.):
optional reference type (actor, activator, door, etc.):
Line 160: Line 155:


FOR ALTERNATE ALIAS: return value:
FOR ALTERNATE ALIAS: return value:
-->{{ #if: {{{altAlias|}}} |<br/><!--
-->{{ #if: {{{altAlias|}}} |<br/>{{ #ifeq: {{{returnType|void}}} | void | (void)&nbsp; |({{ #if: {{{returnVal|}}} | {{{returnVal}}}<nowiki>:</nowiki> |}}<!--
 
return value:
--> ({{ #ifeq: {{{returnVal|nothing}}} | nothing | | {{{returnVal}}} }}<!--


return type (short, float, base object, ref, something else?):
return type (short, float, base object, ref, something else?):
-->{{ #if: {{{returnType|}}} | {{#if:{{{returnVal|}}}|:|}}{{{returnType}}} | void }}<!--
-->{{ #ifeq: {{{returnType|missing}}} | missing | '''missing return type!''' | {{{returnType}}})&nbsp; }} }}<!--
 
-->)&nbsp;<!--


optional reference type (actor, activator, door, etc.):
optional reference type (actor, activator, door, etc.):
Line 180: Line 170:


FOR 2nd ALTERNATE:
FOR 2nd ALTERNATE:
-->{{ #if: {{{alt2Name|}}} |&nbsp;<!--
-->{{ #if: {{{alt2Name|}}} |&nbsp;


return value:
{{ #ifeq: {{{returnType|void}}} | void | (void)&nbsp; |({{ #if: {{{returnVal|}}} | {{{returnVal}}}<nowiki>:</nowiki> |}}<!--
--> ({{ #ifeq: {{{returnVal|nothing}}} | nothing | | {{{returnVal}}} }}<!--


return type (short, float, base object, ref, something else?):
return type (short, float, base object, ref, something else?):
-->{{ #if: {{{returnType|}}} | {{#if:{{{returnVal|}}}|:|}}{{{returnType}}} | void }}<!--
-->{{ #ifeq: {{{returnType|missing}}} | missing | '''missing return type!''' | {{{returnType}}})&nbsp; }} }}<!--
 
-->)&nbsp;<!--


optional reference type (actor, activator, door, etc.):
optional reference type (actor, activator, door, etc.):
Line 200: Line 187:


FOR 2nd ALTERNATE ALIAS: return value:
FOR 2nd ALTERNATE ALIAS: return value:
-->{{ #if: {{{alt2Alias|}}} |<br/><!--
-->{{ #if: {{{alt2Alias|}}} |<br/>{{ #ifeq: {{{returnType|void}}} | void | (void)&nbsp; |({{ #if: {{{returnVal|}}} | {{{returnVal}}}<nowiki>:</nowiki> |}}<!--
 
return value:
--> ({{ #ifeq: {{{returnVal|nothing}}} | nothing | | {{{returnVal}}} }}<!--


return type (short, float, base object, ref, something else?):
return type (short, float, base object, ref, something else?):
-->{{ #if: {{{returnType|}}} | {{#if:{{{returnVal|}}}|:|}}{{{returnType}}} | void }}<!--
-->{{ #ifeq: {{{returnType|missing}}} | missing | '''missing return type!''' | {{{returnType}}})&nbsp; }} }}<!--
 
-->)&nbsp;<!--


optional reference type (actor, activator, door, etc.):
optional reference type (actor, activator, door, etc.):

Revision as of 23:53, 12 August 2010



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.

{{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.
 altName           = the name of an alternate version of a function (e.g. the "C" Magic Effect functions)
 altAlias          = the alias of the alternate function.
 alt2Name          = the name of a second alternate version of a function
 alt2Alias         = the alias of any second alternate version of a function
 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.
 altArgs           = List of arguments for the alternate version of the function.
 alt2Args          = List of arguments for the 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:

(void) SetMagicEffectBarterFactor  
(void) SetMEBarterFactor   
(void) SetMagicEffectBarterFactorC  
(void) SetMEBarterFactorC  

Sets the constant effect barter factor of the magic effect.

Example

SetMagicEffectBarterFactor 5 FIDG
SetMEBarterFactorC 1.5 1397247044 ; code for SHLD