Script functions by category

These functions are built into the program, other [[type:function]]s can be defined using the scripting language.

! Type conversion		<<<
| [[fun:to_string]]		Convert any value to a [[type:string]]
| [[fun:to_int]]		Convert any value to a [[type:int]]
| [[fun:to_real]]		Convert any value to a [[type:double]]
| [[fun:to_number]]		Convert any value to a number
| [[fun:to_boolean]]		Convert any value to a [[type:boolean]]
| [[fun:to_color]]		Convert any value to a [[type:color]]
| [[fun:to_image]]		Convert any value to an [[type:image]]
| [[fun:to_date]]		Convert any value to a [[type:date]]
	
! Numbers			<<<
| [[fun:abs]]			Absolute value
| [[fun:random_int]]		Generate a random [[type:int]].
| [[fun:random_real]]		Generate a random [[type:double]].
| [[fun:random_boolean]]	Generate a random [[type:boolean]].
	
! Text manipulation		<<<
| [[fun:to_upper]]		Convert a string to upper case, @"aBc" -> "ABC"@.
| [[fun:to_lower]]		Convert a string to lower case, @"aBc" -> "abc"@.
| [[fun:to_title]]		Convert a string to title case, @"aBc" -> "Abc"@.
| [[fun:reverse]]		Reverse a string, @"aBc" -> "cBa"@.
| [[fun:trim]]			Remove leading and trailing whitespace from a string, @" abc " -> "abc"@.
| [[fun:substring]]		Extract a part of a string.
| [[fun:replace]]		Replace text matching a regular expression.
| [[fun:filter_text]]		Keep only the text matching a regular expression.
| [[fun:break_text]]		Break text into parts each matching a regular expression.
| [[fun:split_text]]		Split text into parts separated by a regular expression.
| [[fun:sort_text]]		Sort the letters in a string using a custom order.
| [[fun:contains]]		Does a string contain another one?
| [[fun:match]]			Does a string match a regular expression?
| [[fun:regex_escape]]		Escape a string for use in a regular expression.
| [[fun:curly_quotes]]		Make quotes curly.
| [[fun:check_spelling]]	Check text for spelling errors.
	
! [[type:tagged_string|Tags]]	<<<
| [[fun:tag_contents]]		Change the contents of a specific tag.
| [[fun:remove_tag]]		Remove a tag, keep the contents.
| [[fun:remove_tags]]		Remove all tags from tagged text.
	
! [[type:list|Lists]]		<<<
| [[fun:position]]		Find the position of an element in a list.
| [[fun:length]]		Return the number of items in a list.
| [[fun:number_of_items]]	Return the number of items in a list.
| [[fun:sort_list]]		Sort a list.
| [[fun:filter_list]]		Filter a list, keeping only elements that match a predicate.
| [[fun:random_shuffle]]	Randomly shuffle a list.
| [[fun:random_select]]		Pick a random element from a list.
| [[fun:random_select_many]]	Pick multiple random elements from a list.
	
! Keywords			<<<
| [[fun:expand_keywords]]	Expand the keywords in a piece of text.
| [[fun:keyword_usage]]		What keywords are used on a card, and how often are they used?
	
! English language			<<<
| [[fun:english_number]]				Convert a number to text (@"one"@, @"two"@, ''etc.'')
| [[fun:english_number|english_number_a]]		Convert a number to text (@"a"@, @"two"@, ''etc.'')
| [[fun:english_number|english_number_multiple]]	Convert a number to text (@""@, @"two"@, ''etc.'')
| [[fun:english_number|english_number_ordinal]]		Convert a number to text (@"first"@, @"second"@, ''etc.'')
| [[fun:english_plural]]				Find the plural of a word, @"card" -> "cards"@.
| [[fun:english_plural|english_singular]]		Find the singular of a word, @"cards" -> "card"@.
| [[fun:process_english_hints]]				Process the hints left by english_ functions in a keyword's reminder text.
	
! Fields and values			<<<
| [[fun:combined_editor|forward_editor]]	Use one field to edit another.
| [[fun:combined_editor]]		Use one field to edit multiple others.
| [[fun:primary_choice]]		Return the top level choice chosen from a choice field.
| [[fun:chosen]]			Is the given choice selected in a multiple choice value?
| [[fun:count_chosen]]			Count then number of choices selected in a multiple choice value.
| [[fun:require_choice]]		Require that at least one of the given choices is selected.
| [[fun:exclusive_choice]]		Require that at most one of the given choices is selected.
| [[fun:require_exclusive_choice]]	Require that exactly one of the given choices is selected.
| [[fun:remove_choice]]			Remove the given choices from a multiple choice value.
	
! Images			<<<
| [[fun:linear_blend]]		Blend two images together using a linear gradient.
| [[fun:masked_blend]]		Blend two images together using a third mask image.
| [[fun:combine_blend]]		Blend two images together using a given [[type:combine|combining mode]].
| [[fun:set_mask]]		Set the transparancy mask of an image.
| [[fun:set_alpha]]		Change the transparency of an image.
| [[fun:set_combine]]		Change how the image should be combined with the background.
| [[fun:saturate]]		Saturate/desaturate an image.
| [[fun:invert_image]]		Invert the colors of an image.
| [[fun:recolor_image]]		Change the colors of an image to match the font color.
| [[fun:enlarge]]		Enlarge an image by putting a border around it.
| [[fun:crop]]			Crop an image, giving only a small subset of it.
| [[fun:flip_horizontal]]	Flip an image horizontally.
| [[fun:flip_vertical]]		Flip an image vertically.
| [[fun:rotate]]		Rotate an image.
| [[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]].
| [[fun:to_text]]		Remove all tags from tagged text, and convert it to a [[type:string]].
| [[fun:copy_file]]		Copy a file from the [[type:export template]] to the output directory.
| [[fun:write_text_file]]	Write a text file to the output directory.
| [[fun:write_image_file]]	Write an image file to the output directory.
| [[fun:write_set_file]]	Write a MSE set file to the output directory.
	
! Other functions		<<<
| [[fun:trace]]			Output a message for debugging purposes.
| [[fun:assert]]		Check a condition for debugging purposes.
