|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
Dear Khaled, One of the still pervasive weaknesses of mIRC script is the inability to preserve and output a sequential string of neighboring spaces. Over the years many strides have been made to allow working with sequential spaces (eg: /returnex) but the one major hurtle is doing anything to output or display strings that contain space pairs. Without making any major changes to mIRC's scripting engine or parsing routines, I would like to recommend what I believe is the simplest stop-gap solution that should make most of us happy: Allow several commands such as /echo and /msg and /quote and /write to work as an identifier. Since identifiers already preserve sequential spaces, this becomes a simple fix. noop $echo(-tic,notice,#mIRC,$1-) noop $msg(#mIRC,$1-) noop $quote($1-) noop $write(-c,output.txt,$1-) Doing this would make my Christmas very Merry. ~ Raccoon Happy New Year! ![smile smile](/images/graemlins/mirc/smile.gif)
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
Alternately, if you allow us to use &binvars in these commands, or specifically create /bmsg /becho commands, that would be very suitable as well.
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
Joined: May 2010
Posts: 29
Ameglian cow
|
Ameglian cow
Joined: May 2010
Posts: 29 |
Understand that this is old and has been suggested a million times before but I really want something like this. Its an absolute pain dealing with spaces. The only solution people come up with are dirty hacks and the only decent suggestion which is to use a dll no longer exists.
I don't see why this would be difficult to implement. I would be fine with echo and raw supporting binvars.
|
|
|
|
Joined: Apr 2004
Posts: 871
Hoopy frood
|
Hoopy frood
Joined: Apr 2004
Posts: 871 |
the only decent suggestion which is to use a dll no longer exists. While I don't disagree with your post in general, I actually do keep spaces.dll updated. You can always find the latest version at http://www.xise.nl/mirc/ .
Saturn, QuakeNet staff
|
|
|
|
Joined: Jul 2006
Posts: 4,180
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,180 |
The spaces problem can usually be worked around easily, the dll solution still exist, unsure why you say otherwise
As far as the suggestion is concerned, it's not about the difficulty of the implemtation, it's about being consistent, in the past, all commands could be called as identifiers, this functionnality was removed because it would allow users to easily get owned, by $quit for example. So bringing back the feature which was removed for 'security' reason would be a bit illogical. It can be argued that only the commands mentioned in the suggestion could be made as identifier, but I imagine you would quickly start seeing people suggesting others commands, and it wouldn't really make sense to accept one and not the others. Also keep in mind that if mIRC wasn't handling spaces the way it does, it would be a much bigger pain, you would have to use $trim everywhere and handle the removal of consecutives spaces yourself, you DO want mIRC to handle spaces the way it does 99% of the time, it's better that way.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Apr 2004
Posts: 871
Hoopy frood
|
Hoopy frood
Joined: Apr 2004
Posts: 871 |
Just as a constructive reply: my previous suggestion for doing this was to add a new command prefix, say ^, which does preserve spaces (as part of actual $n tokens) when tokenizing the command line. This would be backwards compatible, work with all commands, and, as far as I could tell, it would be fairly easy to implement.
Saturn, QuakeNet staff
|
|
|
|
Joined: Jul 2006
Posts: 4,180
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,180 |
You're only potentially breaking all custom aliases starting with ^ Seriously though, this would be a way, people in the past have suggested others ways, like a $space construct (which I personnally prefer): //echo -a a b $space c d $space e f which would display "a b c d e f" Another suggestion was a new directive, but I don't like it much because you can't use it with one liner: alias name {
#space
echo -a this support consecutives spaces etc
#space
echo -a this doesn't
} $space is really the best because you can alter the way mIRC parse the line directly within the line, allowing alternating between current tokenization and a new tokenization
Last edited by Wims; 14/08/15 09:28 AM.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Apr 2004
Posts: 871
Hoopy frood
|
Hoopy frood
Joined: Apr 2004
Posts: 871 |
Keep in mind this isn't about putting literal spaces into a script - it's about preserving spaces returned by identifiers or in variables. Edit: oh I see what you mean. Such a $space would be much harder to implement though, if possible at all. Right now, the command line parser first evaluates the line, and then tokenizes it. Support for $space would basically require the evaluation routine to provide feedback to its caller on the byte ranges that are to have their spaces preserved, which would then have to be taken into account by the tokenizer. This is somewhat messy and I'm not exactly sure what would be gained by such flexibility either. Then again I'd be happy with it anyhow of course.
Screw people who make custom aliases that start with a ^, though.
Last edited by Sat; 14/08/15 09:46 AM.
Saturn, QuakeNet staff
|
|
|
|
Joined: May 2010
Posts: 29
Ameglian cow
|
Ameglian cow
Joined: May 2010
Posts: 29 |
the only decent suggestion which is to use a dll no longer exists. While I don't disagree with your post in general, I actually do keep spaces.dll updated. You can always find the latest version at http://www.xise.nl/mirc/ . Ah yea, sorry forgot to update my reply there, did eventually find it and it works great (thanks!) just originally everywhere was linking to the now defunct mirc.net But yeah I understand that it may not be about difficulty now. Not sure how they would go about doing it but having a generic binvar accepting raw command to send serverside messages would be great. For built in commands ie, echo etc not sure how you would go about doing it. I dont mind the ^ prefix idea. Just feel like it really should have been addressed by now with a proper solution. Perhaps some form of string literal using backticks for maximum backwards compatability. Or go the javascript route and force some sentence (eg js's "use strict") at the top of the script which then enables the use of string literals? That I can forsee being a lot of work though. As an example:
use strict
alias echoMe {
echo -a "Hello This is a message"
}
Would then do what you expect.
|
|
|
|
Joined: Apr 2003
Posts: 342
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 342 |
One of the still pervasive weaknesses of mIRC script is the inability to preserve and output a sequential string of neighboring spaces. Over the years many strides have been made to allow working with sequential spaces (eg: /returnex) but the one major hurtle is doing anything to output or display strings that contain space pairs. The most serious problem I've encountered is when encountering a file with a name that starts, or contains sequential spaces. At one time it was possible to use $shortfn to obtain the 8.3 "old-skool" name since Windows always tried to preserve them. Formatting a drive as NTFS via Windows will no longer enable short filename support by default. And the ExFAT filesystem doesn't support short file names at all. I've always considered this a bug. It should have been corrected a long long time ago. I know that the consequences for existing scripts could potentially be enormous, but that's a short term problem. Despite living in the short term for most of my life, we all would have been happy in the end. I think the solution to this would be to fix the parsing engine to properly preserve spaces for /commands and /aliases and wherever else. But role it out slowly... so script developers could choose to enable it. For example: via a hidden menu option that would only appear in the "Tools" menu when the shift key is pressed.
Last edited by MeStinkBAD; 18/08/15 02:23 AM.
Beware of MeStinkBAD! He knows more than he actually does!
|
|
|
|
Joined: Jul 2006
Posts: 4,180
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,180 |
$space would be best as far as the scripter is concerned, the implemention details doesn't matter much, we're asking for the possibility to get our string intact in a scripting language, not the moon! Check out mestinkbad's post, you cannot workaround that problem, it's a serious thing although I guess you also screw people using consecutive/leading/trainling space in their filename ![wink wink](/images/graemlins/mirc/wink.gif) The flexibility is that we could get mIRC to use a mix of the old and the new tokenization method in one line, like I said we more than often want the old/current tokenization. Quotes would also achieve that flexibility, but it would break backward comp
Last edited by Wims; 18/08/15 07:57 AM.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
|