mIRC Homepage
Posted By: absentee help with an echo script - 09/02/07 03:55 PM
So far I have this...

on *:TEXT:*:#originalchannel: { if ($nick == somerandomnickname) && ($chan == #originalchannel) { scon -a if ($network == networkname) msg #channeltoechoto $1- } }

But that only echoes from one channel to another. I need it to read data from one channel (timestamp, text, etc), store it in a database, and have it available to be @searched by another channel. How would I do this? (I know nothing about databases!)
Posted By: Scripto Re: help with an echo script - 09/02/07 04:15 PM
Your @search would need to be followed up by some form of a matchtext identifier to search for, like @search find-this-word, or something along those lines.

If that is the case, I would suggest just logging everything from #originalchannelname,(using mIRC's log) and then have your @search command be something like @search #whateverchannel-log-file typesearchword-here.

Then it could resort to that file, to search for that word. you can do that with wildcards

Code:

on *:TEXT:@search*:#2ndchannelname: { 
  scon -a $iif($network,networkname) msg #channeltogoto $read(original-channel-log-filename, s (or w), matchtext)
}

 


You would have to read up on the help file to find what switch works best for your application, there is s, r and w where w is a wildcard match. This might be a handy spot for regex evaluations (which I need to brush up on, so I won't get too deep with it)... Thats in the editor too, its not that rough to learn. Check it out.

The only trouble is if you specify a wildcard its going to return any random wildcard line that matches what the user is looking for. (*help* would return words including, help, helper, helpful... wildcard related) Use s for more specific match searches.
Posted By: absentee Re: help with an echo script - 09/02/07 04:47 PM
Ok, but I wouldn't want to use a log/txt file. The channel that I'm in is pretty active and the file would get too big in no time. Thats why I was thinking of an SQL database or something... and I need to figure out how it would write to the db and retrieve stuff (know almost nothing about DB's... but only option I have I think..)
Posted By: Scripto Re: help with an echo script - 09/02/07 04:51 PM
I use a log system that I wrote myself...

Code:
on ^*:TEXT:*:#:{
  if (!$server) return
  var %logfile = logs\ $+ $asctime(mmmdyyyy) $+ $remtok($chan,1,35) $+ .txt
  write %logfile $strip($tik $ut $+ : $1-)
}
 


This creates a new log, every day at midnight... I am in a few channels that are very active, and none of the files get over 400kb's. I guess it would depend on how far back you want to @search, referencing something like this might be tougher if you want to go back a few days, because you would have to know the date, but you could write it for just the current date.

Are you looking for long history type searches?
Posted By: absentee Re: help with an echo script - 09/02/07 04:54 PM
Right, but if I wanted to search for something with the @search command, it would have to search for tons of log files instead of one database. For example, if I wanted to search when someone said "badunk-a-dunk". Turns out someone said it 241days ago; it would take forever to search through all those log files to find when they did that, whereas it'd be a simple search command in a database...

Edit: yeah, it'd be for longterm.
Posted By: Riamus2 Re: help with an echo script - 09/02/07 10:16 PM
Something like that would take a long time regardless of how you formatted it. It would also get very large no matter how you format it. You are better off using Windows' search function to search for text in files and just let it take its time through the logs. You can cut down on log size by stripping control codes as well.

Or, if you know that you don't want to search text from specific people (such as bots) or that include specific information (such as ads), then you can write your own logging script that will not include those things in the logs. That would also cut down on the log sizes.

Regardless what you're looking for, using mIRC to do it would just be slow and the database file (whatever one you use) would be large as well when you're going back that far.
Posted By: Thrull Re: help with an echo script - 10/02/07 09:57 AM
I log everything in all channels (except control codes). I also have an alias that allows me to find things in the log via mirc, though it uses Regex, so it may not be helpful to you. One of the logs is almost 3 million lines long and it take 30 seconds for a simple Regex and as long as 10 minutes for a complex Regex.

Code:
/scanlog {
  var %logfile = C:\Progra~1\mIRC\logs\ $+ $active $+ . $+ $network $+ .log
  var %get.chan = $active
  window -e @CheckChan
  echo @CheckChan 10Checking %get.chan for the phrase3 $$1-
  filter -fwpg %logfile @CheckChan / $+ $$1- $+1 /i
  if $filtered = 0 { echo @CheckChan No matches found! | join %get.chan | halt }
  echo @CheckChan $filtered entries found!
  join %get.chan
}


You can alter that as you see fit. I could add a few more things to it, but it works for my needs. Enjoy.
© mIRC Discussion Forums