mIRC Home    About    Download    Register    News    Help

Print Thread
#96508 02/09/04 05:33 AM
Joined: Sep 2004
Posts: 2
A
Aizon Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Sep 2004
Posts: 2
I've been looking for a way to count how many actions a nick is involved in, not just for the time connected to a server & channel, but a running count for each time someone includes a nick in a /me action. So far I've had no luck finding any references on how to go about it correctly. Any help, even in the minimal sense would be welcomed.

#96509 02/09/04 08:23 AM
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
If you're referring to a nickname in the target channel assosciated with the action then you can check each action to see if it contains a nickname that's currently on that channel:

on *:action:*:#:{
var %m
;; Build a regular expression based on the words in the action
.echo -q $regsub($1-,/\s/g,\\E|\\Q,%m)
var %x = 1
;; Loop through any found nicknames
while ($fline(#,$+(/^,$chr(40),\Q,%m,\E,$chr(41),$/iS),%x,3)) {
;; Increase a hash table item storing the number of times the found nickname has been mentioned in actions
hinc -m actions $nick(#,$ifmatch)
inc %x
}
}

;; Reload the stored data when mIRC starts
on *:start:{
hmake actions
hload actions actions.hsh
}

;; Save our data when the mIRC session ends
on *:exit:{ hsave -o actions actions.hsh }

Currently it will only increase the item once no matter how many times a particular nickname is mentioned in the action. If you want it to increase it by the number of times a nick is mentioned then use hinc -m actions $nick(#,$ifmatch) $regex($1-,$+(/(?<=^|\s),$nick(#,$ifmatch),(?=\s|$)/iS))

#96510 03/09/04 08:22 AM
Joined: Sep 2004
Posts: 2
A
Aizon Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Sep 2004
Posts: 2
I put that in my remotes and tested it out on a channel and it seemingly didn't work.

I don't know the person well enough who has the similar script bit running in order to ask exactly what it is but in the channel it ends up like this (the nicks being fictitious, by the way):

[15:13] * Taki pets necrid
[15:13] * necrid has been in 6487 actions.


#96511 03/09/04 09:12 AM
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
It seems to work alright for me, are you using $hget(actions,necrid) to retrieve the number of actions they've been in? If so, I can only guess that you had a previous hash table named actions with existing items, but I'm sure you would have realized that if it were the case. Also I made a slight typo in the above post, you should use hinc -m actions $nick(#,$ifmatch) $regex($1-,$+(/(?<=^|\s),$nick(#,$ifmatch),(?=\s|$)/iSg)) with the "g" to increase the item by the number of times that particular nickname was in the action


Link Copied to Clipboard