From WikiChip
Difference between revisions of "mirc/commands/echo"
< mirc‎ | commands

m (add'l examples)
Line 10: Line 10:
  
 
== Switches ==
 
== Switches ==
* '''-c''' - Indicates the <color_name> parameter was provided.
+
=== Target window swiches ===
* '''-e''' - Encloses the text with a pair of line separators
 
* '''-g''' - Prevents the text from being logged.
 
* '''-h''' - Applies a hard-wrap on the text.
 
* '''-i<N>''' - Wraps the text by <N> characters.
 
* '''-t''' - Adds a timestamp to the text if the timestamp is enabled (global or for that window)
 
 
* '''-s''' - prints to the status window
 
* '''-s''' - prints to the status window
 
* '''-a''' - prints to the active window
 
* '''-a''' - prints to the active window
 
* '''-d''' - prints to the single message window
 
* '''-d''' - prints to the single message window
* '''-q''' - Honors the $show flag. (If the alias was called with the . prefix)
+
 
* '''-n''' - Prevents switchbar button/treebar colour change
 
* '''-m''' - Changes switchbar button/treebar colour to "messages" (as defined in mIRC Options / Display); without -m or -n it uses the colour defined for "events".
 
 
=== Settings Related: ===
 
=== Settings Related: ===
 
* '''-r''' - Applies the strip settings to the text (as defined in mIRC Options / IRC / Messages).
 
* '''-r''' - Applies the strip settings to the text (as defined in mIRC Options / IRC / Messages).
Line 27: Line 20:
 
* '''-b''' - Applies the beep settings to the window (as defined in mIRC Options / Sounds).
 
* '''-b''' - Applies the beep settings to the window (as defined in mIRC Options / Sounds).
 
* '''-f''' - Applies the flash settings to the window (as defined in mIRC Options / IRC / Options).
 
* '''-f''' - Applies the flash settings to the window (as defined in mIRC Options / IRC / Options).
 +
 +
=== Other switches ===
 +
* '''-c''' - Indicates that the <colour-name> parameter is provided.
 +
* '''-e''' - Encloses the text with a pair of line separators
 +
* '''-g''' - Prevents the text from being logged if the window has logging on.
 +
* '''-h''' - Applies a hard-wrap on the text so that the wrap point does not change when the window is resized. Text is not wrapped if it is echoed to a custom listbox window.
 +
* '''-i<N>''' - Indents wrapped lines by <N> characters. The standard mIRC indent is 2 spaces.
 +
* '''-t''' - Adds a timestamp to the text if the timestamp is enabled for that window. Without this, the line will not be timestamped even if the window has timestamping set. Note: Custom windows
 +
* '''-q''' - Honors the $show flag. (If the alias was called with the . prefix)
 +
* '''-n''' - Prevents switchbar button/treebar colour change
 +
* '''-m''' - Changes switchbar button/treebar colour to "messages" (as defined in mIRC Options / Display); without -m or -n it uses the colour defined for "events".
  
 
== Parameters ==
 
== Parameters ==

Revision as of 15:28, 17 October 2017

The /echo command prints text to the specified window. This command does not send anything to the server; text is only shown in the window.

Note: If you use /echo to send text to a custom listbox window which has been opened by /window -s, the line will be added added at the bottom of the window rather than being inserted in the correct sort position.


Synopsis

/echo [colour-number] [-deghiNtsaqlbfnmr] [window] <text>
/echo -c[deghiNtsaqlbfnmr] <colour-name> [window] <text>

Switches

Target window swiches

  • -s - prints to the status window
  • -a - prints to the active window
  • -d - prints to the single message window

Settings Related:

  • -r - Applies the strip settings to the text (as defined in mIRC Options / IRC / Messages).
  • -l - Applies the highlight settings to the text (as defined in mIRC Address Book / Highlight).
  • -b - Applies the beep settings to the window (as defined in mIRC Options / Sounds).
  • -f - Applies the flash settings to the window (as defined in mIRC Options / IRC / Options).

Other switches

  • -c - Indicates that the <colour-name> parameter is provided.
  • -e - Encloses the text with a pair of line separators
  • -g - Prevents the text from being logged if the window has logging on.
  • -h - Applies a hard-wrap on the text so that the wrap point does not change when the window is resized. Text is not wrapped if it is echoed to a custom listbox window.
  • -i<N> - Indents wrapped lines by <N> characters. The standard mIRC indent is 2 spaces.
  • -t - Adds a timestamp to the text if the timestamp is enabled for that window. Without this, the line will not be timestamped even if the window has timestamping set. Note: Custom windows
  • -q - Honors the $show flag. (If the alias was called with the . prefix)
  • -n - Prevents switchbar button/treebar colour change
  • -m - Changes switchbar button/treebar colour to "messages" (as defined in mIRC Options / Display); without -m or -n it uses the colour defined for "events".

Parameters

  • [colour-number] - A numeric colour value (0 to 15)
  • <colour-name> - Used with the -c switch. One of the following: action, ctcp, highlight, info, info2, invite, join, part, quit, kick, mode, topic, nick, normal, notice, notify, other, own, wallops, whois
  • [window] - The target window/channel/query
  • <text> - The text to be printed

Examples

A Hello World example:

/echo -a Hello World!

A simple example of a loop that prints a few lines:

alias example {
  var %x = 5
  while (%x) {
    echo -a This is example line $v1 $+ .
    dec %x
  }
}

The above will print:

This is example line 5.
This is example line 4.
This is example line 3.
This is example line 2.
This is example line 1.


echo -t #test            This line begins with timestamp ONLY if timestamping is enabled within #test
echo    #test $timestamp This line begins with timestamp always - regardless whether timestamp is enabled or disabled in #test


; See mirc-options/display
; The 1st line    causes the echo to color the switchbar using the color for "event" because the echo is made within an EVENT
; The 2nd line -m causes the echo to color the switchbar using the color for "messages", overriding the default EVENT color
; The 2nd line -n causes the echo to not change the switchbar color.
; Note that Chanserv giving the joined nick OP level is a separate event, and mIRC will change the -m override, and that event will color the switchbar as the EVENT color
 
on ^*:JOIN:#:{
  echo $color(join)    # $timestamp * $nick $+($chr(40),$gettok($fulladdress,2-,33),$chr(41)) has joined # $comchan($nick,0)
  echo $color(join) -m # $timestamp * $nick $+($chr(40),$gettok($fulladdress,2-,33),$chr(41)) has joined # $comchan($nick,0)
  echo $color(join) -n # $timestamp * $nick $+($chr(40),$gettok($fulladdress,2-,33),$chr(41)) has joined # $comchan($nick,0)
  haltdef
}
//echo 4                abc $chr(22) def $chr(15) this text appears as color four and the color number is not logged at the beginning of the line
//echo $chr(3) $+ 04 $+ abc $chr(22) def $chr(15) this text appears as color for normal text $color(normal) and the color code is logged at the beginning of the line

