SA-MP Forums Archive
[Tool/Web/Other] Code highlight generator [An alternative to the Pawn tag] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Tools and Files (https://sampforum.blast.hk/forumdisplay.php?fid=82)
+---- Thread: [Tool/Web/Other] Code highlight generator [An alternative to the Pawn tag] (/showthread.php?tid=570056)



Code highlight generator [An alternative to the Pawn tag] - Kaperstone - 05.04.2015

I felt the need to disconnect from the thread, because it totally ruined the point of the thread.

What basically this generator does is add bbcode color tags to highlight pawn syntax, like so
Normal code:
Code:
#include <a_samp>
#include <foreach>
/* This is a comment
*/#define Hello/* This means allo */
forward Blah();
// HEllo



if(Hi) {
    // do shiet here
}else{
    // do shiet here
}

#if defined FILTERSCRIPT 

public OnFilterScriptInit() { 
  print("\n--------------------------------------"); 
  print(" Blank Filterscript by your name here"); 
  print("--------------------------------------\n"); 
  return 1; 
} 

public OnFilterScriptExit()  { 
  return 1; 
} 

#else 

main() { 
  new car[2];
new car[(2*sizeof(MAX_PLAYERS+MAX_PLAYER_NAME)];
  new
    car[2]
  ;
  newcar;
  print("\n----------------------------------"); 
  print(' Blank Gamemode by your name here'); 
  print("----------------------------------\n"); 
enumifelsewhileforcontinuebreak
} 

#endif

#define SendClientMessage(%1) \
    SCM(%1)

forward Test();
public Test()
{
    new testvar, array[128];
    if(!testvar) testvar = 1;
    else testvar ++;
    format(array, sizeof(array), "The testvar is %i", testvar);
    SendClientMessage(playerid, 0xFFFFFFFF, array);
    return 1;
}

public OnGameModeInit() return Test();

// Test
With the help of the generator, it becomes :
Code:
#include <a_samp>
#include <foreach>
/* This is a comment
*/#define Hell/* This means allo */
forward Blah();
// HEllo



if(Hi) {
    // do shiet here
}else{
    // do shiet here
}

#if defined FILTERSCRIPT 

public OnFilterScriptInit() { 
  print("\n--------------------------------------"); 
  print(" Blank Filterscript by your name here"); 
  print("--------------------------------------\n"); 
  return 1; 
} 

public OnFilterScriptExit()  { 
  return 1; 
} 

#else 

main() { 
  new car[2];
new car[(2*sizeof(MAX_PLAYERS+MAX_PLAYER_NAME)];
  new
    car[2]
  ;
  newcar;
  print("\n----------------------------------"); 
  print(' Blank Gamemode by your name here'); 
  print("----------------------------------\n"); 
enumifelsewhileforcontinuebreak
} 

#endif

#define SendClientMessage(%1) \
    SCM(%1)

forward Test();
public Test()
{
    new testvar, array[128];
    if(!testvar) testvar = 1;
    else testvar ++;
    format(array, sizeof(array), "The testvar is %i", testvar);
    SendClientMessage(playerid, 0xFFFFFFFF, array);
    return 1;
}

public OnGameModeInit() return Test();

// Test
Link: http://kaperstone.ru/code

There are upcoming additions to the generator such as adding bold and changing the color for the text and integers only.


Re: Code highlight generator [An alternative to the Pawn tag] - Abagail - 05.04.2015

Have you even tried to compile that code? It surely doesn't compile for me... Jk, but you should really put a working example #yolo


Re: Code highlight generator [An alternative to the Pawn tag] - Kaperstone - 05.04.2015

Quote:
Originally Posted by Abagail
View Post
Have you even tried to compile that code? It surely doesn't compile for me... Jk, but you should really put a working example #yolo
What do you mean put working example


Re: Code highlight generator [An alternative to the Pawn tag] - Crayder - 05.04.2015

Some number aren't highlighted! Still missing a few keywords too.


Re: Code highlight generator [An alternative to the Pawn tag] - Abagail - 05.04.2015

Quote:
Originally Posted by Kaperstone
View Post
What do you mean put working example
The example you use does not work! It doesn't really matter that much; but it's kinda annoying to look at:
[code]
Code:
#include <a_samp>
#include <foreach>
/* This is a comment
*/#define Hello/* This means allo */
forward Blah();
// HEllo



if(Hi) {
    // do shiet here
}else{
    // do shiet here
}

#if defined FILTERSCRIPT 

public OnFilterScriptInit() { 
  print("\n--------------------------------------"); 
  print(" Blank Filterscript by your name here"); 
  print("--------------------------------------\n"); 
  return 1; 
} 

public OnFilterScriptExit()  { 
  return 1; 
} 

#else 

main() { 
  new car[2];
new car[(2*sizeof(MAX_PLAYERS+MAX_PLAYER_NAME)];
  new
    car[2]
  ;
  newcar;
  print("\n----------------------------------"); 
  print(' Blank Gamemode by your name here'); 
  print("----------------------------------\n"); 
enumifelsewhileforcontinuebreak
} 

#endif

#define SendClientMessage(%1) \
    SCM(%1)

forward Test();
public Test()
{
    new testvar, array[128];
    if(!testvar) testvar = 1;
    else testvar ++;
    format(array, sizeof(array), "The testvar is %i", testvar);
    SendClientMessage(playerid, 0xFFFFFFFF, array);
    return 1;
}

public OnGameModeInit() return Test();

// Test



Re: Code highlight generator [An alternative to the Pawn tag] - Kaperstone - 05.04.2015

Quote:
Originally Posted by Crayder
View Post
Some number aren't highlighted! Still missing a few keywords too.
Can be you be specific ?

And I noticed your last replys on the previous thread, just didn't get the time to edit the code yet.
Quote:
Originally Posted by Abagail
View Post
The example you use does not work! It doesn't really matter that much; but it's kinda annoying to look at:
[code]
Code:
#include <a_samp>
#include <foreach>
/* This is a comment
*/#define Hello/* This means allo */
forward Blah();
// HEllo



if(Hi) {
    // do shiet here
}else{
    // do shiet here
}

#if defined FILTERSCRIPT 

public OnFilterScriptInit() { 
  print("\n--------------------------------------"); 
  print(" Blank Filterscript by your name here"); 
  print("--------------------------------------\n"); 
  return 1; 
} 

public OnFilterScriptExit()  { 
  return 1; 
} 

#else 

main() { 
  new car[2];
new car[(2*sizeof(MAX_PLAYERS+MAX_PLAYER_NAME)];
  new
    car[2]
  ;
  newcar;
  print("\n----------------------------------"); 
  print(' Blank Gamemode by your name here'); 
  print("----------------------------------\n"); 
enumifelsewhileforcontinuebreak
} 

#endif

#define SendClientMessage(%1) \
    SCM(%1)

forward Test();
public Test()
{
    new testvar, array[128];
    if(!testvar) testvar = 1;
    else testvar ++;
    format(array, sizeof(array), "The testvar is %i", testvar);
    SendClientMessage(playerid, 0xFFFFFFFF, array);
    return 1;
}

public OnGameModeInit() return Test();

// Test
The examples on the first post is to show the difference between one-color code and highlightted code.
The first and second codes pastes should look like it, otherwise people won't understand the need of this.


Re: Code highlight generator [An alternative to the Pawn tag] - Crayder - 05.04.2015

Quote:
Originally Posted by Kaperstone
View Post
Can be you be specific ?
I listed some in the other thread.


Re: Code highlight generator [An alternative to the Pawn tag] - Sellize - 05.04.2015

Well done Kaperstone


Re: Code highlight generator [An alternative to the Pawn tag] - Gammix - 05.04.2015

Code:
new Duck.uou[(14)*(strlen("duck"\man"\"))];
And result:

Quote:
new Duck.uou[(14)*(strlen("duck"\man"\"))]

Look^^


Re: Code highlight generator [An alternative to the Pawn tag] - Crayder - 05.04.2015

Quote:
Originally Posted by Gammix
View Post
Code:
new Duck.uou[(14)*(strlen("duck"\man"\"))];
And result:


Look^^
I don't know if you realised, but pawno does the same thing.