Here's another way you could do it:
alias mod {
set %moderate.time $$?="How long (in seconds) would you like this chat room to be moderated?"
if ($me isopin $active) {
/mode $active +m | /timermod 1 %moderate.time mode $active -m | unset %moderate.time
}
}
That might be a little bit easier.
You could use /mod and it will moderate the channel for however long you tell it to.