mIRC Home    About    Download    Register    News    Help

Print Thread
#193298 18/01/08 03:33 AM
Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
Code:
whois $nick
    raw 311:*: { set %addvar2 ($gettok($+($3,@,$4),1,46),2,64) }
    ;  set %addvar2 $gettok($address($nick,2),2,64)
    set %addvar1 $gettok(%addvar2,1,46)
    set %qvar1 $2
    set %qvar2 $gettok($2,1,35)
    set %qnick4 $nick

I am writing out a bot for a company. I am using an on Text to set these vars but I am having a problem with this nick.
talent-prostar is ~talent@pRoStAr-.user.gamesurge
for some reason $address($nick,2) wont work and neither will the current script above work. It will not set his name in a var and I cant find the reason why. :|

ix007 #193299 18/01/08 03:53 AM
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Code:
raw 311:*: {
  %addvar = $+($2, !, $3, @, $4)
}

This sets up a proper nick!user@host mask.

The nick is $gettok(%addvar, 1, 33). The host is $gettok(%addvar, 2, 64).

This will also succesfully work with $mask(%addvar, 2).

If $address() isn't working, it means your IAL isn't up-to-date.

All this being said, if your IAL is up to date you shouldn't need to do anything like this, as $address() will just work.

See this script as an example of how to keep the IAL up-to-date.

Bekar #193305 18/01/08 04:52 AM
Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
Well the problem isnt that $address isnt working, the problem is that it wont work on certain nicks. My script triggers when someone messages me but for some reason $address cant handle those type of nicks.

Last edited by ix007; 18/01/08 04:53 AM.
ix007 #193306 18/01/08 05:04 AM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
That's because $address() uses the Internal Address List (IAL) to return addresses. The IAL only stores addresses for nicks which it knows the address of, which is something that cannot be guaranteed for any given nick. So you shouldn't use $address() in remote events because you cannot be sure that it will return anything. Instead you should use either the relevant identifiers as listed in /help Remote Identifiers or in the case of raws, use $1 etc. as Bekar explained.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Jan 2008
Posts: 22
I
ix007 Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2008
Posts: 22
Actually, well I have to join the channel for it to work but it is still good. Is there a way to make it so I dont have to join a channel or no ?

Last edited by ix007; 18/01/08 05:20 AM.
ix007 #193313 18/01/08 05:56 AM
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
If they are doing something to you (i.e. triggering an even of some kind), then you can $mask($fulladdress,2) in the event to get the details.

If this is something you are triggering on your own, then using a /who (352), /whois (311) or a /userhost (302) is the only way you can do it.

i.e.
Code:
alias do_action {
  userhost $$1
  %do_action = $addtok(%do_action, $$1, 32)
}
RAW 302:*: {
  if ($istok(%do_action, $gettok($2, 1, 61), 32)) {
    %nick = $v1
    %host = $right($gettok($2, 2, 61), -1)
    do-the-rest-of-your-action
    %do_action = $deltok(%do_action, %nick, 32)
  }
}

Last edited by Bekar; 18/01/08 06:21 AM.
ix007 #193334 18/01/08 03:26 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
There is no $nick in RAW events. Or more accurately, $nick returns the name of the server you are currently connected to (which is the server that sent you the RAW response.)

Also, if that is exactly how your script looks, you will have issues because your RAW event ends on the first line. All the other lines are not within an event or alias at all.

-genius_at_work


Link Copied to Clipboard