mIRC Home    About    Download    Register    News    Help

Print Thread
if commands if #109353 28/01/05 04:47 AM
Joined: Nov 2004
Posts: 332
R
ricky_knuckles Offline OP
Fjord artisan
OP Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
i would like to know if and how you can do something
this coincides the the guest kicking thread because i could have responded but i felt what i gave would be inadequate

i would like to know how you can do a if statement
then the commands and then if something changes abort the command or do something else

for instance
on *:join:#:{
if ($nick == *guest*) { timer 1 1200 kick $chan $nick }
and let say they change their name before the timer goes off
and i want it to make the timer turn off then


The Kodokan will move you, one way or another.
Re: if commands if #109354 28/01/05 06:00 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Each different type of instants of what you ask for might be slightly different how you would need to go about it, but for your example i would use this.

Code:
on *:JOIN:#:{
  if ($nick  == *guest*) {
    .timer.kick. $+ $nick 1 1200 kick $chan $nick
    ;^ renamed the timer to Timer.kick.nickname
  }
}
;  
on *:NICK:{
  if ($timer(.kick. $+ $nick)) {
    .timer.kick. $+ $nick off
    ;^ on a nick change see if there is a timer by the name ,kick.nickname and if so delete the timer
  }
}


Techniclly I could have just dumped the $timer(.kick. $+ $nick) check all together, and on a nick change just done a .timer.kick. $+ $nick off since that would delete the timer if it existed or done nothing, but that wouldnt have shown you how you might test for a timer and take what action you needed, such as you might have wanted to do this

Code:
on *:NICK:{
  if ($timer(.kick. $+ $nick)) {
    .timer.kick. $+ $newnick 1 $timer(.kick. $+ $nick).secs $timer(.kick. $+ $nick).com
    .timer.kick. $+ $nick off
    ;^ once a guest there is no esacpe the kick, it creates a new one under the newnick and deletes the old one
  }
}

Re: if commands if #109355 28/01/05 06:27 AM
Joined: Nov 2004
Posts: 332
R
ricky_knuckles Offline OP
Fjord artisan
OP Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
i feel dumb but i cant follow that
i dont understand the $+ $nick
and all the .
im sorry
could you explain a little more deeply or point me to help if the explanation is there


The Kodokan will move you, one way or another.
Re: if commands if #109356 28/01/05 06:29 AM
Joined: Mar 2004
Posts: 359
L
LostServ Offline
Fjord artisan
Offline
Fjord artisan
L
Joined: Mar 2004
Posts: 359
The $+ combines whats before and after it. (//echo a $+ b) will return 'ab.'

Re: if commands if #109357 28/01/05 06:50 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
The . at the front of the timer is so it doesnt display the timer messages, this is not related to the other .'s

I use .'s between items becuase it makes em easier to read, and to token up if need be, TIMERKICKRICK is harder to read than TIMER.KICK.RICK

$+ as said above is used to join what follows it to whats in front of it as i need the $nick as part of the timer name.
assume $nick is Guest10101, $chan is #blah
.timer.kick. $+ $nick 1 1200 kick $chan $nick
becomes
.timer.kick.Guest10101 1 1200 kick #blah Guest10101
^ that is a named timer one I can identify using the .kick.Guest10101 within the $timer() identifier.

Below replaces the code before sicne i didnt spot the ($nick == *guest*) in the original code

Code:
on *:JOIN:#:{ if (Guest* iswm $nick) { .timer.kick. $+ $nick 1 1200 kick $chan $nick } }
on *:NICK:{ if ($timer(.kick. $+ $nick)) { .timer.kick. $+ $nick off } }