First off.. Please don't post without a subject.
It's even slightly more annoying than a bad subject.
On Tue, 21 May 2002, Nicholas Hutzell wrote:
> I am messing with do_who trying to manual code in
> pretitles for me and my other coder
I will start off with a suggestion. Instead of hard coding the
pretitles in for each person, do it in a more general way.
I know there is at least one snippet floating around on how to do this.
That's my suggestion. Now on to the problem at hand.
> but when i get it all up i get the pretitle but nothing after it...
That's not completely accurate. If you investigate a little more,
you'll find that (Inco) and (Wizi) still come after the pretitle if
they're on.
> does anyone know what my problem might be?
Yep. Even before I looked at your code.
> Here is what i have here..
Since apparently you are incapable of comparing a dozen lines of
code between a working version and a non-working version, I'll help you
out.
> if (!str_cmp(wch->name,"Cuthbert") ||
> (!str_cmp(wch->name,"Pallock")))
> {
Here is the code for the special cases of Cuthbert and Pallock.
This is the "non-working version". Since we have an almost identical
"working version" in the else part, we'll compare to that.
> sprintf(buf,"{D[ {w+{W-{R>{w
> C{Wo{Dde{Wr{wX {R<{W-{w+{D ]{w %s%s{x\n\r",
Taking out the color codes, so it's easier to see what's there:
sprintf(buf, "[ +-> CoderX <-+ ] %s%s\n\r"
[All the rest of this code is identical in the two versions]
> }
> else
> {
> sprintf( buf, "{D[ {w%3d {W%6s
> {R%s {D]{x %s%s%s%s%s%s%s%s{x\n\r",
Once again, taking out the color codes for readability:
sprintf(buf, "[ %3d %6s %s ] %s%s%s%s%s%s%s%s\n\r",
> wch->level,
> wch->race < MAX_PC_RACE ?
> pc_race_table[wch->race].who_name
> : " ", class,
[All the rest of this code is identical in the two versions]
> }
Ok. We have two versions of the code that do almost the exact
same thing. One works and one doesn't. And we've determined that
they are identical except for the parts quoted above.
So by logical deduction, we can conclude that the problem lies in
those few lines above.
I'll give you a hint: It's not the "wch->level,", "wch->race ...",
or "... class," lines.
That leaves us with one line in the working version and one in the
non-working version. So let's compare those two lines to find the
problem (I'll use the versions without the color codes to make
it easier to see what's happening):
Working: sprintf(buf, "[ %3d %6s %s ] %s%s%s%s%s%s%s%s\n\r",
Non-working: sprintf(buf, "[ +-> CoderX <-+ ] %s%s\n\r"
Now we compare those two lines. They start off the same.. sprintf(buf, "
and end the same.. \n\r", so it's not those parts. That leaves us with:
Working: [ %3d %6s %s ] %s%s%s%s%s%s%s%s
Non-working: [ +-> CoderX <-+ ] %s%s
Now from testing, you determined that the "[ +-> CoderX <-+ ]" part works
correctly. So we can eliminate that part too. That leaves us with:
Working: %s%s%s%s%s%s%s%s
Non-working: %s%s
Hmm.. I think I've almost figured out what the problem is.
But I'm getting hungry. I think I'll go get a snack.
Since I've narrowed it down a little, I'll let you try to find
the problem from here while I go look for something to munch on.
Dennis