Unfortunately this gets me back into the original problem I had with autoexits, that being with this snippet there will always be a comma at the end of the exits string. Therefore you end up with: Exits: North, East, West,. That was the main reason we had the flagged section was so we could have a version with comma's and the final value without. Any suggestions for this would be greatly appreciated :) Thanks for your help so far!! Ben >Your problem is simple. Your flag variable is causing problems and, is >actually, quite useless. Here, I'll rewrite your code: > >void do_auto_exits(struct char_data * ch) >{ > int door; > > *buf = '\0'; > > for (door = 0; door < NUM_OF_DIRS; door++) > if (EXIT(ch, door) && EXIT(ch, door)->to_room != NOWHERE) { > if (IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) > sprintf(buf + strlen(buf), " %s(Closed),", capdirs[door]); > else > sprintf(buf + strlen(buf), " %s,", capdirs[door]); > } > sprintf(buf2, "&cExits:%s.&n\r\n", ((*buf) ? buf : " None")); > >---- End Snippet ---- > >How clean does that look? Your color code in there is pointless as well. >Just have it in there at the last line. Shortens the buffer a bit too. -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT