Heya,
Thanks for the reply - The 'My Home' page didn't show there was a new post - hmpf!
I'll quotify your examples. However, keep in mind that I'm bending the rules a bit with the "if it only accepts/returns one parameter, you don't need quotes" bit. This is entirely for user convenience a la the "/me does something" thing, as opposed to '/me "does something"', which would be annoying indeed.
set %blub blah blahThere's two parameters, but the first parameter can never have spaces anyway - variable names cannot contain spaces. So the above should already work.
echo set %blub blah blahAs you mentioned - indeed, this is a command with a single parameter (and optional flags). So, the above should work as is as well.
$iif($?,echo,set) %blub blah blahThis shouldn't require modification either.
There's three bits to the $iif
- the comparison, which is separate, and I think I illustrated in my post
- the value to return if true - note: value, not values. -unless- this value contains a comma, you wouldn't necessarily need to put quotes around it
- the value to return if false - same as above
The rest of the line is just the parameters passed to echo / set, namely either a single parameter - or two parameters, the variable, and then the rest.
You might thing that problems here begin to creep up if you were to do something like this:
echo $iif($?,$me rules!,$me sucks!)Would it still echo <your nickname> rules!|sucks! ?
MaxScript doesn't have a construct such as $iif, so I can't draw a direct comparison (nor would I always want to).
However, I would imagine it would have to be re-formulated as such :
echo $iif($?,$me + " rules!",$me + " sucks!")However, if you were to do in-place replacement of variables, much like say NSIS, you would simply keep things as they were.
Or, if you wanted to type strongly:
echo $iif($?,"$me rules!","$me sucks!")Note that in-place replacement would also facilitate things like:
/say Hi, $nick!Without the need for the $+
However, that would probably be a far greater change to a parser.
hadd -m somehash command $iif($?,echo,set) %blub blah blahAgain, should already work
Just to deconstruct... you've essentially got this:
var %func = $iif($?,echo,set)
var %cmd = %func %blub blah blah
hadd -m somehash command %cmd
No quoting necessary, that I can tell. But let's say I wasn't bending the rule a bit for convenience. Then it woud be...
var %func = $iif($?,"echo","set")
var %cmd = %func + "%blub blah blah"
hadd -m somehash command %cmd
What if you don't want to literally store %blub, but the value thereof ? Well, this :
var %cmd = %func + " " + %blub + " blah blah"( Again, in-place replacement would simplify the above - it'd just be : var %cmd = "%func %blub blah blah". However, what if you then -did- want the literal %blub ? You'd have to escape the % sign, probably. Cost/Benefit
![wink wink](/images/graemlins/mirc/wink.gif)
)
I'm not too actively trying to lay out rules, by the way - I just think it can be done. Quoting strings can already be done - other languages show this. Making convenience exceptions should also be doable, and I think the "1 parameter" decision lends itself best to this.
The real breaker would be if there is a command that accepts multile parameters, that can -also- have spaces in them. I don't think any exist - that would basically be a command a la :
/hw Mostly Water Gnat SwattingWhich acccepts two parameters, each consisting of a string with exactly 1 space in them (i.e. 2 words) - no more, no less (at least no less for the first parameter).
The output of said function being:
Hello world of Mostly Water. Welcome your Gnat Swatting overlords!So if you were to have such a command, then yes.. you would still be forced to do this instead:
/hw "Mostly Water" "Gnat Swatting"Which I think is probably a Good Thing(tm)
Also, again, the end-decision is entirely up to Khaled
![smile smile](/images/graemlins/mirc/smile.gif)
For all I know the changes would be far more extensive than I can imagine, and he would rather just drop mIRC script altogether and implement Python, or interface with the WSH.
By all means, though, keep coming up with possible breakers - if nothing else, it'll make me use my brain some more
![laugh laugh](/images/graemlins/mirc/laugh.gif)
Happy Holidays, everybody!