#String Input Problem
23 messages · Page 1 of 1 (latest)
you want to use real() in situations you actually need the conversion for some sort of calculation AND if you're 100% sure the input from keyboard string is an actual number
but for draw_text, you can only have strings for drawing, no reals
Oh ok. But if I take real() off of it I get an error saying that number is a string and not a number. How to convert it?
not really sure what you're doing with number to cause that, but you can just wrap it in a string() instead then
so you're guaranteed its gonna try and draw a string
The problem is this line. It needs "number" to be a number so it can know what the line width needs to be.
draw_line_width(newX, newY, oldX, oldY, number);
then for that you can indeed use real() since its for a calculation
it all depends on what type is allowed for that argument; like for draw_line_wdith that last argument needs to be a real
With this function you can draw a line of a specified width between any two points in the game room. Please note that the line being drawn may need different values (+/-1 on the x, y) to be drawn with the desired dimensions due to differences across the various supported platforms.
Arguments
x1: The x coordinate of the start of the line.
y1: The y coordinate of the start of the line.
x2: The x coordinate of the end of the line.
y2: The y coordinate of the end of the line.
w: The width of the line in pixels.
but for draw_text, the last argument needs to be a string
That worked.
I was just trying to make it real in the wrong place
yea 
@gusty bluff Is there a way I can set number to say...5 before a number is put into the field?
so you want to display 5 in the input field from the start?
Yes
or do you want number to be 5 before any input? because they're two different things
number should be five before any input I would say
you could set keyboard_string to 5 in create event, so in the step it'll already be 5 when getting set to number
oh cool
so you could do:
//create
number = "";
keyboard_string = "5";