for (door = 0; door <= 5; door++)
{
if (fAuto)
{
strcat (buf, " ");
strcat (buf, dir_name[door]);
if (door < 5)
strcat (buf, ",");
}
if (fAuto)
{
strcat (buf, " ");
strcat (buf, dir_name[door]);
if (door < 5)
{
if ((pexit = ch->in_room->exit[door+1]) != NULL) //checks to make sure the next exit is valid, otherwise we don't need the comma.
strcat (buf, ",");
}
}
if (fAuto)
{
strcat (buf, " ");
strcat (buf, dir_name[door]);
strcat (buf, ",");
}
// outside the for loop
if (fAuto && buf[0])
{
buf[strlen(buf) - 1] = 0;
}
I am playing around with QuickMUD and what I am trying to do is to get autoexit to display exits with commas instead of spaces:
[Exits: north, south, west, down] instead of [Exits: north south west down]
In act_info.c:
If I put a comma in there – strcat (buf, ", "); it gives me:
[Exits: , north, south, west, down]
And if I move it down to below strcat (buf, dir_name[door]); then it gives me:
[Exits: north, south, west, down, ]
I totally understand why it is coming out this way but can someone explain to me a way to have it format properly? I just want to figure out a way to have the last direction displayed without a comma but I don't know how to program the mud to do it. Thanks!