Commit 601fd0e2 authored by twanvl's avatar twanvl

Documented add cards scripts and the new_card function

parent dd67895f
...@@ -79,11 +79,14 @@ These functions are built into the program, other [[type:function]]s can be defi ...@@ -79,11 +79,14 @@ These functions are built into the program, other [[type:function]]s can be defi
| [[fun:set_combine]] Change how the image should be combined with the background. | [[fun:set_combine]] Change how the image should be combined with the background.
| [[fun:saturate]] Saturate/desaturate an image. | [[fun:saturate]] Saturate/desaturate an image.
| [[fun:enlarge]] Enlarge an image by putting a border around it. | [[fun:enlarge]] Enlarge an image by putting a border around it.
| [[fun:crop]] Crop an image, giving only a small subset of it. | [[fun:crop]] Crop an image, giving only a small subset of it.
| [[fun:drop_shadow]] Add a drop shadow to an image. | [[fun:drop_shadow]] Add a drop shadow to an image.
| [[fun:symbol_variation]] Render a variation of a [[type:symbol]]. | [[fun:symbol_variation]] Render a variation of a [[type:symbol]].
| [[fun:built_in_image]] Return an image built into the program. | [[fun:built_in_image]] Return an image built into the program.
! Cards <<<
| [[fun:new_card]] Construct a new [[type:card]] object.
! HTML export <<< ! HTML export <<<
| [[fun:to_html]] Convert [[type:tagged text]] to html. | [[fun:to_html]] Convert [[type:tagged text]] to html.
| [[fun:symbols_to_html]] Convert text to html using a [[type:symbol font]]. | [[fun:symbols_to_html]] Convert text to html using a [[type:symbol font]].
......
Function: new_card
--Usage--
> new_card(map_of_field_names_to_values)
Create a new [[type:card]] object not already in the set.
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.
--Parameters--
! Parameter Type Description
| @input@ [[type:map]] of field names to field values Field values to set
--Examples--
> # Create a new card
> my_card := new_card(
> [ name: "My Card"
>> , type: "Super cool"
>> , rule_text: "This card is <i>mine</i>!"
> ])
>
> # Write an image of the card to a file
> write_image_file(my_card, file: "my_card.jpg")
Data type: add cards script
DOC_MSE_VERSION: since 0.3.7
--Overview--
A script to add multiple cards to the set at once.
--Properties--
! Property Type Default Description
| @name@ [[type:string]] Name of this script; appears in the menu.
| @description@ [[type:string]] @""@ Description of this script; appears in the status bar.
| @enabled@ [[type:scriptable]] [[type:boolean]] @true@ Is this script enabled?
| @script@ [[type:script]] Script that produces the cards.<br>
This script should return a [[type:list]] of [[type:card]]s.
The [[fun:new_card]] function can be used to make new cards.
--Example--
>add cards script:
> name: &Basic Lands
> description: Adds 5 basic lands to the set.
> script:
> [ new_card([name: "Plains", super_type: "Basic Land", sub_type: "Plains"])
> , new_card([name: "Island", super_type: "Basic Land", sub_type: "Island"])
> , new_card([name: "Swamp", super_type: "Basic Land", sub_type: "Swamp"])
> , new_card([name: "Mountain", super_type: "Basic Land", sub_type: "Mountain"])
> , new_card([name: "Forest", super_type: "Basic Land", sub_type: "Forest"])
> ]
When invoked, this script will add the five basic lands to the set.
...@@ -46,6 +46,8 @@ Such a package contains a [[file:format|data file]] called <tt>game</tt> that ha ...@@ -46,6 +46,8 @@ Such a package contains a [[file:format|data file]] called <tt>game</tt> that ha
| @keyword parameter types@ [[type:list]] of [[type:keyword param type]]s Types of parameters available to keywords. | @keyword parameter types@ [[type:list]] of [[type:keyword param type]]s Types of parameters available to keywords.
| @keywords@ [[type:list]] of [[type:keyword]]s Standard keywords for this game. | @keywords@ [[type:list]] of [[type:keyword]]s Standard keywords for this game.
| @word lists@ [[type:list]] of [[type:word list]]s Word lists that can be used by text fields. | @word lists@ [[type:list]] of [[type:word list]]s Word lists that can be used by text fields.
| @add cards script@ [[type:list]] of [[type:add cards script]]s DOC_MSE_VERSION: since 0.3.7
A list of scripts for convienently adding multiple cards to a set.
--Examples-- --Examples--
Look at the game files in the standard MSE distribution for examples. Look at the game files in the standard MSE distribution for examples.
...@@ -27,6 +27,8 @@ These contain several properties, similair to the file types. But they are part ...@@ -27,6 +27,8 @@ These contain several properties, similair to the file types. But they are part
| [[type:keyword param type]] A type of parameters for keywords. | [[type:keyword param type]] A type of parameters for keywords.
| [[type:statistics dimension]] A dimension for the statistics panel. | [[type:statistics dimension]] A dimension for the statistics panel.
| [[type:statistics category]] A category for the statistics panel. | [[type:statistics category]] A category for the statistics panel.
| [[type:word list]] A list of words that can be used for a drop down list in text fields.
| [[type:add cards script]] A script for convienently adding multiple cards to a set.
| [[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. | [[type:control point]] A point on in a symbol part.
......
...@@ -76,6 +76,8 @@ $built_in_functions = array( ...@@ -76,6 +76,8 @@ $built_in_functions = array(
'drop_shadow' =>'', 'drop_shadow' =>'',
'symbol_variation' =>'', 'symbol_variation' =>'',
'built_in_image' =>'', 'built_in_image' =>'',
// cards
'new_card' =>'',
// html export // html export
'to_html' =>'', 'to_html' =>'',
'symbols_to_html' =>'', 'symbols_to_html' =>'',
......
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