Jump to content
  • 0

Changing source line colour?


Question

Posted

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?

4 answers to this question

Recommended Posts

  • 0
Posted

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
  • 0
Posted

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)

 

  • 0
Posted
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)

 

  • 0
Posted
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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...