mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2004
Posts: 59
S
synth7 Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Jul 2004
Posts: 59
Right now, I have a trigger so that when someone says @log, I'll say a certain line from the logs I have for that day. Here's what I have for that, because it may help with my problem, may not.

Code:
alias todayslog {
  return $logdir $+ $network $+ \ $+ $chan $+ . $+ $time(yyyymmdd) $+ .log
}

on *:TEXT:*:#digitaltoxicity: {
  if (@log isincs $1 && !$checkdelay(log)) { msg $chan $read($todayslog) | $delay(10,log) }
}


(Don't mind the $checkdelay and $delay, those are for trigger spam protection.)

Anyways, here's my dilemma. I want to make a trigger especially for one person in the channel. So when someone says @sour, it will look in $todayslog, and say a random line that 'sour' says. I tried this next bit of code, but it didn't work frown

Code:
on *:TEXT:*:#digitaltoxicity: {
  if (@log isincs $1 && !$checkdelay(log)) { msg $chan $read($todayslog, nw, *<sour>* ) | $delay(10,log) }
}


All that did was output the first line containing <sour> and not a random one like I had hoped. On a second reading though of the help documentation of $read() I noticed that it seems to only look for the first line. So, is what I want to do easily achieved, or no?



Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
Use /filter to get all matching lines to another file (or @window):

Code:
/filter -ffc $+(",$todayslog,") temp.txt *&lt;sour&gt;*


Then $read(temp.txt,n) to get a random line from it

*<sour>* could also locate <sour> in the middle of other people's messages. If you're worried about this you could improve your wildmatch to '& <sour> *' (for example) where & may represent your timestamp

Joined: Jul 2004
Posts: 59
S
synth7 Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Jul 2004
Posts: 59
Thanks, that did it




Link Copied to Clipboard