mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
d85f5a4927
make styling_data initializable in new_card script function
33 lines
1.5 KiB
Plaintext
33 lines
1.5 KiB
Plaintext
Function: new_card
|
|
|
|
--Usage--
|
|
> new_card(map_of_field_names_to_values)
|
|
|
|
Creates a new [[type:card]] object. The card is not automatically added to a set. Use the [[fun:add_card_to_set]] function for that.
|
|
|
|
The argument is a map from card field names to values, for example @new_card([name: "My Card"])@ creates a card with the name @"My Card"@, and all other fields at their default value.
|
|
|
|
The map can also contain the following built-in keys: notes, id, linked_card_1 to linked_card_4, linked_relation_1 to linked_relation_4, stylesheet, and styling_data. For styling_data, the value must itself be a map from styling field names to values. Be sure to define a stylesheet before styling_data.
|
|
|
|
NOTE: you should use underscores instead of spaces in field names.
|
|
|
|
--Parameters--
|
|
! Parameter Type Description
|
|
| @input@ [[type:map]] of field names to field values Field values to set
|
|
| @ignore_field_not_found@ [[type:boolean]] Optional. If set to true, key/value pairs that don't correspond to a field will be ignored instead of throwing.
|
|
|
|
--Examples--
|
|
> # Create a new card
|
|
> my_card := new_card(
|
|
> [ name: "My Card"
|
|
>> , rule_text: "This card is <i>mine</i>!"
|
|
>> , stylesheet: "magic-m15-adventure.mse-style"
|
|
>> , styling_data: [frames: "Reversed, vehicle", chop_main: "5,5"]
|
|
> ])
|
|
>
|
|
> # Write an image of the card to a file
|
|
> write_image_file(my_card, file: "my_card.png")
|
|
|
|
> # Add the card to the current set
|
|
> add_card_to_set(my_card)
|