mIRC Home    About    Download    Register    News    Help

Print Thread
On Join for Clones that needs cleaning #108312 18/01/05 09:13 PM
Joined: Sep 2004
Posts: 237
JAFO Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Sep 2004
Posts: 237
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.

Re: On Join for Clones that needs cleaning #108313 18/01/05 10:22 PM
Joined: Jan 2005
Posts: 25
A
arctangent Offline
Ameglian cow
Offline
Ameglian cow
A
Joined: Jan 2005
Posts: 25
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 -
Re: On Join for Clones that needs cleaning #108314 18/01/05 11:01 PM
Joined: Sep 2004
Posts: 237
JAFO Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Sep 2004
Posts: 237
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.

Re: On Join for Clones that needs cleaning #108315 18/01/05 11:17 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
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.

Re: On Join for Clones that needs cleaning #108316 18/01/05 11:24 PM
Joined: Sep 2004
Posts: 237
JAFO Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Sep 2004
Posts: 237
Makes sense.... thanks!

Re: On Join for Clones that needs cleaning #108317 18/01/05 11:24 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You're welcome.

Re: On Join for Clones that needs cleaning #108318 18/01/05 11:28 PM
Joined: Jan 2005
Posts: 25
A
arctangent Offline
Ameglian cow
Offline
Ameglian cow
A
Joined: Jan 2005
Posts: 25
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 -