diff --git a/doc/type/index.txt b/doc/type/index.txt index b09ca989..e8d40439 100644 --- a/doc/type/index.txt +++ b/doc/type/index.txt @@ -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. --Enumerations-- -| [[type:alignment]] Alignment of text and images -| [[type:direction]] Direction of text -| [[type:combine]] How to combine images with the background -| [[type:symbol combine]] How to combine [[type:symbol part|symbol shapes]] with the background +| [[type:alignment]] Alignment of text and images. +| [[type:direction]] Direction of text. +| [[type:combine]] How to combine images 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-- | [[type:string]] Text, @"abc"@ diff --git a/doc/type/keyword.txt b/doc/type/keyword.txt index e69de29b..6489b8fe 100644 --- a/doc/type/keyword.txt +++ b/doc/type/keyword.txt @@ -0,0 +1,27 @@ +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, @"type"@ 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 cost +> mode: core +> reminder: {param1}: Attach to target creature you control. Equip only as a sorcery. diff --git a/doc/type/keyword_mode.txt b/doc/type/keyword_mode.txt index e69de29b..4bb11288 100644 --- a/doc/type/keyword_mode.txt +++ b/doc/type/keyword_mode.txt @@ -0,0 +1,22 @@ +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 diff --git a/doc/type/keyword_param_reference_script.txt b/doc/type/keyword_param_reference_script.txt new file mode 100644 index 00000000..a2c10c87 --- /dev/null +++ b/doc/type/keyword_param_reference_script.txt @@ -0,0 +1,25 @@ +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.
+ This means you will likely need to do some escaping.
+ 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})\} diff --git a/doc/type/keyword_param_type.txt b/doc/type/keyword_param_type.txt index e69de29b..b7855f0b 100644 --- a/doc/type/keyword_param_type.txt +++ b/doc/type/keyword_param_type.txt @@ -0,0 +1,40 @@ +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,
for example @"Cycling "@ would become @"Cycling cost"@. +| @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.
+ 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 "@. + 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})\} diff --git a/doc/type/regex.txt b/doc/type/regex.txt index e69de29b..f90a3102 100644 --- a/doc/type/regex.txt +++ b/doc/type/regex.txt @@ -0,0 +1,2 @@ +Primitive type: regular expression +