mIRC Homepage
Posted By: JAFO On Join for Clones that needs cleaning - 18/01/05 09:13 PM
I have this and it works, but there has to be a better way of doing it.
Code:
on *:JOIN:*:{
  if ($ialchan($wildsite,$chan,0) > 1) { /set -u5 %IAL $ialchan($wildsite,$chan,0) }
  else { Halt }
  if (%IAL == 2) {  echo $chan $timestamp 4 Joins: $nick $address 4,0Clone Alert ... 4 $ial($wildsite,1).nick 9is also4 $ial($wildsite,2).nick }
  elseif (%IAL == 3) {  echo $chan $timestamp 4 Joins: $nick $address 4,0Clone Alert ... 4 $ial($wildsite,1).nick 9is also 4 $ial($wildsite,2).nick 9& 4 $ial($wildsite,3).nick  }
  elseif (%IAL == 4) {  echo $chan $timestamp 4 Joins: $nick $address 4,0Clone Alert ... 4 $ial($wildsite,1).nick 9is also 4 $ial($wildsite,2).nick 9& 4 $ial($wildsite,3).nick 9& 4 $ial($wildsite,4).nick  }
  elseif (%IAL == 5) {  echo $chan $timestamp 4 Joins: $nick $address 4,0Clone Alert ... 4 $ial($wildsite,1).nick 9is also 4 $ial($wildsite,2).nick 9& 4 $ial($wildsite,3).nick9&  4 $ial($wildsite,4).nick 9& 4 $ial($wildsite,5).nick  }
  else { Halt }
}  

Just looking to clean it up..... i would prefer to not have to write infinate lines of if then statements.
try this:
Code:
  
on *:join:#:{
 var %i  = $ialchan($wildsite,#,0),%out
 if (%i > 1) {
  while (%i) {
   %out = $addtok(%out,$ialchan($wildsite,#,%i).nick,44)
   dec %i
  }
  echo -a * Clones ( $+ $wildsite $+ ): %out
 }
}

you'd wanna make sure your ial is on, and that it is properly updated when u first join ( /who # )
Posted By: JAFO Re: On Join for Clones that needs cleaning - 18/01/05 11:01 PM
Works great , and thanks. Now can you break it down for me?
This part: $addtok(%out,$ialchan($wildsite,#,%i).nick,44)
I still just dont get tokens. AT ALL.
By looking at the code I think that %out are the cloned nicknames. So, if the clones are greater than one, it adds cloned nicknames $ialchan($wildsite,#,%i).nick seperated by the delimiter $chr(44) which is a comma. So the end result is Clone1,Clone2,Clone3,Clone4,Clone5 etc.
Posted By: JAFO Re: On Join for Clones that needs cleaning - 18/01/05 11:24 PM
Makes sense.... thanks!
You're welcome.
no problem wink

well, tokens are parts of the string based upon specific DELIMITERS. what do mean?

take this example:

"I am a sentence."

there are 4 words (i think :P,counting the 'a') in it. How do we count words? what identifies one word from the next? SPACES. in other words, it is a SPACE DELIMITED line.

let's break it down in mIRC:

note: the ascii number that represents the SPACE character is 32.

//echo -a * There are $numtok(This is a sample string., 32) SPACE DELIMITED tokens in: This is a sample string.

//echo -a * The 1st one is: $gettok(This is a sample string.,1,32)
//echo -a * The 2nd one is: $gettok(This is a sample string.,2,32)
//echo -a * And the last one is: $gettok(This is a sample string.,5,32)

hope this help smile

read on:

/help $gettok
© mIRC Discussion Forums