Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ How to prompt the user for information?
How to prompt the user for information?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Azrith
(15 posts) Bio
|
Date
| Sat 01 Feb 2003 04:15 AM (UTC) |
Message
| Hi,
I have been doing some coding and am working on making some new additions and I have run into a problem.
How in the world can I prompt the user to input a value. For instance when the character first joins it asks for their name class race etc. I am looking to do something very similar but can't figure out how they are prompting and waiting for the input. Any help would be greatly appreciated.
Azrith | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 01 Feb 2003 05:17 AM (UTC) |
Message
| Take a look at the "nanny" function in comm.c.
Basically the MUD maintains a "state" flag which is how far it has progressed through the initial questions, and then just "playing". You could add more states to the list, and then modify nanny to ask the appropriate questions. Here is the current list from mud.h ...
/*
* Connected state for a channel.
*/
typedef enum
{
CON_PLAYING, CON_GET_NAME, CON_GET_OLD_PASSWORD,
CON_CONFIRM_NEW_NAME, CON_GET_NEW_PASSWORD, CON_CONFIRM_NEW_PASSWORD,
CON_GET_NEW_SEX, CON_GET_NEW_CLASS, CON_READ_MOTD,
CON_GET_NEW_RACE, CON_GET_EMULATION, CON_EDITING,
CON_GET_WANT_RIPANSI, CON_TITLE, CON_PRESS_ENTER,
CON_WAIT_1, CON_WAIT_2, CON_WAIT_3,
CON_ACCEPTED, CON_GET_PKILL, CON_READ_IMOTD
} connection_types;
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Azrith
(15 posts) Bio
|
Date
| Reply #2 on Sat 01 Feb 2003 06:00 AM (UTC) |
Message
| Ya I did see that in nanny but what I was hoping to do was ask the questions later in the game when the user input a certain command such as buy home. Is this possible or am I going to have to resort to creating many commands?
Thanks!
Azrith | Top |
|
Posted by
| Meerclar
USA (733 posts) Bio
|
Date
| Reply #3 on Sat 01 Feb 2003 02:47 PM (UTC) |
Message
| For ingame functions of that nature you'll need to write a command specially for that function. |
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org | Top |
|
Posted by
| Azrith
(15 posts) Bio
|
Date
| Reply #4 on Sat 01 Feb 2003 05:05 PM (UTC) |
Message
| Hmmm. That is what I was afraid of. To me this is a great limitation for smaug. Reason being is it makes playing that much more difficult. Instead of just being able to prompt for information and have then enter I will now have to modify the buy command so that if they choose home it purchases a home. Then I will have to create another command such as design. I will then have to use the second or third argument to determine what they want to design plus they will have to enter their choice after that. Next thing I know Ive got a long command to do 1 thing.
Ex. design home name Azriths Home.
Ex. design home levels 4
Ex. design home desc Azriths newly built home.
vs having it prompt
What would you like the name of your new home to be?
How many levels would you like your home to be?
What would you like your description for your home to be?
The user is going to find themselves having to use help more often and more lengthly input. :) but I guess it will have to work out HEHEHE.
Thanks for all the help guys.
Azrith | Top |
|
Posted by
| Meerclar
USA (733 posts) Bio
|
Date
| Reply #5 on Sat 01 Feb 2003 05:35 PM (UTC) |
Message
| Actually, I'd recommend not even letting players directly purchase houses from merchants. I've never played or worked on a MUD where that idea was successfully added and the players didn't go absolutely stupid over it. I'd advise requiring the morts that want houses that badly to deal with your builder staff to get the housing done. I advise this for a number of reasons, not the least of which is the sheer insanity of recoding the olc to allow players access to building commands without giving them the ability to edit areas thruout the mud. If you have to have this functionality, I'd advise a codebase other than SMAUG to attempt it with, probably something seriously modified from a MUSH codebase which normally offers players the ability to add such things as their own rooms. |
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #6 on Sat 01 Feb 2003 10:31 PM (UTC) |
Message
|
Quote:
vs having it prompt
What would you like the name of your new home to be?
How many levels would you like your home to be?
What would you like your description for your home to be?
The user is going to find themselves having to use help more often and more lengthly input. :) but I guess it will have to work out HEHEHE.
This is a fundamental problem with implementing interactive client-server systems. It is not a limitation of SMAUG specifically.
For example, what happens if the player is at the prompt:
"What would you like your description for your home to be?"
... when they realise they meant to enter 3 levels rather than 2? How do they go back to re-enter the previous answer? Enter GOBACK? What if they decide to cancel buying the house? Do they enter CANCEL? What if a mob attacks them half-way through? Do they enter KILL? What if someone pages them while they are in the buying process?
In the end, to cater for all these situations the prompting approach isn' t that simple after all. It might look like this ...
What would you like your description for your home to be?
To cancel, enter CANCEL.
To re-enter your previous response, enter GOBACK.
To reply to a page, enter REPLY.
To flee from an attack, enter FLEE.
etc.
This is why most MUDs have one-line commands, and do not get involved in interactive responses, the one exception being when you initially connect, or make a new character, which is before you are officially playing, and thus those considerations do not really apply.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
19,090 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top