mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 3 1 2 3
#30809 19/06/03 09:52 AM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
https://forums.mirc.com/showflat.php?Cat=...=true#Post30982

(So no one can tell me I didn't search :P)

But isn't there any way so you can handle multiple spaces in events?? (on INPUT, on TEXT)
I've tried a lot of things (replacing $chr(32) with $chr(160)) but nothing works in events. Maybe some one that knows a good script around??

#30810 19/06/03 10:07 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
i know one of the threads mentioned chr(160), becasue i got the idea from here afterall. Maybe you didn't search well enough. >:D


-KingTomato
#30811 19/06/03 10:13 AM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
Maybe you could give me a hand?.. have searched, couldn't find it :tongue:

#30812 19/06/03 10:14 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
5 spaces = $str($chr(160), 5) etc

EDIT:
keep in mind that does not work for incoming text, only outgoing. I.e. you can't preserv an on text's sequencial spacing using that.


-KingTomato
#30813 19/06/03 10:17 AM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
I know that, but that's not what i want, I know how to send multiple spaces, but what i want is:

on ^*:TEXT:*:#:{
echo $chan $timestamp < $+ $nick $+ > $replace($1-,$chr(32),$chr(160))
}

For instance, if someone SENDS me a line containing multiple spaces, i want to echo the multiple spaces, but so far, everything i tried, failed.. :@

Any ideas?

#30814 19/06/03 10:22 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
incase u didn't see it considering i posted it presumibly while you were replying

Quote:

EDIT:
keep in mind that does not work for incoming text, only outgoing. I.e. you can't preserv an on text's sequencial spacing using that.


not pssible, thats like saying..

Code:
/test {
  var %a = 1, %string = .a.b.c......d.e.f
  while ($gettok(%string, %a, 46)) {
    /set %t [ $+ [ %a ] ] $ifmatch
    /inc %a
  }
  /echo -a %t4
}


we all know %t4 will echo d. Same goes with spaces. Mirc handles the $1, $2, ..., $n by seperating things by spaces. So if it sees two spaces and a null between them, why should it be counted? I mean if you had (underscores represent spaces)

hello_there____kingtomato

and had

on 1:TEXT:*:#: {
/echo -a $3
}

would you really want $3 to echo a null just so you can have multiple spaces?


-KingTomato
#30815 19/06/03 10:24 AM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
if ($chr(32) $+ * iswm $1-) {
//echo -a $chr(32) $+ $1-
}
if (* $+ $chr(32) iswm $1-) {
//echo -a $1- $+ $chr(32)
}
if (* $+ $chr(32) $+ * iswm $1-) {
/tokenize 32 $1-
//echo -a $1 $2 $3 $4 $5
}
think that should work :tongue:

or you could try

var %space $replace($1-,$chr(32),_)

//echo -a $replace(%space,_,$chr(32))

Last edited by pheonix; 19/06/03 10:26 AM.

new username: tidy_trax
#30816 19/06/03 10:29 AM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
Quote:
would you really want $3 to echo a null just so you can have multiple spaces?


No, that wouldn't be a good solution either, it would be real messy, but i would like to see that mIRC gives an option to access the raw text that was send with the multiple spaces for example, but i think a have found a solution using RAWs. If it works i'll post it smile

#30817 19/06/03 10:31 AM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
Quote:
var %space $replace($1-,$chr(32),_)

//echo -a $replace(%space,_,$chr(32))


I've tried that in a lot of different ways and it doesn't work. The problem is, that mIRC itself does a little cleanup on the message send, before it triggers a on TEXT event.

#30818 19/06/03 10:31 AM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
you can write a dll to make it work, but im sure theres an easier way :tongue:


new username: tidy_trax
#30819 19/06/03 10:32 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Don't even try, raws don't respond to commands already responded and enterpreted by mirc. I do agree with you in a raw tho. Such as ever event could have a &raw variable.

on 1:TEXT:*:#: {
/echo -a This is the text sent $1-
/echo -a Raw text: $bvar(&raw, 1, $bvar(&raw, 1, 0)).text
}

the binary is able to hold consecutive spaces making it ultimatly the most reasonable choice.


-KingTomato
#30820 19/06/03 10:34 AM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
First thing also doesn't do what i want frown

#30821 19/06/03 10:35 AM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
Quote:
on 1:TEXT:*:#: {
/echo -a This is the text sent $1-
/echo -a Raw text: $bvar(&raw, 1, $bvar(&raw, 1, 0)).text
}

the binary is able to hold consecutive spaces making it ultimatly the most reasonable choice.

Yes that would be a good option, maybe post it in the future suggestions topic :P

