PDA

View Full Version : Help with a coding issue



Paul Pratt
July 14th, 2016, 05:46
More work on the Dark Heresy rules.

I have a situation where a roll could be from 1 to 6 d10's depending on the situation. If one of the die turn up a "9" then I would like a message to be displayed.

I know how to capture a die in a fixed roll. Using that as a starting point I am this far. If I replace the "x" below with a number...say 2, whenever the 2nd die results in a 9 the message is displayed. I need to capture and check each die for a 9. Not sure how to do that. Any help out there?


local nResult = rRoll.aDice["x"].result;
if nResult == 9 then
rMessage.text = rMessage.text .. " -->Perils of the Warp!<-- "
end

Thanks - Paul

damned
July 14th, 2016, 06:22
Have a look at Trenloes successes extension. It will report on how many dice meet/exceed the success target - Im sure you could adapt it from there.

Paul Pratt
July 14th, 2016, 08:19
Got it thanks. I was close on my second version, the extension pointed me in the right direction. Works great now thanks.

damned
July 14th, 2016, 08:30
Got it thanks. I was close on my second version, the extension pointed me in the right direction. Works great now thanks.

Huzzah! Trenloe is still the king even when he isnt posting!