They are the same, either remove the first one completely, or comment it out.

as a different alternative, color can be quite easy to add, if you don't want
all the customability of lopes. (personal color saved to pfiles).

below is a snippet of my (not sure who had the original idea, wasn't me though)
write_to_descriptor function. it allows the color character to be ` instead of
~ or { and has worked like a charm for years.

------->CODE<-----------
/*
* Lowest level output function.
* Write a block of text to the file descriptor.
* If this gives errors on very long blocks (like 'ofind all'),
*   try lowering the max block size.
*/
bool write_to_descriptor( int desc, char *txt, int length )
{
 int iStart;
 int nWrite;
 int nBlock;
 int i = 0, k = 0, j= 0, r = 0, z = 0;
 char tmptxt[4*MSL], col_Code;
 const char ran[] = "01234567";

 length = strlen( txt );


 // Find and expand color codes to ANSI type.
 for( i=0, k=0; i < length; i++ )
  {
  j = number_range(0,7);
  r = number_range(0,1);
  if( r==0 && j==0)
   j++;
  if(z==0)
   z++;
  if ( txt[i] != '`' )
   {
   tmptxt[k++] = txt[i];
   }
  else
   {
   tmptxt[k++] = 27;
   tmptxt[k++] = '[';
   col_Code = txt[++i];
   switch( col_Code )
    {
    case '`' : k -= 2;     tmptxt[k++] = '`'; continue;
    case 'r' : tmptxt[k++] = '0'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '1'; z=1;break;
    case 'g' : tmptxt[k++] = '0'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '2'; z=2;break;
    case 'y' : tmptxt[k++] = '0'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '3'; z=3;break;
    case 'b' : tmptxt[k++] = '0'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '4'; z=4;break;
    case 'm' : tmptxt[k++] = '0'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '5'; z=5;break;
    case 'c' : tmptxt[k++] = '0'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '6'; z=6;break;
    case 'w' : tmptxt[k++] = '0'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '7'; z=7;break;
    case 'D' : tmptxt[k++] = '1'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '0'; z=0;break;
    case 'R' :  tmptxt[k++] = '1'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '1'; z=1;break;
    case 'G' : tmptxt[k++] = '1'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '2'; z=2;break;
    case 'Y' : tmptxt[k++] = '1'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '3'; z=3;break;
    case 'B' : tmptxt[k++] = '1'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '4'; z=4;break;
    case 'M' : tmptxt[k++] = '1'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '5'; z=5;break;
    case 'C' : tmptxt[k++] = '1'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '6'; z=6;break;
    case 'W' : tmptxt[k++] = '1'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '7'; z=7;break;
    case '1' : tmptxt[k++] = '4'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '1'; z=1;break;
    case '2' : tmptxt[k++] = '4'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '2'; z=2;break;
    case '3' : tmptxt[k++] = '4'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '3'; z=3;break;
    case '4' : tmptxt[k++] = '4'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '4'; z=4;break;
    case '5' : tmptxt[k++] = '4'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '5'; z=5;break;
    case '6' : tmptxt[k++] = '4'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '6'; z=6;break;
    case '7' : tmptxt[k++] = '4'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '7'; z=7;break;
    case '8' : tmptxt[k++]=ran[r]; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++]=ran[z];  break;
    case '!' :  tmptxt[k++] = '5'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '1'; z=1;break;
    case '@' : tmptxt[k++] = '5'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '2'; z=2;break;
    case '#' : tmptxt[k++] = '5'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '3'; z=3;break;
    case '$' : tmptxt[k++] = '5'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '4'; z=4;break;
    case '%' : tmptxt[k++] = '5'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '5'; z=5;break;
    case '^' : tmptxt[k++] = '5'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '6'; z=6;break;
    case '&' : tmptxt[k++] = '5'; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++] = '7'; z=7;break;
    case '*' : tmptxt[k++]=ran[r]; tmptxt[k++] = ';'; tmptxt[k++] = '3';
tmptxt[k++]=ran[j]; z=j;break;
    case 'x' : tmptxt[k++] = '0'; break;
    default  : break;
    }
   tmptxt[k++] = 'm';
   }
  }
 tmptxt[k++] = 27;
 tmptxt[k++] = '[';
 tmptxt[k++] = '0';
 tmptxt[k++] = 'm';
 length = k;

 for( iStart = 0; iStart < length; iStart += nWrite )
  {
  nBlock = UMIN( length - iStart, 4096 );
  if ( ( nWrite = write( desc, tmptxt + iStart, nBlock ) ) < 0 )
   {
//   logf( "Write_to_descriptor : %d %s\n", desc, strerror(errno));
// the above just logs an error(formatted), no need to use if you dont have a
logf in your code -SB
   return FALSE;
   }
  }
 return TRUE;
}

---------->END CODE<---------------

Have fun

Steve Boleware

> Here are the two functions containing the two error lines:
>
>
> /*
>  * Send a page to one char.
>  */
> void page_to_char( const char *txt, CHAR_DATA *ch )
> {
<snipped>
> }
>
> /*
>  * Page to one char, new colour version, by Lope.
>  */
> void page_to_char( const char *txt, CHAR_DATA *ch )
> {
<snipped>
> }
>
>
> So, it looks to me like they are both functions doing the same thing?  But
> I can't take either out without screwing things up even more.  Right now I
> am working without this code actually put in, until I can figure out how to
> fix it.  So, any ideas would be very much appreciated.  Thanks all!
>
> Kris


Reply via email to