Jump to content
Jedzkie

[Suggestion] displaybottom & message colors

Recommended Posts

hi! can i suggest that the displaybottom & message script can set its desired message color? for example.

 

*displaybottom <message>,<color>;

 

*message <message>,<color>;

Share this post


Link to post
Share on other sites

hi! can i suggest that the displaybottom & message script can set its desired message color? for example.

 

*displaybottom <message>,<color>;

 

*message <message>,<color>;

if I remember correctly, the message color can only be set to

white (normal chat)

violet (battleground chat)

red (party chat)

green (guild chat)

these 4 colors only

the reason is because of the packet limitation the client can do

 

however I also quite favor this to have dispbottom can use all these 4 kinds of color

 

dispbottom <message>{, <type> };

where <type> can be

CHAT_GREEN 0

CHAT_WHITE 1

CHAT_RED 2

CHAT_VIOLET 3

 

type will always resort to CHAT_GREEN as default, as we always have

but make it enable optional field to allow them to display in other colors we can have

 

btw, is there other color that the client can do ?

Share this post


Link to post
Share on other sites

 

hi! can i suggest that the displaybottom & message script can set its desired message color? for example.

 

*displaybottom <message>,<color>;

 

*message <message>,<color>;

if I remember correctly, the message color can only be set to

white (normal chat)

violet (battleground chat)

red (party chat)

green (guild chat)

these 4 colors only

the reason is because of the packet limitation the client can do

 

however I also quite favor this to have dispbottom can use all these 4 kinds of color

 

dispbottom <message>{, <type> };

where <type> can be

CHAT_GREEN 0

CHAT_WHITE 1

CHAT_RED 2

CHAT_VIOLET 3

 

type will always resort to CHAT_GREEN as default, as we always have

but make it enable optional field to allow them to display in other colors we can have

 

btw, is there other color that the client can do ?

 

as far i as know, my friend told me that "CaseRO", uses rAmod, have these. i'll post a screenshots later.

Share this post


Link to post
Share on other sites

 

hi! can i suggest that the displaybottom & message script can set its desired message color? for example.

 

*displaybottom <message>,<color>;

 

*message <message>,<color>;

if I remember correctly, the message color can only be set to

white (normal chat)

violet (battleground chat)

red (party chat)

green (guild chat)

these 4 colors only

the reason is because of the packet limitation the client can do

 

however I also quite favor this to have dispbottom can use all these 4 kinds of color

 

dispbottom <message>{, <type> };

where <type> can be

CHAT_GREEN 0

CHAT_WHITE 1

CHAT_RED 2

CHAT_VIOLET 3

 

type will always resort to CHAT_GREEN as default, as we always have

but make it enable optional field to allow them to display in other colors we can have

 

btw, is there other color that the client can do ?

I'm not sure if the two are related, but the #channel system employed in-game currently can display any color the user designates in the conf file (save for #FF00FF I imagine?). I recall the old limitations, but perhaps if they were able to get any color to display in the channel system (replacement for @main; originally released here on Hercules) they can do the same for dispbottom. It'd be nice at least. +1 from me!

Share this post


Link to post
Share on other sites

I'm not sure if the two are related, but the #channel system employed in-game currently can display any color the user designates in the conf file (save for #FF00FF I imagine?). I recall the old limitations, but perhaps if they were able to get any color to display in the channel system (replacement for @main; originally released here on Hercules) they can do the same for dispbottom. It'd be nice at least. +1 from me!

OMFG !!

totally forgotten about channel system

you are right, NO LIMITATION

 

I used rathena emulator to get this working fine

