 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23381 Location: Colorado, USA
|
Posted: Wed Feb 27, 2008 9:02 pm
Should %-1 be changed on handling quotes? |
This is related to a post a few weeks ago by someone who was trying to use an alias like this:
#alias s {say %-1}
and then typing:
s "hello world"
In CMUD, the " quotes are stripped when the argument is passed to the alias. Now, it makes correct sense that %1 should have the value "hello world" without the quotes. This is how all other programming languages work with arguments to methods (which is what an alias really is).
But when using %-1, the user obviously wants all of the arguments to be returned, and probably wants all of the arguments exactly as typed (with quotes, parenthesis, etc). The concept of %-1 is pretty unique to CMUD/zMUD and doesn't have any analog in other programming languages. So perhaps CMUD should be changed so that %-1 (and %-2, etc) retains the exact text that was typed, rather than using the "parsed" text.
As another example of what this would change, imagine the above alias used like this:
s (whatever+yeah)
With this change, it would send "say (whatever+yeah)" to the MUD instead of the current "say whateveryeah". Anyway, something to think about and discuss. |
|
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Wed Feb 27, 2008 9:13 pm |
I've had troubles related to this in zMUD, using %-1 for chatting on clan channels, and having to use ~ for certain special characters but never really knowing if the text would come through the way I want or not. I, for one, would welcome this change. 
|
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Feb 27, 2008 10:50 pm |
I definitely think that having the option of not stripping special characters will make people very happy indeed. One question, though:
s "hello world" "hello world" "hello world"
I reckon that %-2 should contain "hello world" "hello world" in this case (since it means "everything except the first parameter"). Is this how you'd see it working? |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23381 Location: Colorado, USA
|
Posted: Wed Feb 27, 2008 11:35 pm |
Yes, exactly right Fang.
|
|
|
|
 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Thu Feb 28, 2008 12:00 am |
Sounds like a good change
|
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Thu Feb 28, 2008 12:42 am |
I would have to agree as well. It is rather easy to strip out unwanted items. It is impossible to add symbols to the text that will exaclty match user inputs all the time.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
JQuilici Adept
Joined: 21 Sep 2005 Posts: 250 Location: Austin, TX
|
Posted: Thu Feb 28, 2008 12:48 am |
I agree - this would be a good change.
|
|
_________________ Come visit Mozart Mud...and tell an imm that Aerith sent you! |
|
|
 |
Troublemag Wanderer
Joined: 14 Jul 2004 Posts: 83
|
Posted: Thu Feb 28, 2008 1:39 am |
Oh, please yes! And thank you!
|
|
_________________ CMUDPro 3.22 |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Thu Feb 28, 2008 5:07 am |
Yes, that sounds like a nice change to me as well.
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
cuprohastes Wanderer
Joined: 22 Oct 2006 Posts: 92
|
Posted: Thu Feb 28, 2008 7:08 am |
Actually, I'd been thinking about it and I'd thought of a couple of different ways you could handle the situation;
You could have a bar for sending commands, and a bar for normal muck activity - talking, posing, aliases etc... or an auto-say toggle so you could flip it on and it'd treat everything as thought you'd put `. But then how would you use an alias or macro?
Then I thought "Hey what if you inverted the situation?" - I mean, using scripts and so on has to be the lesser used option to simply chatting, paging, posing and so on right? So what if you used ` to say to CMud "Parse this" instead of "Send this as a literal". But there again, it'd need a huge re-write, and again, you'd have problems with aliases...
Then I thought how much I'd like some cheesecake. That was nice.
But I like this even better. If I recall I actually tried to do this with the scripting at one point and took an hour or two of sticking things into variables and calling them back before totally losing the plot... I tried the same thing with the Snarl notifier script. I wanted to send an incoming string to the Snarl notification program, but only the first word would be sent.
Which reminds me, I need to make a couple of feature requests at some point, regarding out-of-focus notifications and being able to turn off the taskbar icon notification per window/adding event exceptions. |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Feb 28, 2008 11:21 am |
| cuprohastes wrote: |
| being able to turn off the taskbar icon notification per window |
At the risk of derailing (though I get the impression that this change is universally approved) - this is already on the todo list. |
|
|
|
 |
cuprohastes Wanderer
Joined: 22 Oct 2006 Posts: 92
|
Posted: Thu Feb 28, 2008 11:32 am |
I'm waiting for the next RC and slew of bugfixes before I leap in with my +10 to niggling details list of feature requests. Just in case some of them get added in or made irrelevant.
|
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23381 Location: Colorado, USA
|
Posted: Thu Feb 28, 2008 6:24 pm |
cuprohastes: You can already use Ctrl-R to toggle the command line parsing off and on. Also, you can open an Editor window and turn off it's separate Parse option and use that for sending regular chat text if you want. You can also create some simply #ONINPUT triggers to handle how the command line is handled (essentially overrides the parsing). Also, your assumptions about people using scripting being the minority is incorrect. The vast majority of users use aliases, which is part of the command line parsing.
Also, it never hurts to create a new post and add your suggestions and feature requests. If they are simple and easy, then it's sometimes easier for me to add them when I'm working on bug fixes. It depends a lot on what the suggestions are. For example, I'm pretty much ignoring any mapper improvement suggestions right now and waiting until I start rewriting the mapper. But I'm right in the middle of the Settings Editor rewrite, so suggestions about that might be quick and easy to add right now.
Anyway, back to the topic at hand. It looks like it's pretty unanimous already. Now I'll just have to figure out how I'll implement this ;) So this probably isn't going to be implemented in the first release next week, but I'll start thinking about how I can do it in the future. |
|
|
|
 |
cuprohastes Wanderer
Joined: 22 Oct 2006 Posts: 92
|
Posted: Thu Feb 28, 2008 6:46 pm |
The problem is, I switch between aliases and simple say/pose so much that it's not practical to keep toggling the parsing on and off.
I might try the editor window though, I supect it'll drive me nuts if I have more than one world open. |
|
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sat Mar 01, 2008 4:23 pm |
To get back on subject here, yes Zugg, make the change. I've always thought that should be proper functionality.
|
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
|
|
|