|
Joined: May 2006
Posts: 23
Ameglian cow
|
OP
Ameglian cow
Joined: May 2006
Posts: 23 |
Say I have the following 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?
|
|
|
|
Joined: Apr 2006
Posts: 400
Fjord artisan
|
Fjord artisan
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
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
|
|
|
|
Joined: May 2006
Posts: 23
Ameglian cow
|
OP
Ameglian cow
Joined: May 2006
Posts: 23 |
What about something like this? 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  ), but I'll try some solutions when I get home. Please post any others anyone else can think of, thanks.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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.
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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  I'm appalled that you ask me if I tested it, I know when code is right or wrong!
Gone.
|
|
|
|
Joined: May 2006
Posts: 23
Ameglian cow
|
OP
Ameglian cow
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).
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
I get the feeling that you didn't read the post that I linked to.
Gone.
|
|
|
|
Joined: May 2006
Posts: 23
Ameglian cow
|
OP
Ameglian cow
Joined: May 2006
Posts: 23 |
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?
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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.
|
|
|
|
Joined: May 2006
Posts: 23
Ameglian cow
|
OP
Ameglian cow
Joined: May 2006
Posts: 23 |
If the loop method is the only way, do I /have/ to loop through and tokenize? Why not this?: echo $chan $replace($replace($rawmsg,$chr(32),$chr(160)),$chr(160),$chr(32))
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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.
|
|
|
|
Joined: Jun 2003
Posts: 5,024
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: May 2006
Posts: 23
Ameglian cow
|
OP
Ameglian cow
Joined: May 2006
Posts: 23 |
I'm afraid $text did not work. Does $1- in on TEXT and on INPUT retain /all/ the spaces?
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
I'm afraid $text did not work. It does. 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.
|
|
|
|
Joined: May 2006
Posts: 23
Ameglian cow
|
OP
Ameglian cow
Joined: May 2006
Posts: 23 |
Okay, lastly, how can I apply space preservation to the on INPUT event?
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
Okay, lastly, how can I apply space preservation to the on INPUT event? Take a look at Mentality's post.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
what would you know DaveC I mean spaces.dll can do it, duh!
|
|
|
|
|