Jump to content
  • 0

npctalk color in script


utofaery

Question


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

1. Can we change npctalk color when in script ?

2. cases on npc whisper function

how do a player activate an npc that has whisper function this thing is a maze to me...

 

 

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

I vaguely remember we discuss about *dispbottom2 and *message2 custom script command during my stay on hercules
http://herc.ws/board/topic/3899-suggestion-displaybottom-message-colors/?do=findComment&comment=25468


answer is yes, it just not implemented
look at the npctalk inside script.cpp, it default to color_table[COLOR_WHITE], this value is hard-coded

BUILDIN_FUNC(npctalk)
{
	struct npc_data* nd = NULL;
	const char* str = script_getstr(st,2);

	if (script_hasdata(st, 3) && strlen(script_getstr(st,3)) > 0)
		nd = npc_name2id(script_getstr(st, 3));
	else
		nd = (struct npc_data *)map_id2bl(st->oid);

	if (nd != NULL) {
		send_target target = AREA;
		char message[CHAT_SIZE_MAX];

		if (script_hasdata(st, 4)) {
			switch(script_getnum(st, 4)) {
				case BC_ALL:	target = ALL_CLIENT;	break;
				case BC_MAP:	target = ALL_SAMEMAP;	break;
				case BC_SELF:	target = SELF;			break;
				case BC_AREA:
				default:		target = AREA;			break;
			}
		}
		safesnprintf(message, sizeof(message), "%s", str);
		if (target != SELF)
			clif_messagecolor(&nd->bl, color_table[COLOR_WHITE], message, false, target);
		else {
			TBL_PC *sd = map_id2sd(st->rid);
			if (sd == NULL)
				return SCRIPT_CMD_FAILURE;
			clif_messagecolor_target(&nd->bl, color_table[COLOR_WHITE], message, false, target, sd);
		}
	}
	return SCRIPT_CMD_SUCCESS;
}

 

so I play around again with it, Hercules plugin of course,

#include "common/hercules.h"
#include "map/clif.h"
#include "map/script.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"messagecolor",
	SERVER_TYPE_MAP,
	"0.1",
	HPM_VERSION,
};

BUILDIN(messagecolor) {
	struct block_list *bl = map->id2bl( script_getnum(st,2) );
	if (!bl) {
		ShowWarning("buildin_messagecolor: Error in finding object GID %d!\n", script_getnum(st,2));
		return false;
	}
	clif->messagecolor( bl, script_getnum(st,4), script_getstr(st,3) );
	return true;
}

HPExport void plugin_init (void) {
	addScriptCommand( "messagecolor", "isi", messagecolor );
}
prontera,155,185,5	script	kjsdhfksjf	1_F_MARIA,{
//	messagecolor getcharid(3), "asdfasdf", C_BLUE; <-- doesn't work
	messagecolor getnpcid(), "asdfasdf", C_BLUE;
	messagecolor getnpcid(), "asdfasdf", C_RED;
	messagecolor getnpcid(), "asdfasdf", C_YELLOW;
	messagecolor getnpcid(), "asdfasdf", C_PINK;
	messagecolor getnpcid(), "asdfasdf", C_PURPLE;
	messagecolor getnpcid(), "asdfasdf", C_ORANGE;
	end;
}

screen2019Hercules027.jpg

 

 

2. forget the whisper feature, that thing is from the past
everyone use *bindatcmd now

https://github.com/rathena/rathena/blob/master/doc/whisper_sys.txt

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

9 minutes ago, AnnieRuru said:

I vaguely remember we discuss about *dispbottom2 and *message2 custom script command during my stay on hercules
http://herc.ws/board/topic/3899-suggestion-displaybottom-message-colors/?do=findComment&amp;comment=25468


answer is yes, it just not implemented
look at the npctalk inside script.cpp, it default to color_table[COLOR_WHITE], this value is hard-coded


