I'm trying to use Crystal Ball Lite to create pre-fab attack and damage rolls for my D&D 3.5 rogue. However, I'm having trouble getting the syntax correct in order to do what I want.

I'm trying to set up a button that will roll an attack, check if it's a crit, and then roll damage (including crit damage if necessary). Here's what I've got so far. Whitespace & newlines added for clarity.

Code:
resultonly(     ($MainAttack1$=(1d20+17+5)) IF >= 39
 
THEN $MainAttack1Crit$=1 "Main Attack 1 crit!" 

ELSE "Main Attack 1" $MainAttack1$ END);



resultonly(     ($MainDamage1$=(9d8+1d6+14+12)) IF $MainAttack1Crit$ == 1 

THEN $MainDamage1$+(1d6+14+12) "Sneak Attack vs FF and Evil crit!" 

ELSE $MainDamage1$ "Sneak Attack vs FF and Evil" END);
The problem is that when I try to add more than one operation into either THEN/ELSE, only the first operation is executed. What I really want the script to do is to store the crit variable (1/0), and declare the result of a crit confirm roll.

Code:
resultonly(     ($MainAttack1$=(1d20+17+5)) IF >= 39
 
THEN $MainAttack1Crit$=1 "Main Attack 1 crit! Confirm:" $MainAttack1Confirm$=(1d20+17+5) $MainAttack1Confirm$

ELSE $MainAttack1Crit$=0 "Main Attack 1" $MainAttack1$ END);



resultonly(     ($MainDamage1$=(9d8+1d6+14+12)) IF $MainAttack1Crit$ == 1 

THEN "Sneak Attack vs FF and Evil not confirmed:" $MainDamage1$ $MainDamage1Crit$=($MainDamage1$+1d6+14+12) "crit:" $MainDamage1Crit$

ELSE $MainDamage1$ "Sneak Attack vs FF and Evil" END);

Having written all of this out, I'm thinking that this might be easier to do in BASH than in Crystal Ball (because that allows for input, and better output formatting). I'm still a total noob at bash, so if anyone could help me write a script for that instead, then that would work too ^^