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
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Fri Aug 20, 2004 4:42 pm   

Is there a way to create d-quote (") chars in final set
 
First off, this works as-is.

I would like to quote the variable value in the assignment line in the final setting just for anality's sake. Twisted Evil Is there a way to do it? I've tried everything I can think of to retain double quote chars through two levels of evaluation/expansion, but I'm having no luck. Oh, the reason for this code is to create a new menu item by selecting 'ADD Container' from the button menu it resides in.

First the alias. It works but could probably be shortened by combining some of the elements.

#ALIAS create_new_menu_item {#PROMPT New_Container "What container do you want to add?";#WHILE (@New_Container = "") {};#IF (@New_Container != "") {#VAR New_Container %concat( "#MENU", " ", ~{, ~", @New_Container, ~", ~}, " ", ~{, "Practice_Status=", ~", "NO", ~", ~;, "#IF", " ", ~(, ~", ~@, "dummyToggle", ~", " = 1", ~), " {Start_Container=", ~", @New_Container, ~", ~;, "GEN:Materials_Container=", ~", @New_Container, ~", ~}, " ", ~{, "#IF", " ", ~(, ~", ~@, "dummyToggle", ~", " = 2", ~), " ", ~{, "Current_Container=", ~", @New_Container, ~", ~;, "GEN:Forge_Container=", ~", @New_Container, ~", ~}, " ", ~{, ~}, ~}, ~}, " ", ~", "Containers_Menu", ~", " ", ~", ~");#EXEC @New_Container;GEN:} {#VAR New_Container ""}}

>New_Container="dirty cloth sack";create_new_menu_item

Creates the following variable:

#VAR New_Container {#MENU {"dirty cloth sack"} {Practice_Status="NO";#IF ("@dummyToggle" = 1) {Start_Container="dirty cloth sack";GEN:Materials_Container="dirty cloth sack"} {#IF ("@dummyToggle" = 2) {Current_Container="dirty cloth sack";GEN:Forge_Container="dirty cloth sack"} {}}} "Containers_Menu" ""} {}

#EXEC @New_Container creates this menu item:

#MENU {dirty cloth sack} {
    Practice_Status=NO
        #IF (@dummyToggle = 1) {
            Start_Container=dirty cloth sack
            GEN:Materials_Container=dirty cloth sack
            } {
            #IF (@dummyToggle = 2) {
                Current_Container=dirty cloth sack
                GEN:Forge_Container=dirty cloth sack
                } {}
            }
        } ""


What I'd like to see is this:

#MENU {"dirty cloth sack"} {
    Practice_Status=
"NO"
        #IF (@dummyToggle = 1) {
            Start_Container=
"dirty cloth sack"
            GEN:Materials_Container=
"dirty cloth sack"
            } {
            #IF (@dummyToggle = 2) {
                Current_Container=
"dirty cloth sack"
                GEN:Forge_Container=
"dirty cloth sack"
                } {}
            }
        } ""


Is this possible? If so, how?
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Aug 21, 2004 2:07 pm   
 
Try using %char(34) in place of the ". I didn't test with your full-blown script, but I did test it in a single variable as follows:
Quote:

test="%char(34)testing%char(34)"
#SH @test
produced:
"testing"

Is this what you need?
_________________
.geniusclown
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Sat Aug 21, 2004 5:45 pm   
 
I tried several variations using %char(34). I didn't have any luck, but thanks for the suggestion! Wink
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Aug 21, 2004 6:22 pm   
 
So, I'm playing around with the #MENU command (never had before), and used your script (not the one generated by the alias, but what you said you want it to create).... What I notice is that even though the quotes are stripped in the speed menu, they're present in the Settings! Based on this, my guess is that even if you can maintain the double-quotes through several parses, I don't think it would accomplish what you ultimately want.
_________________
.geniusclown
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Sat Aug 21, 2004 7:43 pm   
 
Post what you ended up with? I don't care about quotes showing when viewing the menu items.

I can't get quotes to show up in the final menu setting. They show up in the variable before the #EXEC command, but once the menu item is created, no quotes.

I'm interested in how you did it.

Note: The #MENU command seems to be very busy. Once I get more than about five items in a menu button, the window refreshes (flickers) are really annoying. Have you noticed flickering at all? I'm thinking of adding that to the bug tracker.

If I didn't have the button in a window that is hidden until needed, it would be near unsuable with all that flicker.
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Sat Aug 21, 2004 8:26 pm   
 
I copied and pasted into the command:
Quote:
#MENU {"dirty cloth sack"} {
Practice_Status="NO"
#IF (@dummyToggle = 1) {
Start_Container="dirty cloth sack"
GEN:Materials_Container="dirty cloth sack"
} {
#IF (@dummyToggle = 2) {
Current_Container="dirty cloth sack"
GEN:Forge_Container="dirty cloth sack"
} {}
}
} ""

Which created the speed menu item "dirty cloth sack"... when I selected the object in the Settings editor, the quotes were present, but when I right-clicked in the game window, the label had the quotes stripped. Note that I did not use the alias to create the menu via a variable.

Playing around, and digging through the help docs, I found that the %expand function will do what you want. In the create_new_menu_item alias, replace "#EXEC @New_Container" with "#EXEC %expand(@New_Container,-2)", which will expand the variables without stripping the quotes.
_________________
.geniusclown
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Wed Aug 25, 2004 2:59 pm   
 
You could also try %literal("). No idea if it works though.
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