do_show for mortals [by Xual]
Snippet Posted Sunday, October 25th @ 07:04:22 PM, by George Greer in the Objects dept.
Xual writes "This command is used to show the extra description of an object to another player, if one exists with the same name as the object. If you decide to use this code, all I ask is that you send me an email to let me know what you think."
This command is used to show the extra description of an object to another
player, if one exists with the same name as the object.  I thought that it 
was more important as a player command, so I renamed all occurences of the
wiz command "show" to "gshow".  I'll leave the interpreter.c stuff up to
you, adding commands is pretty well documented elsewhere.  If you decide to
use this code, all I ask is that you send me an email to let me know what
you think.

Xual
Implementor, Danathara Online RPG
xual@satanspawn.ml.org 

ACMD(do_show)
{
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char *desc;
	struct char_data *victim;
	struct obj_data *obj;
	int tmp;

	two_arguments(argument, arg1, arg2);

	if(!*arg1){
	  send_to_char("Show what to whom?\r\n", ch);
	  return;
	}
	else if(!*arg2){
	  send_to_char("Who did you want to show that to?\r\n", ch);
	  return;
        }
	if(!(victim = get_char_vis(ch, arg2))){
	  send_to_char(NOPERSON, ch);
	  return;
	}
	else if(victim == ch){
	  send_to_char("Ha Ha!  Why don't you just look at it?\r\n", ch);
	  return;
	}
	else if(AFF_FLAGGED(victim, AFF_BLIND)) {
	  sprintf(buf, "%s is blind and can see nothing.\r\n", GET_NAME(victim));
	  send_to_char(buf, ch);
	  return;
	}
	else if(IS_DARK(victim->in_room) && !CAN_SEE_IN_DARK(victim)) {
	  send_to_char("It's too dark!\r\n", ch);
	  sprintf(buf, "%s tries to show you something, but it's too dark to see.\r\n", GET_NAME(ch));
	  send_to_char(buf, victim);
	  return;
	}
	else  
          if((obj = get_obj_in_list_vis(ch, arg1, ch->carrying))  ||
	     (obj = get_object_in_equip_vis(ch, arg1, ch->equipment, &tmp))) {
	    if ((desc = find_exdesc(arg1, obj->ex_description)) != NULL) {
	      sprintf(buf, "You show %s to %s.\r\n", obj->short_description, GET_NAME(victim));
	      send_to_char(buf, ch);
	      sprintf(buf, "%s shows you %s.\r\n", GET_NAME(ch), obj->short_description);
	      send_to_char(buf, victim);
		  send_to_char(desc, victim);
	      }
	    else {
	      sprintf(buf, "You show %s to %s.\r\n", obj->short_description, GET_NAME(victim));
	      send_to_char(buf, ch);
	      sprintf(buf, "%s shows you %s.\r\nYou see nothing special about it.\r\n", GET_NAME(ch), 
		          obj->short_description);
	      send_to_char(buf, victim);
		  }
	  }
	  else {
	    sprintf(buf, "You dont seem to have %s %s.\r\n", AN(arg1), arg1);
	    send_to_char(buf, ch);
	  }
	 	  
}

<< CGI Scripts: Making Life Simple | Reply | View as text | Flattened | Score snippet [by Hellfire] >>

 


Related Links
  Xual
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.