Jump to content
  • 0

Script Command Mes2


Question

3 answers to this question

Recommended Posts

  • 0
Posted
function	script	mes2	{

	setarray .@color$[0],"red","ff0000","green","00ff00","blue","0000ff";

	.@str$ = strtolower(getarg(0));
	.@mes$ = getarg(1);
	.@color = inarray(.@color$,.@str$);
	mes ((.@color != -1)? "^"+.@color$[.@i + 1] : "") + .@mes$;
	return;

}

	mes2 "red","Hello there.";
	mes2 "green","What's up?";
	close;

Add colors in .@color$

  • Love 1
  • 0
Posted

Thanks for replying, but in case it would be by source same. No script.

By script I had already done, wanted to change.

 

function	script	F_Color	{
	if(getarg(1) == "null")
			return "";
	setarray .@cores$[0], "amarelo", "^FFFF00", "azul", "^0000FF",
						"branco", "^EEE9E9", "dourado", "^DAA520",
						"cinza", "^696969", "laranja", "^FF7F00",
						"marrom","^8B4726", "preto", "^000000",
						"roxo", "^4527A0", "vermelho", "^FF0000", 
						"verde", "^1B5E20";
						 
	.@cor$ = strtolower(getarg(1));
	for(.@i = 0; .@i < getarraysize(.@cores$); .@i += 2)
		if(.@cores$[.@i] == getarg(1))
			return .@cores$[.@i + 1]  + getarg(0) + "^000000";
	return getarg(1) + getarg(0) + "^000000";
}

 

  • 0
Posted (edited)

I'm not really good with source but I tried...

BUILDIN_FUNC(mes2)
{
	TBL_PC* sd;
	if( !script_rid2sd(sd) )
		return SCRIPT_CMD_SUCCESS;

	int color_n = script_getnum(st,2);
	char *message;

	size_t len = 0;

	unsigned long color = color_table[color_n];

	char color_string = "^";
	char color_code = (char*)color;

	message = (char*)aMalloc(2);

	len = strlen(color_code);
	memcpy(&message, color_string, 1);
	memcpy(&message, color_code, len);
	temp = script_getstr(st, 3);
	len = strlen(temp);
	memcpy(&message, temp, len);

	clif_scriptmes(sd, st->oid, message));

	st->mes_active = 1; // Invoking character has a NPC dialog box open.
	return SCRIPT_CMD_SUCCESS;
}

BUILDIN_DEF(mes2,"is"),

EDIT: Forgot to say this uses the channel system colors... if it works.

Edited by n0tttt

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