Skip to content

user references defines

nhmkdev edited this page Oct 24, 2015 · 3 revisions

User Guides - References - Defines

General

This guide covers the creation and usage of defines. They are not very complex so there is not much to this! Be sure you have a decent understanding of references before you work with defines.

What is a define

A define is a value that is available across your entire reference. Usually anything referenced with @[column name] must exist in the current row of your reference.

With a define you can create values that can be referenced independent of the row. Maybe there are a number of constant values in your game that you want to easily tweak across multiple cards...

This functionality is best used to save you a lot of trouble when working with FormattedText Elements. They can be very bulky and contain a lot of duplicated information to embed graphics.

Creating a Defines file

Creating a defines file is fairly easy. Name it the same as your reference file with _defines appended to the name -- Example:

  • Reference File: data.csv
  • Define File: data_defines.csv

The file should be located in the same folder as your reference file.

Project wide Defines file

You can also create defines that will be available across your entire project (in every layout).

  • Project File: sample_project.cmp
  • Define File: sample_project_defines.csv

The file should be located in the same folder as your project file.

Define Contents

The content of the define file (also a CSV like the reference) is as follows:

  • Column 1: Define Name
  • Column 2: Define Value

Nested Defines

As with references you can even nest a define to reference other defines. (see the fourth row)

Using Defines

That is just about all there is to defines. You can use them just like a reference column with @[define name].

Define Sample Uses

Reduce FormattedText Clutter

Define Value
factionImg <img=images\faction_empire.bmp;.90;0;3>

With this you can easily reference the icon in any FormattedText element with just @[factionImg]. If you reference factionImg in multiple places you can tweak its configuration in just a single spot.

Reduce Clutter Overall + Nesting

Define Value
tokenActionCost 3 tokens
tokenActionMessage Each Action you take costs @[tokenActionCost].

Sometimes you need to repeat extensive information/instructions. Centralizing this into a single spot means future tweaks are controlled by a single entity. You can further simplify this with nesting of values.

Defines Referencing Columns

Define Value
factionImg <img=@[image];.90;0;3>

Remember that values are processed based on the defines combined with the current row of your reference file. You can create a hybrid define that can pull from the reference as indicated in the above sample. The image column would need to exist somewhere in your reference.

Last Words

Obviously you can be a lot more creative than these samples but hopefully you get the idea. The goal of defines is to cut down repetition and centralize your core variable values.

There are also project wide defines for use across all layouts/references. See the manual for details.