mIRC Home    About    Download    Register    News    Help

Print Thread
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.

Joined: Jan 2005
Posts: 25
A
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 -
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.

Joined: Dec 2002
Posts: 3,547
S
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.

Joined: Sep 2004
Posts: 237
JAFO Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Sep 2004
Posts: 237
Makes sense.... thanks!

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You're welcome.

Joined: Jan 2005
Posts: 25
A
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 -

Link Copied to Clipboard