mIRC Home    About    Download    Register    News    Help

Print Thread
#50404 20/09/03 02:49 PM
Joined: Dec 2002
Posts: 188
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Dec 2002
Posts: 188
I know multiple spaces stuff have been mentioned billions of times, and codemastr posted a solution using binary variables.

Ok, so now, I heard that binary variables do allow spaces. But what I want to do is:

I want to convert $chan(#channel).topic into a binary variable, so that I can read from it and it can accept multiple spaces. Can anyone tell me how to do it?

Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
Couldn't be done unfortunately. AFAIK $rawmsg isn't available in raw events/on topic events so there's no identifier which contains the unstripped text to start off with. And you couldn't set a topic with multiple spaces because there's no output command which accepts a binvar directly as a parameter, so they'll always stripped before being sent.

Joined: Dec 2002
Posts: 188
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Dec 2002
Posts: 188
but in default mirc, it doesn't strip multiple spaces though.

mIRC should have $unstrip or something though...

Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
For input/output control of multiple spaces (albeit somewhat limited) all mIRC really needs is a $rawmsg for every relevant event (TOPIC, TEXT, INPUT, CTCP, etc.) and for /raw to have a -b switch so it can take a binvar as a parameter. With that you could do just about anything with multiple spaces and it wouldn't require breaking any scripts or making any real changes to the mIRC scripting language. Hopefully something like this will be added for the next version.

Joined: Aug 2003
Posts: 1,825
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,825
JFWIW: $rawmsg sure is available in raws/events/joins/etc. smile

Joined: May 2003
Posts: 161
A
Vogon poet
Offline
Vogon poet
A
Joined: May 2003
Posts: 161
I think mIRC should just make token ranges like $1- use the original spacing.

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
To "convert" it, use: //bset -t &v 1 $replace($chan(#).topic,$chr(32),$lf) | breplace &v 10 32 and by now &v will contain the full topic including multiple spaces.

Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
That's good then, but I'm pretty sure there's still no such identifier (or equivalent) for on INPUT events, which is pretty necessary IMO.

Ashkrynt: I'd like it too if there was an alternative range to $x which retained spaces and allowed null tokens, but I don't think it should replace it. Many scripts already made use methods which would break if $x returned $null and didn't represent the end of the token range. Plus many scripts/scripters in the future might not want or need the extra functionality and would prefer to use the simpler tokens.

Online: Good point. Didn't occur to me that $chan().topic would be filled correctly anyway.

Joined: Dec 2002
Posts: 188
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Dec 2002
Posts: 188
Thanks, so how do I echo a binary variable?>

Yeah, I think a good identifier would be $b1- etc

Last edited by trenzterra; 21/09/03 01:43 AM.
Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
Use //echo -a $bvar(&v,1-).text but here's the catch: when you echo the binvar content, mIRC kills the spaces once again...

What you can do however is either replace evey space with a hard-space, ASCII code 160, or put a couple of control codes between a pair of consistent spaces before echoing them to the screen. Examples:

//echo -a $replace($chan(#).topic,$chr(32),$chr(160))
//echo -a $replace($chan(#).topic,$str($chr(32),2),$+($chr(32),$str($chr(2),2),$chr(32)))

I apologize if this is somewhat confusing, but that's all we can do at the moment.

Btw starbucks, it's not only $chan().topic that keeps the original spacing. Most, if not all of mIRC's inbuilt identifiers return correct text: $sfile, $sound, $findfile, $read(,n), $readini(,n) and $hget, to name a few. Eventually, the doubled spaces get stripped by /commands.

Joined: Dec 2002
Posts: 188
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Dec 2002
Posts: 188
thanks online!!

Joined: Dec 2002
Posts: 188
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Dec 2002
Posts: 188
hmm if Khaled doesn't want to add a new identifier that doesn't remove spaces, he should at least support all commands which works with $chr(160)

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
160 is not a real space (ie. you can't use it to separate command parameters), it's just dispayed as a blank character in some fonts. I don't think Khaled needs to do something about it.

Joined: Dec 2002
Posts: 188
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Dec 2002
Posts: 188
yeah, i noticed that, word wrap doesn't work properly

eg when topic is too long and has to spread across two lines
in $chr(32) it puts:

hiiiiiiiiiiii I am blah blah
howw are you?

in $chr(160) it may display

hiiiiiiiiiiii I am blah blah h
oww are you?

Joined: Apr 2003
Posts: 210
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Apr 2003
Posts: 210
Quote:
160 is not a real space (ie. you can't use it to separate command parameters), it's just dispayed as a blank character in some fonts. I don't think Khaled needs to do something about it.


Despite your script work arounds, Ultimatly it comes down to using $replace(....,$chr(32),$chr(160)) ... Which is crap, everyone knows you shouldnt use $chr(160) Like that. So, In fact khaled does need to do something about it.


Link Copied to Clipboard