Welcome to the Builder Academy

Question Special Exit Name

More
29 Aug 2020 01:02 - 29 Aug 2020 01:03 #9150 by cry1004
Special Exit Name was created by cry1004
To change the exit name of a specific room,
do I need to add the exit name to
const char *dirs[]
const char *autoexits[] ...
in the constants.c file?

It's not the way to write down the exit name in the room description,
but I wonder how l make it appear at the exit.

The following code is an example.
If I try to mark the exit of the elevator and the exit of each floor in the elevator.
Code:
The Lobby It is a spacious lobby that is luxuriously decorated. [ Exits: n e s w ev ] 500H 100M 82V (news) (motd) > ev The Elevator You are in the elevator. [ Exits: G 1f 2f 3f 4F 5f ] 500H 100M 82V (news) (motd) > 3f The Shopping center You are standing in a shopping center on the third floor. [ Exits: n e s w ev ] 500H 100M 82V (news) (motd) >
Last edit: 29 Aug 2020 01:03 by cry1004.

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

More
29 Aug 2020 14:47 #9187 by thomas
Replied by thomas on topic Special Exit Name
This isn't actalluy very easy to do, iirc.

The code responsible for this particular list is in act.informative.c :
Code:
static void do_auto_exits(struct char_data *ch) { int door, slen = 0; send_to_char(ch, "%s[ Exits: ", CCCYN(ch, C_NRM)); 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 (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) send_to_char(ch, "%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)) send_to_char(ch, "%s%s%s ", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); else send_to_char(ch, "\t(%s\t) ", autoexits[door]); slen++; } send_to_char(ch, "%s]%s\r\n", slen ? "" : "None!", CCNRM(ch, C_NRM)); }
This needs to be rewritten to take into consideration "special" doors.

Next, you'll need to change the command interpreter to check for "loose door names". That is, if it doesn't find anything in the command list, it needs to check if the entered command is the name of a door. This happens around line 532 in interpreter.c :
Code:
if (*complete_cmd_info[cmd].command == '\n') { int found = 0; send_to_char(ch, "%s", CONFIG_HUH); for (cmd = 0; *cmd_info[cmd].command != '\n'; cmd++) { if (*arg != *cmd_info[cmd].command || cmd_info[cmd].minimum_level > GET_LEVEL(ch)) continue; /* Only apply levenshtein counts if the command is not a trigger command. */ if ( (levenshtein_distance(arg, cmd_info[cmd].command) <= 2) && (cmd_info[cmd].minimum_level >= 0) ) { if (!found) { send_to_char(ch, "\r\nDid you mean:\r\n"); found = 1; } send_to_char(ch, " %s\r\n", cmd_info[cmd].command); } } }

In practice, this is a central thing in tbamud, and has been for very many years. There are bound to be many things that can go wrong with changing it, and I'm not comfortable with writing a forum post to show you what to do. I'm bound to miss a lot of edge cases - like what do we do about OLC? or stat room?

I suggest instead to see what can be done with triggers.

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

More
29 Aug 2020 15:09 #9189 by cry1004
Replied by cry1004 on topic Special Exit Name
Thank you for your advice.

Today I added an exit by editing several files.

Attachment 192.jpg not found

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

More
29 Aug 2020 16:20 #9192 by Parnassus
Replied by Parnassus on topic Special Exit Name
I find this impressive! My translator says:
You can go to the 1st, 2nd, 3rd, 4th, 5th floor, bath, and basement.
and later:
The places you can go to are east, west, south, north, and elevators.

It doesn't seem that you need this anymore but for a different way of doing it, you can check my elevator trigger .

The way I handled it was to have the floors on the elevator buttons and you can only exit to one floor at a time. (well, except for the first time which I need to fix sometime.)
The following user(s) said Thank You: cry1004

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

More
29 Aug 2020 16:37 - 30 Aug 2020 00:53 #9193 by cry1004
Replied by cry1004 on topic Special Exit Name
Thank you for your advice.

I wanted to show the exit.
So, I edited several files today.

structs.h: added exit.
redit.c: The added exit has been modified so that it can be edited.
interpreter.h: Added exit name as command.
constants.c: Added exit to *dirs[] and rev_dir[].
asciimap.c: Modified to show exits on the map.
act.informative.c: Modified to show the exit below the room description.

It's still working fine.
Last edit: 30 Aug 2020 00:53 by cry1004.

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

More
29 Aug 2020 22:03 #9206 by thomas
Replied by thomas on topic Special Exit Name
Very nice. Well done!
The following user(s) said Thank You: cry1004

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

Time to create page: 0.207 seconds