ScriptCards version 1.1.2 Now Availble The development GIST now contains the latest updates for ScriptCards. There are a number of changes time time around, and I'll update the Wiki as I get the time to do so (likely over the weekend). As always, bug reports and feedback before I prep this for a push to OneClick are appreciated. Now on with the goodness: New Dice Roll Syntax : XdYr<Z and XdYr>Z. This type of dice syntax will reroll values depending on the result. For example, 5d6r<2 will reroll 1s and 2s on 5d6. 5d6r>5 will reroll 6s on the roll. Note that Z is inclusive (ie, z=2 means reroll 1s and 2s). New Dice Roll Syntax : XdY! or XdY!>Z or XdY!<Z for exploding dice. With the standard syntax (XdY!), any max rolls on the die will be rerolled and added to the total, potentially triggering additional rerolls. With the exteneded syntax (XdY!>Z or XdY!<Z) results >= or <= Z will be rerolled and added. Note that Z is inclusive. New Dice Roll Syntax : XdYro<Z or XdYro>Z allows for reroll-once mechanics. For example, 1d20ro<1 will roll a d20. If the result is a 1, the d20 will be rolled again, and the second result will be kept. The value of Z is inclusive in the greater than/less than check. Turn Tracker Support There are new function (--~) statements available for manipulating the turn tracker. These are: --~|turnorder;clear clears the turn tracker --~|turnorder;addtoken;tokenid;trackervalue adds token "tokenid" to the turn tracker with a value of "trackervalue" (but see the next entry) --~|turnorer;replacetoken;tokenid;trackervalue replaces the tracker entry for token "tokenid" to the turn tracker with a value of "trackervalue". Adds the token if it isn't in the tracker already. --~|turnorder;removetoken;tokenid removes (all) entries for token "tokenid" from the turn tracker --~|turnorder;addcustom;textlabel;trackervalue adds a new row to the turn tracker named "textlabel" with a value of "trackervalue". Will not be associated with a token. Array Support ScriptCards now supports creation and manipulation of arrays. Things to keep in mind about arrays: Arrays are a lists of strings. Items in an array cannot contain the semi-colon (;) character, as that is used to separate parameters in the function code that deals with arrays. Arrays are accessed via the --~ script command. In some cases, the value of the tag (variable name) for array commands is not used, and can be a dummy value or simply omitted. I have omitted them in the statements below. All commands that DO return a value return string values, even if the content is numeric. If a command returns a value and there is some sort of reason that it isn't an array value, you will get "ArrayError" in the return value. This can happen if you reach the end of an array while stepping through it, for example, so checking for "ArrayError" can serve as the end condition for a loop. Each array keeps track of its current index, allowing you to step forward and backwards through arrays. Any number of arrays can be defined. Unlike string variables and roll variables, arrays cannot be persisted between scripts. The following commands are available for working with arrays: --~|array;define;arrayname;val1;val2;val3;val4 Defines an array called "arrayname" and adds four values to it. Sets the array index to 0. --~|array;add;arrayname;val5;val6;val7 Adds additional elements to an already defined "arrayname" array. --~|array;remove;arrayname;val3;val4 Removes "val3" and "val4" from the arrayname array. Resets the array index to 0. --~|array;replace;arrayname;currentval;newval Replaces "currentval" in arrayname with "newval". All occurrences will be replaced. --~myindex|array;getindex;arrayname Retrieves the current index for arrayname and stores it in myindex (string variable) --~|array;setindex;arrayname;newindex If newindex is a valid index for arrayname, the index will be set to that value. Otherwise nothing will be changed (for example, setting the index of an array of 5 items to 100 won't modify anything). --~myvalue|array;getcurrent;arrayname Gets the value of the current index item in arrayname and returns it to myvalue (string variable). --~myvalue|array;getnext:arrayname Increases the index by 1 and returns the new current item. If the next item in the array doesn't exist, myvalue (string variable) will be set to "ArrayError" --~myvalue|array;getprevious;arrayname Decreases the index by 1 and returns the new current item. If the previous item in the array doesn't exist, myvalue (string variable) will be set to "ArrayError" --~myvalue|array;getfirst;arrayname Sets the index to 0 and returns the new current item to myvalue (string variable). --~myvalue|array;getlast;arrayname Sets the index to the last item in the array and returns the new current item to myvalue (string variable). --~|array;removeat;arrayname;index removes the item at index "index" from "arrayname" --~itemindex|array;indexof;arrayname;searchvalue Sets "itemindex" (string variable) to the index in the array for the first item that matches "searchvalue" --~length|array;getlength;arrayname Sets "length" (string variable) to the number of items in the array Finally, I'm working on integrating some object-related commands into the Array support. The first of these is: --~|array;pagetokens;arrayname;@{selected|token_id} The last parameter is any token ID on the page you are interested in. It will be used to get all graphics objects on the page and fill the array with their IDs. Samples Here are a couple of examples for working with arrays. This one creates a simple array, adds an item to it, iterates over the array, replaces one of the items, and then re-iterates over the array in reverse order. !script {{ --~dummy|array;define;myarray;Apple;Bananna;Pear;Pumpkin --~dummy|array;add;myarray;Onion --~testvar|array;getfirst;myarray --:loop| --+Value|[&testvar] --~testvar|array;getnext;myarray --?[&testvar] -ne ArrayError|loop --+Loop1|Is Done! --~dummy|array;replace;myarray;Apple;Potato --~testvar|array;getlast;myarray --:loop2| --+Value|[&testvar] --~testvar|array;getprevious;myarray --?[&testvar] -ne ArrayError|loop2 --+Done|All done! }} Next, we get all of the tokens on the page for the selected token and display their names: !script {{ --~dummy|array;pagetokens;myarray;@{selected|token_id} --~count|array;getcount;myarray --+Total:|There are [&count] graphical objects on the page --~testvar|array;getfirst;myarray --:loop| --+Value|[*[&testvar]:character_name] --~testvar|array;getnext;myarray --?[&testvar] -ne ArrayError|loop --+Loop1|Is Done! }} I'll post the Fireball macro I used above a when I get the chance to clean it up a bit.