Colours, codes and pointers

by Unknown

Back to Mechanic's Corner.

Unknown2005-12-23 04:31:47
Ok, so I'm trying to modify Whyte's system from Imperian to suit Lusternia's unique charms, and one thing that I need to do is grab and store the color codes from each prompt line.

The raw data sent from the Lusternian server at each prompt is, for example:

 = 0;
   p_health = atoi( q );
 }
}



That's having problems, so obviously something is really wrong... but is anyone able to spot it? I'm only a hobbyist coder, so don't laugh at me if it's something really silly. unsure.gif

Incidentally, would anyone be interested in starting a collaborative effort to build up a few Lusternian modules for Whyte's system? Let's call it, Project M, the successor to Project Z. tongue.gif I like the thought of a free mudbot program for Lusternia because it works with any client, including nexus. Plus Whyte is a genius, and his system is beautiful.


Edit: In case that string above isn't showing correctly, the integer values for the same characters are:

27,91,51,55,109,27,91,51,50,109,50,57,56,57,104,44,27,91,51,55,109,27,91,51,50,109,32,52,53,51,52,109,44,27,91,51,55,109,27,91,51,50,109,32,53,51,48,54,101,44,27,91,51,55,109,27,91,51,50,109,32,49,48,112,44,27,91,51,55,109,27,91,51,50,109,32,49,50,52,57,48,101,110,44,27,91,51,55,109,27,91,51,50,109,32,49,57,53,49,48,119,27,91,51,55,109,32,101,120,45
Unknown2005-12-23 04:33:36
Oh, if it helps, this is the original for Imperian, that works perfectly.


CODE

if ( ( p = strstr( rawline, "H:" ) ) )
  {
     if ( *(p+2) == '\\33' )
       {
   c = p_color_hp;
   p += 2;
   while( *p != 'm' )
     *c++ = *p++;
   *c++ = *p++;
   *c = 0;
   p_hp = atoi( p );
       }
     else
       {
   p_color_hp = 0;
   p_hp = atoi( p + 2 );
       }
  }

Unknown2005-12-23 05:33:06
The only thing I could gues at is 32M32M is a hexidecimal colour code? I can't check at the moment though.

And there my help stops. lol.
Tiran2005-12-23 05:44:36
The colour codes are defined by the ANSI X3.64 standard. These codes are of the form: 
Unknown2005-12-23 05:52:14
QUOTE(Tiran @ Dec 23 2005, 05:44 AM)
The colour codes are defined by the ANSI X3.64 standard. These codes are of the form: 239369

Wow, that is so helpful... thankyou!!! wub.gif