README for spaces.dll v1.5 - multi-space support DLL for mIRC
Copyright (c) 2005-2026, David "Saturn" van Moolenbroek <saturn@quakenet.org>
Visit http://www.xise.nl/mirc/ to get the latest version of this DLL
This version of the DLL supports mIRC version 7.1 - 7.84


1.    Introduction
2.    Functions
2.1.    loaded - check if the DLL is loaded
2.2.    echo   - echo text to windows without loss of spaces
2.3.    send   - send commands to IRC without loss of spaces
2.4.    dcc    - send text to DCC Chats without loss of spaces
2.5.    input  - get "on INPUT" text without loss of spaces (DEPRECATED)
3.    Example
4.    License
5.    Source code
6.    Version history


1. Introduction
  
  It's a known fact that the way mIRC handles spaces in scripts is not exactly
  perfect; double consecutive spaces get lost when calling commands and
  tokenizing text strings. This has its good sides, but definitely also its
  bad sides: in order to echo a string with multiple consecutive spaces, one
  has to use $chr(160) as fake space (which is not in all fonts), or use for
  example pairs of bold characters - did you know that if you put bold
  characters between the spaces, mIRC has to print the spaces to the screen
  one by one? I won't even get into the amount of ugliness you have to use in
  order to send commands to the server without loss of spaces, or get the
  unmodified text from an editbox in "on INPUT" events.

  This DLL offers a somewhat neater solution to these problems. It allows you
  to echo text to the screen, send commands to the IRC server and DCC Chat
  windows, and get the original text in "on INPUT" events - all while
  preserving double consecutive spaces. It could be used by people who want to
  give mIRC their own look (think theme scripts!) or simply align text
  properly. Along with mIRC's own $rawmsg identifier and regex support, this
  DLL should allow you to do pretty much everything related to text input and
  output with a script, without the disadvantage of losing spaces just because
  you're using a script.

  An important note: this DLL uses internal functions of mIRC directly, and
  therefore is limited to exactly these mIRC versions that it is programmed
  for. You can find the supported mIRC versions at the top of this readme;
  BOTH older AND newer versions of mIRC are NOT supported. See also the
  "loaded" function below.


2. Functions

  The DLL implements five functions: loaded, echo, send, dcc, and input.

  Important: to preserve spaces, make the DLL calls using $dll, not /dll.
  The "echo", "dcc" and "send" calls will never return anything, so $dll can
  safely be used as command for them. This is also shown in the example in
  section 3 below. Alternatively, since mIRC 6.17, you can use /noop $dll(..).

  The same goes for custom aliases/identifiers by the way - if you want your
  own custom aliases to preserve spaces, you'd better start calling them as
  identifiers!

2.1. loaded - check if the DLL is loaded

  To check if the DLL has been loaded successfully, use:

    echo -a Loaded: $dll(spaces.dll, loaded, )

  This function will return 1 if spaces.dll has been loaded successfully, 0
  otherwise. The DLL will fail to load if it does not support the mIRC
  version that it was loaded in; the exact list of supported mIRC versions is
  at the top of this file. If the DLL returns 0, your script should fall
  back on the normal mIRC commands!

2.2. echo - echo text to windows without loss of spaces

  You can echo text without loss of spaces, with the echo call; its parameters
  are the parameters you would have used in a call to the standard /echo
  command:

    $dll(spaces.dll, echo, -atc info2 * Some $str($chr(32), 8) space)

  This example will show ten spaces between "Some" and "space".

2.3. send - send commands to IRC without loss of spaces

  To send a command to the IRC server of the current connection, use the send
  call. This works just like /raw, while preserving spaces:

    $dll(spaces.dll, send, PRIVMSG $me : $+ %text)

  This will send the exact text in the variable %text to yourself.

  If successful, this command produces no output in the local window.

2.4. dcc - send text to DCC Chats without loss of spaces

  To send text to a DCC chat connection, use the following command. The first
  parameter has to be a nickname ('=' prefix is optional); the rest is the
  text to send:

    $dll(spaces.dll, dcc, =nick Hello $chr(32) $+ there!)

  If successful, this command produces no output in the local window.

  The DLL internally uses the /msg command to do this, so error messages you
  get from using this call incorrectly, will start with "* /msg: ". This may
  change in the future.

