mIRC Home    About    Download    Register    News    Help

Print Thread
#3778 28/12/02 03:02 PM
Joined: Dec 2002
Posts: 8
D
Davey Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Dec 2002
Posts: 8
I tried to script this script to tell the common channels of the user when they PM you, but it didn't quite work frown.
Code:
on ^*:text:*:?:{
  if (%flood.protection == $true) {
    if (%flood.protection.query == $true) {
      if (%flood.protection.query.max => $query(0)) {
        close -m $nick
        halt
      }
    }
  }
  if ($query($nick) == $null) {
    query $nick
    if ($comchan($nick,0) == 0) {
      echo $nick « Common channels with $nick $+ : none »
      echo $nick ‹ $+ $nick $+ › $1-
      halt
    }
    var %nick.comchan = $null, %nick.cmc.count = 0
    :cc.loop
    inc %nick.cmc.count
    if ($comchan($nick,%nick.cmc.count) == $null) {
      echo $nick « Common channels with $nick $+ : %nick.comchan »
      echo $nick ‹ $+ $nick $+ › $1-
      halt
    }
    elseif ($comchan($nick,%nick.cmc.count) != $null) {
      var %nick.comchan = %nick.comchan $comchan($nick,%nick.cmc.count)
      goto cc.loop
    }
  }
  elseif ($query($nick) != $null) {
    echo $nick ‹ $+ $nick $+ › $1-
    halt
  }
}

It doesn't show the common channels part. The rest works fine. All my variables for the protection part are set, etc.
Just will not show the common channels. Anyone have any ideas?

Dave.

#3779 28/12/02 04:57 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Code:

on ^*:TEXT:*:?:{
  if ((%flood.protection) && (%flood.protection.query) && ($query(0) > %flood.protection.query.max)) {
    close -m $nick
    halt
  }
  if (!$query($nick)) {
    query $nick
    if ($comchan($nick,0)) {
      var %nick.comchan, %i = 1
      while ($comchan($nick,%i)) {
        %nick.comchan = %nick.comchan $ifmatch
        inc %i
      }
      echo -ti2 $nick « Common channels with $nick $+ : %nick.comchan »
       echo -ti2 $nick ‹ $+ $nick $+ › $1-
    }
    else {
      echo -ti2 $nick « Common channels with $nick $+ : none »
       echo -ti2 $nick ‹ $+ $nick $+ › $1-
    }
  }
  else echo -ti2 $nick ‹ $+ $nick $+ › $1-
  haltdef
}


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#3780 29/12/02 10:02 AM
Joined: Dec 2002
Posts: 8
D
Davey Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Dec 2002
Posts: 8
I used this code, which is almost exactly the same as yours, except the 'else' at the end has an open and close bracket (I wanted to make it look neater):

on ^*:TEXT:*:?:{
if ((%flood.protection) && (%flood.protection.query) && ($query(0) > %flood.protection.query.max)) {
close -m $nick
halt
}
if (!$query($nick)) {
query $nick
if ($comchan($nick,0)) {
var %nick.comchan, %i = 1
while ($comchan($nick,%i)) {
%nick.comchan = %nick.comchan $ifmatch
inc %i
}
echo -i2 $nick « Common channels with $nick $+ : %nick.comchan »
echo -i2 $nick < $+ $nick $+ > $1-
}
else {
echo -i2 $nick « Common channels with $nick $+ : none »
echo -i2 $nick < $+ $nick $+ > $1-
}
}
else {
echo -i2 $nick < $+ $nick $+ > $1-
haltdef
}
}


It does exactly the same as the other one.
I am an oper on another server and I used RootServ to make ChanServ PM me. It never said "< common channels with ChanServ: none >", it just showed ChanServ's message.

Dave.

#3781 30/12/02 01:40 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
You also altered the logic by including the haltdef inside the else block rather than leaving outside where I had it. It will only halt the default text if it matches the final else now.

Where did the message from ChanServ show up? In your Status window? As a -ChanServ- notice? Did you already have a query window open named ChanServ?


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard