mIRC Homepage

on text/notice/action for $Me

Posted By: FroggieDaFrog

on text/notice/action for $Me - 13/05/10 09:25 PM

I understand these activate from a socket read. But an event triggered when these are sent to the server would be nice. Currently a user has to either A: use on input, and check for /say /msg /amsg /me /describe /ame /notice etc etc. That's ALOT of if-then-elses (edit added: or rewrite the commands: /alias ....)

something like the following if not just expand the current text/notice/action events:
on *:USER(TEXT|NOTICE|ACTION):matchtext:target:{}
Posted By: Riamus2

Re: on text/notice/action for $Me - 13/05/10 09:37 PM

What exactly are you trying to do? In most situations, you don't need to look for the /commands unless you're halting /commands, which is usually not a good idea.
Posted By: FroggieDaFrog

Re: on text/notice/action for $Me - 13/05/10 10:28 PM

exactly! I'm writing a logger that loox similer to /debug and I want to log the actions, notices and msgs I send. (without actually using the /debug command)
Posted By: hixxy

Re: on text/notice/action for $Me - 13/05/10 11:51 PM

Why not just overwrite those aliases?

Code:
alias say { ... }
alias msg { ... }
alias amsg { ... }
alias qmsg { ... }
alias me { ... }
alias describe { ... }
alias ame { ... }
alias qme { ... }
alias notice { ... }
alias onotice { ... }
Posted By: FroggieDaFrog

Re: on text/notice/action for $Me - 13/05/10 11:56 PM

I like to have my code modulated so one thing doesn't depend on another. Right now I have a theme script and a logger script. If i rewrote the aliases I'd have to incorparate the theme part and logging together...
Posted By: MeStinkBAD

Re: on text/notice/action for $Me - 14/05/10 04:00 AM

Originally Posted By: hixxy
Why not just overwrite those aliases?

Code:
alias say { ... }
alias msg { ... }
alias amsg { ... }
alias qmsg { ... }
alias me { ... }
alias describe { ... }
alias ame { ... }
alias qme { ... }
alias notice { ... }
alias onotice { ... }


You are short about a hundred or so commands...
Posted By: drum

Re: on text/notice/action for $Me - 14/05/10 08:18 AM

You can monitor outgoing PRIVMSG/NOTICE/etc without rewriting all the aliases or using ON INPUT by using /debug with the '-i' switch outputting to a hidden custom window or to the nul device (if Khaled added support for that again, I don't remember). Either way, you can just monitor all lines for PRIVMSG, NOTICE, etc., and log it as necessary.

Just make sure your alias is very efficient because it will be called for every single line sent to or received from the server.
Posted By: argv0

Re: on text/notice/action for $Me - 14/05/10 10:19 AM

"without actually using /debug" -- stop. Use /debug, that's what it's for.

/debug takes the -i switch to call a custom alias, you can have this log your actions much more effectively.

A remote event that triggers when an alias fires would be complicated for many reasons.

First and foremost, you could never use that alias inside the event or you'd end up with a weird recursive scenario.

Secondly, not all users make use of /msg, /me, etc.- mIRC allows you so send /raw commands to the server, and its possible many scripts make use of those- mIRC would have to parse every outgoing /raw command to recognize what kind of event it is, which is a waste of resources.

Thirdly, if you really want to handle *user* input you *should* use the ON INPUT event, not check commands.

Lastly, you didn't really explain what it is you're trying to do.. a logger is a very vague description.
Posted By: FroggieDaFrog

Re: on text/notice/action for $Me - 14/05/10 03:29 PM

The reason I don't want to use debug, is due to the fact that I use it to get/view raw data from time to time. If i use "/debug -i" to catch the events then when I use /debug @raw it stops the event catching
Posted By: hixxy

Re: on text/notice/action for $Me - 14/05/10 05:19 PM

Easily worked around:

Code:
alias mdebug {
  tokenize 32 $1-
  if ($window(@raw)) aline @raw $1-
}
alias odebug {
  if (!$window(@raw)) window @raw
}


//debug -i mdebug | odebug
Posted By: drum

Re: on text/notice/action for $Me - 15/05/10 12:39 AM

You might also want to replace the /debug alias so that you don't accidentally mess up the logging. For example:

Code:
alias debug { echo -a Oops! Use /dbon and /dboff instead. }
alias dbon { if ($window($debug)) { window -a $debug } }
alias dboff { if ($window($debug)) { window -h $debug } }

on *:CLOSE:@:{ if ($target == $debug) { .timer 1 0 startdb } }

alias startdb {
  window -h @raw $+ $cid
  !debug -i @raw $+ $cid dbparse
}

alias dbparse {
  ; your commands here
  return $1-
}
Posted By: argv0

Re: on text/notice/action for $Me - 15/05/10 02:19 AM

Complicated and awkward.

Code:
alias debug { !debug $iif(-* iswm $1, $1 $+ i $2-, -i $1-) dbparse }
alias dbparse { ... }


The above simply injects -i ... dbparse into any /debug call, it will act transparently to the current usage of /debug, and users can override -i with their own alias if they want.

Posted By: FroggieDaFrog

Re: on text/notice/action for $Me - 15/05/10 03:13 AM

Quote:
complicated and awkward

Having to use /debug instead of an event is complicated and awkward imo
Posted By: drum

Re: on text/notice/action for $Me - 15/05/10 06:49 AM

Originally Posted By: argv0
Complicated and awkward.


It's complicated because it avoids potential problems. Consider:

* The user types /debug off. Of course the user could just refrain from doing it, but you might do it accidentally without realizing the mistake until later, and the damage has already been done.

* The user closes the debug output window. Debugging turns off automatically, so you need to monitor when it happens to reactivate /debug.

I just felt that giving up a little bit of control with /debug would be necessary to guarantee that the debugging is never unintentionally stopped.

It's not a completed script, but I do think simply injecting it into /debug is not going to be reliable enough.
© 2020 mIRC Discussion Forums