MQtoSMTL Override Color Correction

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

MQtoSMTL Override Color Correction

Post by MacroFiend » Wed Nov 05, 2003 1:31 am

The color being passed to MQtoSMTL is (typically) an ARGB value ... SMTL uses standard RGB like a regular HTML doc, so we need to convert the ARGB value back to RGB before pushing it in to the the output line. I did this very simply right before the while loop. Also, to ensure that MQ doesn't simply default to white when there are other colors present and an override is passed, (like SuperWho which starts the string w/ a color change), I insert the override color before we start processing the input instead of only when there isn't a color set before it. Below is the code to be inserted to make these fixes.

Code: Select all

	int TotalColors=0; // this MUST be signed.[color=red]
	if (ColorOverride>0xFF000000) ColorOverride^=0xFF000000;

	// Always wrap the output in the default override color.
	pchar_out_string_position+=InsertColor(&out[pchar_out_string_position],ColorOverride);
	CurrentColor=ColorOverride;[/color]

	while(in[pchar_in_string_position]!=0 && pchar_out_string_position<maxlen)

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Nov 05, 2003 1:40 am

Sorry ... forgot to add this code removal in there. Since we are always applying the core coloring, we don't need to do it in the case section.

EQLib_Utilities.cpp - MQtoSMTL

Code: Select all

		default:
			out[pchar_out_string_position++]=in[pchar_in_string_position];
			break;

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Wed Nov 05, 2003 8:39 am

Color override was meant so that if the first character isn't a color, this would be the default color...
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Nov 05, 2003 9:11 am

And it would still work just that way if you define a color and don't close it until the end of the line. Since SMTL is a trimmed down version of HTML, you can nest <c > elements (which you already knew). If, for example, you used my code, /who concolor would show the whole line in the con color coded format while a regular /who would use the EQ defined /who color for everything except your explicitly defined brackets and special info (AFK, TRADER, GM, etc).

In any event, the XOr still needs to happen on the ARGB override value in order to get the real color from it. Otherwise, you end up with <c #FFxxxxxx> in the SMTL output which turns otherwise pretty colors all funky.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Wed Nov 05, 2003 9:13 am

You're right about that, but I'll make it MQToSTML&=0xFFFFFF;
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Thu Nov 06, 2003 12:44 am

Minor bug in your change to my code Lax. You are have ColorOverride&=0xFFFFFF to after you assign it to CurrentColor. Need to either AND them before the assignment or use CurrentColor&=0xFFFFFF.

Code: Select all

	ColorOverride&=0xFFFFFF;
	DWORD CurrentColor=ColorOverride;
or

Code: Select all

	DWORD CurrentColor=ColorOverride;
	CurrentColor&=0xFFFFFF;

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Thu Nov 06, 2003 12:49 am

Silly me.
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0