Page 1 of 1

[gui] change particle color

PostPosted: 08 Oct 2013, 15:11
by Unnamed
After reading it up in the source code I found out the formula for particle color:
2^16 * red + 2^8 * green + blue (red, green, blue = 0..255)
I tested it. Correct me if it is wrong.
But it's annoying to type the whole stuff in cubescript every time so I made a gui now to change the particle color.
Add "exec partcolor.cfg" to autoexec.cfg, select a particle entity and write /changeparticlecolor (You should editbind it if you want to use it often. For me KP_ENTER was not used.)
You can select a color from the list and change the color with three sliders. I also added a "bright" checkbox like at the newlight gui.
The right entity attribute will be changed (I also considered that the progress versus particle has two colors). If an ent wich is not a particle is selected the "change color" button will do nothing.

changelog:
-added preview field for the colour and changed the sliders
-added the option to take the player colour and the particle colour or reset to 0
-added an option to save (and delete) colours. Up to 19 colours can be shown. They can't be named, but the text has the saved colour.
-added scrollbox for saved colours
-buttons instead of guiradio
-reduced the number of displayed colours to 9
-added the option to give colours a name before saving them. you can save the same colour multiple times if it has a different name (disable it?)

Re: [gui] change particle color

PostPosted: 09 Oct 2013, 03:24
by qreeves
It's the same format as used by the player profile colour selection (24bit: 0xRRGGBB), maybe that will help you and give you some ideas on how to preview the selected colour ;)

Re: [gui] change particle color

PostPosted: 09 Oct 2013, 14:19
by Unnamed
Writing 0xRRGGBB into the /entattr command works. I didn't knew that :(
I haven't thought about a preview. This is added to the new version.
You can also save colours to use them later. It could also be usefull for lights and texture colour / glow colour.

Re: [gui] change particle color

PostPosted: 11 Oct 2013, 23:13
by bonifarz
Unnamed {l Wrote}:Writing 0xRRGGBB into the /entattr command works. I didn't knew that :(

Heheh, same here. I did use exactly the same type of decimal conversion until someone gave me a clue about entering integers as hex numbers using 0x. :)
Actually, I think S.E.S. has found a very nice solution for these things in his agui, where all sorts of entity colors can be entered as both decimal rgb-triplets and in 0xrrggbb format. Also there are previews and options to grab colors. Well, I keep posting the same link, but it is just too useful to have people miss it ;)

Re: [gui] change particle color

PostPosted: 12 Oct 2013, 10:00
by Unnamed
Well, I don't like guis, but I often forget wich colours I used for lights or textures.
It was interesting to make a small gui. It would be awesome if the hud could be made in a simmilar way as guis are.