mIRC Home    About    Download    Register    News    Help

Print Thread
#147506 19/04/06 10:41 PM
Joined: Oct 2005
Posts: 91
T
truguce Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Oct 2005
Posts: 91
This is driving me crazy. I am converting my bot over to use all ctcp events. What I am trying to do here is create a login ctcp event. You get three trys to login in then it ignores CTCP from you. The problem I am having is the parts in red are the only ones that are working. I have played around with this and can not get it to work. I was thinking of next saving this to a INI file and go from there but am getting frustrated.
Code:
ctcp *:login:*: { 
  var %temp.nick = $+($chr(37),ctcp,.,$nick,.,trys)
[color:red]  if ($2 == %ctcp.pw) { set %ctcp.nick %ctcp.nick $nick | .notice $nick Correct PW | return } [/color]
  if (!%temp.nick) {
    .notice $nick Wrong Password
    set %temp.nick 1
    return
  }
[color:red]     if (%temp.nick <= 3) { 
    .notice $nick Wrong Password 2
    inc %temp.nick
    return
  } [/color]
  if (%temp.nick > 3) {
    ignore -t $nick
    You have been ignored!!!
  }
}

ctcp *:load:*: {
  if ($nick iswm %ctcp.nick) /load -rs $2 
}
ctcp *:reload:*: { 
  if ($2 == %ctcp.pw) /reload -rs $3 
}
ctcp *:join:*: { 
  if ($nick iswm %ctcp.nick) /join $2
}
ctcp *:part:*: { 
  if ($nick iswm %ctcp.nick) /part $2 
}
  


Thanks all for the help!!

#147507 20/04/06 12:02 AM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
At quick glance I noticed you're using a temporary variable to hold the number of attempts, so it's always going to be 1, which is always going to be less than 3.

#147508 20/04/06 12:10 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
played with this a little
Code:
ctcp *:login:*: { 
  if  ($2 != %ctcp.pw) && (%temp.nick > 3) {
    ignore -tu25 $nick
    notice $nick You have been ignored!!!
    return
  }
  if ($2 != %ctcp.pw) && (!%temp.nick) {
    .notice $nick Wrong Password
    set %temp.nick 1
    return
  }
  if ($2 != %ctcp.pw) && (%temp.nick) && (%temp.nick <= 3) { 
    .notice $nick Wrong Password 2
    inc %temp.nick
  } 
  if ($2 == %ctcp.pw) { set %ctcp.nick %ctcp.nick $nick | .notice $nick Correct PW } 
}

really you should have the %temp.nick use the $nick as part of the var so that different nicks could do it
the ignore could be done by address so one person couldnt change nicks and get around the ignore
I put the unset on the ignore at 25 seconds, you might want to make that longer
I didnt do anything with the rest of what you posted

#147509 20/04/06 12:15 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
was worse than that
ctcp *:login:*: {
var %temp.nick = $+($chr(37),ctcp,.,$nick,.,trys)
if ($2 == %ctcp.pw) { set %ctcp.nick %ctcp.nick $nick | .notice $nick Correct PW | return }
if (!%temp.nick) {
.notice $nick Wrong Password
set %temp.nick 1
return
}

using a local var and setting a global var with the same name

#147510 20/04/06 01:23 AM
Joined: Oct 2005
Posts: 91
T
truguce Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Oct 2005
Posts: 91
Still getting the same error. That is why I got so frustrated. No matter how I changed it this happened..
[18:08] -> [scripting] LOGIN 1542
-
[18:08] -Scripting- Wrong Password 2

It does not set the variable and it always goes to that. I can repeat that over and over and I get the same message.
I did just change the script to this
Code:
ctcp *:login:*: {
  var %temp.nick = $+($chr(37),ctcp,.,$nick,.,trys)
  if  ($2 != %ctcp.pw) && (%temp.nick > 3) {
    ignore -tu25 $nick
    notice $nick You have been ignored!!!
    return  
  }  
  if ($2 != %ctcp.pw) && (!$+($chr(37),ctcp,.,$nick,.,trys)) {
    .notice $nick Wrong Password
    set $+($chr(37),ctcp,.,$nick,.,trys) 1
    return  
  } 
  if ($2 != %ctcp.pw) && ($+($chr(37),ctcp,.,$nick,.,trys)) && ($+($chr(37),ctcp,.,$nick,.,trys) <= 3) {
    .notice $nick Wrong Password 2
    inc $+($chr(37),ctcp,.,$nick,.,trys)  
  }  
  if ($2 == %ctcp.pw) { set %ctcp.nick %ctcp.nick $nick | .notice $nick Correct PW } 
}
  

Just to see whqt would happen. Now it does set the variable but I still get the same error.
[18:14] -> [scripting] LOGIN 5481
[18:14] -Scripting- Wrong Password 2
and that was on the first try and I did it five times and this is my variable
%ctcp.TruGuce.trys 5
I can keep doing it it wont ignore me or give me the first Wrong Password. confused

Last edited by truguce; 20/04/06 01:29 AM.
#147511 20/04/06 01:52 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You can try this code.. I don't know if it works exactly how you want.

Code:
ctcp *:login:*: {
  var %ctcp.login.tries 3
  ;
  if ($nick == %ctcp.nick) {
    .notice $nick You are already logged in
    return
  }
  elseif (%ctcp.nick != $null) {
    .notice $nick Someone is already logged in.
    .notice %ctcp.nick $nick just attempted to log in
    return
  }
  elseif ($2 != %ctcp.pw) {
    inc -u600 $+(%,ctcp.try.,$nick) 1
    if ($($+(%,ctcp.try.,$nick),2) <= %ctcp.login.tries) {
      notice $nick Wrong Password, attempt $v1
    }
    else {
      .ignore -t $nick 2
      notice $nick Wrong Password. You have been ignored.
    }
  }
  else {
    set %ctcp.nick $nick
    .notice $nick Correct Password 
  }
}

(untested)

-genius_at_work

#147512 20/04/06 02:17 AM
Joined: Oct 2005
Posts: 91
T
truguce Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Oct 2005
Posts: 91
THANK YOU!!! It works just right. Thanks for the help!!


Link Copied to Clipboard