mIRC Home    About    Download    Register    News    Help

Print Thread
#186159 18/09/07 10:17 AM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hello
I need hlp with a script i have made the hash tables already but i have a feeling i have maybe bracketed the $iif statment wrongly as its not coloring the nicks in the channel. I have pasted the code below.

Code:
alias away.chk {
  echo -a 4Scanning...
  var %i 1 %chan = $iif($1,$1,$active)
  while $nick(%chan,%i) { 
    %user = $ifmatch
    cline $iif($hget($+(away,$network)),%user),-lm 14,-r)
inc %i 
  }
}

Solo1 #186160 18/09/07 10:35 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I think your problem might be this line:

Code:
var %i 1 %chan = $iif($1,$1,$active)


Change it to:

Code:
var %i = 1, %chan = $iif($1,$1,$active)


Using your code I was unable to loop through the nicknames, which I believe might have been the cause.

SladeKraven #186162 18/09/07 10:46 AM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Thanks for your reply but that has not fixed the problem, vars dint need the =, i want it to color the nicks in the list if they are in a hash table.

Solo1 #186163 18/09/07 11:14 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
It wasn't the problem you were thinking of but it was a problem nonetheless, if you put echo before the cline command in your original post you will notice that it's not looping through the nicknames. Vars do need to be seperated by a comma.

Using your example:

Code:
alias test {
  var %x = 1 %y = 1
  echo -a $calc(%x + %y)
}


That should echo 2, 1+1=2. But it doesn't because only one variable is being assigned a value.

Code:
alias test {
  var %x = 1, %y = 1
  echo -a $calc(%x + %y)
}


Echoes 2 as it should do.

Back to the topic:

Code:
alias away.chk {
  echo -a 4Scanning...
  var %i 1, %chan = $iif($1,$1,$active)
  while $nick(%chan,%i) { 
    %user = $ifmatch
    cline $iif($hfind($+(away,$network),%user),-lm 14,-r) %user
    inc %i 
  }
}


That should work for you.

SladeKraven #186165 18/09/07 11:25 AM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
It now works fine, thanks to you. much appreciated.

SladeKraven #186167 18/09/07 11:27 AM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Is there anyway to make it color the nicks in the common channels. Meaning not just in one channel but in all chans that nick is on?

Solo1 #186172 18/09/07 02:03 PM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
I came up with this but its not working, i want it to color the nicks in all channels and i want it to check all channels i am on in one go, i tried something but its now working, could someone please help me with this. I have pasted my code below.


Code:
alias away.chk {
  if ($1 !ischan) { who $1 | return }
  var %i = 1,%c = 1
  while $chan(%c) {
    while $nick(%chan,%i) { 
      %user = $ifmatch
      $iif($hfind($+(away,$network),%user),com.cline,cline-r) %user
      inc %i 
    }
    inc %c
    if $hget($+(away,$network)) { .hfree $+(away,$network) } | hmake $+(away,$network) 5
    who +aM
  }
}
alias -l com.cline {
  var %i 1
  while ($comchan($1,%i)) { cline -lm 14 $1 $ifmatch | inc %i }
}

Solo1 #186222 19/09/07 02:49 PM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Greetings
I still need help with my script, i will try and make it a little clearer. I have a hash table where all nicks that are set to away on the network are stored in, i have a script that will color the users names in the channel nick list to a diff color if they are stored in the hash table, trouble is i want it color the users names in ALL the channels not just the one channel, could someone please take the time to help, it would be much appreciated. I have pasted the current code below.

Code:
alias away.chk {
  echo -a 4Scanning...
  var %i 1, %chan = $iif($1,$1,$active)
  while $nick(%chan,%i) { 
    %user = $ifmatch
    cline $iif($hfind($+(away,$network,$cid),%user),-lm 14,-r) %user
    inc %i 
  }
}

Solo1 #186234 19/09/07 05:36 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It might just be better if you have it color the nicks when you change the $active window (on ACTIVE). That way, if you're in a lot of large channels, you won't risk freezing mIRC from it trying to color all of those channels at once. Unless you have multiple channels visible at once, you'll only ever see the active channel anyhow. It's up to you, though.

You'd have to use /scon to handle all networks. And you'll have to loop through $chan() as you originally did.

