Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set Color From Hue Picker
Author Message
Avatar
Journeyman
*

Posts: 172
Likes Given: 6
Likes Received: 27 in 12 posts
Joined: Apr 2012
Reputation: 5

The North Shield

Post: #1
Set Color From Hue Picker
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 ;

PHP Code:
PACKET149=f_hue_picker 

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 


// 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<ARGSW0000 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<ARGSW0000 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 

I hope this introduction will be helpful for those who do not know or not familier with this.
(This post was last modified: 01-01-2014 07:02 AM by Avatar.)
01-01-2014 02:06 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
[+] 3 users Like Avatar's post
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Set Color From Hue Picker
nice Big Grin
01-01-2014 03:25 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)