In the previous version of Lackey I started enabling scripting, as described at http://www.lackeyccg.com/forum/index.php?topic=1801.0 .
That method is now obsolete (though I am considering adding backward compatibility if people want it). The problem with that method was it only allowed modifications of the card the script was associated with and it only would run when the card was sent to the table, and only automatically.
The new system is much more versatile. It allows you to:
Have multiple scripts associated with each card.
Scripts can perform any log function (or multiple functions), such as /roll or /flip.
You can now label scrips to make them easier for people to understand.
You can define one of a card's scripts to be run automatically when the card is sent to the table.
Script's effects now appear in the log.
A card's scripts are accessible by right-clicking a card on the table.
Since card scripts use log function commands (http://lackeyccg.com/tutoriallogcommands.html), there are tons of things you can do with them, and as I add more log functions, those will be immediately available to card scripts.
To use the scripts, it's similar to the old method where you make a column in your card data file called "Script". For each card you want to have a script (or scripts) for, you enter in the script syntax into that column.
You can have any number of scripts in that cell. A script begins with <s> and ends with </s>. In between <s> and </s>, you can include:
An indicator if the function is automatically performed when the card is sent to the table. This begins with <a> and ends with </a> and inside you can put y for yes. So the automation syntax part would look like <a>y</a>. You can only have one automatically run script per card. Users can disable these from running in the Preferences/Miscellaneous section under "Enable scripts?".
The second component of the script syntax is a label for the script that appears in the right-click menu of a card on the table. This starts with <l> and ends with </l>. Note that that is the lower case letter L, for label.
The third and final component of the script syntax is the actual function(s) to be performed. This section starts with <f> and ends with </f>. In between, you put any log command, such as "/flip". If you have multiple commands for a single script, separate them with a semicolon.
As an option, you can use a simplified syntax when a card just uses an automatic script. This is good for a card that always is put onto the table with 3 red counters on it, for example. In that case, all you need is the log function, which would be /ccred=3 in that case. No need to use <s> or anything else in the full syntax for a simple script like this. When done like this, a script is given the name "Initialize" in the card's right-click menu on the table, and it is implicitly set to run automatically.
For example, in the script column of a card, you could write:
<s><a>y</a><l>Initialize</l><f>/ccred=3</f></s>
or just
/ccred=3
and they would do the same exact thing.
Note that all scripts are implicitly not automatically performed, unless they are input with the simplified method, in which case they are always implicitly automatically performed.
Suppose you have a card that has multiple abilities. You could give define it like this:
<s><a>y</a><l>Initialize counters</l><f>/ccgreen=3</f></s>
<s><l>+3, Spawn 2 sheep</l><f>/ccgreen+3;/spawnx2 Sheep Token</f></s>
<s><l>-2, Draw 2 cards</l><f>/ccgreen-2;/d2;/s eating sheep!</f></s>
When you drag this card to the table, it would set the green counters to 3.
You could right-click the card while it's on the table see 3 functions, "Initialize", "+3, Spawn 2 sheep", and "-2, Draw 2 cards". The first would reset the counters to 3, as you would do if you moved it off the table and then back. The second script would increase the number of green counters by 3 and then spawn 2 sheep tokens. The 3rd script would subtract 2 green counters and then draw you 2 cards.
That method is now obsolete (though I am considering adding backward compatibility if people want it). The problem with that method was it only allowed modifications of the card the script was associated with and it only would run when the card was sent to the table, and only automatically.
The new system is much more versatile. It allows you to:
Have multiple scripts associated with each card.
Scripts can perform any log function (or multiple functions), such as /roll or /flip.
You can now label scrips to make them easier for people to understand.
You can define one of a card's scripts to be run automatically when the card is sent to the table.
Script's effects now appear in the log.
A card's scripts are accessible by right-clicking a card on the table.
Since card scripts use log function commands (http://lackeyccg.com/tutoriallogcommands.html), there are tons of things you can do with them, and as I add more log functions, those will be immediately available to card scripts.
To use the scripts, it's similar to the old method where you make a column in your card data file called "Script". For each card you want to have a script (or scripts) for, you enter in the script syntax into that column.
You can have any number of scripts in that cell. A script begins with <s> and ends with </s>. In between <s> and </s>, you can include:
An indicator if the function is automatically performed when the card is sent to the table. This begins with <a> and ends with </a> and inside you can put y for yes. So the automation syntax part would look like <a>y</a>. You can only have one automatically run script per card. Users can disable these from running in the Preferences/Miscellaneous section under "Enable scripts?".
The second component of the script syntax is a label for the script that appears in the right-click menu of a card on the table. This starts with <l> and ends with </l>. Note that that is the lower case letter L, for label.
The third and final component of the script syntax is the actual function(s) to be performed. This section starts with <f> and ends with </f>. In between, you put any log command, such as "/flip". If you have multiple commands for a single script, separate them with a semicolon.
As an option, you can use a simplified syntax when a card just uses an automatic script. This is good for a card that always is put onto the table with 3 red counters on it, for example. In that case, all you need is the log function, which would be /ccred=3 in that case. No need to use <s> or anything else in the full syntax for a simple script like this. When done like this, a script is given the name "Initialize" in the card's right-click menu on the table, and it is implicitly set to run automatically.
For example, in the script column of a card, you could write:
<s><a>y</a><l>Initialize</l><f>/ccred=3</f></s>
or just
/ccred=3
and they would do the same exact thing.
Note that all scripts are implicitly not automatically performed, unless they are input with the simplified method, in which case they are always implicitly automatically performed.
Suppose you have a card that has multiple abilities. You could give define it like this:
<s><a>y</a><l>Initialize counters</l><f>/ccgreen=3</f></s>
<s><l>+3, Spawn 2 sheep</l><f>/ccgreen+3;/spawnx2 Sheep Token</f></s>
<s><l>-2, Draw 2 cards</l><f>/ccgreen-2;/d2;/s eating sheep!</f></s>
When you drag this card to the table, it would set the green counters to 3.
You could right-click the card while it's on the table see 3 functions, "Initialize", "+3, Spawn 2 sheep", and "-2, Draw 2 cards". The first would reset the counters to 3, as you would do if you moved it off the table and then back. The second script would increase the number of green counters by 3 and then spawn 2 sheep tokens. The 3rd script would subtract 2 green counters and then draw you 2 cards.