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
fireangel37
Beginner


Joined: 09 Jan 2004
Posts: 17

PostPosted: Thu Mar 25, 2004 5:38 pm   

Help with writing a wizard
 
I'm trying to write a flexible wizard for creating an alias on a MUD I'm on. Because the MUD uses LP color triggers, I need to do some substitution of things.

At the end of the day, I want the command sent to be something like this for one case:

#alias {$2} {say "%^"$3"%^"%1}

This for another case:

#alias #alias {$2} {say "%^"$3"%^""%^"$4"%^"%1}

And this for another case:

#alias {$2} {say "%^"$3"%^""%^"$4"%^""%^"$6"%^"%1}

Obviously I don't know what I'm doing with this, and would appreciate any help.
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Fri Mar 26, 2004 1:54 am   
 
Trying to read your mind here...

What are $3, %1, $4, $6, %2 supposed to represent? Wink
Reply with quote
fireangel37
Beginner


Joined: 09 Jan 2004
Posts: 17

PostPosted: Fri Mar 26, 2004 2:30 pm   
 
Various text items. After a lot of head slamming, I did figure out how to get everything to work proplerly. The trick was to make good use of the CommandN and NextN functions. The only thing that disappoints me about the wizard process is that it has to be a linear set of option windows (as far as I know). For instance:

Param1=What color do you want your text to be in?
Type1=list:%^RED%^|%^WHITE%^
Command1=#alias csay {~say $1 %-1}
Param2=Would you like to prepend your name to the text?
Type2=radio:Yes|No
Next2=%if("$2"=1,-1,0)
Param3=Enter your name:
Type3=string
Convert3=%concat("$3","$2")
Command3=#alias csay {~say $3 %-1}
Param4=Would you like to append your name to the text?
Type4=radio:Yes|No
Next4=%if("$4"=1,-1,0)
Param5=Enter your name:
Type5=string
Convert5=%concat("$3","$5")
Command5=#alias csay {~say $5 %-1}

What concerns me is that, with this code, I can't append but not prepend (ignore the fact that it's a contrived example). I can prepend but not append, of course, but not the other order (well, it could be done in this code, but in general it doesn't appear to be possible). Would returning a non-0 or -1 answer to NextN function like a goto? Or is there something vastly important that I'm missing.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Mar 27, 2004 12:44 am   
 
You got it exactly. NextN is meant to be used as a GOTO. In fact your current usage of -1 and 0 is considered incorrect. I just reread the document on wizard creation and saw those in there. Funny I can't remember ever seeing that before.
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