Last edited by Poltergeist; 19/06/03 10:36 AM.
#30822 19/06/03 10:36 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I can almost definalty say it has been at one point in time. Besides the one person that matters is Khaled, and he frequents all boards. No need to post twice.


-KingTomato
#30823 19/06/03 10:38 AM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
Alright smile

#30824 19/06/03 10:52 AM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Quote:
would you really want $3 to echo a null just so you can have multiple spaces?


Hell yeah, I'd love to see that. It would be completely easy to strip for those who didnt want that functionality (var %a | !.echo -q $regsub($1-,/( +)/g,$chr(32),%a) | tokenize 32 %a), or a function could be built in for people who don't want to figure it out themselves. It's a simple solution (from the scripter's perspective) for what is, in my opinion, the biggest problem in mIRC scripting.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#30825 19/06/03 10:56 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I still say a raw would be a better alternative than a $null. Or maybe an added system like $1, $2, ..., $N for the "regular" tokens, then $r1, $r2, ..., $rN for the "raw" and "true" token identifyers.

BTW, <--- 1000 >:D


-KingTomato
#30826 19/06/03 11:13 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Or just /tokenize 32 $1- since /tokenize already kills consecutive tokens smile For the sake of backwards compatibility though, I'd like to see a new identifier (like $rawtext or $fulltext or whatever) while having $N work the same way.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#30827 19/06/03 11:20 AM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
Quote:
I'd like to see a new identifier (like $rawtext or $fulltext or whatever) while having $N work the same way


I'm with that laugh

#30828 19/06/03 11:50 AM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
True, but if mIRC scripting supported null tokens would /tokenize still behave like that? I do agree that a new identifier or identifier set would be better for compatability since this could otherwise kill a lot of old scripts.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#30829 19/06/03 07:04 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
We're still forgetting yes we can have the consecutive spaces returned, but aliases still delimite just like the events do. All passing would have to be redone to accomidate the consecutive spaces. If you pass
(_ = space)
/myalias this_is_a______demo

You still get $4 as demo in the alias. But then again, you could also have the "$rawtext" in the aliase.
(I would prefer a $R1 $R2, etc variable tho. >:D)


-KingTomato
#30830 19/06/03 07:16 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Well that's whay I was thinking of - the entire language having null token support rather than just an exception for the on TEXT event.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#30831 19/06/03 07:18 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I mean what is so wrong with using chr160? Its a good replacement, and would keep compatability.I do say that events like on text, on actions, etc should support multiple spaces, but then after that its up to you to keep the consecutive spaces in tact whether it be by means of $replace, or otherwise when passing to a alias or variable.


-KingTomato
#30832 19/06/03 07:22 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
It will NOT keep compatibility. Char 160 is NOT a space. It is a non-standard extension to the ASCII table. Many fonts use it, yes, but not all. It is NOT standard.

#30833 19/06/03 07:23 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
well i tried several fonts and it alway echos this, for example

//echo -a a $+ $str($chr(160),10) $+ a
returns
a a


new username: tidy_trax
#30834 19/06/03 07:28 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
You tried several _windows_ fonts. Other OSes might not be the same. And remember, IRC != mIRC. People are using other OSes.

#30835 19/06/03 07:31 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
well as far as i know mirc is only compatable for windows, and this is a mirc forum :tongue: ,well if its not a mirc forum then i think the name should be changed from (mIRC Message Board)

Last edited by pheonix; 19/06/03 07:34 PM.

new username: tidy_trax
#30836 19/06/03 08:24 PM
Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
I agree with codemastr - I think it is pointless sending characters to the room that programmes on other operating systems cannot understand. I have used $chr(160) for internal functions such as spacing information in dialogue listboxes as the TAB just puts an ugly square in place rather than shifting the text along a bit. Mind you I'd love to TAB, I just can't be bothered asking if anyone knows a way to do it.

#30837 19/06/03 08:25 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
[]1,1space[]4,1There's 5 spaces >:D


-KingTomato
#30838 19/06/03 08:35 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
as i said this is a mirc message board, so why should i even consider other os's when mirc is only compatible for windows :tongue: ?


new username: tidy_trax
#30839 19/06/03 08:39 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Because there are chat programs for other operating system, making any text sent over IRC subject to any circumstance. Why not make it universal >:D


-KingTomato
#30840 19/06/03 08:42 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
speak english when speaking to illiterate people blush


new username: tidy_trax
#30841 20/06/03 12:13 PM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
[offtopic]
Just wanted everyone to know that 1K posts has been reached on this forum smile
[/offtopic]

