I feel that there is nothing wrong with asking for help, but the way that some people ask for it is really pathetic. Every coupla months, yet another clueless person gets on this list and starts in with the "code this for me, gimme gimme gimme!" mentality. These people, and I will refrain from naming any current ones, need to sit back, take a deep breath, and decide if they are really competent enough to run a mud. Running a mud takes time, patience, skill, and CODING ABILITY. A mud should be your expression of the fantasy setting that YOU want to have. A collection of other people's snippets does not make a mud. For these people, the answer is simple. R - READ T - THE F - F*CKING C - CODE ObCircle: A command to compare one object to another. I wrote this a long long time ago, and some of it is kinda kludgy, like the moreless string. But I like full, detailed sentenced output to the player, rather than terse phrases or sentence fragments. So, it is a skeleton that can most definitely be built upon and improved. Oh, I don't think GET_OBJ_SHORT() is stock...can't quite remember of I added it myself or not. If not, it is just: #define GET_OBJ_SHORT(obj) ((obj)->short_description) ACMD(do_compare) { char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], type1[15], moreless[20]; struct obj_data *obj1, *obj2; int o1 = 0, o2 = 0; two_arguments(argument, arg1, arg2); if ((!*arg1) || (!*arg2)) { send_to_char("Usage: compare <object 1> <object 2>\r\n", ch); return; } if (!(obj1 = get_obj_in_list_vis(ch, arg1, ch->carrying))) { sprintf(buf, "You don't seem to have %s %s.\r\n", AN(arg1), arg1); send_to_char(buf, ch); return; } if (!(obj2 = get_obj_in_list_vis(ch, arg2, ch->carrying))) { sprintf(buf, "You don't seem to have %s %s.\r\n", AN(arg2), arg2); send_to_char(buf, ch); return; } if (GET_OBJ_TYPE(obj1) != GET_OBJ_TYPE(obj2)) { send_to_char("You can only compare items of the same kind!\r\n", ch); return; } sprintf(buf, "You hold %s and %s in your hands....\r\n", GET_OBJ_SHORT(obj1), GET_OBJ_SHORT(obj2)); send_to_char(buf, ch); switch (GET_OBJ_TYPE(obj1)) { case ITEM_WEAPON: case ITEM_THROW: case ITEM_ARROW: case ITEM_BOLT: case ITEM_GRENADE: o1 = (((GET_OBJ_VAL(obj1, 2) + 1) / 2.0) * GET_OBJ_VAL(obj1, 1)); o2 = (((GET_OBJ_VAL(obj2, 2) + 1) / 2.0) * GET_OBJ_VAL(obj2, 1)); break; case ITEM_ARMOR: case ITEM_BOW: case ITEM_CROSSBOW: o1 = (GET_OBJ_VAL(obj1, 0)); o2 = (GET_OBJ_VAL(obj2, 0)); break; default: send_to_char("You cannot discern any worthwhile information.\r\n", ch); return; break; } /* end switch */ if (o1 == o2) { send_to_char("The two items appear to be quite evenly matched.\r\n", ch); return; } else { if (o1 > o2) strcpy(moreless, "a more effective"); if (o1 < o2) strcpy(moreless, "a less effective"); sprinttype(GET_OBJ_TYPE(obj1), item_types, type1); sprintf(buf, "%s seems to be %s %s than %s.\r\n", CAP(GET_OBJ_SHORT(obj1)), moreless, type1, GET_OBJ_SHORT(obj2)); send_to_char(buf, ch); } } -- -AxL, axl@wpcr.plymouth.edu - SysOp, RPM Director, WPCR Plymouth, 91.7 FM "Discriminate against the next fashion sucker you meet....it's a raver!" - Ec8or, Digital Hardcore Records +------------------------------------------------------------+ | 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