mIRC Homepage
Posted By: KageKonjou Preserving Spaces - 24/05/06 05:46 PM
Say I have the following code:

Code:
on ^*:text:*:#:{
 echo $chan $1-
}


What is the best and most efficient way to preserve spaces in $1-? What I mean is if I don't use the on TEXT event, and someone says something with 6 spaces in it, I'll recieve and see those 6 spaces. With the code above, I see only one space. How do I preserve spacing?
Posted By: Kurdish_Assass1n Re: Preserving Spaces - 24/05/06 06:18 PM
I'm not understanding what you're saying, maybe someone else will, but, can you try and be more specific please?
Posted By: MikeChat Re: Preserving Spaces *DELETED* - 24/05/06 06:51 PM
Post deleted by MikeChat
Posted By: KageKonjou Re: Preserving Spaces - 24/05/06 07:05 PM
What about something like this?

Code:
on ^*:TEXT:*:#:{
  echo $chan $replace($1-,$chr(32), $+ $chr(32) )
}


I'm not home or on mIRC (I'm on irssi, though, good for remote IRC at work laugh), but I'll try some solutions when I get home. Please post any others anyone else can think of, thanks.
Posted By: FiberOPtics Re: Preserving Spaces - 24/05/06 07:24 PM
Click

@Mikechat: that code you posted won't do anything, because you are passing $1- which already has multiple consecutive spaces stripped. $rawmsg on the other hand doesn't have this issue. I don't want to be rude, but I think you were drunk when you made that lol, you're looping from 1 till $len(%text) yet using the increment variable to get tokens, as well as taking the %i'th space delimited token and replacing $chr(32) with $chr(160), but a space delimited token is never a space, so there is actually never any replacement. Also, you are just resetting that %newtext variable each time, so basically that would contain the last token when all looping is done, however since you loop too much ($len instead of $0) it is actually empty when the looping is done.
Posted By: MikeChat Re: Preserving Spaces *DELETED* - 24/05/06 07:34 PM
Post deleted by MikeChat
Posted By: FiberOPtics Re: Preserving Spaces - 24/05/06 07:36 PM
I don't need to test it, take a look at your code and you will soon see what I mean grin

I'm appalled that you ask me if I tested it, I know when code is right or wrong!
Posted By: KageKonjou Re: Preserving Spaces - 24/05/06 07:40 PM
What about just using $rawmsg instead if $1- ? Would that passthru all the spaces? I've not coded a lot when it comes to events, so I'm not certain how to handle extra spaces in mIRC.

The only other thing I can think of is a hacked method one of my friends used for a proxy system he made that runs through mIRC, which uses bset. Granted, that would consume my PC's resources whole, so I'm looking for something that I can use on a large scale (as in applying to every channel I am in, each with a full buffer).
Posted By: FiberOPtics Re: Preserving Spaces - 24/05/06 07:42 PM
I get the feeling that you didn't read the post that I linked to.
Posted By: KageKonjou Re: Preserving Spaces - 24/05/06 07:45 PM
Quote:
I get the feeling that you didn't read the post that I linked to.

Yes, I did, but it mainly just reinforced what you said about $1- stripping extra spaces in itself. What I am asking is what does $rawmsg do? If someone says "Blah(10spaces)foo", do those 10 spaces stay stored in $rawmsg? If so, can I simply echo $rawmsg?
Posted By: FiberOPtics Re: Preserving Spaces - 24/05/06 07:46 PM
Just copy that $text alias by qwerty that I linked you to, put it in your remotes, and then from then on use $text instead of $1- to echo. It's that simple.
Posted By: KageKonjou Re: Preserving Spaces - 24/05/06 07:48 PM
If the loop method is the only way, do I /have/ to loop through and tokenize? Why not this?:

Code:
echo $chan $replace($replace($rawmsg,$chr(32),$chr(160)),$chr(160),$chr(32))
Posted By: FiberOPtics Re: Preserving Spaces - 24/05/06 07:55 PM
What you are doing there has a null effect, you're making changes and then undoing them.

And no, looping is not the only way, if you read the post I linked you to, you see that the code for the $text alias has no looping, so why do you ask? Of course, internally there is looping in that code, but I'm sure you were referring to using a scripted loop.

$rawmsg contains more than just the string that has been said, it also contains who said it and where (it's raw data from the irc server, hence the name $rawmsg) so can't just do the replace, you need to do it so you only echo the relevant string. An example of what $rawmsg could look like:

:FOPtics!FiberOPtic@cable-213-132-147-76.upc.chello.be PRIVMSG #cellka :hello

Please, we like helping out, but you have to atleast do the effort to actually read the help that you've been given. Anyone that had thoroughly read qwerty's post that I linked you to, would have never asked the questions you did.
Posted By: Mentality Re: Preserving Spaces - 24/05/06 08:43 PM
I confess, I have not read this thread word to word, though I have clicked the links and skim read - but has anyone looked at spaces.dll to see if that would help?

Regards,
Posted By: KageKonjou Re: Preserving Spaces - 24/05/06 10:24 PM
I'm afraid $text did not work. Does $1- in on TEXT and on INPUT retain /all/ the spaces?
Posted By: schaefer31 Re: Preserving Spaces - 24/05/06 10:41 PM
Quote:
I'm afraid $text did not work.

It does.

Quote:
Does $1- in on TEXT and on INPUT retain /all/ the spaces?

Besides all the help you received already, your initial post answers this question.
Posted By: KageKonjou Re: Preserving Spaces - 25/05/06 06:16 AM
Okay, lastly, how can I apply space preservation to the on INPUT event?
Posted By: DaveC Re: Preserving Spaces - 25/05/06 08:08 AM
u cant, the best you can do is poll the editbox at a rate likely to capture the exact text entered, this is resource hoggy, and only if u want to proceed with it, well i try and write something to do it, right now burbon has effected my judgement.
Posted By: schaefer31 Re: Preserving Spaces - 25/05/06 10:32 AM
Quote:
Okay, lastly, how can I apply space preservation to the on INPUT event?


Take a look at Mentality's post.
Posted By: DaveC Re: Preserving Spaces - 25/05/06 02:28 PM
what would you know DaveC I mean spaces.dll can do it, duh!
© mIRC Discussion Forums