From: The Lion King Subject: Re: A better load module Would you be interested in a piece of code that allows you to use: > load obj instead of just: > load obj Well... here it is! ---- In act.wizard.c: /* Replace do_load with this... */ /* Extern function from db.c */ int get_vnum_from_name(char* searchname, struct char_data* ch, int do_what); ACMD(do_load) { struct char_data *mob; struct obj_data *obj; int r_num; int temp_num; int is_num=0; two_arguments(argument, buf, buf2); if (!*buf || !*buf2) { send_to_char("Usage: load { obj | mob } { name | vnumber }\r\n", ch); return; } is_num=isdigit(*buf2); if (is_abbrev(buf, "mob")) { if(!is_num){ temp_num=get_vnum_from_name(buf2,ch,USE_MOB); } else{ temp_num=atoi(buf2); } if ((r_num = real_mobile(temp_num)) < 0) { send_to_char("No such animal!\r\n", ch); return; } mob = read_mobile(r_num, REAL); char_to_room(mob, ch->in_room); act("$n chants some runes. The fabric of the Universe rips open!", TRUE, c h,0, 0, TO_ROOM); act("$N falls out of the hole! The Universe re-seals!", FALSE, ch, 0, mob, TO_ROOM); act("You create $N.", FALSE, ch, 0, mob, TO_CHAR); } else if (is_abbrev(buf, "obj")) { if(!isdigit(*buf2)){ temp_num=get_vnum_from_name(buf2,ch,USE_OBJ); } else{ temp_num=atoi(buf2); } if ((r_num = real_object(temp_num)) < 0) { send_to_char("What is that?\r\n", ch); return; } obj = read_object(r_num, REAL); obj_to_room(obj, ch->in_room); act("$n chants some magic runes! The very fabric of the Universe rips open !", TRUE, ch, 0, 0, TO_ROOM); act("$p falls out of the hole! The Universe re-seals!", FALSE, ch, obj, 0, TO_ROOM); act("You do a cool trick and $p appears!", FALSE, ch, obj, 0, TO_CHAR); } else send_to_char("What is that? 'obj' or 'mob' please!\r\n", ch); } --- In db.c: /* Add this to db.c */ /* This gets a vnum of an object or mob from a name... */ int get_vnum_from_name(char* searchname, struct char_data* ch, int do_what); int get_vnum_from_name(char* searchname, struct char_data* ch, int do_what){ if(do_what==USE_MOB){ int nr,mob_number=-1; for(nr = 0; nr <= top_of_mobt; nr++){ if(isname(searchname, mob_proto[nr].player.name)){ mob_number=mob_index[nr].virtual; } } return mob_number; } else{ int nr,obj_number=-1; for(nr =0; nr <= top_of_objt; nr++){ if(isname(searchname, obj_proto[nr].name)){ obj_number=obj_index[nr].virtual; } } return obj_number; } } --- That's all! Steve Conley