Commit ccbdc56b authored by twanvl's avatar twanvl

Documented keyword related types

parent 6b1f673a
...@@ -48,10 +48,11 @@ These contain several properties, similair to the file types. But they are part ...@@ -48,10 +48,11 @@ These contain several properties, similair to the file types. But they are part
| [[type:function]] Functions in scripts. These have no direct representation in a file. | [[type:function]] Functions in scripts. These have no direct representation in a file.
--Enumerations-- --Enumerations--
| [[type:alignment]] Alignment of text and images | [[type:alignment]] Alignment of text and images.
| [[type:direction]] Direction of text | [[type:direction]] Direction of text.
| [[type:combine]] How to combine images with the background | [[type:combine]] How to combine images with the background.
| [[type:symbol combine]] How to combine [[type:symbol part|symbol shapes]] with the background | [[type:symbol combine]] How to combine [[type:symbol part|symbol shapes]] with the background.
| [[type:graph type]] Type of statistics graphs.
--Primitive types-- --Primitive types--
| [[type:string]] Text, @"abc"@ | [[type:string]] Text, @"abc"@
......
Data type: keyword
--Overview--
A keyword in a [[type:set]] or a [[type:game]].
A keyword is something that matches a piece of text, and optionally some kind of reminder text can be shown.
--Properties--
! Property Type Default Description
| @keyword@ [[type:string]] ''required'' Name of the keyword.
| @match@ [[type:string]] ''required'' String to match.
| @reminder@ [[type:scriptable]] [[type:string]] ''required'' Script to generate the reminder text of this keyword.
| @rules@ [[type:string]] @""@ Explanation or additional rules for this keyword.
| @mode@ Name of a [[type:keyword mode]] Mode of this keyword.
The match string can include parameters, @"<atom-param>type</atom-param>"@ where @"type"@ is the name of a [[type:keyword param type|keyword parameter type]] in the game.
These will match according to the @match@ property of that parameter type.
When expanding the reminder text @param1@ refers to the first parameter in the match string, @param2@ to the second, etc.
--Example--
>keyword:
> keyword: Equip
> match: Equip <atom-param>cost</atom-param>
> mode: core
> reminder: {param1}: Attach to target creature you control. Equip only as a sorcery.
Data type: keyword mode
--Overview--
A mode for [[type:keyword]]s.
This becomes a choice in the 'mode' box on the keywords panel.
The idea behind modes is that a mode indicates what type of keyword it is, for example an "official" keyword, a "simple" keyword or a "custom" keyword.
This information can then be used to determine whether to expand the reminder text.
--Properties--
! Property Type Default Description
| @name@ [[type:string]] ''required'' Name of the mode, this is shown in the box and used in scripts.
| @description@ [[type:string]] @""@ A description of this mode.
| @is default@ [[type:boolean]] @false@ Is this the default mode for new keywords?
--Example--
>keyword mode:
> name: custom
> description: Custom keywords
> is default: true
Data type: keyword parameter reference script
--Overview--
A wat to use a [[type:keyword param type|keyword parameter]] in a [[type:keyword]]'s reminder text.
Usually the parameters are included as @"{param1}"@, etc.
But in some cases for instance a function should be applied, @"{fun(param1)}"@.
To make this easy for the user, a menu of choices is provided, this type describes such a choice.
--Properties--
! Property Type Default Description
| @name@ [[type:string]] ''required'' Name of the parameter type.
| @description@ [[type:string]] ''required'' A description of the reference script.
| @script@ [[type:script]] ''required'' Script that generates the code using the parameter.<br/>
This means you will likely need to do some escaping.<br/>
In the script, @input@ refers to the name of the parameter, for example @"param1"@.
--Example--
Apply the [[fun:english_number]] function to the parameter:
>refer script:
> name: as words
> description: (one, two, three)
> script: \{english_number({input})\}
Data type: keyword parameter type
--Overview--
A type of parameter that can be used in a [[type:keyword]].
--Properties--
! Property Type Default Description
| @name@ [[type:string]] ''required'' Name of the parameter type.
| @description@ [[type:string]] ''required'' Description of the parameter type.
| @placeholder@ [[type:string]] @name@ of this param type Placeholder to use for empty parameters, the name is used if this is empty.
| @optional@ [[type:boolean]] @true@ Is a placeholder used when a keyword is encountered with no parameter,<br/> for example @"Cycling "@ would become @"Cycling <atom-kwpph>cost</atom-kwpph>"@.
| @match@ [[type:regex]] ''required'' Regular expression that this param type matches.
| @separator before is@ [[type:regex]] @""@ Regular expression of separator before parameters of this type.
| @separator after is@ [[type:regex]] @""@ Regular expression of separator after parameters of this type.
| @eat separator@ [[type:boolean]] @true@ Allow the user to 'type over' the separator.<br/>
For example if the separator is @" "@ in the keyword @"Cycling"@, and the user types @"Cycling"@,
a space and a placeholder is automatically inserted, making @"Cycling <cost>"@.
If the user now presses space the cursor is only moved, no additional space is inserted, the space is 'eaten'.
| @script@ [[type:script]] Script to apply to parameters of this type before substituting them back into the text.
| @reminder script@ [[type:script]] Script to apply to parameters of this type before using them in the reminder text.
| @example@ [[type:string]] Example for in the keyword editor, currently not used.
| @refer scripts@ [[type:list]] of [[type:keyword param reference script]]s
Scripts for inserting paramaters of this type into the reminder text.
To make this easy for the user, a menu of ways to use a parameter is provided.
--Example--
The 'number' parameter type. It matches a sequence of digits.
It can be included in the reminder text directly, or by applying some function first.
>keyword parameter type:
> name: number
> match: [0-9]+
> refer script:
> name: normal
> description: (1,2,3)
> script: \{{input}\}
> refer script:
> name: as words
> description: (one, two, three)
> script: \{english_number({input})\}
Primitive type: regular expression
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment