TheouAegis
Member
Except for debugging purposes or displaying values (e.g., colors) in hexadecimal to your program's users, there is pretty much no reason to ever use a dec2hex() or dectohex() script to convert a number to a string of a hexadecimal number. For those times when you do need or want to convert an integer to a hexadecimal string, Game Maker Studio already had a function for that:
ptr(val)
It's not intended to be used as a dec2hex script, but on Windows it does that (and Android, kinda). Just surround it with string() and you can treat it as any other string.
show_debug_message(ptr(255));
show_debug_message(string_char_at(string(ptr(255),8));
Edit: See below for warnings on use with other operating systems. I'm curious what this does on Mac.
ptr(val)
It's not intended to be used as a dec2hex script, but on Windows it does that (and Android, kinda). Just surround it with string() and you can treat it as any other string.
show_debug_message(ptr(255));
show_debug_message(string_char_at(string(ptr(255),8));
Edit: See below for warnings on use with other operating systems. I'm curious what this does on Mac.
Last edited: