Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
MrCheviot
Novice


Joined: 02 Dec 2007
Posts: 42

PostPosted: 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
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: 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
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
MrCheviot
Novice


Joined: 02 Dec 2007
Posts: 42

PostPosted: 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
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: 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
Reply with quote
MrCheviot
Novice


Joined: 02 Dec 2007
Posts: 42

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net