mIRC Home    About    Download    Register    News    Help

Print Thread
$whois(nick) Identifier #240988 12/03/13 06:12 AM
Joined: Mar 2013
Posts: 3
V
V4V Offline OP
Self-satisified door
OP Offline
Self-satisified door
V
Joined: Mar 2013
Posts: 3
An identifier that allows the use of information from /whois events would be very useful.

Examples:

$whois($nick).identified would return $true if you recieved a 307 Event or $false otherwise.

$whois($nick).channels would return the channels as seen in a /whois. Space-delimited and obscuring secret ones.

Re: $whois(nick) Identifier [Re: V4V] #240991 12/03/13 10:04 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Identifiers aren't really the best option for something that requires waiting for a response from the server. There may be something else that can be done, but using RAW to get this information works very well. It will trigger as soon as you have it, which is what you need when you are trying to get information that the server has to send you. An identifier would have to wait for it, which wouldn't work very well. Or else mIRC would have to store all /whois responses and you'd only know the result from the last time you used it, which also wouldn't be very good because you might think it's current information, but it may be hours, days, or even weeks old.


Invision Support
#Invision on irc.irchighway.net
Re: $whois(nick) Identifier [Re: Riamus2] #240993 12/03/13 10:40 AM
Joined: Mar 2013
Posts: 3
V
V4V Offline OP
Self-satisified door
OP Offline
Self-satisified door
V
Joined: Mar 2013
Posts: 3
Originally Posted By: Riamus2
Identifiers aren't really the best option for something that requires waiting for a response from the server. There may be something else that can be done, but using RAW to get this information works very well. It will trigger as soon as you have it, which is what you need when you are trying to get information that the server has to send you. An identifier would have to wait for it, which wouldn't work very well. Or else mIRC would have to store all /whois responses and you'd only know the result from the last time you used it, which also wouldn't be very good because you might think it's current information, but it may be hours, days, or even weeks old.


Will a RAW trigger in the middle of an ongoing script? For example could I /whois a nick, have a raw set a variable, and check it later on?

-EDIT- Also, I assumed the identifier would request new information everytime.

Last edited by V4V; 12/03/13 10:42 AM. Reason: Afterthought
Re: $whois(nick) Identifier [Re: V4V] #240994 12/03/13 02:57 PM
Joined: Jan 2004
Posts: 1,286
L
Loki12583 Online
Hoopy frood
Online
Hoopy frood
L
Joined: Jan 2004
Posts: 1,286
Not in the middle as you suggest, exactly. Whether you use the same alias with a switch to go to a certain point, or a completely new alias is up to you. You'll lose any temporary vars and probably event-specific identifiers when you return from the first call - so you'll need to save any data before that.

Here's a very rough structure:

Code:
alias myalias {
  if ($1 == whois-raw) goto whois-raw
  ...
  set %checking-whois-raw %nick
  whois %nick
  return
  :whois-raw
  ...
}

raw *whatever*:*:{
  if (%checking-whois-raw != %nick) return
  myalias whois-raw ...
}

Re: $whois(nick) Identifier [Re: V4V] #240999 12/03/13 11:22 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
mIRC scripting is single threaded, which means everything is done in order. So if you had an identifier that requested information from the server and had to wait until it received it before continuing on in the script, that would cause everything else to freeze until it completed. If you know you can get a response almost instantly every time, then an identifier could work well. But with a server, it could take a few seconds or even a few minutes if you have bad lag. It could entirely lock up mIRC until you break out of the script if you get disconnected and don't get a reply at all. That is why an identifier wouldn't really work for that kind of situation.

You should be able to do whatever you need with RAW events. More detail on what you want to accomplish might make it easier for someone to give you more exact information on how to do it. However, what Loki showed is a good start for what you probably need. It also shows how you could trigger an alias directly from the RAW event so that it does something once you receive a reply.

You have a variety of ways to save data in variables. For example, you could /whois a nick and using RAW, you could set a variable that showed the last /whois's channel list. Then, you could use that variable whenever you want. Of course, that only gives the last call. You could manage it another way by using dynamic variables to track more than one /whois at a time, though that can get a little complicated when using multiple RAW numerics.


Invision Support
#Invision on irc.irchighway.net
Re: $whois(nick) Identifier [Re: Riamus2] #241000 13/03/13 04:32 AM
Joined: Mar 2013
Posts: 3
V
V4V Offline OP
Self-satisified door
OP Offline
Self-satisified door
V
Joined: Mar 2013
Posts: 3
Ok. Thank you for the replies.