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


Joined: 05 Nov 2001
Posts: 12
Location: United Kingdom

PostPosted: Thu Jun 06, 2002 11:56 am   

setup
 
Ok I'm working on a class/race/start city setup. what I want to be able to do is, for the user to type setupand be given a list of options and then for Zmud to wait untill 1 of the options is given.


>setup

What race are you playing?
1)Elf
2)Drow
3)Sprite
ect

Please choose your race.(1-9)

**I know all of the above is echos. It's just this bit at the end I'm having problems with. I want it to sit and wait until a number from 1 to 9 is entered and on a incorect entry to jump back into the loop.**

Any help would be great.

~(,,,,)'>
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Jun 06, 2002 12:30 pm   
 
I don't really understand much what you are trying to do here. You say you want to do all of this in your side? That is, the list of options is presented to you, and you are the one that makes a selection? If so, you might want to look into #ONINPUT triggers that match based on what is entered in the command line.

Kjata
Reply with quote
NiteTrip
Novice


Joined: 21 May 2002
Posts: 40
Location: Canada

PostPosted: Thu Jun 06, 2002 9:22 pm   
 
You could also look into pick lists and such, to make a nice user interface
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jun 07, 2002 12:13 am   
 
quote:

Ok I'm working on a class/race/start city setup. what I want to be able to do is, for the user to type setupand be given a list of options and then for Zmud to wait untill 1 of the options is given.


>setup

What race are you playing?
1)Elf
2)Drow
3)Sprite
ect

Please choose your race.(1-9)

**I know all of the above is echos. It's just this bit at the end I'm having problems with. I want it to sit and wait until a number from 1 to 9 is entered and on a incorect entry to jump back into the loop.**

Any help would be great.

~(,,,,)'>



First, drop all your menu text into an alias:



#ALIAS ShowMenu {
;check validity of parameter
#IF (%null(%1)) {
;no parameter, so throw up an error
#say Menu not specified, ending process
} {
;parameter found, verify
#if (%ismember(%1,@menulist)) {
;valid
#case %ismember(%1,@menulist) {
1st menu stuff
#VAR menu menu-name
} {
2nd menu stuff
#VAR menu menu-name
} {etc}
} {
;invalid, show error
#SAY '%1' is not a valid menu, ending process
}
}


Be sure to set up the @Menulist variable so that the menu names match up with the order of the menus as they appear.

Next, create the #ONINPUT trigger:



#ONINPUT {(*)} {
#if (%isnumber(%1)) {
;it's a number, verify choice
#if (%1 >= 1 or %1 <= highval) {
;is a valid choice
#case %ismember(@menu,@menulist) {do menu stuff} {etc}
} {
;not valid
#SAY '%1' is not a valid option, please try again
ShowMenu @menu
}
} {
;not a number, so reissue menu
#SAY '%1' is not a valid option, please try again
ShowMenu @menu
}
}


There's a lot of error-check code in there, so it looks a lot harder than it really is. AS ALWAYS, consider this untested.

li'l shmoe of Dragon's Gate MUD
Reply with quote
bdragon125
Beginner


Joined: 05 Nov 2001
Posts: 12
Location: United Kingdom

PostPosted: Sun Jun 16, 2002 7:46 pm   
 
Thanks peeps you've been a great help.

BD

~(,,,,)'>
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