mIRC Home    About    Download    Register    News    Help

Print Thread
Preserving Spaces #149840 24/05/06 05:46 PM
Joined: May 2006
Posts: 23
K
KageKonjou Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: May 2006
Posts: 23
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?

Re: Preserving Spaces #149841 24/05/06 06:18 PM
Joined: Apr 2006
Posts: 400
K
Kurdish_Assass1n Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
I'm not understanding what you're saying, maybe someone else will, but, can you try and be more specific please?


-Kurdish_Assass1n
Re: Preserving Spaces *DELETED* #149842 24/05/06 06:51 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Post deleted by MikeChat

Re: Preserving Spaces #149843 24/05/06 07:05 PM
Joined: May 2006
Posts: 23
K
KageKonjou Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: May 2006
Posts: 23
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.

Re: Preserving Spaces #149844 24/05/06 07:24 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.


Gone.
Re: Preserving Spaces *DELETED* #149845 24/05/06 07:34 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Post deleted by MikeChat

Re: Preserving Spaces #149846 24/05/06 07:36 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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!


Gone.
Re: Preserving Spaces #149847 24/05/06 07:40 PM
Joined: May 2006
Posts: 23
K
KageKonjou Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: May 2006
Posts: 23
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).

Re: Preserving Spaces #149848 24/05/06 07:42 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I get the feeling that you didn't read the post that I linked to.


Gone.
Re: Preserving Spaces #149849 24/05/06 07:45 PM
Joined: May 2006
Posts: 23
K
KageKonjou Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: May 2006
Posts: 23
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?

Re: Preserving Spaces #149850 24/05/06 07:46 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.


Gone.
Re: Preserving Spaces #149851 24/05/06 07:48 PM
Joined: May 2006
Posts: 23
K
KageKonjou Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: May 2006
Posts: 23
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))

Re: Preserving Spaces #149852 24/05/06 07:55 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.


Gone.
Re: Preserving Spaces #149853 24/05/06 08:43 PM
Joined: Jun 2003
Posts: 5,024
M
Mentality Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
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,


Mentality/Chris
Re: Preserving Spaces #149854 24/05/06 10:24 PM
Joined: May 2006
Posts: 23
K
KageKonjou Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: May 2006
Posts: 23
I'm afraid $text did not work. Does $1- in on TEXT and on INPUT retain /all/ the spaces?

Re: Preserving Spaces #149855 24/05/06 10:41 PM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
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.

Re: Preserving Spaces #149856 25/05/06 06:16 AM
Joined: May 2006
Posts: 23
K
KageKonjou Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: May 2006
Posts: 23
Okay, lastly, how can I apply space preservation to the on INPUT event?

Re: Preserving Spaces #149857 25/05/06 08:08 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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.

Re: Preserving Spaces #149858 25/05/06 10:32 AM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Quote:
Okay, lastly, how can I apply space preservation to the on INPUT event?


Take a look at Mentality's post.

Re: Preserving Spaces #149859 25/05/06 02:28 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
what would you know DaveC I mean spaces.dll can do it, duh!