mIRC Home    About    Download    Register    News    Help

Print Thread
#136317 26/11/05 03:29 AM
Joined: Dec 2004
Posts: 80
C
Babel fish
OP Offline
Babel fish
C
Joined: Dec 2004
Posts: 80
hi,how do u make a script that read's a random code (example: a9kk4) in a text file and then sets the random code as a variable,and requires someone to repeat the code?.
and if u enter the wrong code and anything...it either will not responce or appears a message for a limited time.

example: (what u see in the channel):
-------------------------------------------------
<koko>!code
<bot>security code: 1234
<koko>1234
<bot>code confirmed


practice makes perfect... smile
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
as a start, try this
Code:
on *:text:!code *:#:{
  if (%code) { $iif($2 == %code,msg $chan code confirmed,msg $chan $1- Does Not Match) }
  if (!%code) { 
    set -u10 %code $r(1,9999)
    msg $chan Current code: %code
  }
}

Joined: Dec 2004
Posts: 80
C
Babel fish
OP Offline
Babel fish
C
Joined: Dec 2004
Posts: 80
yeah...but i want the bot to record the code from an text file and then someone has to repeat the code that was shown to work the script :P and the script u posted has no $read text parts :P and it was a hard script too!!!


practice makes perfect... smile
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
try
Code:
on *:text:!code *:#:{
  if (%code) { $iif($2 == %code,msg $chan code confirmed,msg $chan $1- Does Not Match) }
  if (!%code) { 
    set -u10 %code $read(random.txt)
    msg $chan Current code: %code
  }
}


that reads a random line from a text file
I have no idea what you mean by simple or not simple, if you dont like this code by all means write up your own

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
 on *:text:!code:#:{
set %code $read(code.txt)
.msg $chan security code: %code
}
on *:text:*:#:{
if $1 == %code {
.msg $chan code confirmed
}
}
  

Joined: Jun 2005
Posts: 9
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2005
Posts: 9
Give it a try:

Code:
on *:text:!code:#:{
  if (%occupied == 0) || (!%occupied) {
    set %occupied 1
    set %nick $nick
    set %chan $chan
    set %code $read(code.txt)
    msg $chan Security code: %code
    .timercode 1 10 /timeout
    .enable #codecheck
  }
  else msg $chan $nick bot is already working ;)
}
#codecheck off
on *:text:&amp;:#:{
  if ($nick == %nick) {
    if ($1 == %code) {
      msg $chan code confirmed
      set %occupied 0
      timercode off
    }
    else {
      msg $chan %nick $+ , $1 $+ : wrong code
      msg $chan %nick repeat operation
      set %occupied 0
      timercode off
    }
    .disable #codecheck
  }
}
#codecheck end
alias -l /timeout {
  set %occupied 0
  msg %chan %nick $+ , time out, sorry
  msg %chan %nick repeat operation 
  .disable #codecheck
}  


You can change any part to make it work as you want.


Link Copied to Clipboard