Bespoke Prompt

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
4 months 4 weeks ago #7987 by WhiskyTest
Bespoke Prompt was created by WhiskyTest
Bespoke Prompt allows players to create a personalized prompt. There are a few 'custom' prompt snippets from the Circlemud days floating around, so I went for 'bespoke'.

I borrowed heavily from original LexiMUD source.

It dispenses with, but does not remove, the DISP_HIT, DISP_MANA, etc. toggles. Removing them is unnecessary and would corrupt all players currently set preferences. Better to just reuse them for other purposes when needed.

The display command is used to set a pre-made prompt to make things quick for those who aren't that bothered about the prompt, and the implementer can add their own.

The prompt command will accept a string of characters such as %h %m %v for hitpoints, mana, move and so on.
Color codes are also accepted and changes to comm.c have been made to allow colors in prompt. (Probably the most interesting change)

The easily expandable list of values are:
%h %H %ph , current health, max health, health as a percentage
%m %M %pm , as above for mana points
%v %V %pv , as above for movement points
%g %G , gold on hand, gold in bank
%q, quest points
%x %X , current exp, exp till next level
%% , a percent sign
%_ , a newline
%O, opponents name and condition
%T, tanks name and condition
(tank = whoever your opponent is fighting if it isn't yourself)


Please share any improvements and bug fixes you come across!
Attachments:

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago #7991 by Sascha
Replied by Sascha on topic Bespoke Prompt
Interesting. Thanks!

Dovie'andi se tovya sagain. After the Breaking MUD, now in beta testing...

Please Log in or Create an account to join the conversation.

More
4 months 3 weeks ago #7995 by Sascha
Replied by Sascha on topic Bespoke Prompt
So first off, this is cool. Let me repeat. THIS. IS. COOL. There are a few things to it that are a little tricky and may need clarification or refinement. We've been joyfully testing this all day long over at ATB. :)

I mailed Whisky over at my game but here are some small things found so far:

1) Something about typing 'prompt' without an argument is not quite working. If you know to type 'display' the menu will come up, but otherwise you're on your own.

2) The tank display seems to display whomever is not the group leader, even if the group leader is actually tanking.

3) Could a prompt that is imm-level defined be added to show zone number and room vnum?

We love this over at ATB. It's a winner!

Dovie'andi se tovya sagain. After the Breaking MUD, now in beta testing...

Please Log in or Create an account to join the conversation.

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
4 months 3 weeks ago #7997 by WhiskyTest
Replied by WhiskyTest on topic Bespoke Prompt
Glad it is of use :)

1). Yeah sorry, I need to work on including clearer instructions!

do_prompt() is used to manually set a prompt, for those that want to string together their own customizations.
Without an argument, do_prompt() should simply return the string that is currently set, or "n/a" if nothing has been set. It may be worth changing the "n/a" to something like "not set - see HELP DISPLAY" ?

Which segues to the missing help information :)
PROMPT

Usage: prompt <string>

Manually set a custom prompt. <string> can be made up from the following values:

%h - current hitpoints          %H - Max hitpoints         %ph - hitpoints as a percentage
%m - current mana points  %M - Max mana points  %pm - mana as a percentage
%v - current move points    %V - Max move points   %pv - move as a percentage
%g - gold on hand                 %G - gold in bank
%q - quest points
%x - current XP                      %X - XP till next level
%% - show a percentage sign
%_ - new line

All color codes are accepted using the '@' symbol.

Example: prompt %h %m %v @W>@n 

See also: DISPLAY TOGGLE COLOUR

DISPLAY

Usage: display <number>

Set your prompt to a preset display.
Typing display by itself will show a list of options.

Example: display 2

See also: PROMPT

2.) I quickly tested this and couldn't reproduce it. Lets discuss on AtBMUD further.

3.) Absolutely! Remember when expanding this code that you lose any data that exceeds MAX_PROMPT_LENGTH, which is why I raised it by another 100 characters. Also there may be better ways to provide some information that players request, like having ROOMFLAGS turned on will show room vnums etc. Just something to consider before adding additional fields.

char *prompt_str(struct char_data *ch) in comm.c is where you make the changes.

Find an unused letter inside the switch statement
switch (*(++str)) {
Order doesn't matter, but it's nice to keep it alphabetical for next time you look at it.

Then add your new code block, eg:
 case 'z':
                    if (GET_LEVEL(ch) >= LVL_IMMORT) // add zone number for immortals
                        snprintf(i, sizeof(i), "%d", zone_table[world[IN_ROOM(ch)].zone].number);
                    else
                        snprintf(i, sizeof(i), "z"); // for mortals, just add the letter Z
                    tmp = i;
                    break;

Adding room vnums would be very similar, change the case and the zone number for room vnum.
The following user(s) said Thank You: thomas

Please Log in or Create an account to join the conversation.

Time to create page: 1.363 seconds