is it possible to draw more than 1 variable using draw_text? What i would like to do is this.
draw_text(x,y,global.hp + "/" + global.max_hp)
i know i have done something like this in the past, but i cant remember how.
drawing more than 1 variable with draw_text
Started by matthewberry23, Jul 03 2012 05:36 PM
4 replies to this topic
#1
Posted 03 July 2012 - 05:36 PM
#2
Posted 03 July 2012 - 05:38 PM
You got it, but remember, when converting a real to a string, you need to string() it.
draw_text(x,y,string(global.hp) + "/" + string(global.max_hp))
#3
Posted 03 July 2012 - 05:43 PM
You got it, but remember, when converting a real to a string, you need to string() it.
draw_text(x,y,string(global.hp) + "/" + string(global.max_hp))
yeah, i just tried that, but the error says wrong type arguments to +
i also tried
draw_text(x,y,string(global.hp) && "/" && string(global.max_hp))
and i get the same error
#4
Posted 03 July 2012 - 05:48 PM
You can always do something much more complex, and not so good if this error persists... I had the same error, so i experimented and reached this :
draw_text(x,y,global.hp)
draw_text(x+25,y,"/")
draw_text(x+30,y,global.max_hp)
or play with the numbers until you reach the satisfying result. However, the 1 line code is much better if you can make it work...
draw_text(x,y,global.hp)
draw_text(x+25,y,"/")
draw_text(x+30,y,global.max_hp)
or play with the numbers until you reach the satisfying result. However, the 1 line code is much better if you can make it work...
#5
Posted 03 July 2012 - 06:01 PM
Here is the code you should use
EDIT: This is a code to show time, if its too complicated I'll Shorten it for use.
I was bored
draw_text(view_xview[0]+view_wview[0]/2-string_width(string(current_hour)+":"+string(current_minute)+":"+string(current_second))/2,view_yview[0]+view_hview[0]-string_height(string(current_hour)+":"+string(current_minute)+":"+string(current_second))-1,string(current_hour)+":"+string(current_minute)+":"+string(current_second));of course replace with your own.
EDIT: This is a code to show time, if its too complicated I'll Shorten it for use.
I was bored
draw_text(x,y,string(current_hour)+":"+string(current_minute))
Edited by Merlocker, 03 July 2012 - 06:15 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











