Template talk:ScriptEvent

From modwiki

Jump to: navigation, search

Intro

Templates eliminate redundancy by simplifying the task of writing specially formatted articles to that of filling out a form. In this way, pages can be made consistant without the need to edit the markup of individual articles.

By making a change to a specific template, one can apply changes across the wiki wherever that specific template is used.

This template's purpose is to ensure the consistancy of all script event articles. Learning it's use and employing it is encouraged for users who intend to make regular contributions to the script events section of the wiki.

How to use this template

For the sake of simplicity, this template and any other template can be invoked using the following markup ...

{{ScriptEvent}}

... where ScriptEvent could be replaced with the name of any template used on this wiki. Used as such it would produce a page looking like this.

Note that the resulting page is devoid of any real content. This is because the ScriptEvent template in particular uses five parameters -- description, usage, parameters, examples, and notes -- to fill in the various sections.

That said, by providing the template with values for each parameter, one can produce a script event article with appropriate content.

Passing all five parameters to the ScriptEvent template can be accomplished with the following markup ...

{{ScriptEvent | description= | usage= | parameters= | examples= | notes= }}

Note how the name of the template and all 5 parameters are separated with the pipe character. Also note that each parameter is followed by an equals sign.

We will go over the purpose and expected use of each parameter in the sections that follow.

Description

This field is used to describe what a given script event does. In other words, it should contain the answer to the question "what does this script event do?"

In practice, providing this information to the template is as simple as typing your answer after the equals sign like so...

{{ScriptEvent | description= This script event does this. | usage= | parameters= | examples= | notes= }}

Of course reading over and/or editing a lengthy template call can prove difficult if it's all on a single line so it's encouraged that one split the call into multiple lines for the sake of legibility like so...

{{ScriptEvent
| description= This script event does this.
| usage=
| parameters=
| examples=
| notes= }}

And this will be the course of action used in the examples to follow.

Usage

This field is used to describe how a script event should be called.

Generally speaking, it should mimick the appearance of the script event in practical use with the exception that returned data types and parameters are emphasized with special use of bold or italic text.

Case in point, at the time of this writing the script event activate used the following for usage...

void activate( entity activator )

Here the term void is used to describe the data type returned by this script event. Since no data is returned, it is deemed void. Since this term would not appear in practical use, and is only used to emphasize the data type it is italicized.

The term activate appears as normal since it is the name of the script event and appears as it would in practical use. The same is true of the parenthasis.

The term entity is used to describe the data type expected for the following parameter. Again, since this term would not appear in practical use, and is only used to emphasize the data type of activator, it too is italicized.

The term activator is a descriptive term used to illustrate what kind of value is expected by the script event. To emphasize that this term is a parameter and does not have to be explicitly named as shown, it is highlighted in bold print.

To provide this information to the template, it's as simple as typing the markup after the equals sign like so...

{{ScriptEvent
| description= This script event does this.
| usage= ''void'' eventName( ''entity'' '''myEntity''')
| parameters=
| examples=
| notes= }}

Note that one can apply bold or italic formatting to a selection of text using the toolbar as described on the editing help page.

Parameters

This field is used to provide a bulleted list of the parameters used in the usage section and a more detailed description of what they entail.

It's encouraged that users format their text for this field as such...

*[myEntity] - An entity.

... and that they use a new line for each parameter.

In practice it should look like this...

{{ScriptEvent
| description= This script event does this.
| usage= ''void'' eventName( ''entity'' '''myEntity''')
| parameters=*[myEntity] - An entity.
| examples=
| notes= }}

Examples

This field is used to provide examples of the script event in use. These can be snippets of code gathered from the game itself or bits you've written yourself.

Please note that this wiki has implemented a special script tag capable of applying syntax highlighting to scripts. By enclosing your examples in this tag they will be colorized based on scripting markup.

Case in point, here is an example...

$my_entity.activate($player1);

The markup for the above script is as such ...

<script>$my_entity.activate($player1);</script>

It's also encouraged to add descriptive notes on what a script snippet does.

Providing this information to the template is as simple as typing the markup after the equals sign like this ...

{{ScriptEvent
| description= This script event does this.
| usage= ''void'' eventName( ''entity'' '''myEntity''')
| parameters=*[myEntity] - An entity.
| examples= This script event is made up and is a bad example ...
<script>eventName($player1);</script>
| notes=}}

Notes

This field is used to provide any extra notes that you feel are worthy of mention. Case in point ...

  • Inconsistancies between various games
  • Cautionary notes
  • Creative uses
  • ect...

Providing this information to the template is as simple as typing the markup after the equals sign like this ...

{{ScriptEvent
| description= This script event does this.
| usage= ''void'' eventName( ''entity'' '''myEntity''')
| parameters=*[myEntity] - An entity.
| examples= This script event is made up and is a bad example ...
<script>eventName($player1);</script>
| notes= This script event is not real. Do not attempt to use it.}}

What the end result looks like

Game class

This event operates on an instance of the game class type {{{gameclass}}}

Description

This script event does this.

Usage

void eventName( entity myEntity)

Parameters

  • [myEntity] - An entity.

Examples

This script event is made up and is a bad example ...

eventName($player1);

Notes

This script event is not real. Do not attempt to use it.


Closing

If you are unsure of what information to provide for a given parameter or the proper markup, post your changes using the template even if you leave fields blank. Also be sure to leave a note on the discussion page where you are free to describe the problem you encountered.

Personal tools
Main
id Tech 5