Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bots

Development::Bots Forum for bots.

Reply
 
Thread Tools Display Modes
  #16  
Old 07-18-2011, 07:40 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

After more color tests - the colors are fine the way they are. Unsure why but they do work on a ### ### ### style format. It takes time to get a feel for the color shifts because as far as I can tell it isnt an exact 0-255 for each set of ### but it seems it is close.

So for instance it going R### G### B###:
000 000 050 (just type 50 for color) is a blue 000 000 000 is a deep black....way darker then sony ever allowed. Easiest to get a sense of where ya want to be by picking a number like 50 then adding a digit 500, 5000, 5000 etc and youll see the colors change and will give you a place to start.

Don't think coloring weaps and shields is possible at this time so removing sql from submission for now
Reply With Quote
  #17  
Old 07-18-2011, 08:35 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

You don't need an int64 to hold a color, they are 24 bits and fit just fine in an int.

Try something like this. I didn't compile it, but you should be able to get the idea from it.
Code:
	if(!strcasecmp(sep->arg[1], "armorcolor")) {
		if(c->GetTarget() && c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwner() == c)) {
			if(sep->argnum < 6) {
				c->Message(0, "Usage: #bot armorcolor [slot] [red] [green] [blue] - use #bot help armorcolor for info");
				return;
			}

			int setslot = atoi(sep->arg[2]);
			uint8 red = atoi(sep->arg[3];
			uint8 green = atoi(sep->arg[4];
			uint8 blue = atoi(sep->arg[5];
			uint32 setcolor = (red << 16) | (green << 8) || blue;
			//You may not need this, but I believe if a color is set that the top bits must be 0xff
			if(setcolor) {
				setcolor &= (0xff << 24);
			}
		}
A few of other things...

1) Change Bot::GetID to be const, don't make a new function that does exactly the same thing.

2) You don't need to use Bot::GetEquipmentColor() to call your function, just GetEquipmetColor() will call it.

3) You don't need Bot::SendWearChange at all. It's just a copy of Mob::SendWearChange.
Reply With Quote
  #18  
Old 07-18-2011, 09:04 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Quote:
Originally Posted by lerxst2112 View Post
You don't need an int64 to hold a color, they are 24 bits and fit just fine in an int.

Try something like this. I didn't compile it, but you should be able to get the idea from it.
Code:
	if(!strcasecmp(sep->arg[1], "armorcolor")) {
		if(c->GetTarget() && c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwner() == c)) {
			if(sep->argnum < 6) {
				c->Message(0, "Usage: #bot armorcolor [slot] [red] [green] [blue] - use #bot help armorcolor for info");
				return;
			}

			int setslot = atoi(sep->arg[2]);
			uint8 red = atoi(sep->arg[3];
			uint8 green = atoi(sep->arg[4];
			uint8 blue = atoi(sep->arg[5];
			uint32 setcolor = (red << 16) | (green << 8) || blue;
			//You may not need this, but I believe if a color is set that the top bits must be 0xff
			if(setcolor) {
				setcolor &= (0xff << 24);
			}
		}
A few of other things...

1) Change Bot::GetID to be const, don't make a new function that does exactly the same thing.

2) You don't need to use Bot::GetEquipmentColor() to call your function, just GetEquipmetColor() will call it.

3) You don't need Bot::SendWearChange at all. It's just a copy of Mob::SendWearChange.
Thank you for the tips.

Running tests right now.

Criimson
Reply With Quote
  #19  
Old 07-18-2011, 10:03 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Sorry, I made a typo in the original code.

Here are the two corrected bits.

Code:
uint32 setcolor = (red << 16) | (green << 8) | blue;

and

if(setcolor) {
    setcolor |= (0xff << 24);
}

Last edited by lerxst2112; 07-18-2011 at 10:06 PM.. Reason: crazy spacing.
Reply With Quote
  #20  
Old 07-18-2011, 10:20 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Well the code as written doesn't work. It returns 1 no matter what is entered.

Will keep testing and trying to figure it out

Being able to enter RGB would be nice. AFter looking at a couple of websites on color in code I was wondering does EQ use RGB or ARGB?

EDIT: didnt see your reply will look into it

Good sites:

http://www.codeproject.com/KB/graphics/color.aspx

http://developer.android.com/referen...ics/Color.html
Reply With Quote
  #21  
Old 07-18-2011, 10:32 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Yeah, sorry about the errors. Editing in the reply window is a pain. :(

The colors themselves are just RGB. I'm not sure what the high byte is actually used for, but if you look at Mob::SetSlotTint it seems like the client either expects a 0 for no color, or 0xff for any color. I don't know if any other value might work there. I'd guess the current value was found through either trial and error or packet collects to make the client happy.
Reply With Quote
  #22  
Old 07-18-2011, 10:49 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

I have to say: lerxst2112 you are great

I really appreciate all of the help while I learn. I am too stubborn to say I can't do it or learn it and its nice to have someone help when stuck.

Your code works great. I had to remove the
Code:
if(setcolor) {
    setcolor |= (0xff << 24);
}
For some reason with it in it would always return a negative number. But the code works exactly without it. 255 0 0 is red 0 0 255 is blue. Thats exactly how it should work.

Criimson

EDIT: yea using this RGB system is nice. I sat there for like 5 minutes just testing it on my enchanter, watching her rob change
Reply With Quote
  #23  
Old 07-18-2011, 11:23 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Yes, when examined as an integer that will be a negative number, but the reality is that the colors are 4 separate bytes, so displaying it as one int doesn't make sense.

If it works without that then I guess it's fine, but the other code that manipulates colors does do it that way. If you need to display the color you could extract the values again and display that.

Something like this assuming the color variable is named color.

Code:
uint8 red = (color >> 16) & 0xff;
uint8 green = (color >> 8) & 0xff;
uint8 blue = color & 0xff;
I saw you commented out the check for the proper number of parameters. You should probably check that since trying to extract the values if the player doesn't type the line correctly could cause a crash or some very unpredictable behaviour.

I'm glad it works, and I hope you enjoy your colorful bots.
Reply With Quote
  #24  
Old 07-18-2011, 11:54 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

The check was already there but written differently. For some reason when I compiled with your check it would hang on that and not except any input. So I just went with my original check.

And yea its nice to be able to say I want my druid in green and not have to hunt through tons of almost random numbers to find a shade close. Now its "I want this color" and wham
Reply With Quote
  #25  
Old 07-23-2011, 05:32 AM
Capheus
Hill Giant
 
Join Date: Apr 2008
Location: Milwaukee
Posts: 141
Default

Hey wow you guys took it and ran with it. I am hoping I get some time soon to check this stuff out too. Great job guys.
Reply With Quote
  #26  
Old 07-24-2011, 02:32 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

Quote:
Originally Posted by Capheus View Post
Hey wow you guys took it and ran with it. I am hoping I get some time soon to check this stuff out too. Great job guys.
Thought i would post in this thread that this is committed. svn 1982 or newer.
__________________
The Realm
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:10 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3