- Posts: 937
- Thank you received: 17
Why doesnt this work ?
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
6 years 9 months ago - 6 years 9 months ago #5776
by JTP
Why doesnt this work ? was created by JTP
.
Last edit: 6 years 9 months ago by JTP.
Please Log in or Create an account to join the conversation.
- rudeboyrave
-
- Offline
- Premium Member
-
6 years 9 months ago #5778
by rudeboyrave
CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.
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 Member
-
Less
More
- Posts: 937
- Thank you received: 17
6 years 9 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.
- thomas
-
- Offline
- Administrator
-
Less
More
- Posts: 792
- Thank you received: 153
6 years 9 months ago #5781
by thomas
This code is your problem.
Change to something like this:Only checks for an item if there's no character with the name in the room.
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;
}
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;
}
}
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
Less
More
- Posts: 792
- Thank you received: 153
6 years 9 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 Member
-
Less
More
- Posts: 937
- Thank you received: 17
6 years 9 months ago - 6 years 9 months ago #5784
by JTP
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
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;
}
}
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: 6 years 9 months ago by JTP.
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 937
- Thank you received: 17
6 years 9 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.
- Parnassus
- Offline
- Administrator
-
Less
More
- Posts: 370
- Thank you received: 54
6 years 8 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.
- krell
-
- Offline
- Elite Member
-
Less
More
- Posts: 241
- Thank you received: 14
6 years 8 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: 0.170 seconds