Legacy GM Draw_text (Using a string + var) /SOLVED

L

Latch

Guest
When typing this:

Code:
draw_text (30,0,"Options")
draw_text (30,30,option)
It draws both the string and the variable option, when looking at the help section for draw_text it says that you can combine both of the above into one fucntion such as:

Code:
draw_text (30 ,30, "Option: " + option);
Bt this gives me an error, what am I missing? the variable option is in the object that is running the code and the only difference from my code to the help example is that they use a global.var.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Which error? ;)

Probably you're trying to add a number to a string, which won't work. Convert the number to a string via the string function, then you can concatenate them.
 
L

Latch

Guest
Which error? ;)

Probably you're trying to add a number to a string, which won't work. Convert the number to a string via the string function, then you can concatenate them.
Sorry that was silly of me, this error:

Code:
FATAL ERROR in
action number 1
of Draw Event
for object con_god:

DoAdd :: Execution Error
 at gml_Object_con_god_DrawEvent_1 (line 23) - draw_text (0,30,"option:"); draw_text (60,30,option+"Option")
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_con_god_DrawEvent_1 (line 23)
EDIT:
draw_text (0,30,"option:" + string(option))

The above worked, thank you for that now I see what went wrong
 
Top