mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
add set_metadata, get_metadata script functions
This commit is contained in:
@@ -10,7 +10,7 @@ To see the required syntax, use an output of the [[fun:to_json]] function.
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:string]] JSON string to convert to an MSE script value.
|
||||
| @set@ [[type:set]] The active set. This can be omited since "set" is a predefined variable.
|
||||
| @set@ [[type:set]] The active set. This can be omitted since "set" is a predefined variable.
|
||||
|
||||
--Examples--
|
||||
> add_card_to_set(from_json("\{\"mse_object_type\":\"card\", \"data\":\{\"name\":\"Ajani\", \"rarity\":\"mythic rare\"\}\}"))
|
||||
|
||||
@@ -9,4 +9,4 @@ Returns nil if no link of type "Back Face", or no card was found.
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[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.
|
||||
| @set@ [[type:set]] The set in which to look. This can be omitted since 'set' is a predefined variable.
|
||||
|
||||
@@ -10,4 +10,4 @@ Returns and array whose first element is the zoom percentage, the second is the
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:card]] The card you want to retrieve the export settings from.
|
||||
| @set@ [[type:set]] The set the card belongs to. This can be omited since "set" is a predefined variable.
|
||||
| @set@ [[type:set]] The set the card belongs to. This can be omitted since "set" is a predefined variable.
|
||||
|
||||
@@ -9,4 +9,4 @@ 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.
|
||||
| @set@ [[type:set]] The set in which to look. This can be omitted since 'set' is a predefined variable.
|
||||
|
||||
@@ -10,7 +10,7 @@ This is for use in exporter scripts. In card scripts, use the "stylesheet" prede
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:card]] The card you want to retrieve the stylesheet 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 omitted since "set" is a predefined variable.
|
||||
|
||||
--Examples--
|
||||
> # Retrieve the card regions from the card's stylesheet
|
||||
|
||||
@@ -10,7 +10,7 @@ This is for use in exporter scripts. In card scripts, use the 'styling' predefin
|
||||
--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 omitted since 'set' is a predefined variable.
|
||||
|
||||
--Examples--
|
||||
> # Retrieve the value "is foil" from the card's styling options
|
||||
|
||||
@@ -9,4 +9,4 @@ Returns nil if no link of type "Front Face", or no card was found.
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[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.
|
||||
| @set@ [[type:set]] The set in which to look. This can be omitted since 'set' is a predefined variable.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
Function: get_metadata
|
||||
|
||||
--Usage--
|
||||
> get_metadata(input: image)
|
||||
|
||||
Returns the metadata of an image, or an empty string if there isn't any.
|
||||
|
||||
Metadata is only stored when an image is saved as a PNG.
|
||||
It is saved in a uncompressed iTXt chunk with the key "Description".
|
||||
If the image is saved as a JPG, the metadata is lost.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:image]] The image whose metadata we'll get.
|
||||
| @set@ [[type:set]] The active set. This can be omitted since 'set' is a predefined variable.
|
||||
@@ -0,0 +1,16 @@
|
||||
Function: set_metadata
|
||||
|
||||
--Usage--
|
||||
> set_metadata(input: image, metadata: string)
|
||||
|
||||
Returns a copy of the input image with the metadata set to the given string.
|
||||
|
||||
Metadata is only stored when an image is saved as a PNG.
|
||||
It is saved in a uncompressed iTXt chunk with the key "Description".
|
||||
If the image is saved as a JPG, the metadata is lost.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ [[type:image]] The image that will be copied.
|
||||
| @metadata@ [[type:string]] The metadata that will be stored in the copy.
|
||||
| @set@ [[type:set]] The active set. This can be omitted since 'set' is a predefined variable.
|
||||
@@ -3,13 +3,14 @@ Function: to_json
|
||||
--Usage--
|
||||
> to_json(some_script_value)
|
||||
|
||||
Convert a [[type:list]], a [[type:map]], a [[type:card]], a [[type:keyword]], a [[type:pack_type]] or a [[type:set]] to a JSON string.
|
||||
Convert a [[type:list]], a [[type:map]], a [[type:style]], a [[type:card]], a [[type:keyword]], a [[type:pack_type]] or a [[type:set]] to a JSON string.
|
||||
|
||||
This method is also useful for debugging purposes.
|
||||
|
||||
--Parameters--
|
||||
! Parameter Type Description
|
||||
| @input@ some_script_value MSE script value to convert to a JSON string.
|
||||
| @set@ [[type:set]] The active set. This can be omited since "set" is a predefined variable.
|
||||
| @set@ [[type:set]] The active set. This can be omitted since "set" is a predefined variable.
|
||||
|
||||
--Examples--
|
||||
> to_json(card)
|
||||
|
||||
Reference in New Issue
Block a user