Karl Matthias This is a Circle port of SMAUG 1.4's 'compare' command. It basically allows you to compare two pieces of armour or two weapons, both of which you must have somewhere in your inventory. This is helpful to keep players from bugging your immorts with questisons like "which is better, a longsword or a BAD-ASS longsword"... you get the idea. It doesn't compare all aspects of a weapon, so if you want to add that functionality, you can. It basically just checks the values on the object. I assume the original code is by Thoric (Derek Snider), but it was not credited in the source. I had to hack this to hell to get it working on Circle. By: Karl N. Matthias (Relistan on Urath) E-mail: relistan@razors-edge.net Urath: urath.razors-edge.net 4000 ------------------------------------ Visit the Urath homepage at http://www.razors-edge.net/urath/ NOTE: You can do whatever you want with this code as long as you do not take credit for it. Giving me credit on your mud would be nice, but is not necessary. If you use it, drop me a note to let me know. The code isn''t perfect, so if you find bugs or nasties, let me know that, too! But you are on your own in installing this. If it completely junks your Mud, it''s not my fault. You have been warned. If you''re not a coder, get one to add this for you: it''s simple, but not THAT simple. WHAT IT IS: This is a Circle port of SMAUG 1.4''s ''compare'' command. It basically allows you to compare two pieces of armour or two weapons, both of which you must have somewhere in your inventory. This is helpful to keep players from bugging your immorts with questisons like "which is better, a longsword or a BAD-ASS longsword"... you get the idea. It doesn''t compare all aspects of a weapon, so if you want to add that functionality, you can. It basically just checks the values on the object. I assume the original code is by Thoric(Derek Snider), but it was not credited in the source. I had to hack this to hell to get it working on Circle. WHAT TO DO: Open up your act.item.c file and add this to the end of it. Make sure to add the appropriate lines in interpreter.c to make it available to your players. Doing this is fully documented elsewhere so I won''t cover it here. ACMD(do_compare) { char arg1[MAX_STRING_LENGTH]; char arg2[MAX_STRING_LENGTH]; struct obj_data *obj1; struct obj_data *obj2; int value1; int value2; char *msg; argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); if ( arg1[0] == ''\0'' ) { send_to_char( "Compare what to what?\n\r", ch ); return; } if (!(obj1 = get_obj_in_list_vis(ch, arg1, ch->carrying))) { send_to_char( "You do not have that item.\n\r", ch ); return; } if (arg2[0] == ''\0'') { for (obj2 = ch->carrying; obj2; obj2 = obj2->next_content) { if ( !((obj2->obj_flags.type_flag == ITEM_WEAPON) || (obj2->obj_flags.type_flag == ITEM_FIREWEAPON) || (obj2->obj_flags.type_flag == ITEM_ARMOR) || (obj2->obj_flags.type_flag == ITEM_WORN)) && CAN_SEE_OBJ(ch, obj2) && obj1->obj_flags.type_flag == obj2->obj_flags.type_flag && CAN_GET_OBJ(ch, obj2) ) break; } if (!obj2) { send_to_char( "You aren''t wearing anything comparable.\n\r", ch ); return; } } else { if (!(obj2 = get_obj_in_list_vis(ch, arg2, ch->carrying))) { send_to_char( "You do not have that item.\n\r", ch ); return; } } msg = NULL; value1 = 0; value2 = 0; if (obj1 == obj2) { msg = "You compare $p to itself. It looks about the same."; } else if ( obj1->obj_flags.type_flag != obj2->obj_flags.type_flag ) { msg = "You can''t compare $p and $P."; } else { switch (obj1->obj_flags.type_flag) { default: msg = "You can''t compare $p and $P."; break; case ITEM_ARMOR: value1 = obj1->obj_flags.value[0]; value2 = obj2->obj_flags.value[0]; break; case ITEM_WEAPON: value1 = obj1->obj_flags.value[1] + obj1->obj_flags.value[2]; value2 = obj2->obj_flags.value[1] + obj2->obj_flags.value[2]; break; } } if (!msg) { if (value1 == value2) msg = "$p and $P look about the same."; else if (value1 > value2) msg = "$p looks better than $P."; else msg = "$p looks worse than $P."; } act(msg, FALSE, ch, obj1, obj2, TO_CHAR); return; }