I saw some post about how to select manually hue from gump menu to set color to anything in the game. So, actually i shared this before or maybe anyone could share this one before. Since i did not see any related stuff, i decided to post in script submission to make it more clear for those who are looking for.
First of all, what we are wanting is only possible with packet filtering. Therefore, we should set packet in sphere.ini like the following ;
After that we should create the function which is going to filter coming packet ;
PHP Code:
[FUNCTION f_hue_picker]
REF1= <local.char>
REF1.tag.color_picked <LOCAL.7><STRSUB 1 0 <LOCAL.8>>
return 1
// You can practically use this function and adjust it in several ways.
//This is just how we are taking picked hue from hue picker. For instance, //i'm using this analogy for the public chat and
//I'm able to choose my chat color from hue picker.
// If you want to tag the character for insance, just use REF1 = //<local.char> and assign a tag to ref1 like ref1.tag.color_picked = //<LOCAL.7><STRSUB 1 0 <LOCAL.8>>, something like that. Depends on //your choice.
// This seems more proper for the purpose. Anyway , i suppose you will get it.
After that, we should define what packet we are going to send client to get hue picker ;
PHP Code:
[FUNCTION HuePicker]
SRC.SENDPACKET 095 D<ARGS> W0000 W0FAB
In fact, there is something weird on this if you do realize. SendPacket works with objects and the things that we are looking for is not an object or could it be an object ? Of course, you can for example pick color for character body or hair , etc. Therefore, if we want to get picked hue we should send any object ( it can be layer of anything or whatever you like) to filter hue like the following ;
PHP Code:
[FUNCTION HuePicker]
SRC.SENDPACKET 095 D<ARGS> W0000 W0FAB
//After this sendpacket function, hue picker come up to game screen to pick color. Filtering is functioning after this.
So the main function to set color to character properties is the function just above.
The usage of the huepicker function can be for instance;
PHP Code:
HuePicker <FINDLAYER.LAYER_HAIR>
Let say, you want to use separately for setting color of an object or chat or whatever it is.
So, why don't we make it with sending string to function like ;
PHP Code:
HuePicker <FINDLAYER.LAYER_HAIR>,CHAT
Let say we are send chat in argv[1] and argv[0] is the object. Otherwise just send anything unrelated to conditional statement.
Hence, we should adjust a little bit our function like ;
PHP Code:
[FUNCTION HuePicker]
if strmatch("CHAT","<argv[1]>")
src.ctag.chat_hue 1
endif
src.ctag.hue_picker <argv[0]> // What object is going to be a target for setting color ?
SRC.SENDPACKET 095 D<argv[0]> W0000 W0FAB
Once you send a packet while filtering we can understand whether the purpose of using this function is for CHAT or an object.
So, in filtering, make the following changes;
PHP Code:
[FUNCTION f_hue_picker]
REF1= <local.char>
if <ref1.ctag.chat_hue> // So check the purpose !
REF1.tag.color_picked <LOCAL.7><STRSUB 1 0 <LOCAL.8>> // Tag character for picked color to remember it.
REF1.ctag.chat_hue= // Clearing tags...
REF1.ctag.hue_picker=
return 1
endif
// Otherwise, let the filter make its work on an object.
UID.<ref1.ctag.hue_picker>.COLOR = <LOCAL.7><STRSUB 1 0 <LOCAL.8>>
REF1.ctag.hue_picker =
// If we are using for chat, we tag player to check related system that you are using with tag or if you have another idea , change it.
return 1
I hope this introduction will be helpful for those who do not know or not familier with this.