System.out.println("The value is " + myNumber + "!"); However, if I use "" + variable in GML, it gives me an error. I'm doing this for user-named INI files for saving and it would be nice to know this as well for the future.
Displaying text and variables on the same line
Started by goldsonic46, Jan 21 2012 04:55 AM
4 replies to this topic
#1
Posted 21 January 2012 - 04:55 AM
As the title says, how can I have text and a variable show on the same line when using show_message or draw_text? In C and C++, you simply use %d,%s,%c,etc with the appropriate variable type. In Java, you can do this
#2
Posted 21 January 2012 - 05:10 AM
What's your error?
You should be able to go string1+string2, or "string 1"+string2, or "string 1"+"string 2" or even "string 1" + string(number) + string 2!
You should be able to go string1+string2, or "string 1"+string2, or "string 1"+"string 2" or even "string 1" + string(number) + string 2!
#3
Posted 21 January 2012 - 05:20 AM
___________________________________________
ERROR in
action number 1
of Mouse Event for Left Button
for object obj_save:
Error in code at line 1:
show_message("The number is " + global_control.bomb_gravity[bomb_number]);
at position 48: Wrong type of arguments to +.
#4
Posted 21 January 2012 - 05:51 AM
You need to use string(global_control.bomb_gravity[bomb_number])
#5
Posted 21 January 2012 - 05:57 AM
Thanks!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











