Code: Select all
[h: inputString="numDice|1| How many dice to roll?|TEXT"]
[h: inputString2 = "difficulty|7|Enter Difficulty|TEXT"]
[h: status=input(inputString,inputString2)]
[h: abort(status)]
[h: diceArray='[]']
[h: i=0]
[h, while(i <numDice), CODE:{
[h: theRoll=1d10]
[h: diceArray=json.append(diceArray,theRoll)]
[h: i=i+1]
}]
[h: diceArray=json.sort(diceArray)]
[h: txtResult='']
[h: numSuccess=0]
[h: numFail=0]
[h: numFumble=0]
[count(json.length(diceArray)), CODE:{
[h: thedie=json.get(diceArray,roll.count)]
[h,IF((thedie >=difficulty )&&(thedie <10 )),CODE:{
[h: numSuccess=numSuccess+1]
[h: color='green']
}]
[h,IF(thedie ==10),CODE:{
[h: numSuccess=numSuccess+2]
[h: color='green']
}]
[h,IF(thedie ==1),CODE:{
[h: numFumble=numFumble+1]
[h: color='red']
}]
[h,IF((thedie>=2)&&(thedie<difficulty)), CODE:{
[h: color='black']
[h: numFail=numFail+1]
}]
<font color=[r: color]> [r: thedie] </font>
}]
[h,IF(numSuccess>0), CODE:{
[h: txtResult=' Success!']
[h: color='green']
}]
[h,IF((numFumble>0)&&(numSuccess==0)), CODE:{
[h: txtResult=' BOTCHED!']
[h: color='red']
}]
[h,IF((numFail>0)&&(numSuccess==0)&&(numFumble==0)), CODE:{
[h: txtResult=' Failed!']
[h: color='red']
}]
<font color=[r: color]>[r: txtResult] ([r: numSuccess])
One, sometimes the font tags work and sometimes they don't even if I hardcode them. Guessing it might be some other setting somewhere. They worked while I was working on the script, but not the next day when I restarted Maptools.
Two, this is nice, but is there a way to make the whole thing a private roll? The answer might not be so much a code change but rolling in a different chat channel or such?