BUILDIN_FUNC(npctalk)
{
	struct npc_data* nd = NULL;
	const char* str = script_getstr(st,2);

	if (script_hasdata(st, 3) && strlen(script_getstr(st,3)) > 0)
		nd = npc_name2id(script_getstr(st, 3));
	else
		nd = (struct npc_data *)map_id2bl(st->oid);

	if (nd != NULL) {
		send_target target = AREA;
		char message[CHAT_SIZE_MAX];

		if (script_hasdata(st, 4)) {
			switch(script_getnum(st, 4)) {
				case BC_ALL:	target = ALL_CLIENT;	break;
				case BC_MAP:	target = ALL_SAMEMAP;	break;
				case BC_SELF:	target = SELF;			break;
				case BC_AREA:
				default:		target = AREA;			break;
			}
		}
		safesnprintf(message, sizeof(message), "%s", str);
		if (target != SELF)
			clif_messagecolor(&nd->bl, color_table[COLOR_WHITE], message, false, target);
		else {
			TBL_PC *sd = map_id2sd(st->rid);
			if (sd == NULL)
				return SCRIPT_CMD_FAILURE;
			clif_messagecolor_target(&nd->bl, color_table[COLOR_WHITE], message, false, target, sd);
		}
	}
	return SCRIPT_CMD_SUCCESS;
}

 

so I play around again with it, Hercules plugin of course,


#include "common/hercules.h"
#include "map/clif.h"
#include "map/script.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"messagecolor",
	SERVER_TYPE_MAP,
	"0.1",
	HPM_VERSION,
};

BUILDIN(messagecolor) {
	struct block_list *bl = map->id2bl( script_getnum(st,2) );
	if (!bl) {
		ShowWarning("buildin_messagecolor: Error in finding object GID %d!\n", script_getnum(st,2));
		return false;
	}
	clif->messagecolor( bl, script_getnum(st,4), script_getstr(st,3) );
	return true;
}

HPExport void plugin_init (void) {
	addScriptCommand( "messagecolor", "isi", messagecolor );
}

prontera,155,185,5	script	kjsdhfksjf	1_F_MARIA,{
//	messagecolor getcharid(3), "asdfasdf", C_BLUE; <-- doesn't work
	messagecolor getnpcid(), "asdfasdf", C_BLUE;
	messagecolor getnpcid(), "asdfasdf", C_RED;
	messagecolor getnpcid(), "asdfasdf", C_YELLOW;
	messagecolor getnpcid(), "asdfasdf", C_PINK;
	messagecolor getnpcid(), "asdfasdf", C_PURPLE;
	messagecolor getnpcid(), "asdfasdf", C_ORANGE;
	end;
}

screen2019Hercules027.jpg

 

 

2. forget the whisper feature, that thing is from the past
everyone use *bindatcmd now

https://github.com/rathena/rathena/blob/master/doc/whisper_sys.txt

Could you convert this plugin to rAthena please? instead of Hercules.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

46 minutes ago, Elysium said:

Could you convert this plugin to rAthena please? instead of Hercules.

BUILDIN_FUNC(messagecolor) {
	struct block_list *bl = map_id2bl( script_getnum(st,2) );
	if (!bl) {
		ShowWarning("buildin_messagecolor: Error in finding object GID %d!\n", script_getnum(st,2));
		return SCRIPT_CMD_FAILURE;
	}
	clif_messagecolor( bl, script_getnum(st,4), script_getstr(st,3), true, AREA);
	return SCRIPT_CMD_SUCCESS;
}
BUILDIN_DEF(messagecolor,"isi"),

 

Remember the reason why it doesn't work on players, because "@fontcolor" uses a trick to disguise player as monster
https://github.com/HerculesWS/Hercules/issues/1217
https://github.com/HerculesWS/Hercules/issues/1930

apparently rAthena "@fontcolor" is broken

Edited by AnnieRuru
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

