• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - IDE GML doesn't recognize the colours set in 'Variable Definitions'

N

NilsRungholm

Guest
Seemingly, the colours you pick in an object's Variable Definitions in the IDE (also called Object Variables - very confusing), are not actually valid colours in GML. The colour picker creates a HEX-colour in the format #RRGGBBAA, while GML expects either a color made through make_color() or similar, or a HEX-colour in the format $BBGGRR (all lowercase). See Help -> 'Scripting' -> 'GML Reference' -> 'Drawing' -> 'Color'.

The problem becomes evident when (for instance) trying to set image_blend, like below. The blend that is applied to the object's sprite simply don't match the colour I picked - it's interpreted as something else.



I like the idea of GM:S2's new Variable Definitions, but... What on earth am I missing here? Is there a global setting for interpreting HEX-colours that I'm not aware of? Or did YoYo's QA-team just completely miss the fact that they implemented a useless colour-picker?
 

sylvain_l

Member
nothing

as you figured out GMS2 sucks when it comes to color definition: it use RGB (mostly the sprite editor) and BGR and you can also have some ABGR.
Most function in GML use color in BGR format and have another function for the alpha. (like draw_set_color + draw_set_alpha) but for example surface_getpixel_ext return ABGR format

no alpha for image_blend variable only the three color chanel so instead of $FFC1C1FF use $C1C1FF it will work fine (but it effectevely kinda reduce the UX of putting a color picker here :( as you often require a BGR and it return a ABGR)

edit:
all color picker in GMS2 should have a switch that allow us to select the required format (RGB, BGR, ABGR)
 
Top