# File rbot/plugins/dice.rb, line 62 def privmsg(m) unless(m.params && m.params =~ /^[0-9]*d[0-9]+([+-]([0-9]+|[0-9]*d[0-9])+)*$/) m.reply "incorrect usage: " + help(m.plugin) return end a = m.params.scan(/^[0-9]*d[0-9]+|[+-][0-9]*d[0-9]+|[+-][0-9]+/) r = rolldice(a[0]) t = "[" + a[0].to_s + "=" + r.to_s + "] " for i in 1...a.length tmp = iddice(a[i]) r = r + tmp.total.to_i t = t + tmp.view.to_s end m.reply r.to_s + " | " + t end