Prompt changing and a few other things.
Posted by Mozzy
on Sat 18 Oct 2003 09:27 PM
— 9 posts, 28,515 views.
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
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.
Hi, thanks - something else though
How exactly do I violence_update to slowly deduct? Dont really know.
Cheers - Mozz
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.
Any idea on where abouts that snippet is? IF you do - that'd be great. Ill have a look myself though. ^_^
- Moz
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
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!
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.
Dont worry! I got it all working out now. Thanks for help. ^_^
- Mozz