.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Offtopic (http://forums.bots-united.com/forumdisplay.php?f=23)
-   -   Do NOT use CODE tag for posting source code (http://forums.bots-united.com/showthread.php?t=234)

koraX 06-01-2004 09:58

Do NOT use CODE tag for posting source code
 
Do NOT use CODE tag for posting source code

Code:

// THIS PIECE OF CODE MAKES NO SENSE:
void BotThink( cBot *pBot )
{
  printf("testing string highlighting %d",1);
  int too_bad_number_are_not_highlighted = 12345;
  // STEP 1: Update status
  pBot->UpdateStatus();
  // PASS THROUGH ENGINE
  if((keywords_were_blue)&&(variables_were_not)) {
                I_would_be_happy = TRUE;
  }
  /* another comment */
  return;
}

use PHP tag instead :

PHP Code:

// THIS PIECE OF CODE MAKES NO SENSE:
void BotThinkcBot *pBot )

   
printf("testing string highlighting %d",1);
   
int too_bad_number_are_not_highlighted 12345;
   
// STEP 1: Update status
   
pBot->UpdateStatus(); 
   
// PASS THROUGH ENGINE
   
if((keywords_were_blue)&&(variables_were_not)) {
        
I_would_be_happy TRUE;
   }
   
/* another comment */
   
return;



Pierre-Marie Baty 06-01-2004 13:42

Re: Do NOT use CODE tag for posting source code
 
w00t, neat stuff indeed !
I wonder if I could not hack the PHP scripts to have colors inside [ code ] tags as well...

stefanhendriks 07-01-2004 23:28

Re: Do NOT use CODE tag for posting source code
 
ROFL,yeah, and when you're on it, make the colors more msvc like :) :D

botmeister 08-01-2004 00:09

Re: Do NOT use CODE tag for posting source code
 
nice!

BAStumm 08-01-2004 00:20

Re: Do NOT use CODE tag for posting source code
 
highlight_string() is the php function your looking for.

botman 08-01-2004 01:08

Re: Do NOT use CODE tag for posting source code
 
Some people (like me) think the colored text is HARDER (not easier) to read.

botman

Pierre-Marie Baty 08-01-2004 03:56

Re: Do NOT use CODE tag for posting source code
 
even with neat colors, ladies ?
Code:

// hello, I'm a comment
#include <stuff.h> /* is the include blue ? */
 
float main (beer_t bHeineken)
{
  printf ("burp\n"); // strings should be red, somehow
 
  return; // and God said: Thou Shall Be Blue.
}
 
/*
 * so who's the boss, stupid PHP?
 */

8)

Pierre-Marie Baty 08-01-2004 04:06

Re: Do NOT use CODE tag for posting source code
 
and now with the punctuation blue color removed...
Code:

// hello, I'm a comment
#include <stuff.h> /* is the include blue ? */
 
float main (beer_t bHeineken)
{
  printf ("burp\n"); // strings should be red, somehow
 
  return; // and God said: Thou Shall Be Blue.
}
 
/*
 * so who's the boss, stupid PHP?
 */

darn, it's quite hard to override PHP

koraX 08-01-2004 09:19

Re: Do NOT use CODE tag for posting source code
 
lets see if it works

Code:

#include <stdio.h>
 
int main(void)
{
int just_a_number = 5;
printf("Some ugly text %d\n",just_a_number);
while(getchar()!='\n'); // hmm seems like there has to be a space after while
return -1;
}
 
if while for switch case break continue
 
int char BYTE BOOL float double TRUE FALSE // highlight theses too
 
1 2 3 -4 5.6 // highlight numbers with red for example

this is how it looks in my MSVC
http://neuron.tuke.sk/~wagner/code.gif

koraX 08-01-2004 09:30

Re: Do NOT use CODE tag for posting source code
 
And there is a big bug IMO in code tag, when you copy it (select with mouse and CTRL-C) and then you paste it somewhere (MSVC or Far manager) no 'enters' are copied. No '\n' char, no 0D or 0D 0A chars o_O
Example :
http://neuron.tuke.sk/~wagner/enter.gif


All times are GMT +2. The time now is 11:45.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.