So currently I use:
Code:
on *:text:!d20:#:msg $chan $nick rolled a ( $r(1,20) ).

As a way to roll dice. But I've been experimenting with the idea of being able to do !d(X) and it roll the X as the maximum end of the $r.
Currently I have:
Code:
on *:text:!d*:#:{
  var %h = $$1
  msg $chan $nick rolled a ( ($r(1,%h) ) .
}

But it spits out ( ). So I decided to make it say %h instead and it takes the whole !d* no matter what it is. So if I did !d50 it would enter in:
Code:
( ($r(1,!d50) 

Any idea of how I can fix this?