- Posts: 47
- Thank you received: 1
How do I add a new option to char_data in structs.h file?
- cry1004
- Topic Author
- Offline
- Senior Member
-
Less
More
7 months 1 week ago - 7 months 1 week ago #9726
by cry1004
How do I add a new option to char_data in structs.h file? was created by cry1004
I'm sorry that it seems the only one me keeps asking questions.
When playing games, there are times when you want to start in a specific area as the world grows.
I want to create a new object in a specific room, and when I order it to register, the game starts in that room when I login.
At this time, if the registration cancellation command is entered, the location of the starting room is initialized to mortal_start_room and immort_start_room according to the user's level.
The following is the code I made, but it doesn't run because many places are wrong. It seems to be because I lack basic knowledge of programming.
I added it to the end of the struct char_data in the structs.h file.
I didn't think I should add it to the reset_char function in the db.c file. Or it seems to be initialized with mortal_start_room and immort_start_room according to the user's level.
In the do_stat_character function of the act.wizard.c file, I can get the room name and show it.
This could be solved by knowing how to define and load a new value in char_data.
I think should initialize the starting room for void init_char(struct char_data *ch) function as well.
Again, this is a mess of code.
If the starting room is set in enter_player_game of the interpreter.c file, the character is connected to the room, and if it is not set, I can login to the room according to the level of the character.
ex) mortal_start_room and immort_start_room
I made the utils.h file to get the character's starting room, but it seems to be wrong.
I made a function that initializes the starting room in the limits.c file.
Of course it wasn't made right.
Is it correct to make the following when specifying the following in char_data?start_room is not an int type, it contains the room number.
I want to save and load the location of the starting room just like loading the user's level in utils.h.
In my opinion, it doesn't seem to be called and used as below. Are there any documents that can help you learn this?
The article I wrote was using Google Translator. What I want to say may have been mistranslated into English.
When playing games, there are times when you want to start in a specific area as the world grows.
I want to create a new object in a specific room, and when I order it to register, the game starts in that room when I login.
At this time, if the registration cancellation command is entered, the location of the starting room is initialized to mortal_start_room and immort_start_room according to the user's level.
The following is the code I made, but it doesn't run because many places are wrong. It seems to be because I lack basic knowledge of programming.
I added it to the end of the struct char_data in the structs.h file.
struct char_data *start_room;
I didn't think I should add it to the reset_char function in the db.c file. Or it seems to be initialized with mortal_start_room and immort_start_room according to the user's level.
In the do_stat_character function of the act.wizard.c file, I can get the room name and show it.
This could be solved by knowing how to define and load a new value in char_data.
I think should initialize the starting room for void init_char(struct char_data *ch) function as well.
set_startroom(ch, r_mortal_start_room);
If the starting room is set in enter_player_game of the interpreter.c file, the character is connected to the room, and if it is not set, I can login to the room according to the level of the character.
ex) mortal_start_room and immort_start_room
I made the utils.h file to get the character's starting room, but it seems to be wrong.
#define GET_STARTROOM(ch) (ch->start_room)
I made a function that initializes the starting room in the limits.c file.
Of course it wasn't made right.
void set_startroom(struct char_data *ch, room_vnum rvnum)
{
zone_rnum zrnum = real_zone_by_thing(rvnum);
room_rnum rrnum = real_room(rvnum);
if (GET_STARTROOM(ch) != NULL)
free(GET_STARTROOM(ch));
if (zrnum == NOWHERE || rrnum == NOWHERE)
GET_STARTROOM(ch) = r_mortal_start_room;
}
Is it correct to make the following when specifying the following in char_data?
struct char_data *start_room;
I want to save and load the location of the starting room just like loading the user's level in utils.h.
#define GET_LEVEL(ch) ((ch)->player.level)
In my opinion, it doesn't seem to be called and used as below. Are there any documents that can help you learn this?
#define GET_STARTROOM(ch) (ch->start_room)
The article I wrote was using Google Translator. What I want to say may have been mistranslated into English.
Last edit: 7 months 1 week ago by cry1004.
Please Log in or Create an account to join the conversation.
- Vatiken
-
- Offline
- Administrator
-
- tbaMUD Programmer
Less
More
- Posts: 218
- Thank you received: 47
7 months 1 week ago - 7 months 1 week ago #9728
by Vatiken
tbaMUD developer/programmer
Replied by Vatiken on topic How do I add a new option to char_data in structs.h file?
Please login to view the answers
tbaMUD developer/programmer
Last edit: 7 months 1 week ago by Vatiken.
The following user(s) said Thank You: cry1004
Please Log in or Create an account to join the conversation.
- cry1004
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 47
- Thank you received: 1
7 months 1 week ago - 7 months 1 week ago #9730
by cry1004
Replied by cry1004 on topic How do I add a new option to char_data in structs.h file?
Please login to view the answers
Last edit: 7 months 1 week ago by cry1004.
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
Less
More
- Posts: 693
- Thank you received: 130
7 months 1 week ago #9734
by thomas
Replied by thomas on topic How do I add a new option to char_data in structs.h file?
Please login to view the answers
Please Log in or Create an account to join the conversation.
Time to create page: 0.086 seconds