BUILDIN_FUNC(dispbottom) {	TBL_PC *sd;	if ( script_hasdata(st,4) ) {		if ( data_isstring( script_getdata(st,4) ) )			sd = map_nick2sd( script_getstr(st,4) );		else			sd = map_id2sd( script_getnum(st,4) );	} else		sd = script_rid2sd(st);	if ( sd ) {		const char* msg = script_getstr(st,2);		unsigned short msg_len = strlen( msg ) +1;		unsigned int colorcode;		if ( script_hasdata(st,3) )			colorcode = script_getnum(st,3);		else			colorcode = 0xbbffbb;		WFIFOHEAD( sd->fd, msg_len + 12 );		WFIFOW(sd->fd,0) = 0x2C1;		WFIFOW(sd->fd,2) = msg_len + 12;		WFIFOL(sd->fd,4) = 0;		WFIFOL(sd->fd,8) = colorcode;		safestrncpy((char*)WFIFOP(sd->fd,12), msg, msg_len);		WFIFOSET( sd->fd, msg_len + 12 );	}	return 0;}
BUILDIN_DEF(dispbottom,"s??"),
it works !
prontera,162,180,5	script	kjsdfhksdjf	100,{	dispbottom "test color";	dispbottom "test color", 0xff0000;	dispbottom "test color", 0x0000ff;	dispbottom "test color", 0xffffff;	dispbottom "test color", 0xff00ff;	end;}
post-4102-0-51649400-1389537183_thumb.jpg Edited by AnnieRuru

Share this post


Link to post
Share on other sites

I have seen same  color packet processing in rathena and eathena forum

 

http://rathena.org/board/topic/72457-chat-color-change/?p=148488

 

http://www.eathena.ws/board/index.php?showtopic=278921

 

 

,but  I dont think  dispbottom color msg command  really be needed

Edited by Angelmelody

Share this post


Link to post
Share on other sites

ok, I'm noob

lilith's post is the correct answer

 

hercules/rathena already have clif_colormes

https://github.com/HerculesWS/Hercules/blob/master/src/map/clif.c#L8352

 

so just need to tweak the script command a little bit and it shall be done

BUILDIN_FUNC(dispbottom2) {	TBL_PC *sd;	if ( script_hasdata(st,4) ) {		if ( data_isstring( script_getdata(st,4) ) )			sd = map_nick2sd( script_getstr(st,4) );		else			sd = map_id2sd( script_getnum(st,4) );	} else		sd = script_rid2sd(st);	if ( sd ) {		unsigned int colorcode;		if ( script_hasdata(st,3) )			colorcode = script_getnum(st,3);		else			colorcode = 0xbbffbb;		clif_colormes( sd, colorcode, script_getstr(st,2) );	}	return 0;}

but I dont think dispbottom color msg command really be needed

huh ? why not ? it looks cool ! xD

 

 

I have tried to do message2 which display color message overhead your character

however I have found no known way to display a color message on top of your own head

it seems possible for other players to see your color message, but not by your own

 

