Welcome to the Builder Academy

Question New command - Please help

More
14 Jul 2025 21:30 - 14 Jul 2025 21:33 #10803 by thomas
Replied by thomas on topic New command - Please help
Code:
zone_rnum quest_zone(qst_rnum quest) {   zone_rnum i;   if  (quest == NOTHING) {     return NOWHERE;   }   for (i = 0; i  < top_of_zone_table;  i++) {     if (QST_NUM(quest) >= zone_table[i].bot && QST_NUM(quest) <= zone_table[i].top) {       return i;     }   }   return NOWHERE; } ACMD(do_stat_world) {   int loaded_mobs = 0,   unique_mobs = 0,   loaded_objs = 0,   unique_objs = 0,   accessible_rooms = 0,   current_players = 0,   total_players = top_of_p_table + 1,   accessible_zones = 0,   accessible_quests = 0;   int mob_counts[top_of_mobt], obj_counts[top_of_objt];   int i;   room_rnum tmp = NOWHERE;   char_data *vict = NULL;   obj_data *obj = NULL;   struct descriptor_data *desc = NULL;   for (i = 0; i < top_of_mobt; i++) {     mob_counts[i] = 0;   }   for (i = 0; i < top_of_objt; i++) {     obj_counts[i] = 0;   }   for (vict = character_list; vict; vict = vict->next) {     if (IS_NPC(vict)       && GET_MOB_RNUM(vict) != NOTHING       && GET_ROOM_ZONE(IN_ROOM(vict)) != NOWHERE       && !ZONE_FLAGGED(GET_ROOM_ZONE(IN_ROOM(vict)), ZONE_CLOSED)) {       mob_counts[GET_MOB_RNUM(vict)]++;     }   }   for (obj = object_list; obj; obj = obj->next) {     if (GET_OBJ_RNUM(obj) == NOTHING) {       continue;     }     tmp = obj_room(obj);     if (GET_ROOM_ZONE(tmp) != NOWHERE       && !ZONE_FLAGGED(GET_ROOM_ZONE(tmp), ZONE_CLOSED)) {       obj_counts[GET_OBJ_RNUM(obj)]++;     }   }   for (i = 0; i < top_of_mobt; i++) {     if (mob_counts[i] != 0) {       unique_mobs++;       loaded_mobs += mob_counts[i];     }   }   for (i = 0; i < top_of_objt; i++) {     if (obj_counts[i] != 0) {       unique_objs++;       loaded_objs += obj_counts[i];     }   }   for (i = 0; i < top_of_world; i++) {     if (!ZONE_FLAGGED(GET_ROOM_ZONE(i), ZONE_CLOSED)) {       accessible_rooms++;     }   }   for (desc = descriptor_list; desc; desc = desc->next) {     if (desc->character && CAN_SEE(ch, desc->character)) {       current_players++;     }   }   for (i = 0; i < top_of_zone_table; i++) {     if (!ZONE_FLAGGED(i, ZONE_CLOSED)) {       accessible_zones++;     }   }   for (i = 0; i < total_quests; i++) {     tmp = quest_zone(i);     if (tmp != NOWHERE && !ZONE_FLAGGED(tmp, ZONE_CLOSED)) {       accessible_quests++;     }   }   send_to_char(ch,     "Mobiles: %5d (of %5d different types)\r\n"     "Objects: %5d (of %5d different types)\r\n"     "Rooms  : %5d\r\n"     "Zones  : %5d\r\n"     "Quests : %5d\r\n"     "Players: %5d online, %5d registered",     loaded_mobs, unique_mobs,     loaded_objs, unique_objs,     accessible_rooms,     accessible_zones,     accessible_quests,     current_players, total_players   ); }
A prototype then need to be put in the corresponding .h-file and the interpreter.c command list.
Last edit: 14 Jul 2025 21:33 by thomas.

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

Time to create page: 0.163 seconds