mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Implement unique IDs and card linking
This commit is contained in:
+60
-60
@@ -322,63 +322,63 @@ POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
==END OF TERMS AND CONDITIONS==
|
||||
|
||||
|
||||
==<a NAME="SEC4" HREF="#TOC4">How to Apply These Terms to Your New Programs</a>==
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
] <one line to give the program's name and a brief idea of what it does.>
|
||||
] Copyright (C) <year> <name of author>
|
||||
]
|
||||
] This program is free software; you can redistribute it and/or modify
|
||||
] it under the terms of the GNU General Public License as published by
|
||||
] the Free Software Foundation; either version 2 of the License, or
|
||||
] (at your option) any later version.
|
||||
]
|
||||
] This program is distributed in the hope that it will be useful,
|
||||
] but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
] MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
] GNU General Public License for more details.
|
||||
]
|
||||
] You should have received a copy of the GNU General Public License
|
||||
] along with this program; if not, write to the Free Software
|
||||
] Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
] Gnomovision version 69, Copyright (C) year name of author
|
||||
] Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
] This is free software, and you are welcome to redistribute it
|
||||
] under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
] Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
] `Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
]
|
||||
] <signature of Ty Coon>, 1 April 1989
|
||||
] Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
||||
==<a NAME="SEC4" HREF="#TOC4">How to Apply These Terms to Your New Programs</a>==
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
] <one line to give the program's name and a brief idea of what it does.>
|
||||
] Copyright (C) <year> <name of author>
|
||||
]
|
||||
] This program is free software; you can redistribute it and/or modify
|
||||
] it under the terms of the GNU General Public License as published by
|
||||
] the Free Software Foundation; either version 2 of the License, or
|
||||
] (at your option) any later version.
|
||||
]
|
||||
] This program is distributed in the hope that it will be useful,
|
||||
] but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
] MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
] GNU General Public License for more details.
|
||||
]
|
||||
] You should have received a copy of the GNU General Public License
|
||||
] along with this program; if not, write to the Free Software
|
||||
] Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
] Gnomovision version 69, Copyright (C) year name of author
|
||||
] Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
] This is free software, and you are welcome to redistribute it
|
||||
] under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
] Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
] `Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
]
|
||||
] <signature of Ty Coon>, 1 April 1989
|
||||
] Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
||||
+7
-7
@@ -33,13 +33,13 @@ A heirachical file can contain a reference to another file:
|
||||
Where filename must be an absolute or relative [[type:filename]].
|
||||
|
||||
That file is included literally into the current one; except for indentation, the included file never escapes from the level the 'include file' line is on.
|
||||
|
||||
If the file to be included can vary depending on the locale that is selected, use:
|
||||
>>>include localized file: <em>filename</em>
|
||||
|
||||
MSE will take the filename and add "_" followed by the name of the currently selected locale at the end of it.
|
||||
So for example, if the locale used is the folder "en.mse-locale", the file that will be included is "filename_en"
|
||||
You must provide a version of the file for each locale found in the data folder, even if it is simply a copy of the english one.
|
||||
|
||||
If the file to be included can vary depending on the locale that is selected, use:
|
||||
>>>include localized file: <em>filename</em>
|
||||
|
||||
MSE will take the filename and add "_" followed by the name of the currently selected locale at the end of it.
|
||||
So for example, if the locale used is the folder "en.mse-locale", the file that will be included is "filename_en"
|
||||
You must provide a version of the file for each locale found in the data folder, even if it is simply a copy of the english one.
|
||||
|
||||
--Example--
|
||||
For example, a [[type:set]] might look like this:
|
||||
|
||||
@@ -5,11 +5,13 @@ Function: crop
|
||||
|
||||
Shrink an image by cutting off some of the image, starting at the position denoted by the offsets. The resulting image size is specified in the parameters.
|
||||
|
||||
Resulting image can be bigger than the original, if offset_x or offset_y are negative, or if width or height are bigger than the original width and height.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:image]] Image to enlarge
|
||||
| @height@ [[type:double]] Height of the resulting image
|
||||
| @width@ [[type:double]] Width of the resulting image
|
||||
| @offset_x@ [[type:double]] Offset of crop, horizontally
|
||||
| @offset_y@ [[type:double]] Offset of crop, vertically
|
||||
| @height@ [[type:double]] Height of the resulting image, in pixels
|
||||
| @width@ [[type:double]] Width of the resulting image, in pixels
|
||||
| @offset_x@ [[type:double]] Offset of crop, horizontally, in pixels
|
||||
| @offset_y@ [[type:double]] Offset of crop, vertically, in pixels
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Function: dimensions_of
|
||||
|
||||
--Usage--
|
||||
> dimensions_of(input: image)
|
||||
|
||||
Returns an array containing the width and height of the image in pixels.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:image]] Image to whos dimensions we want.
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Function: get_card_from_link
|
||||
|
||||
--Usage--
|
||||
> get_card_from_link(card: card, "link type")
|
||||
|
||||
Inspects a given [[type:card]]'s links to find one of the given type, and returns the linked card.
|
||||
Returns nil if no card was found.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:string]] The type of link we want to find.
|
||||
| @card@ [[type:card]] The card whose links we'll inspect.
|
||||
| @set@ [[type:set]] The set in which to look. This can be omited since 'set' is a predefined variable.
|
||||
@@ -0,0 +1,12 @@
|
||||
Function: get_card_from_uid
|
||||
|
||||
--Usage--
|
||||
> get_card_from_uid(input: "uid")
|
||||
|
||||
Returns the [[type:card]] with the given uid inside the set.
|
||||
Returns nil if no card was found.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:string]] The uid of the card we want to retrieve.
|
||||
| @set@ [[type:set]] The set in which to look. This can be omited since 'set' is a predefined variable.
|
||||
@@ -5,12 +5,12 @@ Function: get_card_styling
|
||||
|
||||
Get the styling data of a [[type:card]].
|
||||
|
||||
This is for use in exporter scripts. In card scripts, use the "styling" predefined variable instead.
|
||||
This is for use in exporter scripts. In card scripts, use the 'styling' predefined variable instead.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:card]] The card you want to retrieve the styling data from.
|
||||
| @set@ [[type:set]] The set the card belongs to. In an exporter script, this can be omited since "set" is a predefined variable.
|
||||
| @set@ [[type:set]] The set the card belongs to. In an exporter script, this can be omited since 'set' is a predefined variable.
|
||||
|
||||
--Examples--
|
||||
> # Retrieve the value "is foil" from the card's styling options
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Function: get_mse_locale
|
||||
|
||||
--Usage--
|
||||
> get_mse_locale()
|
||||
|
||||
Returns the name of the currently selected locale folder.
|
||||
@@ -0,0 +1,14 @@
|
||||
Function: has_link
|
||||
|
||||
--Usage--
|
||||
> has_link(card: card, "link type")
|
||||
|
||||
Inspects a given [[type:card]]'s links to find one of the given type.
|
||||
Returns true if such a link was found, false otherwise.
|
||||
|
||||
Note that this function does not check if the linked card exists in the set. For that, use get_card_from_link.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:string]] The type of link we want to find.
|
||||
| @card@ [[type:card]] The card whose links we'll inspect.
|
||||
@@ -97,6 +97,8 @@ These functions are built into the program, other [[type:function]]s can be defi
|
||||
| [[fun:flip_vertical]] Flip an image vertically.
|
||||
| [[fun:rotate_image]] Rotate an image.
|
||||
| [[fun:drop_shadow]] Add a drop shadow to an image.
|
||||
| [[fun:insert_image]] Insert an image inside another.
|
||||
| [[fun:dimensions_of]] Get the width and height of an image.
|
||||
| [[fun:symbol_variation]] Render a variation of a [[type:symbol]].
|
||||
| [[fun:import_image]] Load an image from outside the data folder.
|
||||
| [[fun:built_in_image]] Return an image built into the program.
|
||||
@@ -106,6 +108,9 @@ These functions are built into the program, other [[type:function]]s can be defi
|
||||
| [[fun:add_card_to_set]] Add a [[type:card]] to a [[type:set]].
|
||||
| [[fun:get_card_styling]] Get the styling data of a [[type:card]].
|
||||
| [[fun:get_card_stylesheet]] Get the stylesheet of a [[type:card]].
|
||||
| [[fun:get_card_from_uid]] Find the [[type:card]] with the given uid.
|
||||
| [[fun:get_card_from_link]] Find a [[type:card]] that has the given link type to the given [[type:card]].
|
||||
| [[fun:has_link]] Determine if the given the given [[type:card]] has a link of the given type.
|
||||
|
||||
! HTML export <<<
|
||||
| [[fun:to_html]] Convert [[type:tagged text]] to html.
|
||||
@@ -118,6 +123,7 @@ These functions are built into the program, other [[type:function]]s can be defi
|
||||
|
||||
! Other functions <<<
|
||||
| [[fun:get_mse_version]] Get the MSE app version.
|
||||
| [[fun:get_mse_locale]] Get the name of the currently selected locale.
|
||||
| [[fun:get_mse_path]] Get the MSE app folder absolute path.
|
||||
| [[fun:trace]] Output a message for debugging purposes.
|
||||
| [[fun:assert]] Check a condition for debugging purposes.
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
Function: insert_image
|
||||
|
||||
--Usage--
|
||||
> insert_image(base_image: image, inserted_image: image, offset_x: coordinate, offset_y: coordinate, background_color: color)
|
||||
|
||||
Insert an image inside another image.
|
||||
|
||||
The inserted image can be put outside the bounds of the base image. The resulting image will be widened accordingly.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @base_image@ [[type:image]] Image that serves as the canvas
|
||||
| @inserted_image@ [[type:image]] Image inserted on top of the base image
|
||||
| @offset_x@ [[type:double]] Offset of insertion, horizontally, in pixels
|
||||
| @offset_y@ [[type:double]] Offset of insertion, vertically, in pixels
|
||||
| @background_color@ [[type:color]] Background color, optional, defaults to transparent
|
||||
|
||||
@@ -9,8 +9,8 @@ Aside from the [[fun:index|built in functions]] the following variables are prov
|
||||
The current stylesheet
|
||||
| @card@ [[type:card]] not in @init script@s or when exporting
|
||||
The current card.
|
||||
| @card_style@ [[type:indexmap]] of [[type:style]]s where @card@ is available Style properties for the current card, the same as @stylesheet.card_style@.
|
||||
| @extra_card@ [[type:indexmap]] of [[type:value]]s field values for the current card as defined by the stylesheet.
|
||||
| @card_style@ [[type:indexmap]] of [[type:style]]s where @card@ is available Style properties for the current card, the same as @stylesheet.card_style@.
|
||||
| @extra_card@ [[type:indexmap]] of [[type:value]]s field values for the current card as defined by the stylesheet.
|
||||
| @extra_card_style@ [[type:indexmap]] of [[type:style]] where @card@ is available Style properties for the current card as added by the stylesheet.
|
||||
| @styling@ [[type:indexmap]] of [[type:value]]s where @card@ is available Styling options for the stylesheet/card.
|
||||
| @value@ [[type:value]] when evaluating a [[type:field]]'s @script@ or @default@ script Current value in the field.
|
||||
|
||||
+5
-5
@@ -43,9 +43,9 @@ Fields are part of the [[file:style triangle]]:
|
||||
| @card list name@ [[type:localized string]] field name Alternate name to use for the card list, for example an abbreviation.
|
||||
| @card list alignment@ [[type:alignment]] @left@ Alignment of the card list column.
|
||||
| @sort script@ [[type:script]] Alternate way to sort the card list when using this column to sort the list.
|
||||
| @import script@ [[type:script]] Script applied to the value given when creating a card with the new_card function. The script may return a map from field names to values.
|
||||
For example, the pt field should not be initialized directly, since it is a combination of the power field and toughness field.
|
||||
So if a value is given for pt, it must be redirected to power and toughness like so: {split := split_text(value, match:"/"); [power:split[0], toughness:split[1]]}.
|
||||
| @import script@ [[type:script]] Script applied to the value given when creating a card with the new_card function. The script may return a map from field names to values.
|
||||
For example, the pt field should not be initialized directly, since it is a combination of the power field and toughness field.
|
||||
So if a value is given for pt, it must be redirected to power and toughness like so: {split := split_text(value, match:"/"); [power:split[0], toughness:split[1]]}.
|
||||
Use the make_map function to dynamically create maps.
|
||||
|
||||
The @type@ determines what values of this field contain:
|
||||
@@ -85,8 +85,8 @@ Additional properties are available, depending on the type of field:
|
||||
These choices must appear in the same order as they do in the @choices@ property.
|
||||
|
||||
| @"boolean"@ ''A boolean field is a choice field with the choices @"yes"@ and @"no"@.'' <<< <<< <<<
|
||||
|
||||
| @"slider"@ ''A slider field is a choice field where the choices are all numbers.'' <<< <<< <<<
|
||||
|
||||
| @"slider"@ ''A slider field is a choice field where the choices are all numbers.'' <<< <<< <<<
|
||||
| ^^^ @script@ [[type:script]] Script to apply to values of this field after each change.<br/>
|
||||
If the script evaluates to a constant (i.e. doesn't use @value@) then values in this field can effectively not be edited.
|
||||
| ^^^ @default@ [[type:script]] Script to determine the value when it is in the default state (not edited).
|
||||
|
||||
Reference in New Issue
Block a user