2.5. input - get "on INPUT" text without loss of spaces (DEPRECATED)

  IMPORTANT: as of mIRC 7.52, this command has become obsolete, as mIRC now
  natively supports the "$parms" identifier which does the same. For now, the
  'input' command is still supported, but it may be removed from future
  versions of this DLL. Please do not use this command in new scripts.

  To retrieve the input text without loss of spaces in an "on INPUT" event,
  use:

    var -p %input = $dll(spaces.dll, input, )

  Note that this is guaranteed to work ONLY when called from "on INPUT"
  events; in other cases, the results are undefined. The -p flag to /var was
  introduced in 7.52; for older versions, use -n instead.


3. Example

  The following snippet is an example of how to preserve spaces in a custom
  on INPUT event for queries. It is very basic and lacks all kinds of
  functionality, but it should give you a general idea of how you can use the
  various functions in spaces.dll. Note that there is no check for "loaded",
  and therefore also no fallback on standard mIRC commands if the DLL didn't
  manage to load.

  on *:INPUT:?:{
    ; don't process commands, unless ctrl+enter was pressed
    if ((/* iswm $1) && (!$ctrlenter)) return

    ; get the original and unmodified input, instead of using $1-
    var -p %input = $parms

    ; send the text to the IRC server
    $dll(spaces.dll, send, PRIVMSG $target : $+ %input)

    ; echo the text in the query window
    $dll(spaces.dll, echo, -aitc own $+(<,$me,>) %input)

    ; and keep mIRC from doing anything else with the input
    halt
  }


4. License

  Distribution of spaces.dll and this README.txt is UNLIMITED, provided that
  the files are both UNMODIFIED. You are free to include the DLL without this
  readme in your script distribution, without giving credit, as long as the
  DLL is unmodified. You are not allowed to TAKE credit for this DLL (duh!).

  THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
  EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO WARRANTIES OF
  MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL THE
  AUTHOR BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING INCIDENTAL OR
  CONSEQUENTIAL DAMAGES, ARISING OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. YOU ACKNOWLEDGE THAT YOU HAVE
  READ THIS LICENSE, UNDERSTAND IT AND AGREE TO BE BOUND BY ITS TERMS.


5. Source code

  Due to legal reasons, this DLL has to remain closed-source. I'm not going to
  go into exact details about this, but although the creation of this DLL was
  perfectly legal, and using the DLL is *definitely* legal, I would break a
  law if I were to release its source, because this would reveal information
  about how mIRC works internally. I promise I'll update it as soon as I can
  after the release of new mIRC versions, though!


6. Version history

  Version   Released    Description/changes

  1.5       23-06-2026  Update for mIRC 7.84 (no functional changes)

  1.5       13-11-2025  Update for mIRC 7.83 (no functional changes)

  1.5       28-10-2025  Update for mIRC 7.82 (no functional changes)

  1.5       09-04-2025  Update for mIRC 7.81 (no functional changes)

  1.5       03-02-2025  Update for mIRC 7.79 (no functional changes)

  1.5       06-11-2024  Update for mIRC 7.78 (no functional changes)

  1.5       11-06-2024  Update for mIRC 7.77 (no functional changes)

  1.5       12-01-2024  Update for mIRC 7.76 (no functional changes)

  1.5       27-08-2023  Update for mIRC 7.75 (no functional changes)

  1.5       02-08-2023  Update for mIRC 7.74 (no functional changes)

  1.5       18-06-2023  Update for mIRC 7.73 (no functional changes)

  1.5       27-11-2022  Update for mIRC 7.72 (no functional changes)

  1.5       01-10-2022  Update for mIRC 7.71 (no functional changes)

  1.5       18-07-2022  Update for mIRC 7.69 (no functional changes)

  1.5       02-04-2022  Update for mIRC 7.68 (no functional changes)

  1.5       02-10-2021  Update for mIRC 7.67 (no functional changes)

  1.5       29-06-2021  Update for mIRC 7.66 (no functional changes)

  1.5       08-05-2021  Update for mIRC 7.65
                        Changed to use LOADINFO's mBytes for newer mIRC
                        versions where applicable; no functional impact

  1.5       11-12-2020  Update for mIRC 7.64 (no functional changes)

  1.5       17-08-2020  Update for mIRC 7.63 (no functional changes)

  1.5       29-07-2020  Update for mIRC 7.62
                        Fixed load failure error printing (thanks KindOne)

  1.4       02-03-2020  Update for mIRC 7.61 (no functional changes)

  1.4       09-02-2020  Update for mIRC 7.59 (no functional changes)

  1.4       24-11-2019  Update for mIRC 7.58 (no functional changes)

  1.4       28-07-2019  Update for mIRC 7.57 (no functional changes)

  1.4       06-07-2019  Update for mIRC 7.56
                        Due to scripts not performing proper 'loaded' checks
                        (section 2.1), the DLL now prints an error if other
                        functions are used from an incompatible mIRC version

  1.3       09-02-2019  Update for mIRC 7.55 (no functional changes)

  1.3       21-12-2018  Update for mIRC 7.54 (no functional changes)

  1.3       01-12-2018  Update for mIRC 7.53 (no functional changes)
                        Examples in README now use /var -p (thanks KindOne)

  1.3       03-03-2018  Update for mIRC 7.52
                        Deprecated 'input' command

  1.2       19-09-2017  Update for mIRC 7.51 (no functional changes)

  1.2       26-05-2017  Update for mIRC 7.49 (no functional changes)

  1.2       16-04-2017  Update for mIRC 7.48 (no functional changes)

  1.2       21-01-2017  Update for mIRC 7.47 (no functional changes)

  1.2       02-08-2016  Update for mIRC 7.46 (no functional changes)

  1.2       25-04-2016  Update for mIRC 7.45 (no functional changes)

  1.2       25-03-2016  Update for mIRC 7.44 (no functional changes)

  1.2       03-08-2015  Update for mIRC 7.43 (no functional changes)

  1.2       17-07-2015  Update for mIRC 7.42 (no functional changes)

  1.2       28-02-2015  Update for mIRC 7.41 (no functional changes)

  1.2       27-11-2014  Update for mIRC 7.38 (no functional changes)

  1.2       14-08-2014  Update for mIRC 7.36 (no functional changes)

  1.2       21-06-2014  Update for mIRC 7.34 (no functional changes)

  1.2       25-05-2013  Update for mIRC 7.32 (no functional changes)

  1.2       17-01-2013  Update for mIRC 7.29 (no functional changes)

  1.2       20-10-2012  Update for mIRC 7.27 (no functional changes)

  1.2       16-06-2012  Update for mIRC 7.25 (no functional changes)

  1.2       14-10-2011  Update for mIRC 7.22 (no functional changes)

  1.2       07-03-2011  Update for mIRC 7.19 (no functional changes)

  1.2       18-12-2010  Update for mIRC 7.17 (no functional changes)

  1.2       08-11-2010  Update for mIRC 7.15 (no functional changes)

  1.2       16-10-2010  Update for mIRC 7.14 (no functional changes)

  1.2       31-07-2010  Update for mIRC 7.1 (no functional changes)

  1.2-beta  02-05-2010  Update for mIRC 7.02 beta22
                        Converted to unicode; no backwards compatibility

  1.1       18-10-2008  Update for mIRC 6.35 (no functional changes)

  1.1       08-08-2008  Update for mIRC 6.34 (no functional changes)

  1.1       18-07-2008  Update for mIRC 6.33 (no functional changes)

  1.1       21-05-2008  Update for mIRC 6.32 (no functional changes)

  1.1       01-11-2007  Update for mIRC 6.31 (no functional changes)

  1.1       20-08-2007  Update for mIRC 6.3 (no functional changes)

  1.1       23-11-2006  Update for mIRC 6.21 (no functional changes)

  1.1       08-08-2006  Update for mIRC 6.2 (no functional changes)

  1.1       10-06-2006  Added 'dcc' command to send text to DCC Chat windows
                        Fixed spaces being lost at the start of 'echo' lines

  1.0       18-02-2006  Update for mIRC 6.17 (no functional changes)

  1.0       01-06-2005  First public release

  1.0-beta  31-05-2005  First beta release (thanks Zyberdog, Osc, Mentality!)
