Ideas for traps/detecting/removing

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
9 months 2 weeks ago #6821 by JTP
JTP replied the topic: Ideas for traps/detecting/removing
static void look_in_direction(struct char_data *ch, int dir)
{
  int anything_special = FALSE;

  if (EXIT(ch, dir)) {
    if (EXIT(ch, dir)->general_description && anything_special = TRUE)
      send_to_char(ch, "%s", EXIT(ch, dir)->general_description);

    if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword && anything_special = TRUE)
      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 && anything_special = TRUE)
      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 && anything_special = TRUE)
      send_to_char(ch, "You sense that a trap might be there.\r\n");

    }
    if (!anything_special)
    send_to_char(ch, "Nothing special there...\r\n");
}


act.informative.c: In function ‘look_in_direction’:
act.informative.c:622: error: invalid lvalue in assignment
act.informative.c:625: error: invalid lvalue in assignment
act.informative.c:627: error: invalid lvalue in assignment
act.informative.c:632: error: invalid lvalue in assignment


The errors is in all 4 lines where anything_special is used ?

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

More
9 months 2 weeks ago #6822 by thomas
thomas replied the topic: Ideas for traps/detecting/removing
My bad. The statements are being interpreted as "a && b && c = d" and everyone can see that "a && b && c" isn't a valid l-value. However, if you add some parenthesis:
static void look_in_direction(struct char_data *ch, int dir)
{
  int anything_special = FALSE;

  if (EXIT(ch, dir)) {
    if (EXIT(ch, dir)->general_description && (anything_special = TRUE))
      send_to_char(ch, "%s", EXIT(ch, dir)->general_description);

    if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword && (anything_special = TRUE))
      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 && (anything_special = TRUE))
      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 && (anything_special = TRUE))
      send_to_char(ch, "You sense that a trap might be there.\r\n");

    }
    if (!anything_special)
    send_to_char(ch, "Nothing special there...\r\n");
}
That is the problem with browser code - long feedback cycles.

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

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
9 months 2 weeks ago - 9 months 2 weeks ago #6824 by JTP
JTP replied the topic: Ideas for traps/detecting/removing
Yea browser code is hard.

It compiled but didnt show room name when looking in a possible direction :(

Only gives right message is there is no exit where your trying to look.

Hope we can solve this...It would be cool if it was possible for a player with sense trap to both get the room name and trap message.

And players without sense trap just the room name.


Looking at a closed direction Works, so why not the room name...
If i remove the trap part. It Works like it should with room name.
Last Edit: 9 months 2 weeks ago by JTP.

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

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
9 months 2 weeks ago #6825 by JTP
JTP replied the topic: Ideas for traps/detecting/removing
static void look_in_direction(struct char_data *ch, int dir)
{
  if (EXIT(ch, dir)) {
    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");

    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
    send_to_char(ch, "Nothing special there...\r\n");
}


This worked for my imp with sense trap up until a test char without sense trap tryed to look in a direction.
Then after that it didnt Work for my imp either..

Something is messed up with the trap part just dont know what.

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

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
9 months 2 weeks ago #6826 by JTP
JTP replied the topic: Ideas for traps/detecting/removing
Just removed all the trap part.

Seems looking in a direction only Works in some zones like god zone and old stock start city..

But not in my new start city ??? So wierd.

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

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
9 months 2 weeks ago #6827 by JTP
JTP replied the topic: Ideas for traps/detecting/removing
Ok problem solved, exits in my new city dont have exit descriptions set DOH :) my bad.

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

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
9 months 2 weeks ago #6828 by JTP
JTP replied the topic: Ideas for traps/detecting/removing
Its going to take for ever to add this exit description to all the new zones 8)

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

Time to create page: 1.169 seconds