|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
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: 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: [color:blue]hello world
hello<B><B> <B><B><B><B> <B><B><B><B> <B><B><B><B> <B><B>world[/color][color:green]
hello world
hello <B><B> <B><B> <B><B> 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
|
|
|
|
Joined: Feb 2003
Posts: 32
Ameglian cow
|
Ameglian cow
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.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
Ah good point Here's $text, adding a ^B pair at the beginning (only when necessary though): alias text var %a | !.echo -q $regsub($right($rawmsg,- $+ $pos($rawmsg,:,2)),/(?<= [color:red]|^[/color])(?= )/g,,%a) | return %a
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
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!
|
|
|
|
Joined: Sep 2003
Posts: 70
Babel fish
|
Babel fish
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.
|
|
|
|
Joined: Jan 2006
Posts: 1
Mostly harmless
|
Mostly harmless
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:
on *:text:#:{
$dll(spaces.dll, echo, -t $chan $+(<,$nick,>) $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:
on *:INPUT:#:{
if ((/* iswm $1) && (!$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 $+(<,$me,>) %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.
|
|
|
|
|