mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2005
Posts: 2
F
Bowl of petunias
OP Offline
Bowl of petunias
F
Joined: Mar 2005
Posts: 2
Hi I have the following script (to display nicks on channel when I join in a form I like, without having to have a nicklist open) when I join any channel:

Code:
 
on me:*:join:#:/timer -m 1 600 joinon

alias joinon {
  echo 0 -ma Who's on the channel? lets see... there's
  set %who.total $nick($chan, 0)
  set %who.disp 0
  while %who.disp < %who.total {
    inc %who.disp
    inc %who.numnicks
    set %who.nextnick $nick($chan, %who.disp)
    set %who.allnicks $str.concat($chr(32) - $chr(32), %who.allnicks, %who.nextnick)
    if (%who.numnicks == 3) {
      set %who.numnicks 0
      unset %who.allnicks
    }
  }
  if ((%who.numnicks  == 1) || (%who.numnicks == 2)) {
    set %who.numnicks 0
    unset %who.allnicks
  }
  unset %who.*
}
}
 

Now it's not working when called as above from the remote. If I call the alias direct from a channel. it works fine. I can see it's falling down somewhere on the evaluation of $chan... but I can;t see how to make the script evaluate the channel when in the onjoin. All help welcome.

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Pass the chanelname to the alias
  • on me:*:join:#:/timer -m 1 600 joinon #
and replace "$chan" in the alias with "$1"

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I'd only add that in your case a /timer is not the best solution. You should be using the "end of names" (366) raw event and run /joinon from there. This way you make sure that /joinon is executed neither sooner nor later than it should, ie right after mirc gets the list of nicknames.
Code:
on me:*:join:#: set $+(%,onjoin,$cid,#) 1
raw 366:*: var %a = $+(%,onjoin,$cid,$2) | if $(%a,2) { unset $(%a) | joinon $2 }
You still have to change every occurance of $chan to $1 in /joinon's code.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
something u might like to add once you have it working with $1 is this tho the first line of the alias JOINON

alias joinon {
tokenize 32 $1 $chan

This well allow it to work using $1 and if no $1 was passed (ie you typed in /joinon) it well use the current channel if your in one.

Joined: Mar 2005
Posts: 2
F
Bowl of petunias
OP Offline
Bowl of petunias
F
Joined: Mar 2005
Posts: 2
Many thanks for everybody's help. Works like a dream smile


Link Copied to Clipboard