GM Version: 1.4.1757 Target Platform: ALL Download: N/A Links: N/A Summary: Getting a colour code from a single stored value Tutorial: So here's a perfectly painful solution to the perfectly normal desire to get a colour code from saved text like a JSON file. Unfortunately GM:S doesn't let you just drop in a hexcode for colour (#000000 for black, #FF00FF for hot pink, etc) like everybody else in the world uses. The make_colour_rgb or make_colour_hsv functions require you to give separate variables for each value. If you want to save a single string for your colour code and you're using standard digits each code can be 1-255, unfortunately different string lengths to parse out and re-enter for the three values. I haven't had much luck getting hex numbers to work in GMS, and eventually I got tired of padding my numbers to be three digits ("1" as "001"). So until GM:S supports just dropping in hexcodes for colours like everybody else in the world, here's a crazy overcomplicated solution for saving colour codes as a single string and dynamically handling the character length of the digits: I'll be happy if it saves anyone the hassle of figuring out such a basic desire: Code: var mapbgcode= ds_map_find_value(yourdatamap, "mapbgcolour"); //1-3 digit rgb var firstbreak=string_pos(",",mapbgcode); var stillremaining=string_copy(mapbgcode,firstbreak+1,string_length(mapbgcode)); var secondbreak=string_pos(",",stillremaining); var mapred=(string_copy(mapbgcode,1,firstbreak-1)); var mapgreen=(string_copy(mapbgcode,firstbreak+1,secondbreak-1)); var convoluted=string_length(mapred)+1+string_length(mapgreen)+1+1; var mapblue=(string_copy(mapbgcode,convoluted,string_length(mapbgcode)-convoluted)); mapbgcolour=make_colour_rgb(real(mapred),real(mapgreen),real(mapblue)); where: "yourdatamap" is your decoded json, "mapbgcolour" is the key for the saved colour value (a string of a #,#,# - where each number can be 0 to 255) and the name of the variable with the final colour code. Good grief.