mIRC Home    About    Download    Register    News    Help

Print Thread
#98882 27/09/04 05:02 PM
Joined: Jul 2004
Posts: 40
D
dmmrs Offline OP
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Jul 2004
Posts: 40
Ok. If I do a /whois on someone and they are not online, i get thsi in my status window:

TW 12No such nick/channel
TW 12End of /WHOIS list.

Now how would i get that into my script, for example:

/whois $2-
if *No Such nick* isin Status text {
msg $chan $2- IS NOT online
}
else msg $chan $2- IS online

Now I know the code isnt right for if blah isin Status text, but what would I use? If anything at all?


i script, therefore i am smirk
theres logic in there somewhere...
#98883 27/09/04 05:12 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
You dont 'read' the status window, but instead, you REACT when you recieve the above message, using what is called a 'raw event' which monitors data that is sent by the server. You can view the raw data by using the command, /debug @debug which will output all the data sent from/to the server into a window called @debug.

In this case you are dealing with the following raw data;

-> server WHOIS example
<- :server 401 Coolkill example :No such nick/channel
<- :server 318 Coolkill example :End of /WHOIS list.

So the code, would be as follows;

[color:orange]; raw event syntax (differs from most other events), 401 is taken from the above, most data sent from the server as a unique raw number.

raw 401:*:{
; output your message
echo -s User isn't online.
; set a var for 5 seconds
set -u5 %^nu 1
; halt mIRCs default message.
haltdef
; end of raw event.
}
; open another raw event, for the 'end of whois'
raw 318:*:{
; if the above var is set, halt the message completely, this will stop you getting the annoying end of whois message and just outputting your message.
if (%^nu) { haltdef }
; end of raw event
}
[/color]
Eamonn.

#98884 27/09/04 05:16 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
The raw 401 is the one responsible for the "No such nick" reply. Raw 311 is one of the /whois reply raws. There is no $chan in a /whois reply, so you'd have to previously store the chan in a %variable. Try this:
Code:
on *:input:#: if (/whois == $$1) { set $+(%whois.,$2) $target }
raw 401:*: if ($eval($+(%whois.,$2),2)) { msg $v1 $2 is not online at the moment. | unset $+(%whois.,$2) }
raw 311:*: if ($eval($+(%whois.,$2),2)) { msg $v1 $2 is online at the moment. | unset $+(%whois.,$2) }
I think this might help smile

Zyzzyx.


"All we are saying is give peace a chance" -- John Lennon
#98885 27/09/04 05:58 PM
Joined: Jul 2004
Posts: 40
D
dmmrs Offline OP
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Jul 2004
Posts: 40
Um, that doesn't seem to work.

Maybe if I explain what I want to achieve...

I have a search script at the moment, that firstly logs people when they say certain things in a channel. Then people can !search via anything they want, and it'll come up with matches for each person that said that word.

Making sense so far? I hope so...

Now, when someone does the !search fool (for example), it'll /msg the person who searched with all the nicks that said that word. What I want to do is find a way of doing it so that before it /msg's the person who searched, it checks to see if that person is online, and if they are, it shows their nick in pm, in a different colour.

That's why I thought maybe a /whois would be best, but obviously not.

Any ideas would be gretly appreciated.


i script, therefore i am smirk
theres logic in there somewhere...
#98886 27/09/04 06:29 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Ah, I see now smile

Assuming the searching time doesn't take long, you don't need to do the checking, since (assuming again) the whole process is done under the ON Text event.

If not, you can set the same variable used in the ON Input code above and put it in the ON Text, changing the value from $chan to $nick.

Good luck,
Zyzzyx smile


"All we are saying is give peace a chance" -- John Lennon
#98887 27/09/04 07:29 PM
Joined: Jul 2004
Posts: 40
D
dmmrs Offline OP
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Jul 2004
Posts: 40
I found another way to do it, but the txt file has each line in this format:

nickname-word or words

The code is:

%t = $read(funnies.txt,w,* $+ $2- $+ *, %tt)
if ($readn != 0) && ($1 ison #funandgames) {
/msg $nick 3 %t
}
elseif ($readn != 0) && ($1 !ison #funandgames) {
/msg $nick 4 %t

The $1 ison ... is where im stuck, how can i get it to only recognise the nickname to check if that online, not if the whole line of the txt file is online? If the nick is online, it displays the result in green, otherwise in red.


i script, therefore i am smirk
theres logic in there somewhere...
#98888 27/09/04 07:38 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
If the format of the line containing the nick is the one you said above (nickname-word(s)), you can use this instead of $1: $gettok($1-,1,45)

This will pick up the 1st word before the dash (-), which, according to the format above, is the nick.

BTW, nice work around smile

Zyzzyx.


"All we are saying is give peace a chance" -- John Lennon
#98889 28/09/04 10:07 AM
Joined: Jul 2004
Posts: 40
D
dmmrs Offline OP
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Jul 2004
Posts: 40
ok. I can see how that would work, but how can i change it so it looks for a different character, for example a full stop, or a hash, or a percentage sign?

Im assuming its to do with the 1,45 part, but how do i know what character that specific number is looking for?

Sorry to sound stupid, whcih I probably do...


i script, therefore i am smirk
theres logic in there somewhere...
#98890 28/09/04 02:12 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Type //echo -a $asc(<character>) to get an asc number that you can use in $gettok().

$asc(.) = 46
$asc(#) = 35
$asc(%) = 37


New username: hixxy
#98891 28/09/04 02:17 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
You may also like to see, this thread that has a list of alternative methods.

Eamonn.

#98892 28/09/04 07:04 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
The $gettok identifier works this way: $gettok($1-,1,45)

- The blue part contains the text which you want to work with;

- The red number is the token(s) you want to retrieve. If you wish to get the first token, then use 1. If you want to get the last token, use -1. To get the third token use 3 and so on.. You can also specify a sequence, i.e. from tokens 5 to 7 you can use 5-7;

- Finally, the orange number is what tidy_trax and Coolkill explained. This number refers to the Ascii character of the separator of the tokens.

Eg: one,two,three,four --> the separator is the comma (,) which is $chr(44).
Hi there mate! --> separator is the space, which is $chr(32).

So, in order to make that work with an equal sign, for example, you change the 45 for the 61 (which is the Ascii value of =).

$gettok(one=two=three=four=five,3,61) -> This returns three, since we are asking for the 3rd token separated by =

$gettok(one two=three four=five six,1,61) -> In this case, the value returned is one two because we requested the 1st value separated by the = (not the space).

I hope this could be of any help smile
Zyzzyx.


"All we are saying is give peace a chance" -- John Lennon

Link Copied to Clipboard