I realize I am a newbie at coding and admit it fully! I would like to have this refined and possibly change as described at the bottom. With the help of George, I made this command to take certain items in the mud that a player has (if they have them) and give them an item. In effect they MAKE an item. I saw this command on another mud and decided to add it in. The original idea is not mine, and I don't know who originally did it. I am only trying to refine this one. ACMD(do_make) { int i; char arg1[MAX_INPUT_LENGTH]; one_argument(argument, arg1); if (!*arg1) send_to_char("Make what?\r\n", ch); else if (!strcmp(arg1, "Dreamblade")) { int obj_num[3] = { 3001, 3002, 3003 }; struct obj_data *objs[3]; for (i = 0; i <= 2; i++) obj_num[i] = real_object(obj_num[i]); /* do they have the items? */ for (i = 0; i <= 2; i++) objs[i] = get_obj_in_list_num(obj_num[i], ch->carrying); if (objs[0] && objs[1] && objs[2]) { send_to_char("You fiddle with some items and create something.\r\n", ch); /* remove the objects that are needed */ for (i = 0; i <=2; i++) obj_from_char(objs[i]); /* give them the item MADE item */ obj_to_char(read_object(3008, VIRTUAL), ch); } else { /* they dont have the items */ send_to_char("You don't seem to have all the parts.\r\n", ch); /* list the items needed if your a god */ if (GET_LEVEL(ch) > LVL_GOD) { sprintf(buf, "The objects you need are %d, %d, and %d.\r\n", obj_num[0], obj_num[1], obj_num[2]); /* this gives the RNUM instead of the VNUM */ send_to_char(buf, ch); } } } else /* They did not input a valid argument */ send_to_char("What was it your trying to make?\r\n", ch); } The command works with no problems, what I need to also do is check to see if the item exists for the one being made. I don't think there is a problem with checking items in inventory as the items may or may not exist already. The only downfall is that this will only create ONE item and other items can be added in, at the expense of CODING it in and recompiling and Rebooting to load it. I would like to find a way to have the code written to get the obj numbers from a file that can be edited online, Without having to reboot and recode. i.e. Load the data from a file similar to a world file # dreamblade 3 number of items needed 3001 3002 3003 3008 last item is the one given. Other things eventually: scan the file and list them for Gods/IMPs OLC edit online. Can anyone help in making this better? +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST