Kurt J. said: ScriptCards 1.2.1 - Please Read the Notes Edition! :) I've updated the development GIST with version 1.2.1. The focus of the 1.2.x series is mostly around cleaning up some of the code, and adding some additional convenience features to the "language". This version starts off that process, and the final change listed here is a big one, so please read this before updating to 1.2.1 to ensure that you are aware of the potential for impact to your existing scripts (while not huge, it is still there). Corrected (several) bugs with the "indexof" array function. It now shouldn't crash the sandbox, and should actually work :) ( Thanks Soren S.) Added UDL token attributes to the token attribute list so they can be used with the [*x:t-attribute] syntax. Also corrected the spelling of t-light_radius (thanks Colin C.) Completely rewrote the code that processes the results of conditionals and case statements ( not conditional evaluation itself ) This code was expanded upon at one point to add the "false" branch options, but was less than ideal. This rewrite itself shouldn't have a huge impact, but it also enabled to to expand upon the abilities of conditional statements to do more than just branching. With version 1.2.1, the following options are available in both the true and false sections of a conditional: - Normal branch : This is the current default behavior. Including a label name will jump to that label as a "goto" branch. - Procedure branch : Also the current behavior. Preceding a label name with ">" will execute a gosub branch, passing parameters separated by semicolons. IMPORTANT: Semicolons inside double-quotes are now ignored, treating the unit as a single parameter. When passing token/character/etc. IDs (which can contain semicolons), wrap the parameter in double-quotes to prevent it from being split into multiple parameters. This may have an impact on existing code if you were passing parameters containing quotes. I'm working on a method for escaping the quotes so they can still be in parameters, but that is not in place yet. - Roll Variable Assignment : If the first character for the segment is an equals sign (=) you can assign a roll variable as a result of the conditional. The variable name takes the place of the branch label, and the first parameter is used as the definition of the roll variable. For example: --? $Atk.Base -eq 20|=Damage;2d8|=Damage;1d8 This will check to see if the base roll for $Atk was a 20, and assign the result of 2d8 to the Damage variable if true, or 1d8 if not. - String Variable Assignment : If the first character for the segment is an ampersand (&) you can assign a string variable as a result of the conditional. The variable name takes the place of the branch label, and the first parameter is used as the string content. For example: --? $Atk.Base -eq 20|&HitType;Critical Hit!|&HitType;Hit Would assign "Critical Hit" to HitType if the roll was a 20, or just 'Hit" otherwise. Each segment/case is treated as its own entity, meaning you can mix and match any of the above options in a single --? or -c line (ie, on true, gosub to a procedure but just set a variable on false, etc.) Important: There is a small potential here for problems with existing scripts if you use labels that start with "=" or "&" characters. This would be extremely uncommon (and confusing), but it is technically allowed by the language. Any chance Case Statement could be adapted to include comparisons? For example: --c[*S:level]|-ge 17:Dam;5d6|-ge 11:Dam;4d6|-ge 5:Dam;3d6|-ge 1:Dam;2d6 Some abilities are determined by character tier, and it would be cleaner to do a single case statement line to see what tier the character is in compared to a bunch of conditionals. --?[*S:level] -ge 1|=Dam;2d6
--?[*S:level] -ge 5|=Dam;3d6
--?[*S:level] -ge 11|=Dam;4d6
--?[*S:level] -ge 17|=Dam;5d6