mIRC Home    About    Download    Register    News    Help

Topic Options
#108312 - 18/01/05 09:13 PM On Join for Clones that needs cleaning
JAFO Offline
Fjord artisan

Registered: 23/09/04
Posts: 237
Loc: New Orleans
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.

Top
#108313 - 18/01/05 10:22 PM Re: On Join for Clones that needs cleaning
arctangent Offline
Ameglian cow

Registered: 13/01/05
Posts: 25
Loc: PHIL
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 # )
_________________________
- I AM -

Top
#108314 - 18/01/05 11:01 PM Re: On Join for Clones that needs cleaning
JAFO Offline
Fjord artisan

Registered: 23/09/04
Posts: 237
Loc: New Orleans
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.

Top
#108315 - 18/01/05 11:17 PM Re: On Join for Clones that needs cleaning
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
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.

Top
#108316 - 18/01/05 11:24 PM Re: On Join for Clones that needs cleaning
JAFO Offline
Fjord artisan

Registered: 23/09/04
Posts: 237
Loc: New Orleans
Makes sense.... thanks!

Top
#108317 - 18/01/05 11:24 PM Re: On Join for Clones that needs cleaning
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
You're welcome.

Top
#108318 - 18/01/05 11:28 PM Re: On Join for Clones that needs cleaning
arctangent Offline
Ameglian cow

Registered: 13/01/05
Posts: 25
Loc: PHIL
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
_________________________
- I AM -

Top