mIRC Home    About    Download    Register    News    Help

Page 3 of 3 < 1 2 3
Topic Options
#30849 - 02/09/03 01:12 AM Re: Multiple Spaces
qwerty Offline
Hoopy frood

Registered: 07/01/03
Posts: 2523
The main problem with this approach is that it uses too many ^B pairs. Here's a test script to see what I mean:
Code:
alias text var %a | !.echo -q $regsub($right($rawmsg,- $+ $pos($rawmsg,:,2)),/(?&lt;= )(?= )/g,,%a) | return %a
on *:text:*:?:{
  tokenize 32 $replace($right($rawmsg,$+(-,$pos($rawmsg,:,2))),$chr(32),$+(,$chr(32),))
  echo 2 -s $1-
  echo 2 -s $replace($1-,$chr(2),&lt;B&gt;)
  tokenize 32 $text
  echo 3 -s $1-
  echo 3 -s $replace($1-,$chr(2),&lt;B&gt;)
}
Open a query window to yourself and type "hello<space><space><space><space>world" (and make sure there isn't any on *:input:?: interfering). Status will print:
Code:
[color:blue]hello    world
hello&lt;B&gt;&lt;B&gt; &lt;B&gt;&lt;B&gt;&lt;B&gt;&lt;B&gt; &lt;B&gt;&lt;B&gt;&lt;B&gt;&lt;B&gt; &lt;B&gt;&lt;B&gt;&lt;B&gt;&lt;B&gt; &lt;B&gt;&lt;B&gt;world[/color][color:green]
hello    world
hello &lt;B&gt;&lt;B&gt; &lt;B&gt;&lt;B&gt; &lt;B&gt;&lt;B&gt; world[/color]
Ie, the first method uses 16 ^B characters, while the second only 6. Apart from this, $text has the advantage that if you /tokenize it, the $* tokens will either contain the original words or the ^B pairs. In the above example, $1 will be "hello<B><B>" in the first case and "hello" in the second. This looks a lot cleaner and easier for scripts to handle.
_________________________
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Top
#30850 - 02/09/03 01:33 AM Re: Multiple Spaces
praetorian_ Offline
Ameglian cow

Registered: 22/02/03
Posts: 32
your method is definitely better.

theres one small problem, though.. if text is preceded by a space (or multiple spaces), the first space gets chopped off.

edit: easily fixed by adding an extra set of ^b's at the beginning of the text.


Edited by praetorian_ (02/09/03 01:38 AM)

Top
#30851 - 02/09/03 01:50 AM Re: Multiple Spaces
qwerty Offline
Hoopy frood

Registered: 07/01/03
Posts: 2523
Ah good point smile

Here's $text, adding a ^B pair at the beginning (only when necessary though):
Code:
alias text var %a | !.echo -q $regsub($right($rawmsg,- $+ $pos($rawmsg,:,2)),/(?&lt;= [color:red]|^[/color])(?= )/g,,%a) | return %a

_________________________
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Top
#30852 - 02/09/03 04:52 AM Re: Multiple Spaces
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2590
We can only hope that /echo will support &binvars someday.
/raw could also use &binvar support, allowing you to send any number of multi-spaced messages to the server. At least from there, we could script the rest.
_________________________
Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Top
#30853 - 02/09/03 08:35 PM Re: Multiple Spaces
madewokherd Offline
Babel fish

Registered: 01/09/03
Posts: 70
Actually, we could get away using switches that cause /raw or /echo to evaluate things TWICE. Immediately after evaluation (and assuming they are on their own), $identifiers (thus $bvar.text) and %variables retain multiple spaces. It works perfectly for /loadbuf, aside from /loadbuf being generally annoying and unreasonable for this sort of thing.

Top
#30854 - 28/01/06 07:21 PM Re: Multiple Spaces
Crashspeeder Offline
Bowl of petunias

Registered: 28/01/06
Posts: 1
There is a way.

You'll need a DLL, and a "trick" posted earlier.

As was said previously, $mid($rawmsg,$calc($pos($rawmsg,$+($chr(32),:),1) +2)) will contain the FULL content of a message, spaces and all. However, echoing it was always a problem. A DLL created by Saturn specifically for mIRC 6.16 allows you to echo it easily! ( URL here )

Although well documented for SENDING text, receiving required some searching, I found the best way to be the following:

Code:
on *:text:#:{
$dll(spaces.dll, echo, -t $chan $+(&lt;,$nick,&gt;) $mid($rawmsg,$calc($pos($rawmsg,$+($chr(32),:),1) +2)) 
halt
}



and it will echo EXACTLY what was said, spaces and all.

To SEND all your text, as is perfectly documented in the README, use the following:

Code:
  on *:INPUT:#:{
    if ((/* iswm $1) &amp;&amp; (!$ctrlenter)) return
    ;gets the full, unmodified $1- from your editbox
    var %input = $dll(spaces.dll, input, )
    $dll(spaces.dll, send, PRIVMSG $target : $+ %input)
    $dll(spaces.dll, echo, -aitc own $+(&lt;,$me,&gt;) %input)
    halt
  }



And as i'm sure you noticed, the DLL accepts all the flags echo accepts. From there you just need to edit the above for any type of input and text (except DCC chats since they're not supported by the DLL yet).


I hope this helps somebody because it solved all my problems and took me forever to find.

Top
Page 3 of 3 < 1 2 3