• 0
bWolfie

Set font color in message box?

Question

Hello again Hercules,

 

I want to set a variable so when it is 1, it can appear in a message box next to writing in a 'mes' box. But I can't figure out how to make it work.

 

E.g.

I set my variable to 1.

set @color, 1;

And then whenever 

if (.color == 1) {
^00ff00;
}
else {
^ff0000;
}

 

It will appear in a message box like so:

 

if color is set to 1,

mes "" + @color + "This text is bright green^000000.";

This text is bright green.

 

if color is set to 0 (or anything else),
mes "" + @color + "This text is bright green^000000.";

This text is bright green.

 

Hope I explained it well enough. Any suggestions appreciated. Thank you.

Edited by True Zeal

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

there is function for this
 
https://github.com/HerculesWS/Hercules/blob/master/npc/other/Global_Functions.txt#L360" class="bbc_url" title="External link" rel="nofollow external">https://github.com/HerculesWS/Hercules/blob/master/npc/other/Global_Functions.txt#L360

//== Function F_MesColor ===================================
// Function to colorize npc dialog without having to memorize the color code
// Examples:
//    mes callfunc("F_MesColor", C_BLUE) +"This message is now in BLUE";
function	script	F_MesColor	{
	return sprintf("^X", min(getarg(0), 0xFFFFFF));
}

Share this post


Link to post
Share on other sites
  • 0

Sorry I should have explained what I'm trying to do better. I'm trying to make an npc which you can choose which buffs it gives and the buffs it will give you depends on what is active. The activity will be shown in red or green on a menu.

Error log says I am missing a parenthesis/bracket '(' ')' somewhere in this line.

 

 

[email protected] = select("^777777Return^000000:(@agicolor?"^cc0000":"^cc0000") +Increase Agility^000000:(@blessingcolor?"^cc0000":"^cc0000") +Blessing^000000");

Share this post


Link to post
Share on other sites
  • 0

Thank god, I can finally see the light. Thanks for all the replies and taking your time to help me so far. I think I'm almost there.

 

Edit: Figured it out. 

Edited by True Zeal

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

Loading...