Jump to content
  • 0

color code to this menu


Question

Posted (edited)

I want to put a color code to the menu items in this script, but not sure how to do it. It's from the script: npc/merchants/elemental_trader.txt

		set .@menu$, "";
		for(set .@j,1; .@j<5; set .@j,.@j+1) {
			if (.@Items[.@j] != .@i) set .@menu$, .@menu$+getitemname(.@Items[.@j]);
			set .@menu$, .@menu$+":";
		}
		set .@menu$, .@menu$+"Cancel";
		set .@j, select(.@menu$);

Thanks~

Edited by Lilo

5 answers to this question

Recommended Posts

  • 0
Posted

Then it'd go like this

set .@menu$, "";
		for(set .@j,1; .@j<5; set .@j,.@j+1) {
--			if (.@Items[.@j] != .@i) set .@menu$, .@menu$+getitemname(.@Items[.@j]);
++			if (.@Items[.@j] != .@i) set .@menu$, .@menu$+"^ff0000"+getitemname(.@Items[.@j])+"^000000";
			set .@menu$, .@menu$+":";
		}
		set .@menu$, .@menu$+"Cancel";
		set .@j, select(.@menu$);
  • 0
Posted

Hello

 

Do you want to put the same color for each item or do you want to put different colors? If you want them to be different, how do you want to choose the color?

 

Same color is fine. ^FF0000

  • 0
Posted

 

Then it'd go like this

set .@menu$, "";
		for(set .@j,1; .@j<5; set .@j,.@j+1) {
--			if (.@Items[.@j] != .@i) set .@menu$, .@menu$+getitemname(.@Items[.@j]);
++			if (.@Items[.@j] != .@i) set .@menu$, .@menu$+"^ff0000"+getitemname(.@Items[.@j])+"^000000";
			set .@menu$, .@menu$+":";
		}
		set .@menu$, .@menu$+"Cancel";
		set .@j, select(.@menu$);

 

Thanks alot, it worked!  /no1

  • 0
Posted

you can also do it like this

set .@j, select( "^FF0000"+.@menu$+"^000000" );

this way it would reduce the length of the menu string and give up more slots for other menus since string have a limit of 2048 ~ 4096 characters.

  • Like 1

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