BUILDIN_FUNC(message2) {	TBL_PC *sd;	if ( data_isstring( script_getdata(st,2) ) )		sd = map_nick2sd( script_getstr(st,2) );	else		sd = map_id2sd( script_getnum(st,2) );	if ( sd ) {		unsigned int colorcode;		if ( script_hasdata(st,4) )			colorcode = script_getnum(st,4);		else			colorcode = 0x00ff00;		clif_messagecolor2( &sd->bl, colorcode, script_getstr(st,3) );	}	return 0;}
BUILDIN_DEF(message2,"vs?"),
clif.c
void clif_messagecolor2(struct block_list* bl, unsigned long color, const char* msg) {	unsigned short msg_len = strlen(msg) + 1;	uint8 buf[256];	color = (color & 0x0000FF) << 16 | (color & 0x00FF00) | (color & 0xFF0000) >> 16; // RGB to BGR	nullpo_retv(bl);	if( msg_len > sizeof(buf)-12 ) {		ShowWarning("clif_messagecolor: Truncating too long message '%s' (len=%u).n", msg, msg_len);		msg_len = sizeof(buf)-12;	}	WBUFW(buf,0) = 0x2C1;	WBUFW(buf,2) = msg_len + 12;	WBUFL(buf,4) = bl->id;	WBUFL(buf,8) = color;	memcpy(WBUFP(buf,12), msg, msg_len);	clif_send(buf, WBUFW(buf,2), bl, AREA);}

 

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

^ Thanks for sharing but your snippets need some modification because Hercules is using different structure in source code. So its not compatible with Hercules :D

 

and instead of editing src file, is it OK with you if convert it to Plugins?

Share this post


Link to post
Share on other sites

I think it would be nice to have it as an optional parameter.

Totally agree, if the syntax changes there won't be backwards compatibility

Share this post


Link to post
Share on other sites

 

 

I think it would be nice to have it as an optional parameter.

Totally agree, if the syntax changes there won't be backwards compatibility

 

 

I do think so too.

Share this post


Link to post
Share on other sites

I can write this

http://upaste.me/de7c10577fd5ed9d5

 

there is a problem ...

prontera,162,180,5	script	aasdf	100,{	dispbottom "test color";	dispbottom "test color", 0xFF0000;	dispbottom "test color", 0x00FF00;	dispbottom "test color", 0x0000FF;	end;}
I test with this script

it seems only able to display RED correct ...

green and blue are not ...

 

I remember when I did with rathena emulator on my previous post here, I don't recall having this bug

Share this post


Link to post
Share on other sites

so ... Haru has cleaned up the clif->colormes function

https://github.com/HerculesWS/Hercules/commit/d66cc50af6d781d179f46ae67d74bf26bf5914e5

now its very easy to implement this suggestion

 

pull request

https://github.com/HerculesWS/Hercules/pull/858

 

and I just compared hercules and rathena script_commands.txt

we are so behind them right now, missing so many script commands its not even funny

I'm thinking maybe I should stop supporting on the forums ....

until at least have hercules emulator on par with rathena standard

 

EDIT:

what the heck ?

post-4102-0-13345800-1447097535_thumb.jpg

why when used 0x000000 it is display as white ??

or maybe just my hexed client maybe ?

 

EDIT2:

tested on rathena, they also having this same issue

post-4102-0-52786500-1447098162_thumb.jpg

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

merge in

https://github.com/HerculesWS/Hercules/commit/19d83e65e83887a9f15353e626eaab57d7f86a74

 

finally ...

 

erm, I just saw messagecolor script command :o

wait wait ... not finish yet ...

 

hmm impossible, it require player to refresh the client

#include <stdio.h>#include <stdlib.h>#include <string.h>#include "map/pc.h"#include "map/script.h"#include "common/HPMi.h"#include "common/socket.h"#include "common/strlib.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo = {	"messagecolor",	SERVER_TYPE_MAP,	"0.1",	HPM_VERSION,};BUILDIN(messagecolor) {	TBL_PC *sd = NULL;	if (script_isstringtype(st,2))		sd = script->nick2sd(st, script_getstr(st,2));	else		sd = script->id2sd(st, script_getnum(st,2));	if ( sd ) {		const char *message = script_getstr(st,3);		unsigned short msg_len = strlen( message ) +1;		int color = script_getnum(st,4);		WFIFOHEAD( sd->fd, msg_len + 12 );		WFIFOW( sd->fd, 0 ) = 0x2C1;		WFIFOW( sd->fd, 2 ) = msg_len + 12;		WFIFOL( sd->fd, 4 ) = sd->bl.id;		WFIFOL( sd->fd, 8 ) = RGB2BGR(color);		safestrncpy( (char*)WFIFOP( sd->fd,12 ), message, msg_len );		WFIFOL( sd->fd, 4 ) = -sd->bl.id;		WFIFOSET( sd->fd, msg_len + 12 );	}	return true;}HPExport void plugin_init (void) {	addScriptCommand( "messagecolor", "vsi", messagecolor );}
looks doesn't work ?
prontera,159,185,5	script	kjdsfkshfs	1_F_MARIA,{	messagecolor getcharid(3), "test yellow", C_YELLOW;	end;}
try @fontcolor blue

then type something

click on the npc again, then it shows up

 

the sd->fontcolor_tid seems to have something to do it here

Edited by AnnieRuru

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.