Looking for help to create Troll definitions

## Looking for help to create Troll definitions

 Wed Oct 15 11:28:25 2014   by   Gareth Larter Dear All,I play a lot of Ars Magica and I'm looking at how Troll can be used to roll the different type of dice in the game (partly because I'd like to use Dice Master to help run my game).In Ars Magica (ArM5), there are three types of dice rolls.Simple - a straight forward d10 role with results from 1 to 10.Quality - a d10 roll with results from 1 to 10, but 1s reroll and double the next roll. I think I've cracked it using the following codefunction quality(x) =  if x=1 then 2 * call quality(d10)  else x  call quality(d10)Stress - similar to Quality but the results on the first die ranges from 0 to 9 (so z9). Again 1s reroll and double but a 0 can result in a botch. I realise that I could reuse the above code to generate the result (substituting z9 for d10 in that first call) but how can I check for botchs.I assume that an if x=0 then call checkbotch(n) would work but can I have multiple if checks in a function? Thu Oct 16 09:48:48 2014   by   Torben Your quality function does exactly what you describe, so you should be fine.It is certainly possible to use multiple if-then-else checks in a function.  Generally, Troll is designed to nest structures (except function definitions) arbitrarily.  So your stress roll could be written as`function stress(x) =  if x=0 then (whatever you do with botches)  else if x=1 then 2 * call stress(z9)  else xcall stress(z9)`