mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
add add_card_to_set script function
make styling_data initializable in new_card script function
This commit is contained in:
@@ -3,24 +3,30 @@ Function: new_card
|
||||
--Usage--
|
||||
> new_card(map_of_field_names_to_values)
|
||||
|
||||
Create a new [[type:card]] object not already in the set.
|
||||
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 of values to set, for example @new_card([name: "My Card"])@ creates a card with the name @"My Card"@, and all other fields at their default value.
|
||||
|
||||
NOTE: you should use underscores instead of spaces in field names.
|
||||
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 card field will be ignored instead of throwing.
|
||||
| @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"
|
||||
>> , type: "Super cool"
|
||||
> [ 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.jpg")
|
||||
> write_image_file(my_card, file: "my_card.png")
|
||||
|
||||
> # Add the card to the current set
|
||||
> add_card_to_set(my_card)
|
||||
|
||||
Reference in New Issue
Block a user