Welcome to the Builder Academy

Question Why doesnt this work ?

More
19 Apr 2016 17:20 - 19 Apr 2016 20:10 #5776 by JTP
Why doesnt this work ? was created by JTP
.
Last edit: 19 Apr 2016 20:10 by JTP.

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

More
19 Apr 2016 18:38 #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.

More
19 Apr 2016 18:49 #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
19 Apr 2016 19:37 #5781 by thomas
Replied by thomas on topic Why doesnt this work ?
Code:
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:
Code:
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
19 Apr 2016 19:39 #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:
Code:
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.

More
19 Apr 2016 19:44 - 19 Apr 2016 19:46 #5784 by JTP
Replied by JTP on topic Why doesnt this work ?
Code:
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: 19 Apr 2016 19:46 by JTP.

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

Time to create page: 0.222 seconds