And hope that any none vnum numbers don't get messed up :)
> -----Original Message-----
> From: Tom Whiting [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 07, 2002 12:24 PM
> To: [email protected]
> Subject: RE: New VNums
>
>
> Or just use perl OUTSIDE of the mud to do this:
> perl -pi~ -e 's/66(\d\d)/17\1/g' file.are
> where 66 is the first two numbers of the vnum (what they are)
> 17 is the second two numbers(what you want them to)
> file.are is the one you want to change
> This would change all references to 66XX for example to 17XX,
> etc and on
> down the line.
> If you do this inside of the mud, your mud won't boot, it'll
> try to load
> the area, detect conflicting vnums and then not load it up at all.
> IF you do this though, be careful, if you're using OLC2, because this
> will change the vnum for the prog, but NOT the vnum of the
> file the prog
> is written to (because they're written separate from area files w/
> olc2).
> All you have to do there is make sure you renumber the prog from
> 66xx.prg to 17xx.prg
>
> -------------------------------------------
> TJW: Head tech, Dreamless Realms Mud
> Web: http://drealms.kyndig.com
> Snippets http://drealms.kyndig.com/snippets
> Telnet telnet://drealms.kyndig.com:9275
> The OLC2 Pages http://olc.kyndig.com
> -------------------------------------------
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason
> Gauthier
> Sent: Monday, January 07, 2002 10:10 AM
> To: 'Matthew Kerwin'; [email protected]
> Subject: RE: New VNums
>
> You could.. or you could just write a function to renumber an area.
>
> (Works on my mud, you WILL need to change it to work on yours)
>
> void do_renumber(CHAR_DATA *ch, char *argument)
> {
> extern int port;
> char arg[MSL];
> char test[1];
> long base, difference, vnum, room;
> AREA_DATA *pArea;
>
> if (port == 1536 || port == 1538){
> ptc(ch, "This command cannot be used on live or build.\n\r");
> return;
> }
>
> if (IS_WILDERNESS(ch->in_room)){
> ptc(ch, "Not in the wilderness.\n\r");
> return;
> }
>
> test[0]=1;
> if (argument[0] == 0 || arg[0] == 0){
> ptc(ch, "Syntax: renumber <min vnum>\n\r");
> return;
> }
>
> if (atol(argument) == 0){
> ptc(ch, "Sorry, not supporting 0 as an argument.\n\r");
> return;
> }
> base = atol(argument);
> do_links(ch, test);
>
> if (test[0] == 'Y'){
> ptc(ch, "Cannot renumber areas with links.\n\r");
> return;
> }
>
> for (pArea = area_first; pArea; pArea = pArea->next){
> if (pArea->min_vnum <= base && pArea->max_vnum >=base){
> ptc(ch, "Area '%s' conflicts with base vnum.\n\r",
> pArea->file_name);
> return;
> }
> }
>
> difference = base - ch->in_room->area->min_vnum;
> room = ch->in_room->vnum + difference;
> /* renumber rooms */
> for (vnum = ch->in_room->area->min_vnum;
> vnum<ch->in_room->area->max_vnum; vnum++){
> ROOM_INDEX_DATA *r;
> OBJ_INDEX_DATA *o;
> MOB_INDEX_DATA *m;
> PROG_LIST *mplist;
> PROG_CODE *mpcode;
> RESET_DATA *reset;
> EXIT_DATA *exits;
> int i;
> r = pRoomArray[vnum];
> if (r){
> pRoomArray[vnum + difference] = r;
> pRoomArray[vnum + difference]->vnum += difference;
> /* and do the resets */
> for ( reset = get_room_reset(pRoomArray[vnum+difference]);
> reset;
> reset = reset->next ){
> reset->arg1 += difference;
> reset->arg3 += difference;
> }
> pRoomArray[vnum] = NULL;
> /* go through the exits, change keys! */
> for (i=0; i<MAX_DIR; i++){
> exits = get_exit(0, r, i);
> if (!exits) continue;
> if (exits->key>0){
> if (exits->key >= ch->in_room->area->min_vnum &&
> exits->key
> <= ch->in_room->area->max_vnum)
> exits->key+=difference;
> }
> }
> }
>
> /* renumber the object */
> o = pObjArray[vnum];
> if (o){
> pObjArray[vnum + difference] = o;
> pObjArray[vnum + difference]->vnum += difference;
> pObjArray[vnum] = NULL;
> if (o->item_type == ITEM_PORTAL){
> if (o->value[3] >= ch->in_room->area->min_vnum &&
> o->value[3] <=
> ch->in_room->area->max_vnum)
> o->value[3]+=difference;
> }
> }
>
> /* renumber the mob */
> m = pMobArray[vnum];
> if (m){
> pMobArray[vnum + difference] = m;
> pMobArray[vnum + difference]->vnum += difference;
> /* mprog list */
> for (mplist = pMobArray[vnum+difference]->mprogs; mplist !=
> NULL;
> mplist = mplist->next)
> mplist->vnum += difference;
>
> /* shop time */
> if (pMobArray[vnum+difference]->pShop)
> pMobArray[vnum+difference]->pShop->keeper += difference;
>
> pMobArray[vnum] = NULL;
> }
>
> /* renumber mob progs */
> mpcode = pMprogArray[vnum];
> if (mpcode){
> pMprogArray[vnum + difference] = mpcode;
> pMprogArray[vnum + difference]->vnum += difference;
> pMprogArray[vnum] = NULL;
> }
> }
> /*now make area changes */
> ch->in_room->area->min_vnum += difference;
> ch->in_room->area->max_vnum += difference;
>
> ch->in_room = pRoomArray[room];
> ptc(ch, "Done. Base vnum of '%s' is %ld.\n\r",
> ch->in_room->area->name,
> base);
> ptc(ch, "Saving the world....\n\r");
> process_output(ch->desc, FALSE);
> do_asave(ch, "world");
> }
>
> /* this function will go through the current areas vnums and
> report what
> * vnums have links to other areas */
> void do_links (CHAR_DATA *ch, char *argument)
> {
>
> long i;
> sh_int exits;
> EXIT_DATA *pexit;
> OBJ_DATA *obj;
> bool passed = TRUE;
> if (IS_WILDERNESS(ch->in_room)){
> ptc(ch, "Not used in the wilderness\n\r");
> return;
> }
>
> if (argument[0]==0)
> /* command executed
> * Not 0 means it was passed from another command, like
> renumber
> */
> passed=FALSE;
>
> for (i=ch->in_room->area->min_vnum; i<=ch->in_room->area->max_vnum;
> i++){
> /* check for the room */
> if (pRoomArray[i]){
> for(exits=0; exits<MAX_DIR; exits++){
> pexit = get_exit(ch, pRoomArray[i], exits);
> if (!pexit) continue;
> if (pexit->u1.to_room->vnum <
> ch->in_room->area->min_vnum ||
> pexit->u1.to_room->vnum >
> ch->in_room->area->max_vnum){
> if (!passed)
> ptc(ch, "Room %ld links to %ld [%s].\n\r", i,
> pexit->u1.to_room->vnum, dir_name[exits]);
> else
> argument[0]='Y';
> }
> }
> if (!passed){
> for (obj = get_room_objs(pRoomArray[i]); obj; obj =
> obj->next_content){
> if (obj->item_type == ITEM_PORTAL){
> if (obj->value[3] <
> ch->in_room->area->min_vnum
> ||
> obj->value[3] >
> ch->in_room->area->max_vnum){
> ptc(ch, "Room %ld has a portal to
> %ld.\n\r",
> i,
> obj->value[3]);
> }
>
> }
> }
> }
> }
> }
> }
>
> > -----Original Message-----
> > From: Matthew Kerwin [mailto:[EMAIL PROTECTED]
> > Sent: Monday, January 07, 2002 11:02 AM
> > To: [email protected]
> > Subject: New VNums
> >
> >
> > It's late, I'm tired, and I haven't touched my little ROM for
> > a few months.
> > That said, I was just about to head to bed when I had an
> > idea. You know how
> > there are (probably) several really groovy little non-stock
> > area files
> > floating around there, right? And like some of them more than
> > likely have
> > overlapping VNums, right? Which means the person who uses
> > them has to go
> > through and change every single number in the file.. would it
> > be feasible to
> > use relative numbers? Like if I had a little area that had a
> > little mob in a
> > little room with a little sword, I could assign them all as '0' (or
> > whatever), and then whoever downloads my little area could
> simply set
> > somewhere the 'add the vnum to this base' number, to get a
> > totally unique id
> > for each thingy.
> >
> > I know that could potentially make saving pfiles annoying if
> > you're in the
> > habit of continually adding/removing/changing area files, but
> > then again
> > it's already annoying isn't it?
> >
> > Matty
> > Brainstorming too late on too little Coke
> > -----
> > I'm not dead.
> >
> > _________________________________________________________________
> > Chat with friends online, try MSN Messenger:
> http://messenger.msn.com
> >
> >
> > --
> > ROM mailing list
> > [email protected]
> > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> >
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
>
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>