Welcome to the Builder Academy

Question Ideas for traps/detecting/removing

More
31 Jul 2017 16:06 #6813 by JTP
Hmm
Code:
static void look_in_direction(struct char_data *ch, int dir) { if (EXIT(ch, dir)) { room_rnum going_to EXIT(ch, dir)->to_room; <<--621 if (EXIT(ch, dir)->general_description) send_to_char(ch, "%s", EXIT(ch, dir)->general_description); if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword) send_to_char(ch, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword)); else if (EXIT_FLAGGED(EXIT(ch, dir), EX_ISDOOR) && EXIT(ch, dir)->keyword) send_to_char(ch, "The %s is open.\r\n", fname(EXIT(ch, dir)->keyword)); else if (going_to != NOWHERE && ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_SKILL(ch, SKILL_SENSE_TRAP) > 95) <<--629 send_to_char(ch, "You sense that a trap might be there.\r\n"); } else send_to_char(ch, "Nothing special there...\r\n"); } gcc -g -O2 -Wall -c -o act.informative.o act.informative.c act.informative.c: In function ‘look_in_direction’: act.informative.c:621: error: expected ‘)’ before ‘[’ token act.informative.c:629: error: ‘going_to’ undeclared (first use in this function) act.informative.c:629: error: (Each undeclared identifier is reported only once act.informative.c:629: error: for each function it appears in.) make[1]: *** [act.informative.o] Error 1

Please Log in or Create an account to join the conversation.

More
01 Aug 2017 21:21 #6814 by thomas
re-read the code. You are missing a = on the line it is complaining about :)

Please Log in or Create an account to join the conversation.

More
01 Aug 2017 21:51 #6815 by JTP
Cool thanks the missing = helped

But if the character dont have sense trap and type look up or l u in a direction where there is an up.

No message at all comes, it just makes an empty line ?

Looking in any direction that isnt there i get Nothing special there.

Please Log in or Create an account to join the conversation.

More
03 Aug 2017 15:37 #6816 by thomas
Do not use "else if" on that line, just "else"

Please Log in or Create an account to join the conversation.

More
03 Aug 2017 19:15 - 03 Aug 2017 19:16 #6817 by JTP
If i change the last else if to else, then i get:

act.informative.c: In function ‘look_in_direction’:
act.informative.c:630: warning: value computed is not used
act.informative.c:630: error: expected ‘;’ before ‘send_to_char’
make[1]: *** [act.informative.o] Error 1

If i put a ; in the end. Then i still get the value computed is not used ?
Last edit: 03 Aug 2017 19:16 by JTP.

Please Log in or Create an account to join the conversation.

More
04 Aug 2017 12:08 #6818 by thomas
Does this work?
Code:
static void look_in_direction(struct char_data *ch, int dir) { if (EXIT(ch, dir)) { if (EXIT(ch, dir)->general_description) send_to_char(ch, "%s", EXIT(ch, dir)->general_description); if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword) send_to_char(ch, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword)); else if (EXIT_FLAGGED(EXIT(ch, dir), EX_ISDOOR) && EXIT(ch, dir)->keyword) send_to_char(ch, "The %s is open.\r\n", fname(EXIT(ch, dir)->keyword)); room_rnum going_to = EXIT(ch, dir)->to_room; if (going_to != NOWHERE && ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_SKILL(ch, SKILL_SENSE_TRAP) > 95) send_to_char(ch, "You sense that a trap might be there.\r\n"); } else send_to_char(ch, "Nothing special there...\r\n"); }

Please Log in or Create an account to join the conversation.

Time to create page: 0.217 seconds