Free vnums 1.0 By Xerves (Released November 10, 1999) Xerves is the admin/owner of Rafermand (mud.rafermand.net port 3002) Website: http://www.rafermand.net Contact: xerves@rafermand.net Well, but another snippet. Freevnums is a really handy command that should fit nicely with checkvnums and vassign. What it does, is you type a string like this in the mud freevnums 200 1000 And it will list all the freevnums in a 50 vnum chunk. At Rafermand, we typically use 50 and 100 blocks for vnums, so I thought that would be a good size. If you want to decreate it, you can change some of the code around. A few notes about the below code. 1. It cuts off the last digit (the ones digit) so 201 is treated like 200. If you want to remove that, look in the code for a comment about it. 2. The code is oriented toward the 32600 vnums instead of the 2 billion vnums. If you have 2 billion vnums, you will have to change a bit of the code around. Please do not email me asking how to do it. 3. I am pretty sure the code isn't buggy, but always double check the code against checkvnum 4. It only checks rooms. So if you have 3000 as the end room, and 3001 as the end obj, you might have problems. That is why I suggest using checkvnum to countercheck the work. Anyway, below is the function. Just tack it in act_wiz.c or some other place. ----------------------------- /* Simular to checkvnum, but will list the freevnums -- Xerves */ void do_free_vnums( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; AREA_DATA *pArea; char arg1[MAX_STRING_LENGTH]; bool area_conflict; int low_range, high_range; int lohi[600]; /* Up to 300 areas, increase if you have more -- Xerves */ int xfin = 0; int w = 0; int x = 0; int y = 0; int z = 0; argument = one_argument( argument, arg1 ); if(arg1[0] == '\0') { send_to_char("Please specify the low end of the range to be searched.\n\r", ch); return; } if(argument[0] == '\0') { send_to_char("Please specify the high end of the range to be searched.\n\r", ch); return; } low_range = atoi(arg1); high_range = atoi(argument); if (low_range < 1 || low_range > 32767 ) { send_to_char("Invalid argument for bottom of range.\n\r", ch); return; } if (high_range < 1 || high_range > 32767 ) { send_to_char("Invalid argument for top of range.\n\r", ch); return; } if (high_range < low_range) { send_to_char("Bottom of range must be below top of range.\n\r", ch); return; } /* Forces it to check in sets of 10 -- Xerves*/ low_range = low_range/10; low_range = low_range*10; set_char_color( AT_PLAIN, ch ); for ( pArea = first_asort; pArea; pArea = pArea->next_sort ) { area_conflict = FALSE; if ( IS_SET( pArea->status, AREA_DELETED ) ) continue; else { if ( low_range < pArea->low_r_vnum && pArea->low_r_vnum < high_range ) area_conflict = TRUE; if ( low_range < pArea->hi_r_vnum && pArea->hi_r_vnum < high_range ) area_conflict = TRUE; if ( ( low_range >= pArea->low_r_vnum ) && ( low_range <= pArea->hi_r_vnum ) ) area_conflict = TRUE; if ( ( high_range <= pArea->hi_r_vnum ) && ( high_range >= pArea->low_r_vnum ) ) area_conflict = TRUE; } if (area_conflict) { lohi[x] = pArea->low_r_vnum; x++; lohi[x] = pArea->hi_r_vnum; x++; } } for ( pArea = first_bsort; pArea; pArea = pArea->next_sort ) { area_conflict = FALSE; if ( IS_SET( pArea->status, AREA_DELETED ) ) continue; else { if ( low_range < pArea->low_r_vnum && pArea->low_r_vnum < high_range ) area_conflict = TRUE; if ( low_range < pArea->hi_r_vnum && pArea->hi_r_vnum < high_range ) area_conflict = TRUE; if ( ( low_range >= pArea->low_r_vnum ) && ( low_range <= pArea->hi_r_vnum ) ) area_conflict = TRUE; if ( ( high_range <= pArea->hi_r_vnum ) && ( high_range >= pArea->low_r_vnum ) ) area_conflict = TRUE; } if (area_conflict) { lohi[x] = pArea->low_r_vnum; x++; lohi[x] = pArea->hi_r_vnum; x++; } } xfin = x; for (y=low_range; y= lohi[x] && y <= lohi[w]) { area_conflict = TRUE; break; } if (z <= lohi[w] && z >= lohi[x]) { area_conflict = TRUE; break; } } if (area_conflict == FALSE) { sprintf(buf, "Open: %5d - %-5d\n\r", y, z); send_to_char(buf, ch); } } return; } ---------------------------------------------------------- After you add that, need to add the proper calls in the tables.c chart and a DECLARE_DO_FUN in mud.h. Afterwards, just type make clean and let it compile. Once you get online, use cedit to add the command to the game. cedit freevnums create do_free_vnums cedit freevnums level 58 There you go...you now have the command. Now the command works like this freevnums 200 1000 And the output you might get (the output on mine) Open: 200 - 249 Open: 250 - 299 Open: 550 - 599 Open: 600 - 649 Open: 650 - 699 Open: 700 - 749 Open: 750 - 799 And there you go....those sets of 50 are open :-)