mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
get the $network someone is on - from a different network?

trying to do a script that checks all networks i am on for a nick ..

and then gives me the $network that nick is on
so i can msg that nick ..

Any Ideas ?

Thanks ..

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Add them to your notify list with /notify <nick> then type //scid -at1 if ($notify(<nick>).ison) echo -s $!network

Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
hmmm ..
cant seem to make it work ..

adds it to the notifi

but it does not echo ..

Not really what i need but may beable to make work smile

ideas ?

Last edited by WarlockW; 17/10/05 08:50 PM.
Joined: Jun 2005
Posts: 127
H
Vogon poet
Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
Maybe something like this:
Code:
alias netcheck { 
  if ($1) { 
    scid -at1 whois $1 
    set %netcheck.total $scon(0) 
    set %netcheck.whois $1
  } 
  else { 
    echo -a ** Please specify the nick to scan for
  } 
}
raw 312:*: {
  if (%netcheck.whois) { 
    echo -a %netcheck.whois is connected to $network 
    if ($scid == %netcheck.total) {
      unset %netcheck.total | unset %netcheck.whois 
    }
  }
}


Good luck.
smile


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133
thats cool ..

yea works well .. but need something that after it finds the person it msg them some text ..

Joined: Jun 2005
Posts: 127
H
Vogon poet
Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
You want to mesage the same person the same text on all the networks they're on? shocked


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
Joined: Jun 2005
Posts: 127
H
Vogon poet
Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
I'd suggest you didnt, but if that's what you really want, try this:
Code:
alias netcheck { 
  if ($1) { 
    scid -at1 whois $1 
    set %netcheck.total $scon(0) 
    set %netcheck.whois $1
  } 
  else { 
    echo -a ** Please specify the nick to scan for
  } 
}
raw 312:*: {
  if (%netcheck.whois) { 
    echo -a %netcheck.whois is connected to $network
 [color:red]   msg $2 blah blah blah[/color] 
    if ($scid == %netcheck.total) {
      unset %netcheck.total | unset %netcheck.whois 
    }
  }
}


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
An alternative to HAMM3R's version:

Code:
alias fnickmsg {
  var %nick = $1 , %i = 1
  while ($scon(%i).server) { 
    var %scon = $scon(%i)
    set %search. [ $+ [ %scon ] ] on
    scid %scon ison %nick
    inc %i
  }
}
raw 303:*:{
  var %nick = $2
  if (%search. [ $+ [ $cid ] ]) {
    if (%nick) { 
      echo -at3g %nick is connected to $+($scid($cid).network,.) Sending message.
      .msg %nick whatever
      unset %search. [ $+ [ $cid ] ]
    }
    haltdef
  }
}


I'm always iffy about using scid -a, as it doesn't take into consideration if you're connected to a server or not. (yay for not connected to server messages?)

Good luck with the script.

Joined: Jan 2004
Posts: 133
W
Vogon poet
OP Offline
Vogon poet
W
Joined: Jan 2004
Posts: 133

Thanks Guys Works Get !

Joined: Jun 2005
Posts: 127
H
Vogon poet
Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
Quote:
I'm always iffy about using scid -a, as it doesn't take into consideration if you're connected to a server or not.


That's what the -t1 switch is for. From the help file:

The -tM switch limits the command to being performed only on servers with a certain connection status, where M is an or'd value of 1 = server connected, 2 = not connected...

So, the -t1 switch makes the command only execute on servers that you are connected to.


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Wow, haha. I must have been really tired last night.

I remember looking at the /help /scid section, and somehow I managed to completely overlook the -tM.

Thanks for pointing that out.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
There are a few problems with your code:

1. $scon(0) returns the total amount of server windows, even those where you are not connected in, so it is possible that if ($scid == %netcheck.total) is never $true, since you only do the whois on connected servers.

2. You cannot use $scid like that, it returns nothing. $scid takes a parameter which is not optional. Its parameter must be a number.

3. Even if you could use $scid like that there is a probable error in it. Even though the command /whois is reached to each connected server in order of the server windows (from first to last), that doesn't mean the response from the whois will return in that order. It's very well possible that you receive the whois response from the 3rd window first, or even from the last server window, depending on your lag or quickness of response of the server. In other words, your script might already unset the %whois variables before all responses have been received. When I did //scid -at1 ison $me, and parsed the 303, my first response was from the second server window, followed by the 1st, and then 3 and 4. A second time it was in the order: 2,3,4,1

4. Doing a whois just to know if someone is on a network is somewhat of an overhead. You can minimize the server load by doing an /ison <nick> and parse the raw 303, which returns only 1 line, in contrast with a whois which must return several lines from the server. I know, for the end user it won't make much difference, but it does for the servers.

5. In the raw 312, you are letting it trigger, and will only continue processing if (%netcheck.whois) is $true. That's not bad, but it can be improved. Because right now, even if the person does a regular whois for a nick, it will keep triggering this raw 312, and doing the if check each time. If you use #groups, and only enable them when using the /netcheck command, you will prevent the event from triggering if the group is off, thus the if check will only be done if you in fact issued the /netcheck command.

6.

Code:
alias netcheck { 
  set %ison.nick $$1  
  set %ison.total
  scon -at1 inc % $+ ison.total
  .enable #ison
  scid -at1 ison $1 
  .timernetcheck 1 5 netcheck.cleanup
}
 [color:red]  [/color] 
alias netcheck.cleanup {
  .timernetcheck off
  .disable #ison 
  unset %ison.*
}
 [color:red]  [/color] 
#ison off
raw 303:*:{
  if (%ison.total) {
    if ($2 == %ison.nick) {
      haltdef
      echo -a $2 is on $network 
      .msg $2 &lt;your message&gt;
    }
    dec %ison.total
    if (!%ison.total) netcheck.cleanup 
  }
}
#ison end


I've added a timer which will automatically finish the checking for the raw after 5 seconds. You can adjust this value to your liking. I do it for the reason in number 5, as I don't want that raw triggering when it's not necessary. If the results were returned before the timer triggered, the timer is automatically put off.



Gone.
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Pretty much the same concept as mine, cept mine uses a variable instead of a group, and a while loop instead of the -at1.

Didn't realise it til I re-read my code that the "unset" in my raw 303, would have to be dropped down beneath the next bracket (so that it's above the 'haltdef'.

Though, I suppose you could just change the "set" in mine to "set -u5"

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Lol I didn't even notice you posted that version, it's indeed very similar. Though after checking now, I have the feeling HAMM3R didn't really pay attention to the important differences with our code versus his. Now he knows exactly why his method is less preferable.

Btw you don't need to use $scid($cid).network since the raw event is always returned on the network the ison was sent to, thus $network will always contain the right value.

One other detail: set %search. [ $+ [ %scon ] ] on <-- you don't ever need to specify evaluation brackets when setting a variable. set %search. $+ %scon will work in all cases. This is not the case for unsetting though, although it works in some occasions.


Gone.
Joined: Jun 2005
Posts: 127
H
Vogon poet
Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
Thanks for that extra info guys. I wasnt too knoledgable about the milti-network commands and identfiers before I started. I read over the help file briefly, and wrote the script accordingly. I guess I didnt pay enough attention to the descriptions of $scon etc. But thanks for pointing that out, i'll know better next time.


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net

Link Copied to Clipboard