mIRC Home    About    Download    Register    News    Help

Print Thread
#239825 25/11/12 01:03 AM
Joined: Nov 2012
Posts: 6
G
Gaki Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2012
Posts: 6
I am looking for a simple script that could either log into a file or into a new window if certain words is said on channel. It should log 1 line before and 3 lines after the word was said.

Kinda like highlight. Is there a script that does this?

Gaki #239827 25/11/12 06:52 AM
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
on *:text:*:*:{
   if (word isin $1-) || (word2 isin $1-) || (word3 isin $1-) {
   do stuff
  }
}

do stuff can be replaced with what you want to do, type /help /write or /help /echo in mirc, this will open the help file for you with some examples



if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
sparta #239828 25/11/12 11:26 AM
Joined: Nov 2012
Posts: 6
G
Gaki Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2012
Posts: 6
Code:
on *:text:*:*:{
   if (word isin $1-) || (word2 isin $1-) || (word3 isin $1-) {
   if (!$window(@Log)) { window -nk0 @Log | echo @Log $timestamp < $+ $nick @ $chan $+ > $1- } | else echo @Log $timestamp < $+ $nick @ $chan $+ > $1-
  }
}


I don't know how to do script but I found a sample I copied else where. This logs the whole line when the keyword is uttered, however I don't know what to add to make it log the line before and 3 lines after as well.

Example of what I am talking about say if I wanted to log when someone said "cold" in channel

19:07 @Nick1 The sky is blue
19:07 @Nick1 Winter is coming
19:07 @Nick1 Henry has cold
19:07 @Nick1 He needs to see a doctor
19:07 @Nick1 Lets take him there tomorrow
19:07 @Nick1 Remember to call me
19:07 @Nick1 Ok?

It should be able to log from "Winter is coming" all the way to "Remember to call me".

Any help to expand the script is appreciated. Thanks.



Last edited by Gaki; 25/11/12 11:32 AM.
Gaki #239830 25/11/12 05:09 PM
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Maybe it can be done, but way to much work for this "log" if possible.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
sparta #239833 25/11/12 05:37 PM
Joined: Nov 2009
Posts: 295
P
Fjord artisan
Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
I was kinda interested in doing this when I read the first post, but I've just been lazy lately. Though your post about it being too much work made me want to prove you wrong.

Here is what I have after 5-6 minutes.

Code:
on *:text:*:#chanhere:{
  if ($istok($1-,cold,32)) {
    if (!$window(@Log)) window -nk0 @Log
    if (!%next_log) aline @Log %previous_log
    aline @Log $timestamp < $+ $nick @ $chan $+ > $1-
    set %next_log 2
  }
  elseif (%next_log) {
    aline @Log $timestamp < $+ $nick @ $chan $+ > $1-
    dec %next_log
  }
  set %previous_log $timestamp < $+ $nick @ $chan $+ > $1-
}


It'll log the line before the line which cold appears in and the two after it. I did this as a simple proof so it only works in a single channel. With a bit of tweaking it could work in as many channels as you want. Hope this helps.


http://scripting.pball.win
My personal site with some scripts I've released.
pball #239837 25/11/12 06:43 PM
Joined: Nov 2012
Posts: 6
G
Gaki Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2012
Posts: 6
@ pball, thank you for the valiant effort. It seems to be working. Just what I wanted. Thank you very much. At first I thought It didn't work. Further test shows it does work.

Thanks!

Last edited by Gaki; 25/11/12 07:01 PM. Reason: mistake
Gaki #239842 25/11/12 08:32 PM
Joined: Nov 2012
Posts: 6
G
Gaki Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2012
Posts: 6
Code:
on *:text:*:*:{
  if (word1 isin $1-) || (word2 isin $1-) || (word3 isin $1-) {
    if (!$window(@Log)) window -nk0 @Log
    if (!%next_log) aline @Log %previous_log
    aline @Log $timestamp < $+ $nick @ $chan @ $network $+ > $1-
    set %next_log 2
  }
  elseif (%next_log) {
    aline @Log $timestamp < $+ $nick @ $chan @ $network $+ > $1-
    dec %next_log
  }
  set %previous_log $timestamp < $+ $nick @ $chan @ $network $+ > $1-
}


This is what I am using across different networks since I wanted to log several keywords.

Only issue with it is the next 2 lines after the keyword could be from anywhere. As it just logs whatever was said first in any other channel I was in. If another channel was active the next 2 lines could be from there not the channel the keyword was uttered.

Gaki #239849 26/11/12 02:24 AM
Joined: Nov 2009
Posts: 295
P
Fjord artisan
Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
This is exactly why I said it was a proof of concept and would need work to work in multiple chans/networks. Give me some time and I can make it so it'll work in multiple chans/networks. It's not hard but I'm just not able to do it right now.


http://scripting.pball.win
My personal site with some scripts I've released.
pball #239850 26/11/12 02:38 AM
Joined: Nov 2012
Posts: 6
G
Gaki Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2012
Posts: 6
If it could also save result to txt file besides showing in log window would be great also.

Take your time there is no rush smile

I really appreciate your help on this as I am terrible at it.



Gaki #240164 30/12/12 09:17 PM
Joined: Nov 2012
Posts: 6
G
Gaki Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2012
Posts: 6
Any chance anyone could help further improve on this?

P.S. Have a great New Year 2013


Link Copied to Clipboard