mIRC Home    About    Download    Register    News    Help

Print Thread
#144606 12/03/06 11:20 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
on @CAPS1:text:*:#:{
  if (%dkickop == off) && ($nick isop $chan) { return }
  if (%dkickvo == off) && ($nick isvo $chan) { return }
  if ($ulevel == 200) && (%ctcp.op == Enabled) { return }
  if ($ulevel == 125) && (%Group.AutoOp == Enabled) { return }
  if ($ulevel == 100) && (%friend == Enabled) { return }
  if ($ulevel == 75) && (%a.voice == Enabled) { return }
  set %cps-chan $chan
  var %p = $int($calc(($regex($1-,/[A-ZÄÖ]/g) / $len($1-)) * 100))
  if (%p > 75) && ($len(%matchtxt) > 5) && (!$hget($+(warn,$cid,$chan),$nick)) {
    hinc -m $+(warn,$cid,$chan) $nick 
    .ruser CAPS1 $nick | ban -u $+ %caps.b # $nick %bs | kick $chan $nick You have been warned. turn off your CAPSLOCK.
  }
  elseif (%p > 75) && ($len(%matchtxt) > 5) && ($hget($+(warn,$cid,$chan),$nick)) { 
    .ruser CAPS1 $nick | ban -u $+ %caps.b # $nick %bs | kick $chan $nick You have been warned. turn off your CAPSLOCK.
    hdel $+(warn,$cid,$chan) $nick 
  }
}

the code i have, now to my problem. if the person leav irc or the channel befor the script have been triggered fully "kicked the person", then i see this message:

Nick is not currently on IRC

And i have been trying: if ($nick !ison $chan) { halt } and no luck, also tryed to replace $chan with #, still no luck :tongue: any ideas?
______________________________________

One more question i have, from the help file:

$query(0) returns the total number of open query windows

That arent true, cos if i have two server connections open, then it will only count the querys on one server, how would i solve this in the simplest way ? same goes for open channels..

Last edited by sparta; 12/03/06 11:34 AM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Your problem actually revolves aroudn the fact that mIRC keeps it's own IAL and the fact that the IAL doesn't update immediately when a person leaves a room (whether it be via part, kick or quit). One way around this (although not ideal) is to force the ial to update when someone does one of those.

ie: on *:part:#:{ ialclear $nick }

Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Thnx, i try that.. anything on the $query problem too ? :tongue: been trying with $scon and $scid .. and no luck :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Untested:
Code:
 .scon -at1 echo $!scon $!query(0) 

Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
My suggestion would be to loop to each connection then get the total query for that connection then calculate the total.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Which could be done easily with a slight change to the code I posted.

Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Actually I have a different code in mind.

@ sparta, here's what I have:

Code:
alias queries {
  var %t = 1, %c
  while $scon(%t) {
    scid %t
    %c = $calc(%c + $query(0))
    inc %t
  }
  scid -r
  return %c
}
  


//echo -a $queries on all connections


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Maybe it's just me, but I find I run into problems using both scon and scid in a single code.

Here's my suggestion
Code:
alias queries {
var %query
 .scon -at1 inc %query $!query(0)
return %query
 


The problem that I see (unless I'm imagining things) with xDaeMoN's suggestion, is that if you disconnect from a network, the $scon for that network gets dropped until it's needed, as the cid (as used by scid) does not get dropped, so if you have 4 connections, then drop the 2nd, now you have connection 1,3, & 4 (by cid), and scon(2) will return a $null value...for this situation I don't think it's going to matter, but just my 2 cents worth.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Code:
alias queries {
  scon -a $(inc -u %q $query(0),0)
  return $iif(%q,$v1,0)
}


Your code uses scon in some places and scid in other places. The way the code works, you should be using scon throughout. scon uses a sequential set of numbers to represent the server windows (and related windows) that are currently open, whereas scid uses increasing numbers that are never reused in the life of a mIRC session. Example:

- Open mIRC
- SCID: 1 SCON: 1
- /server -n
- SCID: 1,2 SCON: 1,2
- close first status window
- SCID: 2 SCON: 1
- /server -n
- SCID: 2,3 SCON: 1,2

Note: I'm not sure how the scid numbers are generated/chosen, so they may not always go 1,2,3,4,etc as server windows are opened.

-genius_at_work

Last edited by genius_at_work; 13/03/06 04:52 AM.
Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Quote:
The problem that I see (unless I'm imagining things) with xDaeMoN's suggestion, is that if you disconnect from a network, the $scon for that network gets dropped until it's needed, as the cid (as used by scid) does not get dropped, so if you have 4 connections, then drop the 2nd, now you have connection 1,3, & 4 (by cid), and scon(2) will return a $null value...for this situation I don't think it's going to matter, but just my 2 cents worth.


I disagree. If you disconnect from a connection, the $cid value is still there. Try having 4 connections then do //echo -a $scon(0) then disconnect 2, you'll see that mIRC still sees 4 connections.

The only problem I would see is the accurate number of queries on all the connections, even if one connection is disconnected & you have a query open, the script would still count it.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
I don't really use it that much, still learning. Nice code btw.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Didnt reply to anyone !

Thnx for all help dudes, i fond a code that work the way i want it to, rewrote it a bit to more fit my needs smile

Now i have one more problem, this will return the active network ID:

//echo -a -->> $activecid

but how would i identify network names for the two connections i have? 1 and 2 dosent say much about what name the network have :tongue: and $network only return the network name of the first one i connected to :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
$network will return the name of the active connection. You can view the name of inactive connections by using $scid(<id>).network where <id> is the cid number of the network you are interested in.

-genius_at_work


Link Copied to Clipboard