Ok i got a small problem with a special procedure i wrote a while back.
This specials idea is that every time you sip from the holy_grail it
changes its liquid type to next in list. And when you drink from it and
its empty it refills itself and here is where my problem is. When i
refill the grail it changes it's liquid to the original liquid , the one
set when object is created. Don't think there would be something wrong
with my code but i posts it as well.
SPECIAL(holy_grail)
{
struct obj_data *obj;
struct char_data *victim = NULL;
const int grail_vnum = 21;
int type;
/* Command is neither sip or drink. */
if(!(CMD_IS("sip") || CMD_IS("drink")))
return 0;
one_argument(argument, buf);
if (!generic_find(buf, FIND_OBJ_INV, ch, &victim, &obj))
return 0; /* Object not found */
if(GET_OBJ_VNUM(obj) != 21) /* Is not the grail exiting */
return 0;
if(CMD_IS("sip"))
{
/* Changes the contents of the grail to next type in Liquid list
*/
GET_OBJ_VAL(obj, 2) = GET_OBJ_VAL(obj, 2) + 1;
/* Make sure we don't go over NUM_LIQ_TYPES */
if(GET_OBJ_VAL(obj, 2) >= NUM_LIQ_TYPES)
GET_OBJ_VAL(obj, 2) = 0;
/* Print out some messages to room and character */
sprinttype(GET_OBJ_VAL(obj, 2), drinks, buf2);
sprintf(buf, "As you take a sip from $p it's contents suddenly
changes to %s", buf2);
act(buf, FALSE, ch, obj, NULL, TO_CHAR);
act("As $n sips from $p it's contents suddenly changes", FALSE,
ch, obj, NULL, TO_ROOM);
return 1;
}
else
{
/* If the grail is empty refill it */
if(GET_OBJ_VAL(obj, 1) == 0)
{
/* Refill it to maximum */
GET_OBJ_VAL(obj, 1) = GET_OBJ_VAL(obj, 0);
act("You see $p refill before youre very eyes. AMAZING!!",
FALSE, ch, obj, NULL, TO_CHAR);
act("As $n drinks the last drop from $p it refills.", FALSE,
ch, obj, NULL, TO_ROOM);
return 1;
}
else
return 0;
}
}
Ulrik
+------------------------------------------------------------+
| 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/08/00 PST