mIRC Home    About    Download    Register    News    Help

Print Thread
#149840 24/05/06 05:46 PM
Joined: May 2006
Posts: 23
K
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?

#149841 24/05/06 06:18 PM
Joined: Apr 2006
Posts: 400
K
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
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Post deleted by MikeChat

#149843 24/05/06 07:05 PM
Joined: May 2006
Posts: 23
K
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.

#149844 24/05/06 07:24 PM
Joined: Feb 2004
Posts: 2,019
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.
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Post deleted by MikeChat

#149846 24/05/06 07:36 PM
Joined: Feb 2004
Posts: 2,019
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.
#149847 24/05/06 07:40 PM
Joined: May 2006
Posts: 23
K
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).

#149848 24/05/06 07:42 PM
Joined: Feb 2004
Posts: 2,019
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.
#149849 24/05/06 07:45 PM
Joined: May 2006
Posts: 23
K
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?

#149850 24/05/06 07:46 PM
Joined: Feb 2004
Posts: 2,019
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.
#149851 24/05/06 07:48 PM
Joined: May 2006
Posts: 23
K
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))

#149852 24/05/06 07:55 PM
Joined: Feb 2004
Posts: 2,019
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.
#149853 24/05/06 08:43 PM
Joined: Jun 2003
Posts: 5,024
M
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
#149854 24/05/06 10:24 PM
Joined: May 2006
Posts: 23
K
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?

#149855 24/05/06 10:41 PM
Joined: Aug 2005
Posts: 525
S
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.

#149856 25/05/06 06:16 AM
Joined: May 2006
Posts: 23
K
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?

#149857 25/05/06 08:08 AM
Joined: Sep 2003
Posts: 4,230
D
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.

#149858 25/05/06 10:32 AM
Joined: Aug 2005
Posts: 525
S
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.

#149859 25/05/06 02:28 PM
Joined: Sep 2003
Posts: 4,230
D
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!


Link Copied to Clipboard