Jump to content


Photo

drawing more than 1 variable with draw_text


  • Please log in to reply
4 replies to this topic

#1 matthewberry23

matthewberry23

    GMC Member

  • New Member
  • 45 posts
  • Version:Unknown

Posted 03 July 2012 - 05:36 PM

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.
  • 0

#2 chrscool8

chrscool8

    GMC Member

  • GMC Member
  • 1646 posts
  • Version:GM:Studio

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))

  • 0

#3 matthewberry23

matthewberry23

    GMC Member

  • New Member
  • 45 posts
  • Version:Unknown

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
  • 0

#4 psycho666

psycho666

    GMC Member

  • GMC Member
  • 849 posts
  • Version:GM8

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...
  • 0

#5 Merlocker

Merlocker

    No Imagination

  • GMC Member
  • 450 posts
  • Version:GM8

Posted 03 July 2012 - 06:01 PM

Here is the code you should use
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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users