Text nodes: only displays 1 character, twitches (SOLVED)

I have a text node, it uses the default font. I set the text node to "Timer ends in "…tostring(self.timer) and it displays a “1”

If I remove the …tostring(self.timer) part it displays “e”

In the gui preview, and the default text is set to “Timer ends in” it is wider and displays the entire string.

??

Can you please post the code? The string concatenation operator is .. btw, not ....

2 Likes

It’s based on the “countdown timer” sample code provided somewheres on this forum. How would you add a countdown counter to gui?

As for the comment – the website changed . . to . . .

1 Like

You still need to post more information. Preferrably screenshots and code. Without it one can only guess what’s wrong. Maybe you have rotated the node so it stretches beyond Z -1 and 1?

This isn’t exactly the same issue, but on a different label in the same GUI.

DefoldSven3

This is “Z=0” on the label. Settings I’ve tried are “Fit” and “Stretch” and “Zoom” none seem to behave different.

DefoldSven4

function init(self)
	self.timer = 60*60*4 -- in seconds
end

function final(self)
end

function update(self, dt)
	if self.timer > 0 then
		self.timer = math.max(self.timer - dt, 0) -- make sure it doesn't go below 0
		gui.set_text(gui.get_node("my_shift_ends"), "Shift ends in "..tostring(self.timer))
	else
		-- gameover!!!
		
	end
end

1 Like

You do have rotation around Y. That affects where on Z different parts of the node is.

4 Likes

Both seemed to have that issue. Thanks :rofl:

2 Likes