mIRC Home    About    Download    Register    News    Help

Print Thread
Page 3 of 3 1 2 3
Re: Multiple Spaces #30849 02/09/03 12:12 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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)),/(?<= )(?= )/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),<B>)
  tokenize 32 $text
  echo 3 -s $1-
  echo 3 -s $replace($1-,$chr(2),<B>)
}
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
Re: Multiple Spaces #30850 02/09/03 12:33 AM
Joined: Feb 2003
Posts: 32
P
praetorian_ Offline
Ameglian cow
Offline
Ameglian cow
P
Joined: Feb 2003
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.

Last edited by praetorian_; 02/09/03 12:38 AM.
Re: Multiple Spaces #30851 02/09/03 12:50 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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
Re: Multiple Spaces #30852 02/09/03 03:52 AM
Joined: Feb 2003
Posts: 2,642
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,642
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!
Re: Multiple Spaces #30853 02/09/03 07:35 PM
Joined: Sep 2003
Posts: 70
M
madewokherd Offline
Babel fish
Offline
Babel fish
M
Joined: Sep 2003
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.

Re: Multiple Spaces #30854 28/01/06 07:21 PM
Joined: Jan 2006
Posts: 1
C
Crashspeeder Offline
Mostly harmless
Offline
Mostly harmless
C
Joined: Jan 2006
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.

Page 3 of 3 1 2 3