Note: The mainteinance of the scripting examples is discontinued since I no longer have an interest to continue doing so. The pages will remain here, for now, but that might not be the case in the future. You are free to download all the material on these pages and set a up mirror, or even continue the maintenance of the material by enhancing the examples yourself.
All the material in these examples are for the mIRC version 6.03. It is very likely that some or most of these examples won't work in future versions.
[09:23] <Fred> Hello
Does that look boring to you? Maybe you want something else?
[09:23] <Fred:#chat> Hello
[09:23] [@Fred] Hello
[09:23] <@Fred> Hello
Does this look better? Maybe. When you do your own on TEXT and on INPUT events, you can change the messages are shown. To change the basic outlook of mIRC events, you must halt the default handlers and do your own. If you want to replace an existing handler, you have to make sure you prefix the event with ^ (like on ^*:TEXT), echo your own version of the event and use haltdef.
It is generally a good idea to make your script respect the settings of mIRC. That's why $color should be used whenever possible. The preferred echo command is something like
/echo $color(normal text) -tlmi2 <window> $strip($1-,m)
The -t makes the echo to respect the timestamp settings of the window, the -l makes the echo to respect the highlight settings, the -m makes mIRC to treat the echo as a message and the -i2 puts the default indent of two characters to the text. Other useful switches are -bf which make the echo to respect beep and flash settings. The $strip with m as the second parameter applies the control code stripping settings to the text.
on TEXT is for text other people write, on INPUT is for text you write. on TEXT events don't trigger on yourself because the server never sends your own message back. The on INPUT isn't like on TEXT. on INPUT doesn't take ^ prefix. You should also check if the user is entering a /command. However if user sent the line with control+enter, then /command should be sent as the message instead of processing it as a command. The custom on INPUT event should use .msg to send the message silently, echo the text and halt.
on ^*:TEXT:*:#: {
echo $color(normal text) -tlmi2 $chan < $+ $nick $+ : $+ $chan $+ > $strip($1-,m)
haltdef
}
on *:INPUT:#: {
; Don't use this handler if it's a /command and user didn't press control+enter
if ( ($left($1,1) == /) && (!$ctrlenter) ) return
.msg $chan $1-
echo $color(own text) -tmi2 $chan < $+ $me $+ : $+ $chan $+ > $1-
halt
}
[10:12] <Fred:#chat> Hello, what's up?
Note that due to the way mIRC's scripting language works, multiple spaces will be stripped out. This might cause some problems if you want to see the text in the exact way it was sent but currently there is no way of going around that problem.