mIRC Homepage
Posted By: Pauc Nick??? - 27/06/06 03:55 PM
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- ???
Posted By: Kurdish_Assass1n Re: Nick??? - 27/06/06 04:26 PM
try this:
Code:
on 500:TEXT:-nick*:*: {
  .timer 0 10 /nick $2-
}
Posted By: RusselB Re: Nick??? - 27/06/06 11:04 PM
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
Posted By: MikeChat Re: Nick??? - 28/06/06 01:28 AM
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.
Posted By: DaveC Re: Nick??? - 28/06/06 07:04 AM
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.
© mIRC Discussion Forums