mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2009
Posts: 3
F
fatey Offline OP
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Apr 2009
Posts: 3
Supposing im on #channel1 and someone types in a trigger word "-check"

Script then checks if user_A is in #channel2. If he is in #channel2, script says in #channel1 "user_A is in #channel2".
If user_A is not in #channel2, script says "user_A is gone!"

How do I go about writing something like this? I realise it may be something really straightforward but scripting isnt my forte.

Thanks in advance.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If the bot/client that is running the script is on the second channel, then you can do it like this
Code:
on *:text:-check*:#channel1:{
  if $$2 ison #channel2 {
    .msg $chan $$2 is in #channel2
  }
  else {
    .msg $chan $$2 is gone
  }
}

however, if you don't want (or can't have) the bot/client in the same room, then you would need to do a /whois on the nick, then check the response from raw 319 to see if the channel you're checking is in the response. If it is then the person is in that room, otherwise they are not.

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
I don't get it. How'd the bot know if a user was gone from saying the trigger word in a channel?

Joined: Apr 2009
Posts: 3
F
fatey Offline OP
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Apr 2009
Posts: 3
Thank you for your reply.

The bot is in both channels, ie #channel1 and #channel2.
Checking for a specific user in #channel2, so trigger will only look for the user in #channel2. #channel1 is the broadcast channel so to speak.

Using your code I got this:

Code:
on *:text:-check:#channel1:{
  if fatey ison #channel2 {
    .msg $chan fatey is in #channel2
  }
  else {
    .msg $chan fatey is gone
  }
}


Now, to extend on this: If supposing i wanted to set a variable if a user is present instead, do I do this?

Code:
on *:text:-check:#channel1:{
  if fatey ison #channel2 {
    set %check = yes
  }
  else {
    set %check = no
  }
}


Thanks in advance.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Close. Remove the = sign from the set lines or change the word set to var

Joined: Apr 2009
Posts: 3
F
fatey Offline OP
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Apr 2009
Posts: 3
Ok got it. Works like a charm.

Thanks for your help RusselB.


Link Copied to Clipboard