mIRC Home    About    Download    Register    News    Help

Print Thread
on text/notice/action for $Me #221295 13/05/10 09:25 PM
Joined: Apr 2010
Posts: 958
F
FroggieDaFrog Offline OP
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 958
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:{}

Last edited by FroggieDaFrog; 14/05/10 12:00 AM.

I am SReject
My Stuff
Re: on text/notice/action for $Me [Re: FroggieDaFrog] #221299 13/05/10 09:37 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: on text/notice/action for $Me [Re: Riamus2] #221303 13/05/10 10:28 PM
Joined: Apr 2010
Posts: 958
F
FroggieDaFrog Offline OP
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 958
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)


I am SReject
My Stuff
Re: on text/notice/action for $Me [Re: FroggieDaFrog] #221305 13/05/10 11:51 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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 { ... }

Re: on text/notice/action for $Me [Re: hixxy] #221306 13/05/10 11:56 PM
Joined: Apr 2010
Posts: 958
F
FroggieDaFrog Offline OP
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 958
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...

Last edited by FroggieDaFrog; 13/05/10 11:57 PM.

I am SReject
My Stuff
Re: on text/notice/action for $Me [Re: hixxy] #221321 14/05/10 04:00 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
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...


Beware of MeStinkBAD! He knows more than he actually does!
Re: on text/notice/action for $Me [Re: MeStinkBAD] #221335 14/05/10 08:18 AM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
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.

Re: on text/notice/action for $Me [Re: FroggieDaFrog] #221344 14/05/10 10:19 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
"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.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: on text/notice/action for $Me [Re: argv0] #221362 14/05/10 03:29 PM
Joined: Apr 2010
Posts: 958
F
FroggieDaFrog Offline OP
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 958
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


I am SReject
My Stuff
Re: on text/notice/action for $Me [Re: FroggieDaFrog] #221364 14/05/10 05:19 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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

Re: on text/notice/action for $Me [Re: hixxy] #221370 15/05/10 12:39 AM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
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-
}

Re: on text/notice/action for $Me [Re: drum] #221373 15/05/10 02:19 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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.



- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: on text/notice/action for $Me [Re: argv0] #221374 15/05/10 03:13 AM
Joined: Apr 2010
Posts: 958
F
FroggieDaFrog Offline OP
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 958
Quote:
complicated and awkward

Having to use /debug instead of an event is complicated and awkward imo


I am SReject
My Stuff
Re: on text/notice/action for $Me [Re: argv0] #221377 15/05/10 06:49 AM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
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.