2 minutes ago, AnnieRuru said:

BUILDIN_FUNC(messagecolor) {
	struct block_list *bl = map_id2bl( script_getnum(st,2) );
	if (!bl) {
		ShowWarning("buildin_messagecolor: Error in finding object GID %d!\n", script_getnum(st,2));
		return SCRIPT_CMD_FAILURE;
	}
	clif_messagecolor( bl, script_getnum(st,4), script_getstr(st,3), true, AREA);
	return SCRIPT_CMD_SUCCESS;
}

BUILDIN_DEF(messagecolor,"isi"),

 

Remember the reason why it doesn't work on players, because "@fontcolor" uses a trick to disguise player as monster
https://github.com/HerculesWS/Hercules/issues/1217
https://github.com/HerculesWS/Hercules/issues/1930

Thank you Ma'dam! i'll test it

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

52 minutes ago, AnnieRuru said:

1.

look at the npctalk inside script.cpp, it default to color_table[COLOR_WHITE], this value is hard-coded

 

2

so I play around again with it, Hercules plugin of course,

 

 

3. forget the whisper feature, that thing is from the past
everyone use *bindatcmd now

1. nice npctalk white is messy and bad.  now can change it...

2. thanks for that.

 

3. at the time it was still hot/ popular thing, I can barely get the concept of it ... that's why I am asking though.

4. wait a second what is "isi" ???

as in "Malay" language??? for content??? or it means???

Edited by utofaery
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

9 minutes ago, utofaery said:

4. wait a second what is "isi" ???

as in "Malay" language??? for content??? or it means???

/*==========================================
 * Added built-in functions
 *------------------------------------------*/
static void add_buildin_func(void)
{
	int i;
	for( i = 0; buildin_func[i].func; i++ )
	{
		// arg must follow the pattern: (v|s|i|r|l)*\?*\*?
		// 'v' - value (either string or int or reference)
		// 's' - string
		// 'i' - int
		// 'r' - reference (of a variable)
		// 'l' - label
		// '?' - one optional parameter
		// '*' - unknown number of optional parameters

 

no idea what to say, its part of source modification

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   261
  • Joined:  04/25/12
  • Last Seen:  

4 hours ago, utofaery said:

1. nice npctalk white is messy and bad.  now can change it...

2. thanks for that.

 

3. at the time it was still hot/ popular thing, I can barely get the concept of it ... that's why I am asking though.

4. wait a second what is "isi" ???

as in "Malay" language??? for content??? or it means???

isi = integer, string, integer

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   26
  • Joined:  11/20/11
  • Last Seen:  

Spoiler

 

@AnnieRuru is this possible to showscript too?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   2
  • Joined:  08/15/18
  • Last Seen:  

On 1/5/2020 at 9:46 AM, Ice Bear said:
  Reveal hidden contents

 

@AnnieRuru is this possible to showscript too?

up

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  40
  • Reputation:   0
  • Joined:  02/26/21
  • Last Seen:  

image.png.a2fa656f4f295d9f9ce28b8f13e671ad.png 

Quote

1@tnm3,176,172,5    script    kjsdhfksjf    1_F_MARIA,{
    messagecolor getcharid(3), "asdfasdf", C_BLUE;
    messagecolor getnpcid(0), "asdfasdf", C_BLUE;
    messagecolor getnpcid(0), "asdfasdf", C_RED;
    messagecolor getnpcid(0), "asdfasdf", C_YELLOW;
    messagecolor getnpcid(0), "asdfasdf", C_PINK;
    messagecolor getnpcid(0), "asdfasdf", C_PURPLE;
    messagecolor getnpcid(0), "asdfasdf", C_ORANGE;
    end;
}

Added the diff. for rathena recompiled & restarted server with the above script tested but apparently it is still showing white font instead of the specific color.

Anyone mind to share the solution to this?

Thanking you in advance for sharing.

Cheers.

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...