From fe5878e3d8ca613b1ab1333210d60e626dd5781c Mon Sep 17 00:00:00 2001 From: twanvl Date: Mon, 11 Aug 2008 21:10:59 +0000 Subject: [PATCH] Documented add cards scripts and the new_card function git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1149 0fc631ac-6414-0410-93d0-97cfa31319b6 --- doc/function/index.txt | 5 ++- doc/function/new_card.txt | 25 +++++++++++++++ doc/type/add_cards_script.txt | 31 +++++++++++++++++++ doc/type/game.txt | 2 ++ doc/type/index.txt | 2 ++ .../drupal/mse-drupal-modules/highlight.inc | 2 ++ 6 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 doc/function/new_card.txt create mode 100644 doc/type/add_cards_script.txt diff --git a/doc/function/index.txt b/doc/function/index.txt index ceb2058f..7bb07b3c 100644 --- a/doc/function/index.txt +++ b/doc/function/index.txt @@ -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:saturate]] Saturate/desaturate an image. | [[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:symbol_variation]] Render a variation of a [[type:symbol]]. | [[fun:built_in_image]] Return an image built into the program. +! Cards <<< +| [[fun:new_card]] Construct a new [[type:card]] object. + ! HTML export <<< | [[fun:to_html]] Convert [[type:tagged text]] to html. | [[fun:symbols_to_html]] Convert text to html using a [[type:symbol font]]. diff --git a/doc/function/new_card.txt b/doc/function/new_card.txt new file mode 100644 index 00000000..620fd75c --- /dev/null +++ b/doc/function/new_card.txt @@ -0,0 +1,25 @@ +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 mine!" +> ]) +> +> # Write an image of the card to a file +> write_image_file(my_card, file: "my_card.jpg") diff --git a/doc/type/add_cards_script.txt b/doc/type/add_cards_script.txt new file mode 100644 index 00000000..93aaad1a --- /dev/null +++ b/doc/type/add_cards_script.txt @@ -0,0 +1,31 @@ +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.
+ 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. + diff --git a/doc/type/game.txt b/doc/type/game.txt index 46c4b394..4678f058 100644 --- a/doc/type/game.txt +++ b/doc/type/game.txt @@ -46,6 +46,8 @@ Such a package contains a [[file:format|data file]] called game that ha | @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. | @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-- Look at the game files in the standard MSE distribution for examples. diff --git a/doc/type/index.txt b/doc/type/index.txt index 4e916975..e5e6aec3 100644 --- a/doc/type/index.txt +++ b/doc/type/index.txt @@ -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:statistics dimension]] A dimension 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:symbol part]] Part of a [[type:symbol]]. | [[type:control point]] A point on in a symbol part. diff --git a/tools/website/drupal/mse-drupal-modules/highlight.inc b/tools/website/drupal/mse-drupal-modules/highlight.inc index 3d226d2b..45170a71 100644 --- a/tools/website/drupal/mse-drupal-modules/highlight.inc +++ b/tools/website/drupal/mse-drupal-modules/highlight.inc @@ -76,6 +76,8 @@ $built_in_functions = array( 'drop_shadow' =>'', 'symbol_variation' =>'', 'built_in_image' =>'', + // cards + 'new_card' =>'', // html export 'to_html' =>'', 'symbols_to_html' =>'',