Ugh, I'm doing my first actual coding for a mud, and I was adding a command that when you type TALK <mob>, it sends back a message specific to the vnum with that mob - I got it working, but now I seem to be having some problems - for one thing, it isn't sending back anything at all when you talk to mobs. Can someone look at my code and help my find my errors? It's really rough, I know, and there is probally better ways to do my programming, so if you're expert, please don't flame me. ** act.other.c** At the external variables I added the second line (didn't need to add the first, it was already there) extern struct index_data *mob_index; char *mob_talk (int vnum); Added this function: ACMD(do_talk) { struct char_data *victim; one_argument(argument, buf); if (!(victim = get_char_room_vis(ch, buf))) { send_to_char("Talk to whom?\r\n", ch); return; } if (victim == ch) { send_to_char("No, no, no! You are quite confused.\r\n", ch); return; } if (!IS_NPC(victim)) { send_to_char("That's another player. Try the 'Say' command.\r\n", ch); return; } strcat(buf, mob_talk(GET_MOB_VNUM(victim))); } ** talk.c ** (new file) I just made an switch/case here, I didn't want mess with the mob files. #include "sysdep.h" #include "conf.h" #include "structs.h" #include "interpreter.h" #include "utils.h" /* Add the vnum of the mob and what you want it say in the below format. */ char *mob_talk(int vnum) { switch (vnum) { case 100: return "Bob says, 'I saw a man down by the river, maybe you should check him out.'"; break; default: return "They have nothing to say."; break; } } And of course I added the appropriate code in the interpeter.c and Makefile. I think that is everything, but I'm not sure. But for some reason, it doesn't print anymore what I want it to say. Anyone have some suggestions? Oh, and if I can get this code working, it would be kewl if it was added to the snippets page. I guess that's it. (I think, I'd hate it if I forgot something.) I also wanna code a patch for medit, and eventually add this to the .mob format, but currently its too much of a hassle, and this seemed easier. Monthi +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST