Welcome to the Builder Academy

Question "buf" in old snippits

More
23 Jul 2012 01:39 #418 by Papaya Pete
Yeah, that did it! I had accidentally put it under "char_special_data" instead of "char_data".

So here is another error that's coming up, in interpreter.c. Here is the error message...
Code:
interpreter.c: In function ‘command_interpreter’: interpreter.c:492:5: error: ‘temp’ undeclared (first use in this function) interpreter.c:492:5: note: each undeclared identifier is reported only once for each function it appears in interpreter.c:493:22: warning: assignment makes integer from pointer without a cast

So here is the actual lines of code with some of what is around it.
Code:
REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE); // Eavesdrop if (ch->listening_to) { REMOVE_FROM_LIST(ch, world[ch->listening_to].listening, next_listener); ch->listening_to = NULL; } // End Eavesdrop /* just drop to next line for hitting CR */ skip_spaces(&argument); if (!*argument) return; /* special case to handle one-character, non-alphanumeric commands; requested * by many people so "'hi" or ";godnet test" is possible. Patch sent by Eric * Green and Stefan Wasilewski. */ if (!isalpha(*argument)) { arg[0] = argument[0]; arg[1] = '\0'; line = argument + 1; } else line = any_one_arg(argument, arg);

So the instructions for the snippit mentioned putting in that small bit after where the HIDE affect is removed (just from what I remember, I don't have the instructions open in front of me).

I'll take another look, I've been unable to reply due to being so busy. Thank you so much for your help!

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

More
23 Jul 2012 02:49 #419 by Vatiken
Replied by Vatiken on topic Re: "buf" in old snippits
"REMOVE_FROM_LIST" uses the variable "temp" within it's definition. The variable should be the same as the first variable ("ch") sent in "REMOVE_FROM_LIST".

You should be able to solve your first warning then by entering "struct char_data *temp;" at the beginning of the function.

The second issue is because you are attempting to set "sh_int listening_to" to "NULL", which is invalid because "NULL" sets a pointer to 0x0. As I'm not sure what "listening_to" is actually for, I can't really offer up any accurate advice for what it should then be set to.

tbaMUD developer/programmer

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

More
23 Jul 2012 17:39 #422 by Papaya Pete
That seemed to work, and did a little playing around with it (changed NULL to 0 just to see what will happen; I have the feeling it's going to be listening to a location constantly or something, heh).

Now in comm.c there is an issue with SEND_TO_Q, as it's saying that this is undefined. Here's the snippit in comm.c, I left in the old send_to_room so that it's more easily compared.
Code:
/* New Eavesdrop send_to_room */ void send_to_room(room_rnum room, const char *messg, ...) { struct char_data *i; if (messg) { for (i = world[room].people; i; i = i->next_in_room) if (i->desc) SEND_TO_Q(messg, i->desc); for (i = world[room].listening; i; i = i->next_listener) if (i->desc) { /* the ------'s are used to differentiate eavesdropped stuff from * the stuff that is happening in the same room as the char.. * looks like: * ------- * john dropped a sword * ------ */ sprintf("----------\r\n%s----------\r\n", messg); SEND_TO_Q(i->desc); } } } /* This is the old send_to_room code, before eavesdrop void send_to_room(room_rnum room, const char *messg, ...) { struct char_data *i; va_list args; if (messg == NULL) return; for (i = world[room].people; i; i = i->next_in_room) { if (!i->desc) continue; va_start(args, messg); vwrite_to_output(i->desc, messg, args); va_end(args); } } */

Not sure what SEND_TO_Q is used for, do you happen to remember what it does?

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

More
23 Jul 2012 19:03 #423 by Vatiken
Replied by Vatiken on topic Re: "buf" in old snippits
Pretty sure it serves the same purpose as "write_to_output()", so just go:

write_to_output(i->desc, messg);

tbaMUD developer/programmer

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

More
23 Jul 2012 23:02 #424 by Papaya Pete
So that worked out, it compiled and ran. However, when trying to eavesdrop on the next room nothing was sent to the one eavesdropping. I took a brief look around and saw that someone had the same problem. So they tried adding to act() in comm.c:

At the top of act():
Code:
struct char_data *evasdropper;

At the bottom of act():
Code:
for (; to; to = to->next_in_room) { if (!SENDOK(to) || (to == ch)) continue; if (hide_invisible && ch && !CAN_SEE(to, ch)) continue; if (type != TO_ROOM && to == vict_obj) continue; perform_act(str, ch, obj, vict_obj, to); } /* ADD EAVESDROP STUFF HERE: */ /* Send action to any eavesdroppers in neighboring rooms */ for (eavesdropper = world[ch->in_room].listening; eavesdropper; eavesdropper = eavesdropper->next_listener) { if (eavesdropper->desc) { /* the ------'s are used to differentiate eavesdropped stuff from * the stuff that is happening in the same room as the char.. * looks like: * ------- * john dropped a sword * ------ */ SEND_TO_Q("----------\r\n", eavesdropper->desc); perform_act(str, ch, obj, vict_obj, eavesdropper); SEND_TO_Q("----------\r\n", eavesdropper->desc); } }

So I tried using write_to_output instead of SEND_TO_Q. Didn't quite work out.
Code:
comm.c: In function ‘act’: comm.c:2695:7: warning: passing argument 1 of ‘write_to_output’ from incompatible pointer type comm.c:1258:8: note: expected ‘struct descriptor_data *’ but argument is of type ‘char *’ comm.c:2695:7: warning: passing argument 2 of ‘write_to_output’ from incompatible pointer type comm.c:1258:8: note: expected ‘const char *’ but argument is of type ‘struct descriptor_data *’ comm.c:2697:7: warning: passing argument 1 of ‘write_to_output’ from incompatible pointer type comm.c:1258:8: note: expected ‘struct descriptor_data *’ but argument is of type ‘char *’ comm.c:2697:7: warning: passing argument 2 of ‘write_to_output’ from incompatible pointer type comm.c:1258:8: note: expected ‘const char *’ but argument is of type ‘struct descriptor_data *’

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

More
24 Jul 2012 00:07 #429 by Vatiken
Replied by Vatiken on topic Re: "buf" in old snippits
Your write_to_output() arguments are reversed...

tbaMUD developer/programmer

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

Time to create page: 0.213 seconds