mIRC Home    About    Download    Register    News    Help

Print Thread
#33774 03/07/03 01:03 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
on *:part:#:{
var %i 1
if ($nick == $me) {
while (%i <= $did(switch,4).lines) {
did -ck switch 4 %i
$iif($did(switch,4).seltext == $chan,did -d switch 4 %i,inc %i)
}
}
elseif ($nick != $me) {
while (%g <= $did(switch,7).lines) {
did -ck switch 7 %g
$iif($did(switch,7).seltext == $nick,did -d switch 7 %g,inc %g)
}
}
}

the first part works, removing the channel from list when i part..., but removing the nickname doesnt work frown

Last edited by pheonix; 03/07/03 01:10 PM.

new username: tidy_trax
#33775 03/07/03 01:51 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Your code is unnecessarily slow. You don't need a while loop to find a line that matches a certain word/phrase. All you need is $didwm().
Code:
on me:*:part:#: if $didwm(switch,4,#) { did -d switch 4 $ifmatch }
on !*:part:#: if $didwm(switch,7,$nick) { did -d switch 7 $ifmatch }

However, I couldn't figure out from your post whether these lists (id 4 and 7) contain only 1 instance of the nick/channel or there are more. If the item appears in the list more than once, you need /filter.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#33776 03/07/03 02:51 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i have a nicklist,and a channel list that i am. so when someone leaves/kicked/quits the channel to remove their nickname from 7, and when i leave to remove the channel name that i have just left.


new username: tidy_trax
#33777 03/07/03 04:29 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Alright, I got it right the first time. The code I showed you should do what you want. Look up $didwm() to see what it does, you're gonna like it eventually.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#33778 03/07/03 05:02 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
thats wicked grin

From the help file:
$didwm(name,id,wildtext,N)
Returns the number of the line that matches wildtext, with the search starting at line N. N is optional.



new username: tidy_trax
#33779 03/07/03 06:17 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i have another problem now grin

on *:Dialog:switch:sclick:4:{
did -r $dname 7
var %z 1
var %q 1
while (%z <= $comchan($me,0)) {
if ($comchan($me,%z) == $did(4).seltext) {
.set %channick $did(4).seltext
}
inc %z
}
while (%q <= $nick(%channick,0)) {
if ($nick(%channick,%q) isop $chan) {
did -a $dname 7 @ $+ $nick(%channick,%q)
inc %q
}
elseif ($nick(%channick,%q) ishop $chan) {
did -a $dname 7 % $+ $nick(%channick,%q)
inc %q
}
elseif ($nick(%channick,%q) isvoice $chan) {
did -a $dname 7 + $+ $nick(%channick,%q)
inc %q
}
if ($nick(%channick,%q) isreg $chan) {
did -a $dname 7 $nick(%channick,%q)
inc %q
}
}
/window -a %channick
did -r $dname 8
did -a $dname 8 Server: $server
did -a $dname 8 Channel: %channick
did -a $dname 8 Topic: $chan(%channick).topic
did -a $dname 8 Modes: $chan(%channick).mode
did -a $dname 8 Ops: $nick(%channick,0,o)
did -a $dname 8 Half Ops: $nick(%channick,0,h)
did -a $dname 8 Voiced: $nick(%channick,0,v)
did -a $dname 8 Normal Users: $nick(%channick,0,r)
did -a $dname 8 Total Users: $nick(%channick,0)
did -z $dname 8
}

the 2nd while loop freezes me frown

im trying to get it so its like mircs nicklist
@blah
%blah
+blah
blah
any help greatly appreciated grin


new username: tidy_trax
#33780 04/07/03 10:11 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You don't need a loop here either. You don't need to be bothered with adding the nicks in the list, nor with sorting them: just let /filter do it for you, by dumping the entire nicklist as it is to the dialog. I also modified the previous code I gave you; since you want to add the nicknames with their mode prefix (if any), you also need to tell $didwm() to look for nicks with prefixes. It's also important that you have on OP/DEOP/VOICE/DEVOICE/HELP/DEHELP events, to add/remove the mode prefix from the nicknames in ID 7.

Anyway, here's the code:
Code:
on me:*:part:#: if $didwm(switch,4,#) { did -d switch 4 $ifmatch }
on !*:part:#: if $didwm(switch,7,$pnick(#,$nick)) { did -d switch 7 $ifmatch }
alias pnick return $left($left($nick($1,$2).pnick,- $+ $len($2)),1) $+ $2
on *:Dialog:switch:sclick:4:{
  var %chan = $$did(4).seltext
  [color:red]filter -wocl %chan $dname 7[/color]
  window -a %chan
  did -ra $dname 8 Server: $server
  did -a $dname 8 Channel: %chan
  did -a $dname 8 Topic: $chan(%chan).topic
  did -a $dname 8 Modes: $chan(%chan).mode
  did -a $dname 8 Ops: $nick(%chan,0,o)
  did -a $dname 8 Half Ops: $nick(%chan,0,h)
  did -a $dname 8 Voiced: $nick(%chan,0,v)
  did -a $dname 8 Normal Users: $nick(%chan,0,r)
  did -a $dname 8 Total Users: $nick(%chan,0)
  did -z $dname 8
}


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#33781 04/07/03 11:15 AM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
thankyou that works really well, accept for 1 thing frown
the half-ops come before the ops frown


new username: tidy_trax
#33782 04/07/03 11:42 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
This shouldn't be happening... I can't test any of this right now, but have you by any chance specified the sort style for the dialog listbox? (eg list 4, 100 100 100 100, sort). If you have, remove it, it is not needed.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#33783 04/07/03 01:03 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i took sort of, works fine now, thanx grin


new username: tidy_trax

Link Copied to Clipboard