Why doesnt this work ?

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 5 months ago - 2 years 5 months ago #5776 by JTP
Why doesnt this work ? was created by JTP
.
Last edit: 2 years 5 months ago by JTP.

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

More
2 years 5 months ago #5778 by rudeboyrave
Replied by rudeboyrave on topic Why doesnt this work ?
take a look at do_stat (and do_stat_character, do_stat_object, do_stat_room) and look how the command stat determines if the argument is a mob or obj or room. im thinking you need to make that a 2 argument command so the game knows to look for a mob or an object etc when a player is loreing.

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 5 months ago #5780 by JTP
Replied by JTP on topic Why doesnt this work ?
Tryed two_arguments...compiles ok. But same problems as above.

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

More
2 years 5 months ago #5781 by thomas
Replied by thomas on topic Why doesnt this work ?
  if (!(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_ROOM))) {
    send_to_char(ch, "Lore who?\r\n");
    return;
  }
  if (!(obj = get_obj_in_list_vis(ch, buf, NULL, ch->carrying))) {
    send_to_char(ch, "You can't seem to find that item.\r\n");
    return;
  }
This code is your problem.
Change to something like this:
  if (!(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_ROOM))) {
    if (!(obj = get_obj_in_list_vis(ch, buf, NULL, ch->carrying))) {
      send_to_char(ch, "Lore who or what?\r\n");
      return;
    }
  }
Only checks for an item if there's no character with the name in the room.

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

More
2 years 5 months ago #5782 by thomas
Replied by thomas on topic Why doesnt this work ?
Actually, I'd suggest an even more readable approach, now I look at that response:
  vict = get_char_vis(ch, buf, NULL, FIND_CHAR_ROOM);
  obj = get_obj_in_list_vis(ch, buf, NULL, ch->carrying);
  if (!vict && !obj) {
    send_to_char(ch, "Lore who or what?\r\n");
    return;
  }

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 5 months ago - 2 years 5 months ago #5784 by JTP
Replied by JTP on topic Why doesnt this work ?
  if (!(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_ROOM))) {
    if (!(obj = get_obj_in_list_vis(ch, buf, NULL, ch->carrying))) {
      send_to_char(ch, "Lore who or what?\r\n");
      return;
    }
  }
that gave me this warning:


act.informative.c: In function ‘do_lore’:
act.informative.c:3022: warning: ‘obj’ is used uninitialized in this function

if (obj) { <<-- this is line 3022


i will try the other thing you wrote
Last edit: 2 years 5 months ago by JTP.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 5 months ago #5785 by JTP
Replied by JTP on topic Why doesnt this work ?
Sweet that worked Thomas..Thanks alot.

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

More
2 years 4 months ago #5816 by Parnassus
Replied by Parnassus on topic Why doesnt this work ?
It's nice that you got it to work but is there a reason that the question is gone? It makes the topic so confusing.

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

More
2 years 4 months ago #5841 by Krell
Replied by Krell on topic Why doesnt this work ?
Oh good, I thought it was just me. Thanks Parnassus.

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

Time to create page: 1.303 seconds