Compatibility

Added: mIRC v3.7
Added on: 12 Oct 1995
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also

v · d · e mIRC commands list

A /abook, /action, /add, /ajinvite, /alias, /aline, /ame, /amsg, /anick, /aop, /auser, /auto, /autojoin, /avoice, /away

B /background, /ban, /bcopy, /beep, /bindip, /bread, /break, /breplace, /bset, /btrunc, /bunset, /bwrite

C /channel, /clear, /clearall, /clearial, /cline, /clipboard, /close, /closechats, /closedccs, /closefserves, /closemsg, /cnick, /color, /colour, /comclose, /comlist, /commands, /comopen, /comreg, /continue, /copy, /creq, /ctcp, /ctcpreply, /ctcps

D /dcc, /dccserver, /dde, /ddeserver, /debug, /dec, /describe, /dialog, /did, /didtok, /disable, /disconnect, /dlevel, /dline, /dll, Template:mIRC/donotdisturb, /dns, /dqwindow, /drawcopy, /drawdot, /drawfill, /drawline, /drawpic, /drawrect, /drawreplace, /drawrot, /drawsave, /drawscroll, /drawsize /drawtext

E /ebeeps, /echo, /editbox, /else, /elseif, /emailaddr, /enable, /events, /exit

F /fclose, /filter, /findtext, /finger, /firewall, /flash, /flist, /flood, /flush, /flushini, /fnord, /font, /fopen, /fseek, /fsend, /fserve, /fullname, /fupdate, /fwrite

G /ghide, /gload, /gmove, /gopts, /goto, /gplay, /gpoint, /gqreq, /groups, /gshow, /gsize, /gstop, /gtalk, /gunload, /guser

H /hadd, /halt, /haltdef, /hdec, /hdel, /help, /hfree, /hinc, /hload, /hmake, /hotlink, /hop, /hsave

I /ial, /ialclear, /ialmark, /identd, /if, /ignore, /iline, /inc, /iuser

J /join

L /leave, /linesep, /links, /list, /load, /loadbuf, /localinfo, /log, /logview

M /maxdepth, /mdi, /me, /menubar, /mkdir, /mnick, /mode, /msg

N /noop, /notice, /notify

O /onotice, /omsg

P /pareline, /part, /partall, /pdcc, /perform, /play, /playctrl, /pop, /protect, /proxy, /pvoice

Q /qme, /qmsg, /query, /queryrn, /quit, /quote

R /raw, /registration, /reload, /remini, /remote, /remove, /rename, /renwin, /reseterror, /resetidle, /return, /returnex, /rlevel, /rline, /rmdir, /run, /ruser

S /save, /savebuf, /saveini, /say, /scid, /scon, /server, /set, /setlayer, /showmirc, /signal, /sline, /sockaccept, /sockclose, /socklist, /socklisten, /sockmark, /sockopen, /sockpause, /sockread, /sockrename, /sockudp, /sockwrite, /sound, /speak, /splay, /sreq, /strip, /switchbar

T /timer, /timestamp, /tip, /tips, /titlebar, /tnick, /tokenize, /toolbar, /topic /tray, /treebar

U /ulist, /unload, /unset, /unsetall, /updatenl, /url, /username, /uwho

V /var, /vcadd, /vcmd, /vcrem, /vol

W

X /xyzzy