mIRC Homepage
Posted By: BoredNL $address not functioning all of the time - 18/03/03 11:20 AM
I have all ips of a certain channel I'm on recorded using "on join" and "on part", recording the ip using $address, but sometimes $address simply returns $null, and I don't know why. The address is shown, and it isn't nick/ip specific, it just simply doesn't return a value sometimes for some reason.
Again, a simple example of code where $address isn't working for you would be helpful.
Posted By: BoredNL Re: $address not functioning all of the time - 18/03/03 11:45 AM
uh, as I said, I was using "on join" and "on part", and it doesn't work like 1% of the time for some reason.

Do you really a literal code example??

Here one is.. even though you don't need it, but mkay:

Code:
on *:JOIN:#:{ window @ips | echo @ips (Joining) Channel: $chan Nickname: $nick Address: $address }


(guess what the part script example would look like..)
From the help file:
Quote:
$address(nickname,type)
Searches the Internal Address List for the address associated with the specified nickname.

$address(nick,1) returns *!*user@host

If the Internal Address List doesn't contain a matching nickname, the identifier returns $null.

$Address isn't meant to be used without nickname and type, you really should pay more attention to the help file.

Code:
on *:JOIN:#:{ window @ips | echo @ips (Joining) Channel: $chan Nickname: $nick Address: $address($nick,5) }
But in another part of the help file it says:
$address
Returns the address of the user associated with an event in the form [email][/email]user@host.

It doesn't specify a need for any parameters there...
Always works for me in channel events.
On 1:TEXT:*:#:echo $chan Nick: $nick Address: $address

(07:57:22) (+chris01) hey
Nick: chris01 Address: [email]blah@=vWj841-eaa6.adl.ihug.com.au[/email]


Seems to work just as fine.
Yes I did need to see example code (which is why I asked for it), otherwise there could have been any number of things wrong with your code not related to $address not working, meanwhile we're wasting our time trying to find a reason and a solution. I very much expected the problem to be related to your previous bug report since $address doesn't return a nickname segment. Does $fulladdress work properly in the same code?
Posted By: BoredNL Re: $address not functioning all of the time - 18/03/03 05:06 PM
Actually, it turns out that I was using $address( $nick, 2) anyways.

Btw, are you even reading what I'm saying??

I said it doesn't work about 1% of the time..

1 test (or even multiple tests not in a busy channel) will not be recreating the situation..
Posted By: BoredNL Re: $address not functioning all of the time - 18/03/03 07:55 PM
My guess would be that it takes a little time for the address to be stored, and every great once in a while, it tries to write to the file before the address appears. (The real script writes to a file and optionally echos to a custom window @ips) I know it isn't the way the script is written, I am sure of that. I can just stick the write on a 1 second timer or something.. it'll be ok. smile
Posted By: zack Re: $address not functioning all of the time - 18/03/03 09:03 PM
It smiply doesn't work because your IAL isn't been updated quick enough, as you said with "takes a little time for the address to be stored". When you join a channel, without any fancy stuff like a /who or massive whois', and a user doesn't talk, or quit, or join, just idling there, and you go to kick ban that user, it will only kick but not ban because his/her address isn't in the IAL (this is just an example of why $address doesn't work sometimes).

If worst comes to worst you can just add error checking...

on *:JOIN:#:{ aline -p @window Nick: $nick Address: $iif($address,$ifmatch,N/A) } Or something...

And so on...
Posted By: zac Re: $address not functioning all of the time - 18/03/03 09:20 PM
Impossible. JOIN includes their [email]user@host[/email] (:nick!user@host JOIN <channel>), so the IAL for that entry is updated immediately, assuming IAL is not off.
In the event that the IAL wasn't updated in time (honestly I doubt that's the problem) I'm sure $address (without parentheses) and $fulladdress would be filled since they aren't retrieving data from the IAL. So you should still be able to use $mask($fulladdress, 2) to get the script working 100% of the time.

And by the way yes I did read what you said. I tried approximately 180 joins/parts using the code you listed on various servers and every one returned correctly. Obviously there's still a fair chance that that wouldn't have caught the bug if it was literally a 1% possibility of it occurring, but I assumed you were exaggerating a bit with that figure. Seeing as you were actually using $address() and not $address though it seems my efforts were a waste - entirely what I was trying to avoid by asking you to paste exact code with which the bug had occurred.
Posted By: zack Re: $address not functioning all of the time - 19/03/03 07:35 AM
For some strange reason, in #Scripting on DALnet, today we got around 3 queries regarding why $address doesn't work sometimes.

One of our operators said to use $mask with $fulladdress, eg: $mask($fulladdress,3), not sure why, but it seems to fix the issue.
Technically it's better to use $mask and $fulladdress anyway since it doesn't require the IAL to be switched on. Maybe this apparent bug will help some people make their code more compatible :tongue:
Posted By: Levente Re: $address not functioning all of the time - 27/03/03 07:09 PM
I have a similar problem:
if i write //echo 4 -a *** $address(Someone,0), it writes notihing many times, but if I whois the nick before using $address, it always works. Why is this?
$address(Someone,0) only works if mIRC knows the address of "Someone". mIRC will recieve and store the address when "Someone" joins a channel you are in, "Someone" messages a channel you are in, when you /whois "Someone", etc. If none of these have happened then it will naturally return $null.
© mIRC Discussion Forums