Jay R. said: Could someone explain to me what data statements, for-next loops, and conditional blocks would do that other existing Scriptcard functions couldn't? With maybe a practical example? Trying to wrap my head around this but I am not a coder. :) It isn't really about things that were impossible in ScriptCards prior, but more about making the language easier to use and understand. Here is an example of a script I've had hanging around for a long time that outputs a simple health display for the party: !scriptcard {{ --#title|Party Status --#titleCardBackground|#33CC33 --#tableBGColor|#AAEEAA -->HealthCheck|@{Quej Grastra|character_id} -->HealthCheck|@{Brim Cheuto|character_id} -->HealthCheck|@{Odug Ututees|character_id} --X|End of card Execution --:HealthCheck| --=HealthPerc|[*[%1%]:hp] / [*[%1%]:hp^] * 100 \ 1 --=HealthColor|000000 --?[$HealthPerc.Total] -gt 50|HealthSkip --=HealthColor|FF0000 --:HealthSkip| --+[*[%1%]:character_name]|has [#[$HealthColor.RollText]][*[%1%]:hp] of [*[%1%]:hp^][/#] HP [R]([$HealthPerc.Total]%)[/R] --<|End of HealthCheck }} This was one of the very early Scripts I wrote for ScriptCards, and as such doesn't use any of the language features that have been added to ScriptCards since the very early days. I just rewrote this with loops, non-branch conditionals, and data statements like this: !script {{
--#title|Party Status
--#titleCardBackground|#33CC33
--#tableBGColor|#AAEEAA
--%charLoop|1;20;1
--dcharId|
--?"[&charId]" -eq "EndOfDataError"|%!
-->DisplayCharacter|[&charId]
--%|
--X|
--:DisplayCharacter|character_id
--=HealthPerc|[*[%1%]:hp] / [*[%1%]:hp^] * 100 \ 1
--?[$HealthPerc] -gt 50|&HealthColor;000000|&HealthColor;FF0000
--+[*[%1%]:character_name]|has [#[&HealthColor]][*[%1%]:hp] of [*[%1%]:hp^][/#] HP [R]([$HealthPerc.Total]%)[/R]
--<|
--/|Character IDs for each PC
--d!|"-LRXezam7DzGpyujp-jN";"-LRNuvj1Z8PeU-UcNVFx";"-LRNwKdKpiIR8TtYL1rr"
}} It is a little shorter if you discount the added blank lines for readability, and that is with only three PCs. More importantly (to me) it is much more readable. There are several things changed here, but here are the major ones: By using a For...Next loop, I don't have to have a separate call to HealthCheck for each character, an by reading them from the data statement at the end of the script, if I add players, or a character dies, etc. I only have to update the data statement. It was possible to create loops manually with branches before, but this makes it a bit more like a traditional programming language. In a real game, I would the data statement(s) into a handout and include it as a template whenever I wanted to use the character IDs in my scripts - that way if I have 500 ScriptCards and I add/replace a character I just need to update it in the handout and it will work everywhere. I picked 20 iterations for the For...Next loop, but that was just a number larger than the number of characters I plan on having. It could be 1000. The %! in the conditional will break out of the loop if we hit EndOfDataError. Calculation of the Health Percentage remains the same, but non-branching conditionals allow me to set the HealthColor variable directly on the conditional line instead of having to create a new label skip over if I don't want to change the color. The original card was also before the inclusion of String variables, which make more sense here since then we don't have to add .RollText to everything. The script above doesn't use statement blocks, but here is an example of one that does: !script {{
--&attackDice|1d20
--?"@{selected|rtype}" -inc "{advantage"|&attackDice;2d20kh1
--?"@{selected|rtype}" -inc "{disadvantage"|&attackDice;2d20kl1
--=AttackRoll|[&attackDice] [BASE] + @{selected|strength_mod} [STR] + @{selected|pb} [PROF]
--+Attack Roll|[$AttackRoll] vs AC @{target|npc_ac}
--?[$AttackRoll] -ge @{target|npc_ac} -and [$AttackRoll.Base] -ne 20 -and [$AttackRoll.Base] -ne 1|[
--=Damage|1d8 + @{selected|strength_mod} [STR]
--+Hit!|@{selected|character_name} hit @{target|character_name} for [$Damage] HP
--]|
--?[$AttackRoll.Base] -eq 20|[
--=Damage|2d8 + @{selected|strength_mod} [STR]
--+Critical Hit!|@{selected|character_name} hit @{target|character_name} for [$Damage] HP
--]|
--?[$AttackRoll] -lt @{target|npc_ac} -and [$AttackRoll.Base] -ne 20 -and [$AttackRoll.Base] -ne 1|[
--+Miss!|@{selected|character_name} attacks @{target|character_name}, but misses
--]|
--?[$AttackRoll.Base] -eq 1|[
--=Fumble|[T#fumble-table]
--+Critical Fumble!|@{selected|character_name} attempted to attack @{target|character_name} but something went horribly wrong!
--+|[$Fumble.tableEntryText]
--]|
}} Without statement blocks, each of the different sections would need to have a label to branch to, and then have to worry about resuming somewhere after the damage report (assuming you wanted to do something else. With statement blocks, each conditional can have any number of statements that get executed if the conditional is matched without branching away and back, so the code is easier to follow (especially with indenting showing where the blocked begin and end). EDIT: Updated attack roll example to include handling advantage/disadvantage/normal and character attributes to make it a generally more useful example.