Jump to content
  • 0

Changing source line colour?


Santafe

Question


  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

Hey everyone, was wondering if theres anyway to change the basic "green"coloured statements into other colours? for example: for @stats

		const char* format;
		int value;
	} output_table[] = {
		{ "Base Level - %d", 0 },
		{ NULL, 0 },
		{ "Hp - %d", 0 },
		{ "MaxHp - %d", 0 },
		{ "Sp - %d", 0 },
		{ "MaxSp - %d", 0 },
		{ "Str - %3d", 0 },
		{ "Agi - %3d", 0 },
		{ "Vit - %3d", 0 },
		{ "Int - %3d", 0 },
		{ "Dex - %3d", 0 },
		{ "Luk - %3d", 0 },
		{ "Zeny - %d", 0 },
		{ "Free SK Points - %d", 0 },
		{ "Used SK Points - %d", 0 },
		{ "JobChangeLvl (2nd) - %d", 0 },
		{ "JobChangeLvl (3rd) - %d", 0 },
		{ "Attack Speed MS - %d", 0 },
		{ NULL, 0 }
	};

This would reveal each line in green colour, so i was wondering if theres any way I could change this to make things more colorful? like base level being shown in red , HP in red while others in green or other colors? or is this is basic color shown by rA?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

you remove the if else and clif_displaymessage(fd, output);

and leave 

clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);

like this

	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);
	}

and also you may want to change the clif_displaymessage(fd, output);

that before the for loop that the first line >> '%s' stats: = 'char name' stats:

and the last result would be

from

	clif_displaymessage(fd, output);

	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		clif_displaymessage(fd, output);
	}

to

	clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);

	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);
	}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

under the code you wrote

at for loop

this example for HP in Red

from this

	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		clif_displaymessage(fd, output);
	}

to this

	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		if (output_table[i].value == sd->status.hp) {
			clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);
		}
		else
		{
			clif_displaymessage(fd, output);
		}
	}

 

INFO >>

the color_table is

enum clif_colors {
	COLOR_DEFAULT,
	COLOR_RED,
	COLOR_WHITE,
	COLOR_YELLOW,
	COLOR_CYAN,
	COLOR_LIGHT_GREEN,
	COLOR_MAX
};
#define clif_messagecolor(bl, color, msg, rgb2bgr, type)

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

9 minutes ago, sader1992 said:

under the code you wrote

at for loop

this example for HP in Red

from this


	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		clif_displaymessage(fd, output);
	}

to this


	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		if (output_table[i].value == sd->status.hp) {
			clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);
		}
		else
		{
			clif_displaymessage(fd, output);
		}
	}

 

INFO >>

the color_table is


enum clif_colors {
	COLOR_DEFAULT,
	COLOR_RED,
	COLOR_WHITE,
	COLOR_YELLOW,
	COLOR_CYAN,
	COLOR_LIGHT_GREEN,
	COLOR_MAX
};

#define clif_messagecolor(bl, color, msg, rgb2bgr, type)

 

Ah ty for the guidance sader but what if i want everything to be of a specific colour ( all in red?) do i just remove this line? :

if (output_table[i].value == sd->status.hp)

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  91
  • Topics Per Day:  0.02
  • Content Count:  325
  • Reputation:   34
  • Joined:  06/01/13
  • Last Seen:  

43 minutes ago, sader1992 said:

you remove the if else and clif_displaymessage(fd, output);

and leave 

clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);

like this


	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);
	}

and also you may want to change the clif_displaymessage(fd, output);

that before the for loop that the first line >> '%s' stats: = 'char name' stats:

and the last result would be

from


	clif_displaymessage(fd, output);

	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		clif_displaymessage(fd, output);
	}

to


	clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);

	for (i = 0; output_table[i].format != NULL; i++) {
		sprintf(output, output_table[i].format, output_table[i].value);
		clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);
	}

 

ty worked like a charm <3

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...