Discussion:
Is there a better way to script this?
(too old to reply)
Jynx
2004-07-01 22:33:52 UTC
Permalink
on 1:text:*:?: {
if ($away) {
if ($nick isop #) goto op
.msg $nick I am currently not responding to private messages, please try
later :)
close -m $nick
/echo 4 -s Ignored a message from $nick $+ .
/halt
:op
/echo 4 -s private message from $nick $+ .
/beep 5 1
/halt
}
else {
/echo 4 -s private message from $nick $+ .
/beep 5 1
/halt
}
}


I'm sure there must be a way that doesn't repeat a whole bunch of script but
I'm a newbie at this ;-)
--
Email address is real but very rarely checked
If, for some obscure reason, you wish to mail me
change 'spam.catcher' to my name.

Jynx.
mvio
2004-07-07 16:28:06 UTC
Permalink
First off, look at what the script should be doing
and what it is doing..
Post by Jynx
on 1:text:*:?:{
this is an event that activates when a private message is
sent to you.
Post by Jynx
if ($nick isop #) goto op
This is a check to see if the user is op on "that channel"
But what you have to realize is, that no channel is defined
as the message was PRIVATE.. and not to a channel. # = NULL
so your script wont work.

What you might opt to do is check if the user is an op on
any channel you are on?

We could write an alias to grab a list of channels you and
the person who messaged are on together using comchan
(lets call it gcom, get common channels) $gcom($nick) will
check if the user is an op on any channel you are on, and
return "1" if true.

alias gcom {
var %i = 0
while ($comchan($$1,%i)) {
if ($1 isop $comchan($1,%i)) return 1
inc %i
}
return 0
}

Now we do this: add the "^" to our event which allows
us to halt default actions from taking place within
our client using "haltdef" (why close the query window
when it never has to open at all right?)

on ^1:text:*:?:{
if ($away) {
;ignore messages from nonops
if ($gcom($nick) == 0) {
echo 4 -s Ignored a message from $nick $+ .
haltdef
}
}
;not away, allow all messages
echo 4 -s Private message from $nick $+ .
beep 5 1
}

Anyhow, I think that should have the same results. Put both the
alias and the event in your remotes and try it out. I'm not even
sure that it works, off the top of my head..
Post by Jynx
on 1:text:*:?: {
if ($away) {
if ($nick isop #) goto op
.msg $nick I am currently not responding to private messages, please try
later :)
close -m $nick
/echo 4 -s Ignored a message from $nick $+ .
/halt
:op
/echo 4 -s private message from $nick $+ .
/beep 5 1
/halt
}
else {
/echo 4 -s private message from $nick $+ .
/beep 5 1
/halt
}
}
I'm sure there must be a way that doesn't repeat a whole bunch of script but
I'm a newbie at this ;-)
Loading...