mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
I have figured it out mostly, but I'm only wondering if there's a command that makes my script NOT reply when person x is in the channel.

Person x runs the script as well, and it should only reply when person x is not in the channel because there's no use for people to receive 2 of the same replies.

Thanks in advance.

Joined: Jan 2003
Posts: 249
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Jan 2003
Posts: 249
Add this to your ON *:XXX event used to reply or other event handler. Since you are light on details, that's about all I can do for the moment.

if ( $nick !ison $chan ) { reply }

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Another possibility in case each event has many lines of code. Add this line to the beginning of each event:

if ($nick ison $chan) return

-genius_at_work

Joined: Oct 2004
Posts: 72
C
Babel fish
Offline
Babel fish
C
Joined: Oct 2004
Posts: 72
That won't work for the on NICK and on QUIT events, because $chan is not defined then.

Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
Ok, lets say I want my script to say "Hi" in response to !hi when personx is not on #channel.

Would this work:

on *:TEXT:!hi *:#:
{ if ( personx !ison #channel ) {
msg #channel hi
}
}

Joined: Oct 2004
Posts: 72
C
Babel fish
Offline
Babel fish
C
Joined: Oct 2004
Posts: 72
Yes, that will work, but if you are BOTH on that channel, using the same script, excluding each other, nothing will happen smile

Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
Yes, I know that. wink

I am the only one running it with the exclude. smile

Edit: Wouldn't this mean that it only does it when the person is in the channel? If not, something else must be wrong with it.. because it's not working. frown

Last edited by Noeptolemos; 13/01/06 08:36 PM.
Joined: Oct 2005
Posts: 35
C
Ameglian cow
Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
the ' ! ' before the 'ison' operator makes the operator 'isNOTon'.

I would use the
Code:
on *:text:*:#channel: {
  if (X ison $chan) { return }
  else { commands}

return is like /halt. it just exits the script.


#indierpgs @ magicstar.net Your indie-rpg fix. Online.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Or even simpler:

if (X !ison $chan) {
commands
}


Gone.
Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
on *:text:*:!report *:#: {
if (Killingscream ison #trade-report) { return }
else { msg $chan Thanks $nick }
}

I don't seem to be able to find out what's wrong. I'm sure I'm missing something stupid. Also, I want it to only respond if they say: !report http://forums.whatever.com/<inserttopic here>

The last part has to be random of course. Maybe I can just do:
on *:text:*:!report http://forums.whatever.com/ *:#: {

But I'm not sure about that either.

Thanks for all the help so far. smile

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You cannot use : directly in the matchtext part because that character is preserved as a delimiter for events.

on *:text:$($+(!report http,$chr(58),//forums.whatever.com/&)):#channel: {
if (killingscream !ison #trade-report) msg # Thanks $nick
}

Change #channel to the name of the channel where you want this to trigger in.
The & in the matchtext requires for there to be a topic appended to the url, without any text after this topic, not even a space or any other character.

Alternatively you can use a regex as matchtext like this:

on $*:text:/^!report http\72\Q//forums.whatever.com/\E\S+$/i:#channel: {
if (killingscream !ison #trade-report) msg # Thanks $nick
}


Gone.
Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
Used the last one and it works flawless. How do I make it give the same response if someone does:

!report http://forums.whatever.com/showtopic=1 text

That's my last question, thanks everyone once again and FiberOPtics in particular. wink

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
So the url will always end in "showtopic=<digits>" ?

on $*:text:/^!report http\72\Q//forums.whatever.com/\Eshowtopic=\d+$/i:#channel: {


Gone.

Link Copied to Clipboard