CardMaker Tutorial: References: Data Referencing with Parameters

This guide covers the creation and usage of Data Referencing with Parameters. This is a fairly advanced topic so hopefully you're patient!

Under some circumstances the standard data reference (@[column name]) results in a lot of replication. Take the following example:

  1. Your formatted text elements include a lot of unique icon file names that are uniform in size
  2. You create a number of helper defines like these:
    • <img=images\earth.png;.90;0;3>
    • <img=images\fire.png;.90;0;3>
    • <img=images\water.png;.90;0;3>
    • <img=images\air.png;.90;0;3>
    • <img=images\void.png;.90;0;3>

If you have to adjust each of those custom defines due to another change at the element level it requires a lot of repetition. With defines with parameters you can access a define and tell it to use inputs to populate parts of the string. Instead of mutiple defines you can create a single define as follows:


You can access the define as usual with @[smallImgTag] but the result will be exactly as you specified: <img={1};.90;0;3>

To populate the {1} value you must specify a parameter: @[smallImgTag,images\earth.png]
The result will be <img=images\earth.png;.90;0;3>

That is great but you can take it a step further by using a define for the images\earth.png value. (earthIcon seems like a good define name)

Now you can produce the same result as above with this: @[smallImgTag,@[earthIcon]]

Remember that any @[] data reference can be to the defines file or the current line of your reference file. You can even take this a step further and define parameter based items that use other parameter based items!

takeAndLoseTake {1} {2}\c lose {3} {4}

Critical Note: If you are going to nest parameter defines in your files be sure to QUOTE them as with the takeCoinsLoseDiplomacy value above. If you do not the CSV parser will cut off your value. Some editors may automatically handle this, but a raw text editor will not.
Input: @[takeCoinsLoseDiplomacy,10,2]
Result: Take 10 coins, lose 2 diplomacy

The above is an extreme example (oh and nevermind the potential grammar issues with singular vs. plural)...

© Copyright NHMK 2022    e-mail: nhmkamv at gmail
(Pages on this site use Javascript so if you do not see content you have Javascript disabled!)