Legacy GM Q:Setting colour in a string


i was wondering is it possible in gms to set colour within a string, somthing like this

'hello [col=red]world[col=white], how are you?'.
so basically only the word 'world' is red. somthing like what you can do in the forum.

setting the color with a function doesnt work for me cus im returning the string from a script.
in the string it looks somthing like this in the code
'Sword#Damage: '+string(cheese*fish)+'#Range:'+string(donut+ham);
and this in game
Damage: 243
Range: 12


Nope! Basically, you must create a loop that goes through each letter in the string and positions/draws it.

Edit: removed example script. Why I bother spending the 20 minutes writing a solution for someone who replies "any other suggestions? i alredy use plenty of loops" is beyond me. Any and all solutions will loop. Use a marketplace asset if fully completed code examples are insufficient.
Last edited:


I kept my text in an array and used a special letter at the beginning to identify what color its supposed to be. heres a piece of it: this uses string parsing.
switch (string_char_at(text[a], 1)) { case "g": draw_set_colour(c_ltgray); break; case "r": draw_set_colour(c_red); break; case "b": draw_set_colour(c_aqua); break;}
var writ1=string_delete(text[a], 1, 1); draw_text(20,b,writ1);
not sure what some of those variables did lol, but it works inside a loop. say "repeat (array_length)" check the manual and don't quote me on this but this should give u another option