Not all arguments converted during string formatting (with tr())

Godot Version

4.2

Question

I get the Error (Not all arguments converted during string formatting) in the line
( hint_label.text = tr(“HINT_ATTACK” % [attack_key]))

But the attack_key is a string

Any Idea what courses the error? i mean is clearly a string


var jump_key:String = "W"
var attack_key:String = "Q"
var sprint_key:String = "SHIFT"

func display_conlling_hint(display_time:float, update:Hint_Typs, dialoge_dependency:bool):
	match update:
		Hint_Typs.SPRINT:
			hint_label.text = tr("HINT_SPRINT" % [sprint_key])
		Hint_Typs.ATTACK:
			hint_label.text = tr("HINT_ATTACK" % [attack_key])

If you take out ‘’‘% [attack_key]’‘’ and ‘’‘% [sprint_key]’‘’ does it run without error? What happens then?

The ) at the end was to problem

hint_label.text = tr("HINT_SPRINT" % [sprint_key]) #WRONG
hint_label.text = tr("HINT_SPRINT") % [sprint_key] #RIGHT
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.