Commit d1574f12 authored by twanvl's avatar twanvl

Lots of data type descriptions

parent e3c17370
Enumeration: alignment
Specifies how text and images are aligned in boxes.
An alignment consists of a vertical and a horizontal component.
Optionally there are some modifiers.
--Script syntax--
In scripts, alignment is passed around as a string.
--Possible values--
The value is a combination of one or more flags, separated by spaces.
! Value Description
| @left@ Horizontally, align at the left
| @center@ Horizontally, align in the middle
| @right@ Horizontally, align at the right
| @top@ Vertically, align at the top
| @middle@ Vertically, align in the middle
| @bottom@ Vertically, align at the bottom
| @justify@ Move characters apart or together to exactly fill the width of the box.
| @justify-words@ Move words apart or together to exactly fill the width of the box.
| @justify-overflow@ If the text becomes to long, move characters closer together.
| @stretch Stretch text, so it always fills the width of the box.<br/>
For images; stretch them, but preserve the aspect ratio.
| @stretch-overflow@ Stretch (compress) the text when it becomes too long.
--Examples--
> alignment: top left
> alignment: middle center
> alignment: { "middle" + " " + "left" }
Primitive type: boolean
A boolean is either @true@ or @false@.
In a script, numbers are implicitly converted to booleans, a non-zero number is @true@, 0 is @false@.
When converted to a number, @true@ becomes @1@ and @false@ becomes @0@.
The strings @"yes"@ and @"no"@ can also be converted to booleans.
--File syntax--
> boolean: true
> boolean: false
--Script syntax--
> true or false
The operators @or@, @and@ and @xor@ combine two booleans:
! @a@ @b@ <tt>a or b</tt> <tt>a and b</tt> <tt>a xor b</tt>
| @false@ @false@ @false@ @false@ @false@
| @false@ @true@ @true@ @false@ @true@
| @true@ @false@ @true@ @false@ @true@
| @true@ @true@ @true@ @true@ @false@
==Data type: image combine type== Enumeration: image combine type
This specifies how an image is to be combined with the background. This specifies how an image is to be combined with the background.
This is similair to the feature found in more advanced drawing programs. This is similair to the feature found in more advanced drawing programs.
The formula's are from [[http://www.pegtop.net/delphi/articles/blendmodes/]].
--Script syntax--
In scripts, combine modes are stored as a string.
--Possible values-- --Possible values--
| overlay ! Value Description
\ No newline at end of file | @normal@ Normal behaviour, don't combine.
| @add@
| @subtract@
| @stamp@
| @difference@
| @negation@
| @multiply@
| @darken@
| @lighten@
| @color dodge@
| @color burn@
| @screen@
| @overlay@
| @hard light@
| @soft light@
| @reflect@
| @glow@
| @freeze@
| @heat@
| <tt>and</tt> Bitwise and
| <tt>or</tt> Bitwise or
| <tt>xor</tt> Bitwise xot
| @shadow@ Dark colors normally, white colors darken the background.
| @symmetric overlay@ @(overlay(a,b) + overlay(b,a)) / 2@
--Examples--
> combine: overlay
> combine_image(image1: ..., image2: ..., combine: "shadow")
Enumeration: direction
Specifies the direction of text flow in a text box.
--Script syntax--
In scripts, direction is passed around as a string.
--Possible values--
! Value Description
| @left to right@ Text starts at the left.
| @right to left@ Text starts at the right ''(currently not implemented)''
| @top to bottom@ Text starts at the top, each character is on a new line.
| @bottom to top@ Text starts at the bottom ''(currently not implemented)''
| @horizontal@ Same as @left to right@.
| @vertical@ Same as @top to bottom@.
--Examples--
> direction: horizontal
> direction: top to bottom
Primitive type: real number
Real or floating point numbers are numbers with a decimal point.
Conversio from integer to real numbers happens automatically in scripting.
--File syntax--
> something: 123
> something: 0.5
--Script syntax--
> 123.1 + 456 * -1
--See also--
* [[type:int]]
Primitve type: filename
Filenames are regular [[type:string]]s, pointing to a file.
There are two types of filenames, relative and absolute:
! Syntax Description
| <tt>path/to/file</tt> A relative file, this is retrieved from the current package.
i.e. for a filename in a stylesheet, the file is retrieved from that stylesheet.
| <tt>/package/path/to/file</tt> An absolute filename includes the name of the package. This is a package somewhere in the MSE data directory.
Don't forget the double quotes (@""@) in scripts.
...@@ -20,21 +20,21 @@ Such a package contains a data file called <tt>game</tt> that has the following ...@@ -20,21 +20,21 @@ Such a package contains a data file called <tt>game</tt> that has the following
| @mse version@ [[type:version]] ''required'' Version of MSE this game is made for. | @mse version@ [[type:version]] ''required'' Version of MSE this game is made for.
| @short name@ [[type:string]] file name A short name of this game, for the 'new set' list. | @short name@ [[type:string]] file name A short name of this game, for the 'new set' list.
| @full name@ [[type:string]] file name A longer name of this game. | @full name@ [[type:string]] file name A longer name of this game.
| @icon@ [[type:filename]] ''none'' Filename of an icon for this card, for the 'new set' list. | @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this game, for the 'new set' list.
| @position hint@ [[type:int]] &infin; Where to place this item in the 'new set' list? Lower numbers come first. | @position hint@ [[type:int]] &infin; Where to place this item in the 'new set' list? Lower numbers come first.
| @version@ [[type:version]] @0.0.0@ Version number of this package. | @version@ [[type:version]] @0.0.0@ Version number of this package.
| @depends on@ [[type:list]] of [[type:dependency]]s | @depends on@ [[type:list]] of [[type:dependency]]s
Packages this package depends on. Packages this package depends on.
| '''Specific to games''' <<< <<< <<< | '''Specific to games''' <<< <<< <<<
| @init script@ [[type:script]] @;@ Script to run when this game is loaded, can set variables | @init script@ [[type:script]] @;@ Script to run when this game is loaded,<br/> can set variables
to be used by other scripts in this game or stylesheets using it. to be used by other scripts in this game or stylesheets using it.
| @set fields@ [[type:list]] of [[type:field]]s Fields for the styling panel. | @set fields@ [[type:list]] of [[type:field]]s Fields for the styling panel.
| @default set style@ [[type:indexmap]] of [[type:style]]s Default style for the set fields, can be overriden by the stylesheet. | @default set style@ [[type:indexmap]] of [[type:style]]s Default style for the set fields, can be overriden by the stylesheet.
| @card fields@ [[type:list]] of [[type:field]]s Fields for each card. | @card fields@ [[type:list]] of [[type:field]]s Fields for each card.
| @card list color script@ [[type:script]] from fields Script that determines the color of an item in the card list. If not set uses the @card list colors@ property of the first card field that has it. | @card list color script@ [[type:script]] from fields Script that determines the color of an item in the card list. <br/>If not set uses the @card list colors@ property of the first card field that has it.
| @statistics dimensions@ [[type:list]] of [[type:statistics dimension]]s from fields Dimensions for statistics, a dimension is rougly the same as an axis. By default all card fields with 'show statistics' set to true are used. | @statistics dimensions@ [[type:list]] of [[type:statistics dimension]]s from fields Dimensions for statistics, a dimension is rougly the same as an axis. <br/>By default all card fields with 'show statistics' set to true are used.
| @statistics categories@ [[type:list]] of [[type:statistics category]]s from dimensions Choices shown on the statistics panel. By default all statistics dimensions are used. | @statistics categories@ [[type:list]] of [[type:statistics category]]s from dimensions Choices shown on the statistics panel. <br/>By default all statistics dimensions are used.
| @has keywords@ [[type:boolean]] @false@ Does this game use keywords? Should the keywords tab be available? | @has keywords@ [[type:boolean]] @false@ Does this game use keywords? Should the keywords tab be available?
| @keyword match script@ [[type:script]] @;@ Script to apply to the @match@ property of keywords. | @keyword match script@ [[type:script]] @;@ Script to apply to the @match@ property of keywords.
| @keyword modes@ [[type:list]] of [[type:keyword mode]]s Choices for the 'mode' property of keywords. | @keyword modes@ [[type:list]] of [[type:keyword mode]]s Choices for the 'mode' property of keywords.
......
...@@ -23,8 +23,13 @@ These contain several properties, similair to the file types. But they are part ...@@ -23,8 +23,13 @@ These contain several properties, similair to the file types. But they are part
| [[type:value]] The value in a field, for a particular card. | [[type:value]] The value in a field, for a particular card.
| [[type:card]] A card containing values. | [[type:card]] A card containing values.
| [[type:keyword]] A keyword. | [[type:keyword]] A keyword.
| [[type:keyword mode]] A possible mode for keywords.
| [[type:keyword param type]] A type of parameters for keywords.
| [[type:statistics dimension]] A dimension for the statistics panel.
| [[type:statistics category]] A category for the statistics panel.
| [[type:font]] Description of a font. | [[type:font]] Description of a font.
| [[type:symbol part]] Part of a [[type:symbol]]. | [[type:symbol part]] Part of a [[type:symbol]].
| [[type:control point]] A point on in a symbol part.
--Collection types-- --Collection types--
| [[type:list]] Lists of items | [[type:list]] Lists of items
...@@ -42,8 +47,18 @@ These contain several properties, similair to the file types. But they are part ...@@ -42,8 +47,18 @@ These contain several properties, similair to the file types. But they are part
| [[type:image]] An image defined by a script. | [[type:image]] An image defined by a script.
| [[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--
| [[type:alignment]] Alignment of text and images
| [[type:direction]] Direction of text
| [[type:combine]] How to combine images with the background
--Primitive types-- --Primitive types--
| [[type:string]] Text, @"abc"@ | [[type:string]] Text, @"abc"@
| [[type:tagged string]] Text with tags
| [[type:filename]] Filenames
| [[type:regex]] Regular expression strings
| [[type:boolean]] @true@ or @false@
| [[type:int]] Integer numbers, @1, 2, 100@ | [[type:int]] Integer numbers, @1, 2, 100@
| [[type:double]] Real numbers, @1, 0.5, 21.3@ | [[type:double]] Real numbers, @1, 0.5, 21.3@
| [[type:version]] Version numbers
| [[type:color]] Colors | [[type:color]] Colors
Primitive type: integer number
Integer numbers are numbers without a decimal point.
In many cases negative numbers don't make sense, but the program never complains about them.
--File syntax--
> something: 123
--Script syntax--
> 123 + 456 * -1
--See also--
* [[type:double]]
...@@ -21,6 +21,7 @@ The first element of a list is numbered 0, the next 1, etc. ...@@ -21,6 +21,7 @@ The first element of a list is numbered 0, the next 1, etc.
> list.0 # The first element of the list 'list' > list.0 # The first element of the list 'list'
> list[0] # The same thing > list[0] # The same thing
--Functions--
There are several functions for working with lists: There are several functions for working with lists:
| [[fun:position]] Find the position of an element in a list | [[fun:position]] Find the position of an element in a list
| [[fun:number_of_items]] Find the number of items in a list | [[fun:number_of_items]] Find the number of items in a list
......
==Object type: Set== File type: Set
--Package-- --Overview--
A set is described in a package with the <tt>.mse-set</tt> file extension,
Sets are part of the [[file:style triangle]]:
| Description Looks Data
| [[type:Game]] [[type:Stylesheet]] '''Set'''
| [[type:Field]] [[type:Style]] [[type:Value]]
--Package format--
A set is described in a [[file:package]] with the <tt>.mse-set</tt> file extension,
such a package contains a data file called <tt>set</tt>. such a package contains a data file called <tt>set</tt>.
--Properties-- --Properties--
| game Name of a [[type:game]] The game this set is made for. ! Property Type Default Description
| stylesheet Name of a [[type:stylesheet]] The default style for drawing cards in this set. | '''Common to all packages''' <<< <<< <<<
| @mse version@ [[type:version]] ''required'' Version of MSE this set is made with.
| @short name@ [[type:string]] file name Name of this set.
| @depends on@ [[type:list]] of [[type:dependency]]s
Packages this package depends on.
| '''Specific to sets''' <<< <<< <<<
| game Name of a [[type:game]] ''required'' The game this set is made for.
| stylesheet Name of a [[type:stylesheet]] ''required'' The default style for drawing cards in this set.
| set info [[type:indexmap]] of [[type:value]]s The data for the [[prop:game:set fields]] defined in the game. | set info [[type:indexmap]] of [[type:value]]s The data for the [[prop:game:set fields]] defined in the game.
| styling [[type:indexmap]] of [[type:value]]s | styling [[type:map]] of [[type:indexmap]]s of [[type:value]]s
Data for the 'extra fields' of the stylesheet.<br/>
This is first indexed by stylesheet name, then by field name.<br/>
Data is given not only for the set's stylesheet but also for those of cards.
| cards [[type:list] of [[type:card]]s The cards in the set. | cards [[type:list] of [[type:card]]s The cards in the set.
| keywords [[type:list] of [[type:keyword]]s The custom keywords in the set.
--Example-- --Example--
|- If the game looks like:
| <tt>set info:</tt> >mse version: 0.3.4
| Contains custom information about the set, corresponding to the <tt>set field</tt>s in the game. >name: my game
|- >set field:
| <tt>extra set info:</tt> > name: copyright
| Contains information about the set for a specific style, corresponding to the <tt>extra field</tt>s in the style. <br> > type: text
Stored with an index for the game, see the example below. >card field:
|- > name: card name
| <tt>card:<br>card:<br><i>...</i></tt> > type: text
| Contains information about each card, corresponding to the <tt>card field</tt>s in the game. >card field:
|- > name: power
| <tt>keyword:<br>keyword:<br><i>...</i></tt> > type: text
| Extra keywords specific to this set, in addition to those defined in the game. The the a set file would looks like:
For more information see the <a href="/extending/game">game file</a> >mse version: 0.3.4
|} >game: my game
>name: my set
The <tt>set info</tt> and <tt>card</tt>s contain a list of keys that correspond to the names fields in the game, >set info:
For example if the game looks like: > copyright: something
name: my game >extra set info:
set field: > name of style:
name: copyright > name of field: something
type: text >card:
card field: > card name: first card
name: card name > power: 100
type: text >card:
card field: > card name: second card
name: power > power: 50
type: text
The the set file looks like:
game: my game
name: my set
set info:
copyright: something
extra set info:
name-of-style:
name-of-field: something
card:
card name: first card
power: 100
card:
card name: second card
power: 50
The value that is stored depends on the type of field of course, in the above example the fields have <tt>type: text</tt>, so the value is just the text.
For other types of fields the value is encoded as follows:
{|
! Attribute !! Description
|-
| <tt>text</tt>
| The text that is stored in the field. This text can contain <a href="/extending/tags">tags</a>.
|-
| <tt>choice</tt>
| One of the choices specified in the game.
|-
| <tt>boolean</tt>
| One of <tt>yes</tt> or <tt>no</tt>.
|-
| <tt>color</tt>
| The color is encoded as <tt>rgb(red,green,blue)</tt> where red, green and blue are numbers between 0 and 255 that indicate the color components.
|-
| <tt>image</tt>
| The filename containing the image, this file must also be in the set package. It can be empty to indicate that no image is selected.
|-
| <tt>symbol</tt>
| The filename containing the <a href="/extending/symbol">symbol specification</a>, this file must also be in the set package.
It can be empty to indicate that no symbol is selected.
|}
If a field has the default value (calculated by the default script), then the field name and value are ommited from the set file.
==Data type: character string== Primitive type: character string
A string is just a piece of text.
--File syntax-- --File syntax--
In files, strings are written just as their value:
> string: this is some string
The whitespace at the beginning is removed by the program.
Multiline strings are written on a new line, indented by a TAB:
> string:
> This is a very long string
> It contains a line break.
--Script syntax-- --Script syntax--
In scripts, strings are written between double quotes, @"this is a string"@.
The backslash character is used to escape values:
! Code Represents
| @\"@ A " character
| @\{@ A { character
| @\n@ A newline character (line break)
| @\\@ A backslash
| @\<@ An escaped &lt; for [[type:tagged string]]s.
Sections between curly braces are interpreted as script code, that is concatentated with the string, for example
> "ab{1 + 1}c" == "ab2c"
This can be nested arbitrarily.
The @+@ operator concatenates strings. Numbers and most other values are automatically converted to strings when needed.
Object type: Stylesheet Object type: Stylesheet
--Overview--
Stylesheets are part of the [[file:style triangle]]:
| Description Looks Data
| [[type:Game]] '''Stylesheet''' [[type:Set]]
| [[type:Field]] [[type:Style]] [[type:Value]]
Stylesheets provide the ''look and feel'' of cards.
--Package format--
A stylesheet is described in a [[file:package]] with the <tt>.mse-style</tt> file extension,
such a package contains a data file called <tt>style</tt>.
--Properties-- --Properties--
| @game@ Name of a [[type:game]] Game this stylesheet is made for ! Property Type Default Description
| @init script@ [[type:script]] | '''Common to all packages''' <<< <<< <<<
| @card width@ [[type:double]] Width of cards in pixels | @mse version@ [[type:version]] ''required'' Version of MSE this stylesheet is made for.
| @card height@ [[type:double]] Height of cards in pixels | @short name@ [[type:string]] file name A short name of this stylesheet, for the 'new set' and style panel lists.
| @card dpi@ [[type:double]] Resoltion of cards in dots-per-inch | @full name@ [[type:string]] file name A longer name of this stylesheet.
| @card background@ [[type:color]] Background color of cards | @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this stylesheet, for the 'new set' and style panel lists.
| @card style@ [[type:indexmap] of [[type:style]]s Styles for the [[property:game:card fields]] defined in the game | @position hint@ [[type:int]] &infin; Where to place this item in the list? Lower numbers come first.
| | @version@ [[type:version]] @0.0.0@ Version number of this package.
| @depends on@ [[type:list]] of [[type:dependency]]s
Packages this package depends on.
| '''Specific to stylesheets''' <<< <<< <<<
| @game@ Name of a [[type:game]] ''required'' Game this stylesheet is made for
| @card width@ [[type:double]] 100 Width of cards in pixels
| @card height@ [[type:double]] 100 Height of cards in pixels
| @card dpi@ [[type:double]] 96 Resoltion of cards in dots-per-inch
| @card background@ [[type:color]] white Background color of cards
| @init script@ [[type:script]] @;@ Script to run when this stylesheet is loaded, after the game's init script.
| @styling fields@ [[type:list] of [[type:field]]s Fields for styling options, shown on the 'style' panel.
| @styling style@ [[type:indexmap] of [[type:style]]s Styles for the styling fields.
| @set info style@ [[type:indexmap] of [[type:style]]s game.default_set_style Styling for the 'set info' panel
| @card style@ [[type:indexmap] of [[type:style]]s Styles for the card fields defined in the game
| @extra card fields@ [[type:list] of [[type:field]]s Additional fields to add to each card.<br/>
These fields are intended for things like lines and boxes, whose value is determined automatically.
| @extra card style@ [[type:indexmap] of [[type:style]]s Styling for the extra card fields
Primitive type: version number
--File syntax--
A version number consists of three components, in the form "a.b.c".
Higher numbers mean newer versions.
The version number can also be a date, of the form "YYYY-MM-DD"
--Examples--
> version: 1.2.3
> version: 2007-07-12
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