battle prompt

Posted by Ithildin on Fri 05 Mar 2004 07:05 AM — 3 posts, 13,697 views.

USA #0
ok, so i'm switching everything from my windows smaug to smaugfuss on cygwin. but not everything compiles correctly. in my battle prompt, on my windows version, it shows something like this:

hp mana mv Ithildin: [Perfect Health] mob: [Perfect Health]

whenever i switched it to the smaugfuss, it only shows:

hp mana mv %s: [Perfect Health] %s: [Perfect Health]

here's some of my code:


case 'C':  /* Tank */
	  if ( !IS_IMMORTAL( ch ) ) break;
          if ( !ch->fighting || ( victim = ch->fighting->who ) == NULL )
             strcpy( pbuf, "N/A" );
          else if(!victim->fighting||(victim = victim->fighting->who)==NULL)
             strcpy( pbuf, "N/A" );
          else {
              if ( victim->max_hit > 0 )
                    percent = (100 * victim->hit) / victim->max_hit;
              else
                    percent = -1;
                   if (percent >= 100)
                       strcpy (pbuf, "&c%s: [\x1b[1;32mPerfect Health\x1b[0m]");
                   else if (percent >= 90)
                       strcpy (pbuf, "&c%s: [\x1b[33mSlightly Scratched\x1b[0m]");
                   else if (percent >= 80)
                       strcpy (pbuf, "&c%s: [\x1b[1;33mFew Bruises\x1b[0m]");
                    else if (percent >= 70)
                       strcpy (pbuf, "&c%s: [\x1b[1;33mSome Cuts\x1b[0m]");
                    else if (percent >= 60)
                       strcpy (pbuf, "&c%s: [\x1b[1;35mSeveral Wounds\x1b[0m]");
                    else if (percent >= 50)
                       strcpy (pbuf, "&c%s: [\x1b[35mNasty Wounds\x1b[0m]");
                    else if (percent >= 40)
                       strcpy (pbuf, "&c%s: [\x1b[35mBleeding Freely\x1b[0m]");
                    else if (percent >= 30)
                       strcpy (pbuf, "&c%s: [\x1b[31mCovered in Blood\x1b[0m]");
                    else if (percent >= 20)
                       strcpy (pbuf, "&c%s: [\x1b[1;31mLeaking Guts\x1b[0m]");
                    else if (percent >= 10)
                       strcpy (pbuf, "&c%s: [\x1b[1;31mAlmost Dead\x1b[0m]");
                    else
                       strcpy (pbuf, "&c%s: [\x1b[1;31mDYING\x1b[0m]");
             }
          break;



how do i make the names go back into the %s?

USA #1
ok, i found it. i changed to sprintf and put a victim->name in there. worked.
Canada #2
BTW, you may want to remove the manual color codes, and put in the mud ones. If you don't, this will force color on the person, even if they have color turned off, and should someone be using a really old client, may cause other problems.