But a $rawtext identifier or null token support would be the best solution IMO

#30842 20/06/03 12:28 PM
Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
What he means is that when you send a unique character to the chatroom only mIRC users will be able to see it. Users of other programmes will not. We all know mIRC dominates by far over anything else and all else added together but that is not to say that mIRC should 'go it alone'. There has to be some sort of conformity or at least discussion with the authors of other programmes and indeed IRCd's when wanting to commit to a feature or function that would otherwise stand alone.

#30843 20/06/03 12:31 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
ok


new username: tidy_trax
#30844 20/06/03 07:27 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
ty watchdog.. couldn't have explained it better myself (or else i would have) laugh


-KingTomato
#30845 01/09/03 03:07 PM
Joined: Sep 2003
Posts: 70
M
Babel fish
Offline
Babel fish
M
Joined: Sep 2003
Posts: 70
The issue has been resolved in mIRC 6.1. The message sent for just about any event is $mid($rawmsg,$calc($pos($rawmsg,$+($chr(32),:),1) +2)). Using single identifiers (including $replace() and $+()) can be done without loss of multiple spaces. The /set command doesn't lose them ether. So you can /set a %variable to something containing the original line of text with its spacing preserved. Of course, you can't /echo it because /echo loses the spaces. What you CAN do is use /loadbuf -e on a file containing only the name of the %variable you want to echo. It's a complicated process, but in the end it lets you echo things without losing the spaces and without putting in hard spaces.

#30846 01/09/03 11:09 PM
Joined: Feb 2003
Posts: 32
P
Ameglian cow
Offline
Ameglian cow
P
Joined: Feb 2003
Posts: 32
i have found another way to do it without using /loadbuf (which wont wrap the same way as /echo -iN, ect.)

Code:
  var %rm = $right($rawmsg,$+(-,$pos($rawmsg,:,2)))
  bwrite temp.txt -1 $eval(%rm,0) 
  bread temp.txt 0 $lof(temp.txt) &amp;temp
  breplace &amp;temp 32 160
  tokenize 32 $replace($bvar(&amp;temp,1-).text,$chr(160),$+(,$chr(32),))
  write -c temp.txt
 


it basically sets a variable for the message, then /bwrites the variable to a file. write would probably also work. also, the $eval(%rm,0) should write the text '%rm' to the file, but instead it writes it's contents. if i try to /bwrite $rawmsg or just the variable, the spacing is lost.

after it is written, the file is read into memory and /breplace is used to replace all spaces with $chr(160). in turn, $chr(160) is turned into ^b^b$chr(32)^b^b (to preserve the spacing without using different characters in place of a space) and tokenized so that $1- will contain the original text but with extra spacing included.

the only downside is that any $chr(160)'s in the original text would be converted to a space, but since $chr(160) is commonly used as a replacement for $chr(32), i am willing to accept this.

#30847 01/09/03 11:24 PM
Joined: Sep 2003
Posts: 70
M
Babel fish
Offline
Babel fish
M
Joined: Sep 2003
Posts: 70
The only differences in behavior between /loadbuf and /echo that I've noticed are that /loadbuf automatically scrolls to the bottom of the window, and that it doesn't keep track of your place properly, which indeed may be annoying enough to make your method worthwhile. /loadbuf wraps the same way, to my knowledge, if you use the -pi2 switches. Also, I see no reason why you cannot use $replace($right($rawmsg,$+(-,$pos($rawmsg,:,2))),$chr(32),$+(,$chr(32),)), and thus avoid reading/writing a file, and losing $chr(160).

But for me, I can accept no loss of information.

#30848 01/09/03 11:25 PM
Joined: Feb 2003
Posts: 32
P
Ameglian cow
Offline
Ameglian cow
P
Joined: Feb 2003
Posts: 32
Code:
tokenize 32 $replace($right($rawmsg,$+(-,$pos($rawmsg,:,2))),$chr(32),$+(,$chr(32),))


that also works. i knew i shouldnt post the first solution i found ;/

#30849 02/09/03 12:12 AM
Joined: Jan 2003
Posts: 2,523
Q
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)),/(?&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
#30850 02/09/03 12:33 AM
Joined: Feb 2003
Posts: 32
P
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.
#30851 02/09/03 12:50 AM
Joined: Jan 2003
Posts: 2,523
Q
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
#30852 02/09/03 03:52 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
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!
#30853 02/09/03 07:35 PM
Joined: Sep 2003
Posts: 70
M
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.

#30854 28/01/06 07:21 PM
Joined: Jan 2006
Posts: 1
C
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 1 of 3 1 2 3

Link Copied to Clipboard