Register forum user name Search FAQ

Gammon Forum

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 ➜ prompt

prompt

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Frobozz   (75 posts)  Bio
Date Mon 22 Nov 2004 04:08 PM (UTC)
Message
Question:

I found the code for display_prompt and default_prompt and do_prompt, however, I am unable to figure out how to do or achieve the following:

Keep the prompt (not fprompt) from spamming each time some form of input reaches the char. Ideally I want the prompt to look like this:

> sayto frobozz You are a newbie coder
You say to Frobozz "You are a newbie coder"
Frobozz says, "I am not!"
Frobozz says, "I swear"
> sayto frobozz "hah"

Where now the code makes it look like this:

<hp/hp sp/sp mp/mp> sayto frobozz You are a newbie coder
You say to Frobozz "You are a newbie coder"
<hp/hp sp/sp mp/mp>
Frobozz says, "I am not!"
<hp/hp sp/sp mp/mp>
Frobozz says, "I swear"
<hp/hp sp/sp mp/mp> sayto frobozz "hah"

So I guess my question is how do I set the default prompt to ">" and keep the prompt from spamming unless the player enters a command or return?

Thank you again.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Mon 22 Nov 2004 05:43 PM (UTC)
Message
You can't really do what you want, because that would require the program to know when the user is going to type in a command. If you think about it,
> sayto frobozz You are a newbie coder
You say to Frobozz "You are a newbie coder"
Frobozz says, "I am not!"
Frobozz says, "I swear"
(how do you know it's time to print out '>'?)
> sayto frobozz "hah"
The answer is that you don't and I believe you can't. That's why SMAUG prints out the prompt after every 'block' of output.

As for setting the default prompt, that should be as simple a matter as just changing the default_prompt function, right? I don't remember what it looks like off the top of my head but it should be in there.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Frobozz   (75 posts)  Bio
Date Reply #2 on Tue 23 Nov 2004 08:58 PM (UTC)
Message
By editing the default_prompt, display_prompt and "bust a prompt" I was able to get the desired results.

Anyone else looking to do the same can look there!
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Tue 23 Nov 2004 09:21 PM (UTC)
Message
Could you explain how you manage to display a prompt only when the user is about to type in a command?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Tinkle   (2 posts)  Bio
Date Reply #4 on Sun 27 Feb 2005 08:58 AM (UTC)
Message
You could only display a full prompt under certain circumstances, such as
1. A certain amount of time (i.e. 4 seconds) has elapsed since the last time that user was sent a full prompt.
2. A certain amount of text (i.e. 20 lines) have been sent since the last full prompt.
3. The user has sent a line of input.

That would have pretty much the same affect.

Im too new to know how to code it, but adding a few variables to the character and changing the prompt function should be sufficient.
Top

Posted by Gatewaysysop2   USA  (146 posts)  Bio
Date Reply #5 on Sun 27 Feb 2005 08:53 PM (UTC)
Message
Are people to understand from the lack of response that they're supposed to offer what they know in order to answer your question, but when you stumble upon the answer yourself, the rest of us are aren't worth sharing it with? I sincerely hope not, because that'd be rather selfish.

It would seem like common courtesy to give a bit more info on this, especially since someone else already made the request. To be quite honest, if I figured out how to code something that people claimed to be impossible, I would surely post and brag. But hey, that's just me.

"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence
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,286 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.