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 changing and a few other things.

Prompt changing and a few other things.

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


Posted by Mozzy   (19 posts)  Bio
Date Sat 18 Oct 2003 09:27 PM (UTC)
Message
Hey all -

Yeah, I been still going on the MUD, and it's not looking to bad. What I need an answer to though, is how you create two seperate prompts? Like - I want one where you're just walking around, but then I want a different one when you're in battle. How can this be done? Also, ontop of that - in the battle prompt, I need minor HP to be taken off every round, even if no damage is applied. How can I do this?

Next, is when I log into the MUD - every 15 secs or so, for some reason, I fall asleep and I have to wake up. I just sleep automatically. Whats with this?

Oo, and one more thing. How do I change the colour of the messages at the end? Like take the red out of '$n is DEAD!"

Thats about all. Help would be greatly appreciated. ^_^

- Mozzy
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Sat 18 Oct 2003 09:37 PM (UTC)
Message
To create two separate prompts, you would have to add a new variable to the pc_data structure, and make sure that you save/load it properly (in save.c I believe.) Then, edit display_prompt (comm.c I think) to load the prompt for normal or for fighting, depending on whether or not the character is fighting. You'll have to extend the prompt command as well to allow setting of the different prompts.

You can edit violence_update to deduct HP slowly from everybody in a fight. Note that this might have slightly undesired effects.

If you're randomly falling asleep, you may have a messed up mental state. This happens if you eat corpses and stuff (I'm assuming you're an imm.) To fix, type: mset self mental 0 or something. Out of curiosity, check your mstate (using mstat or score) and see what you get.

The message colors for that stuff should be in fight.c, in the damage_message function.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Mozzy   (19 posts)  Bio
Date Reply #2 on Sun 19 Oct 2003 02:36 AM (UTC)
Message
Hi, thanks - something else though

How exactly do I violence_update to slowly deduct? Dont really know.

Cheers - Mozz
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #3 on Sun 19 Oct 2003 08:14 AM (UTC)
Message
There is a snippet out there that adds a coupld options into the normal prompt that allow you to have an enemies remaining HP in a bar-style or in a percentage, based on the "is slightly scratched" style message. It can sit in your prompt, but only displays when your in battle. This could easily be adapted to whatever you needed without having to add another variable to your character structures.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Mozzy   (19 posts)  Bio
Date Reply #4 on Sun 19 Oct 2003 08:49 PM (UTC)
Message
Any idea on where abouts that snippet is? IF you do - that'd be great. Ill have a look myself though. ^_^

- Moz
Top

Posted by Mozzy   (19 posts)  Bio
Date Reply #5 on Sun 19 Oct 2003 11:43 PM (UTC)
Message
Okay, found a snippet, trying to get it to work... Just curious though, on a few other snippets - the instructions say 'patch' <certain file>. How do I patch it?

Also, my bigger problem, I am trying to put in a snippet for boards, and came with this error;

boards.c: In function 'do_bset':
boards.c:1886: 'arg' undeclared (first use in this function)
boards.c:1886: (Each undeclared identifier is reported only once for each function it appears in.)
boards.c: In function 'chk_unread':
boards.c:2034: structure has no member named 'time'
make[1]: *** [boards.o] Error 1]


As far as I can tell, it is having a problem dealing with the piece of code; as it is line 1886

if ( !str_cmp( arg, "check") )
{
chk_unread( ch );
return;
}


I think it's in the right place and everything.. Anyone tell me whats wrong? How I declare it and such?
Also, line 2034 is
if ( newnote->time > ch->pcdata->last_read )
unread += 1;
So yeah, any help would be great!

- Mozzy
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #6 on Mon 20 Oct 2003 02:22 PM (UTC)
Message
Make sure that this (or something like it) is in the variable defines at the top of the function:

char arg[MAX_STRING_LENGTH];

That would take care of the definition and thus that error would be fixed.

Next, not sure which struct, but it looks like you need to add a new permanent variable to a data struct. To find which one, look at the top of the function chk_unread and see what newnote.

Its probably something similar to this:
NOTE_DATA *newnote;

If thats the case, go into mud.h or where ever the note_data struct is and at the bottom of it, before the closing curly bracket }; add in:

int time;

Now, the int might not be right, I'm not sure what you would define time as, and I can't look at my source right now, but I'm sure Nick or one of the more experienced coders will come and correct me if I'm wrong.

As for your patching problems, I've got no clue.

Hope I helped some. Good luck!

~Nick Cash
http://www.nick-cash.com
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #7 on Mon 20 Oct 2003 04:22 PM (UTC)
Message
Declaring the new argument variable won't do anything unless you actually put something in it.

Throwing in the new variable is also an unsafe thing to do, but, well, hey. :) Seems that your snippet is either for a different version of SMAUG, or already has extensions built into it other than the snippet itself.

Can you post the beginning, say, 50 lines of do_bset please? Or more, if you can.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Mozzy   (19 posts)  Bio
Date Reply #8 on Mon 20 Oct 2003 09:06 PM (UTC)
Message
Dont worry! I got it all working out now. Thanks for help. ^_^

- Mozz
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.


26,896 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.