mIRC Home    About    Download    Register    News    Help

Print Thread
#152128 27/06/06 03:55 PM
Joined: Jun 2006
Posts: 6
P
Pauc Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
P
Joined: Jun 2006
Posts: 6
Whan i give command to bot "-nick" the script will /nick $2-
but if nick is already in use i need to start the timer and maybe every 10 sec to try to change the given nick and when te nick will change the timer must stop

on 500:TEXT:*-nick:*:/timer 0 10 /nick $2- ???


0.mk
#152129 27/06/06 04:26 PM
Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
try this:
Code:
on 500:TEXT:-nick*:*: {
  .timer 0 10 /nick $2-
}


-Kurdish_Assass1n
#152130 27/06/06 11:04 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I wouldn't use a 0 in the timer line as you have it, as that will make the nick change command go every 10 seconds.

I suggest this instead:
Code:
 on 500:text:-nick*:*:{
.timer 1 10 nick $$2
}
 

That will force a 10 second delay from the time the -nick command is given before the nick is changed, and will only run once each time the -nick command is given.

The $$2 ensures that a nick has been supplied

#152131 28/06/06 01:28 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:
Whan i give command to bot "-nick" the script will /nick $2-
but if nick is already in use i need to start the timer and maybe every 10 sec to try to change the given nick and when te nick will change the timer must stop


you might try thiis
Code:
on 500:TEXT:*-nick:*:{
  if ($me != $$2) { nickcheck $2 }
}
alias nickcheck {
  nick $1
  .timernick 1 1 nickcheck2 $1
}
alias nickcheck2 {
  if ($me != $1) { .timernick 1 10 nickcheck $1 }
}

when the command is received the first bit checks that the nick is not already the requested nick (command accidently given twice)
then sends the nick to the alias that will change the nick. I did this so that if the nick is already in use the second alias that has the timer can act like a recursive loop with the first alias.
the timer in the first alias may need to be a longer delay depending on average lag to the server.

#152132 28/06/06 07:04 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
heres another option, i used a 60 second delay, becuase i think the irc server gets pissed with you trying to change nicks at rates like 10 seconds a time

Code:
on 500:TEXT:-nick *:*:{
  if ($me != $2) {
    nick $2
    .timer.-nick.change.to.* off
    .timer.-nick.change.to. $+ $2 0 60 if ($me != $!mid($ctimer,18)) nick $!v2 $(|,) if ($me == $!mid($ctimer,18)) timer $!+ $!ctimer off
  }
}


* i used two ifs in the timer becuase sometimes the else function seems to go a bit crazy in a timer command, i never really worked out what or how tho.

Last edited by DaveC; 28/06/06 07:42 AM.

Link Copied to Clipboard