This works very well - I just had to change the $1 to $2 in the line below:

Code
($1 == $voicepassword($nick))

I've added some other checks, and am working on the messaging if they don't get it right the first time. I think I'll give them three tries, then put them on ignore for a few minutes. I like how you got around the ON TEXT issue by adding the voiceme * to the matchtext. That keeps other private messages from triggering it perfectly.

Originally Posted by maroon
Code
ON *:START:{ set %voicepassword $regsubex($str(x,50),/x/g,$rand(a,z)) }
ON *:CONNECT:{ if ($network == Change_Me) set %voicepassword $regsubex($str(x,50),/x/g,$rand(a,z)) }

alias voicepassword  { return $hotp(%voicepassword $$1, $calc( ($ctime - $timezone + 0*3600) // 86400),sha256,6) }

on *:TEXT:voiceme:?: {
  ;send the message
  .msg $nick Please reply with this text and I will give you voice: voiceme $voicepassword($nick)
}

on *:TEXT:voiceme *:?: {
  if $nick ison #mychan && $nick !isvoice #mychan {

    if ($1 == $voicepassword($nick)) {
      //echo -a nick in channel

      /mode #mychan +v $nick
      .msg $nick Congrats! You have voice (+v) and can chat in channel. 
    }
    else {
      echo -a here is what to do when they give the wrong number
    }

  }
  else {
    //echo -a $nick not in channel
    .ignore -pu300 $nick
  }
}

Last edited by fusion9; 06/02/23 03:03 AM. Reason: removed a bad assumption (that I just tested)