Hiya all,
I'm trying to add hidden objects, and a search command to find
them. Below is the code for my search command, but it doesn't compile.
The errors it spits out are also below. The only other thing I added for
the command in act.other.c was:
extern struct obj_data *object_list;
up at the top.
##########
# Errors #
##########
act.other.c: In function 'do_search':
act.other.c:164: invalid operands to binary &
act.other.c:164: parser error before '{'
act.other.c: At top level:
act.other.c:188: parse error before '{'
########
# Code #
########
ACMD(do_search)
{
byte percent;
struct obj_data *obj;
int roll = 20;
if (IS_DARK(ch->in_room) && !CAN_SEE_IN_DARK(ch))
send_to_char("It's too dark to search for anything!\r\n", ch);
else if (IS_AFFECTED(ch, AFF_BLIND))
send_to_char("Your blind, how can you search for anything?\r\n", ch);
else {
for (obj = world[ch->in_room].contents; obj; obj = obj->next_content) {
if (IS_SET(obj, ITEM_HIDDEN) {
if (GET_OBJ_COST(obj) > 100)
roll -= 15;
if (GET_OBJ_COST(obj) > 50)
roll -= 10;
if (GET_OBJ_COST(obj) > 10)
roll -= 5;
if (GET_OBJ_WEIGHT(obj) > 20)
roll += 10;
if (GET_OBJ_WEIGHT(obj) > 10)
roll += 5;
if (GET_OBJ_WEIGHT(obj) > 5)
roll += 2;
if (roll < 1)
roll = 2;
percent = number(1, 101);
if (percent <= roll) {
REMOVE_BIT(obj->obj_flags.extra_flags, ITEM_HIDDEN);
send_to_char("You found something.\r\n", ch);
break;
}
}
}
}
}
I also added
#define ITEM_HIDDEN (1 << 17)
in structs.h.
thanks in advance
Homer
aka Fionn Colvin :)
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST