Welcome to the Builder Academy

Question Moving ROOM exits from the Room Description to the Player Prompt

More
23 Aug 2016 06:22 #6130 by risin
Hey guys,

Like the description says, I'm looking to move the exits from the room description the players prompt. I'm a web developer (php, javascript, python, nodejs) with limited C#, C++, and Java experience. I'm hoping to learn a lot from the people here and appreciate any and all help.

Thanks in advance for any, and all help :)

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

More
23 Aug 2016 21:47 #6131 by thomas
Welcome, Risin.

Are you thinking of the list of exits shown when roomflags are on?

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

More
23 Aug 2016 22:11 #6132 by thomas
Because if you are, the code that currently lists out exits is here: github.com/tbamud/tbamud/blob/2f12752373...t.informative.c#L418 (it's called from line 529).
And you'll want to be calling it somewhere near github.com/tbamud/tbamud/blob/2f12752373...8a4/src/comm.c#L1205

To make this happen, I'd move the function somewhere else, utils.c, for instance, and add the prototype to utils.h. Note that it is currently static, so this modifier needs to go to be able to access it from other files. Then it's just a matter of calling it from the make_prompt() function.
The following user(s) said Thank You: risin

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

More
24 Aug 2016 03:56 #6133 by risin
Hello Thomas, and thank you for the reply!

I was looking to do this for the players, so they would have a prompt that showed them the exits in addition to the hp and mana.

188H 100M 82V EXITS:NESW>

would be an example

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

More
24 Aug 2016 05:12 #6134 by WhiskyTest
Yeah Thomas has you on the right track with those two links.
I would add that you would need to change the function 'do_auto_exits' to append the exits onto the prompt string so that make_prompt() can do all the necessary formatting/overflow handling. As it currently is it will spit out the exits in the middle of the make_prompt() function which will just break.

I hope that made sense - fiddling with the prompt is a bit confusing when you first look at it, but hopefully you have enough to make a start?

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

More
24 Aug 2016 06:20 #6135 by zusuk
Welcome!

Yeah I imagine you'd put something like this in make_prompt() in comm.c:
Code:
for (door = 0; door < DIR_COUNT; door++) { if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT)) continue; if (!seesExits) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) count = snprintf(prompt + len, sizeof (prompt) - len, "%s(%s)%s", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); else if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN)) count = snprintf(prompt + len, sizeof (prompt) - len, "%s%s%s", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); else count = snprintf(prompt + len, sizeof (prompt) - len, "%s", autoexits[door]); slen++; if (count >= 0) len += count; }

That's how it looks like in our code, you'd then just add the proper toggle so the player can turn it off and on (unless you want to force them to have it)

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100
The following user(s) said Thank You: risin

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

Time to create page: 0.259 seconds