mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Dec 2003
Posts: 48
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2003
Posts: 48
I'll make my problem simple to khaled,
go to any window, type
/echo -a b<space><space><space><space>c

result "b c"

I've had a hell of a time with this for the
longest time, the scripting environment
is always chopping out the spaces, and
it messes up my string parsing.

I noticed that you can type
"a<space><space><space><space>b"
in a text window, and it does fine, If khaled
would fix this, I think alot of scripters
would be very happy.

even this forum parses excessive
spaces, let me make it clear to everyone
space parsers are bad!

P.S (bring back the help icon)

Last edited by NrWarren; 27/12/03 11:34 AM.
Joined: Sep 2003
Posts: 70
M
Babel fish
Offline
Babel fish
M
Joined: Sep 2003
Posts: 70
it's very probably your web browser that removes the extra spaces. They tend to do that (I think it's actually some soft of standard).

This has been discussed several times before. There are some ways around the limitation, most of which are not pretty. There have also been suggestions to use things like binary variables (allow echoing of binary variables and pass binary variables to scripts).

I suggest you look around for other threads on the subject.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
next time you ask a question it would be nice if you did a search on the subject, or read up on the details of the feature. If you aren't already aware, spaces are something mIRC has been "chopping" out ever since the birth of the language. mIRC tokenizes all information it receives (when it receives it in script). Therefore when you say $1-, you're saying "The tokenized version of my text", which is inherently space stripped, just by the fact that it was tokenized. There is no way around this- its the method that the language parses information. This explains why you can have multiple spaces in an unscripted IRC environment (IE. talking in a chatroom) but lose that ability once you put in an ON INPUT event that does the command /say $1-


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
madewokherd: Its not a browser limitation, the html standard eliminates 'white space'. For this reason, it makes it possible to indent such tags at <tables>, <tr>, <td>, etc. without getting the uneccisery spaces. e.g.

Code:
&lt;body&gt;
  &lt;table border='0' cellpadding='0' cellspacing='0' width='90%'&gt;
    &lt;tr&gt;
      &lt;td&gt;
        This is just a simple celled table, that is first of all prefixes by 8 spaces. Then, you begin
        to type.  Should HTML actually allow consecutive spaces, your text wouldn't look as pretty &gt;:P
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
&lt;/body&gt;


As for mirc, if you want to align tect, you may find my snipplet someone valuable, as it bypasses it (for if you are attempting to make a table, or soemthing). Otherwise, bear with it.


-KingTomato
Joined: Dec 2003
Posts: 48
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2003
Posts: 48
By the way argv, I did search the forums for "spaces" and I found no links suggesting it. perhaps I didn't look hard enough, but I did look :P

Also, you said mIRC obviously sorts by tokens, and thats great and all, but an extra identifier could be given at the handling of the event/alias that is the "REAL" string, without the tokens being parsed, basically we are being limited
only to the usage of tokens to deal with our parameters.
think about it.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
I don't find that to be a limitation at all, since you always have binary variables to do your dirty work with spaces. and just like was mentioned, you can use aliases to fake spacing.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Dec 2003
Posts: 48
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2003
Posts: 48
you're missing the point, the point is, this is a suggestion to khaled, something that he can fix. I don't see why you should defend something that could be better?

yes there are work arounds like replacing spaces, and using binary, but the fact remains it is clumsy. Even WITH binary variables, I still encounter the same problems, you got to come out of binary some time, and when you do.. it gets tokenized.

I know its easier for me to ask him to fix it, but from what I understand, all he has to do is make an edit to the way it handles parameters and set an identifier that gives the exact result, (no token parsing).

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
You make that comment like it's once simple addition. From my standpoint its not.

Not only would it be a failry decent modification to the parsing agent, but also a severe hit to scripts. A lot of scripts have loops dependant on "until token is null" i.e. the last word; causing these scripts to break.

As far as for a 'clumsy' method, it's laster all these years thus far. It can't be too bad. And when you say that it gets tokenized when removed from a binary format, thats not true. Maybe with your method of parsing, but its completly possible to do it otherwise.


