|
MrCheviot Novice
Joined: 02 Dec 2007 Posts: 42
|
Posted: Mon Dec 03, 2007 12:01 am
#PICK, #YESNO - Displaying options with a colon ":" in them |
Here's the problem:
#va picklist {p:Pick from List|o:1|Item_Without_Colon:Do_Something|Item:With_Colon:Do_Something_Else}
#pick {@picklist}
So obviously, the item "Item:With_Colon" is the problem. I've tried surrounding it in single/double quotes, using %char(58), putting the string inside %string() and %literal().. is there anyway to do this? Would be nice if it worked for the execution command as well, since the item selected may have a colon in it, which is then sent on to another command.
Thanks in advance,
-MrC |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Dec 03, 2007 11:37 am |
What about putting a tilde (~) before the colon? That causes the parser to ignore it.
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Dec 03, 2007 7:08 pm |
I tried that in my own tests and it didn't work. I'm not sure there's much that can be done about about this. I tried it with %concat with the same results.
Zugg as a side note this holds true in CMUD as well. Since this is essentially trying to against the parsing issue, I don't think it's really a bug.
Mr. Cheviot, as a work around, maybe you can translate it to another character for display purposes using %subchar(). |
|
_________________ Asati di tempari! |
|
|
|
MrCheviot Novice
Joined: 02 Dec 2007 Posts: 42
|
Posted: Mon Dec 03, 2007 8:22 pm |
I was just about to post that I had no luck w/ the ~ option either. It seems to be internal to the #PICK routine, so it's not a bug really, just an inflexibility of ZMUD.
Currently, it's not just for display purposes. If I have "Item:WithColon" as the display, when it's selected I want the script to execute "someAlias Item:WithColon" - this means the list def for this particular item is
"...|Item:WithColon:someAlias Item:WithColon|..."
which I'd like to behave like
"...|{Item:WithColon}:{someAlias Item:WithColon}|..."
but currently shows "Item" and tries to exec "WithColon" and ignores the rest..
Re: the %subchar idea, I guess I could try to implement that on both sides, i.e. pre- @picklist and then on the argument passed to 'someAlias'
Hoping there's another way though. Thanks for the ideas,
-MrC |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Dec 03, 2007 11:35 pm |
I also can't come up with any other idea than subchar'ing both sides.
Sorry we couldn't help more. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
MrCheviot Novice
Joined: 02 Dec 2007 Posts: 42
|
Posted: Tue Dec 04, 2007 12:02 am |
No worries - work around and move on, right?
Just made two functions:
#va prePick {%subchar(%-1,":","!")}
#va postPick {%subchar(%-1,"!",":")}
And modified the list creation routine (it's in a loop):
#va picklist %additem(%concat(@prePick(%i),":someAlias ",@prePick(%i)))
And then in someAlias do the opposite:
#va picked @postPick(%-1)
I suppose ; would have been a better/closer replacement, but using ";" when going between aliases/functions can lead to some headaches I've found.
Thanks again,
-MrC |
|
|
|
|
|