Difference between revisions of "How do I customize mIRC's own output"
BlackShroud (talk | contribs) m (added author-tag) |
|||
Line 69: | Line 69: | ||
[[Category:Tutorials]] | [[Category:Tutorials]] | ||
+ | {{Author|Tovrleaf}} |
Revision as of 14:59, 31 August 2005
How to replace the <>'s around nicknames with eg. ()'s?
First what we'll need is on TEXT -event.
on <level>:TEXT:<matchtext>:<*><?><#[,#]>:<commands>
See how it works. <level> matches for userlevel what is specified for $nick. * is wildcardmatch for all levels (named, general) what also means for all users, what's also that we should use. <matchtext> is the text what event should trigger on - otherwords, when matchtext is in part of string event is triggered. Again, wildcardmatch to trigger for any text is the perfect match. Last we must specify the window where event should be enabled. # matches for all channel windows and that's good enough for us.
on *:TEXT:*:#:{ }
Next, we must halt default text event to insert our own output for channel. "^" before a level prefix makes event haltable. When default event is haltable it can be halted with using "haltdef".
on ^*:TEXT:*:#:{ haltdef }
What does this script do? Literally - nothing. It halts the default text event and leaves it like that. Nothing is sent out. Now, let's add our own customised output by using command "echo".
/echo [color] [-cdeghiNtsaqlbfnmr] [color name] [#channel|[=]nick]
The syntax is kinda confusing. But don't panic. Switches we need are: echo -lmt $chan $nick $1-
Following has been copy pasted from mIRC's own help file:
l = switch makes it apply the highlight settings to the line that's displayed. $1- = you can use $N- to refer to parameters N and onwards, and m = switch indicates that the line should be treated as a user message, not an event. t = switch prefixes the line with a timestamp if global time stamping is on or timestamping is on for that window.
Rest of syntax can be found from mIRC's help file, these are the only ones we need for handling this event so I'll leave the rest of it for your own time.
$N-M to refer to parameters $N through to $M. So to refer to a whole line, you would use $1-.
$nick = Returns the nickname of the user associated with an event. $chan = Returns the name of the channel for a specific event.
on ^*:TEXT:*:#:{ echo -lmt $chan $nick $1- | haltdef }
Now, let's use $nick($chan,$nick).pnick, instead of plain $nick to include the prefix in nick. The pnick property returns the nickname in a .@%+nick format. It includes the prefixes in front of the nick.
Now we can start editing the output. $+ combines parameters between each item, so "a $+ b" would return "ab" and ( $+ $nick $+ ) returns to ($nick) and so on.
on ^*:TEXT:*:#:{ echo -lmt $chan ( $+ $nick($chan,$nick).pnick $+ ) $1- | haltdef }
What we've done this far, only effects to text what is sent by other people and not your by yourself. If you wanna change the look of your own input you should do the following.
First what we need is on INPUT -event to trigger to your own text.
on <level>:INPUT:<*#?=!@>:<commands>
The syntax is kinda same as on TEXT -event's syntax.
To prevent halting anything else than straight output, we should check that user or in this case you, ain't trying to execute a command:
if (!$ctrlenter) && ($left($1,1) !== $readini(mirc.ini,text,commandchar))
$ctrlenter = Identifier to test whether Control+Enter was pressed when the user entered the text. ($left($1,1) !== $readini(mirc.ini,text,commandchar)) = Returns to user specified command prefix from mirc.ini. In other words that we ain't typinc /command. By default is's set to slash "/".
Because on INPUT it isn't default event use halt instead of haltdef.
Now, use echo to echo text to channel same way we used it with on TEXT -event. Difference is now that we have to send data to server, instead of only receiving it. Dot in front of command makes the command "silent". So the command is actually executed but not to displayed on your screen, ex. "/.msg $nick hello how are you".
on *:input:#:{ if (!$ctrlenter) && ($left($1,1) !== $readini(mirc.ini,text,commandchar)) { echo -lmt $chan ( $+ $replace($nick($chan,$me).pnick,@+,+) $+ ) $1- .msg $chan $1- halt } }
And that's all you need to know how to customize mIRC's own output. Next step is to be creative, use your imagination; use colors, bolds and underlines variations - what looks the best for your eye.
Contributed by Tovrleaf |