-KingTomato
Joined: Dec 2003
Posts: 48
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2003
Posts: 48
er, I don't really understand what you meant by this modifcation breaking other scripts, it would be an addition, not altering the functionality of scripts, but by adding a new identifier instead to give the real text. (making it optional to use)

you're probably right about the binary part, i'll figure that out later, but you shouldn't have to rely on binary.

everyone used windows 95 for years and some still do, are you saying its not clumsy just because people has made do with it? that answer should be obvious. I don't understand why you people want to stick up for this problem, if I didn't know any better, you act like you wrote the code yourself, like I said, stop sticking up for other methods and maybe something will be done preferably sooner into the future :P

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
you say fix as if its broken- its not broken- its merely a part of the language- deal with it.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
use something like this

alias spaced return $replace($1-,~,$chr(160))

/echo -a b   c
/echo -a $spaced(b~~~c)

result
b c
b   c


or if your just writting echos etc, use $chr(160) to begin with, oddly if u want to use alt-160 u actualy have to use alt-255, dont ask me why.

if your working with pre existing strings with spaces, then use
%whatever = $replace(%whatever,$chr(32),$chr(160))

Last edited by DaveC; 28/12/03 08:26 AM.
Joined: Dec 2003
Posts: 48
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2003
Posts: 48
hey dave, thanks for the work around, i would do it that way, but what i'm writing requires the real spaces. I'll just have to do it the binary way. by the way, if you wanted to do chr 160 with alt (with the actual #), type alt + 0160

Joined: Dec 2003
Posts: 48
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2003
Posts: 48
you know what argv, I say what I mean, so don't confuse yourself. I was offering a suggestion for a future mIRC, thats how i'm dealing with it, and I think its a little backwards of you telling me to deal with it, obviously I will have to deal with it regardless of what you say.

Joined: Sep 2003
Posts: 70
M
Babel fish
Offline
Babel fish
M
Joined: Sep 2003
Posts: 70
You can echo the real spaces using /loadbuf -e (evaluation). Put the spaced string in a %variable. Put the name of the %variable on its own in the file (this way, you can reuse the file and don't have to write to the disk every time). Then use /loadbuf with the evaluation switch to echo it.

I know, this doesn't solve the problem of getting the spaces in an on input event. smirk

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
NrWarren -
the point is, this has been requested and whined about so many times in the past, you think Khaled would have done something about it by now. The reason he hasn't is most likely that it's a pretty tough problem to solve given the constraints of the parser. I imagine lines are tokenized even before they get to the script parser, which would mean that he would have to rework the parser to handle script code (parse an identifier such as $fullline or something) before it handles script code (note the redundancy?) - Redoing the parser is not worth his time and effort, and certainly isn't that important just so users can echo "REAL" spaces.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I actually replied in a different thread on how to catch spaces in a on input
http://forums.mirc.com/showthreaded.php?Cat=&Board=scriptsandpopups&Number=67894


Joined: Sep 2003
Posts: 70
M
Babel fish
Offline
Babel fish
M
Joined: Sep 2003
Posts: 70
I find that timers + $editbox tend to cause problems sometimes here by not triggering between typing and pressing enter. Also, what if you, um, paste something? That solution, even for a workaround, is just not good enough for me.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
That timer goes off 40 times a second, its faster than the keyboard repeat rate, as for pasting, well thats up to what you code the timer event to do, it should take every event as a new line of text. The Only time i have seen it beaten is when i was loading text into the editbox using /editbox -n

Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Well it's still unusable for many, because it's simply not using spaces at the end. $chr(160) isn't a space in many fonts, one can't assume this. Granted it's only taking account of echoed text in your example, not what's sent, but you simply can't send text with multiple spaces.. and this is needed more than just echoing text like it should be sent and still sending it all messed up.


* cold edits his posts 24/7
Joined: Nov 2003
Posts: 33
Ameglian cow
Offline
Ameglian cow
Joined: Nov 2003
Posts: 33
yes, it does get all messed up... if you use the edit box in a custom window, the spaces are killed in your on *:input:... event.


--------------------
I may be insane, but I enjoy it!
Page 1 of 2 1 2

Link Copied to Clipboard