Of course, you *could* use /cnick instead of /cline.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #186237 19/09/07 07:13 PM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hi Riamus,
Thanks for your reply, i don't want to use the on *:active method as its not a clean way of doing what i want, i do wish /cline had the option of coloring the user on all channels. I don't have much scripting experience hence me asking in the forum. I wonder if you would help to script a solution using /cline or my method.

Solo1 #186252 19/09/07 11:01 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Well, I don't do much with /scon, so it would be better for someone who knows that command better to figure that one out for you. Still, why not just use /cnick and save yourself the trouble?


Invision Support
#Invision on irc.irchighway.net
Riamus2 #186279 20/09/07 11:36 AM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hi

I dont want to use /scon as i dont want to cycle through networks, just the channels, and i have looked at /cnick in the help file and its not working i made sure its on and i type /cnick <nick> color and it says * Added admin to color list but it does not color the nick, i need to instantly color the nick, I paste the script again below, I just want it to work on all the channels i am on on that network.

Code:
alias away.chk {
  echo -a 4Scanning...
  var %i 1, %chan = $iif($1,$1,$active)
  while $nick(%chan,%i) { 
    %user = $ifmatch
    cline $iif($hfind($+(away,$network,$cid),%user),-lm 14,-r) %user
    inc %i 
  }
}


Kind regards

Solo1 #186281 20/09/07 01:03 PM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Try this
  • /cnick -fs1 <NICK> 14

Where f forces a new entry and s1 puts the new entry to the 1st position.
So:-fs1 is forcing a new entry at position 1. mIRC uses the first match, putting it into pos 1 will override any generic colors for ops/modes/etc

To remove it you'd do
  • /cnick -r <NICK>


deegee #186289 20/09/07 02:38 PM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hi degee
Your suggestion has been very helpful and i have amended the script, i wonder if you can improve it or make the code a little better. I have pasted the code below.

Code:
alias away.names {
  if $hget($+(away,$network,$cid)) { .hfree $+(away,$network,$cid) }
  who +aM
  var %c 1
  while ($chan(%c)) { away.chk $ifmatch | inc %c }
}
alias -l away.chk {
  var %i = 1, %chan = $1
  while $nick(%chan,%i) { 
    %user = $ifmatch
    .cnick $iif($hfind($+(away,$network,$cid), -fs1 %user),14,-r) %user
    inc %i 
  }
}


The above seems to me a little long way of going about things as i am using two aliases.

I just want it to cycle all channels and color the nicks accordingly. I use a time in an on connect script to use the aliases every few minutes. Your help is appreciated.

Last edited by Solo1; 20/09/07 02:39 PM.
Solo1 #186291 20/09/07 03:01 PM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Assuming that '/who +aM' generates a raw 352 reply..
Code:
alias away.names {
  while $cnick(1).color == 15 { .cnick -r 1 }
  who +aM
}
raw 352:*:{
  if (G isin $7) { .cnick -fs1 $6 15 }
  halt
}

Code:
;Plus a startup event to clear any leftover entries from last session
on *:start:while $cnick(1).color == 15 { .cnick -r 1 }

I'm assuming you already have the raws halted so I didn't addin any code to enable/disable groups or whatever...

deegee #186293 20/09/07 03:55 PM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hi Degee,
That looks alot simpler and it is a raw 352 reply, I just want it to check every few mins incase a nick has come back from the away status during the time i am connected to the server, Instead of constantly /who'ing channels i wanted to /who +aM every few mins instead as that decreases network traffic to the irc server significantly, is there anyway your script can be modded to check every few mins and update the nick list accordingly??


edit: As the script is not resetting the nicks color when they have returned from /away status
Kind regards

Last edited by Solo1; 20/09/07 03:59 PM.
Solo1 #186295 20/09/07 04:01 PM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
You could just add a timer into it
Code:
alias away.names { .timeraway.names $+ $cid 0 900 away.check }
alias -l away.check {
  while $cnick(1).color == 15 { .cnick -r 1 }
  who +aM
}
raw 352:*:{
  if (G isin $7) { .cnick -fs1 $6 15 }
  halt
}\


Quote:
edit: As the script is not resetting the nicks color when they have returned from /away status

It'll only reset colors when the alias is run, not when they set themselves back.

Last edited by deegee; 20/09/07 04:03 PM.
deegee #186296 20/09/07 04:03 PM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Just did, works fine now, you have been very helpful.

Many thanks


Link Copied to Clipboard