mIRC Home    About    Download    Register    News    Help

Print Thread
#269803 29/01/22 08:02 PM
Joined: Jan 2022
Posts: 5
F
fusion9 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2022
Posts: 5
Hi!

This is probably very simple, but I've searched and can't find it:

How do you get the host/ip from a user address? I'm not looking for a mask, but only the host part after the @. E.G. just the x.x.x.x or server.isp.net.

I need to pass only that to a utility script.

Thanks in advance!

fusion9 #269805 30/01/22 08:33 AM
Joined: Jan 2004
Posts: 1,944
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
Lotsa of good stuff at wikichip too
https://en.wikichip.org/wiki/mirc/identifiers/$address

Notice how the example uses $gettok to get the portion of the string following the @ which is codepoint 64

fusion9 #269807 30/01/22 02:00 PM
Joined: Jan 2012
Posts: 216
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2012
Posts: 216
You can get this with a combination of several identifiers: $address and $gettok = "$gettok($address(NickName,5),2,64)" - "NickName" can be any user nickname.

First you get the full mask of the user's address: "$address(NickName,5)" - more details here: https://en.wikichip.org/wiki/mirc/identifiers/$address

Then, a part of the host is cut out from the resulting mask: "$gettok($address(NickName,5),2,64)" - more details here: https://en.wikichip.org/wiki/mirc/identifiers/$gettok

You can run this code on the command line to see the result:
Code
//echo -a $gettok($address(NickName,5),2,64)


You can also use this method: "$ial(NickName).host" - more details here: https://en.wikichip.org/wiki/mirc/identifiers/$ial

To test the result, enter this:
Code
//echo -a $ial(NickName).host



🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code (mIRC scripts, help, discuss, examples)
maroon #269809 30/01/22 07:24 PM
Joined: Jan 2022
Posts: 5
F
fusion9 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2022
Posts: 5
Thank you - that makes it very easy for what I want to do smile

Epic #269810 30/01/22 07:25 PM
Joined: Jan 2022
Posts: 5
F
fusion9 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2022
Posts: 5
Thank you, Epic - I love having options smile

Just not tooo many!

Epic #269811 30/01/22 07:43 PM
Joined: Jan 2022
Posts: 5
F
fusion9 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2022
Posts: 5
Ok - I'm seeing that if a user is in the same channel(s) as I am, these both work great. If a user isn't in the same channel, I'll need to get the user address and pass that explicitly?

I'm getting * /echo: insufficient parameters when they are not in the same channel as my client with either method.

fusion9 #269812 31/01/22 12:46 AM
Joined: Jan 2004
Posts: 1,944
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
More precisely, the $address string is empty if they're not in your IAL, which could potentially be disabled with /ial off
In addition, the IAL contains addresses only if mirc sees them "do something". So if you enter a channel with 1000 nicks, none of them will be in your ial unless they were already there due to them being in one of your other channels, or until they send a channel message, change their nick, get op/voiced by someone etc.

To add all 1000 people to your ial: /who #channelname

You need to be careful about just having a script doing the /who whenever you join a channel, because if you autojoin 20 large channels and send 20 /who at the same time...

You can also add someone to your ial individually like /who nick or /whois nick

maroon #269813 31/01/22 01:56 AM
Joined: Nov 2021
Posts: 56
Babel fish
Offline
Babel fish
Joined: Nov 2021
Posts: 56
Anyway we can do the /who with delay when joining multiple channels and have duration between them to prevent discon or other issues

maroon #269814 31/01/22 04:31 AM
Joined: Jan 2022
Posts: 5
F
fusion9 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2022
Posts: 5
Ok great - I was misunderstanding. I was thinking the gettok method wasn't using the IAL.

I can easily check for a value, and if empty, do the who on the individual nick, etc.

Thank you again!

Simo #269817 31/01/22 11:55 AM
Joined: Jan 2004
Posts: 1,944
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
Well, there's a raw event that's triggered when a /who event is finished, so you can use that as a signal to start another one, and it's up to you how long of a delay is safe.
$chan(#channelname).inwho can tell you if there's a /who in progress, but it only tells you for the 1 channel, so you'd need to keep track separately for which channels you've sent a request.

These are useful identifiers:
$nick($chan,0)
$ialchan(*,#,0)

The 1st one tells you how many nicks mIRC things is in there. Which can be different than reality for some networks who have some kind of invisible auditorium mode.

The 2nd one tells you how many of those nicks are in the IAL.

If the 2 numbers match, there's no need for /who, though the server would still spam you with the reply if you asked for it.

I think Racoon has made some scripts in the past to manage this more efficiently, such as estimating when you're better off asking for info about the 4 nicks you don't have than to ask for info for the whole channel even if you already have 90%


Link Copied to Clipboard