Is it possible to create custom name placeholders?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By wombatTurkey
:warning: Old Version Published before Godot 3 was released.

Sorry for the title :P, but hard to explain.

Anyways, simple text placeholder conversion:

var format_string = "%s was reluctant to learn %s, but now he enjoys it."
var actual_string = format_string % ["Estragon", "GDScript"]

print(actual_string)
# output: "Estragon was reluctant to learn GDScript, but now he enjoys it."

Is it possible to do something like this

var format_string = "%customname1 was reluctant to learn %customname2, but now he enjoys it."
var actual_string = format_string % { customname1 = "Estragon", customname2 = "GDScript"}

print(actual_string)
# output: "Estragon was reluctant to learn GDScript, but now he enjoys it."

Reason I ask is I’m creating a fairly large dynamic tooltip for player skills. Need to generate damage, cooldown, skill descriptions, etc on the fly. Doing something like this would be a lot easier then just an array. But, I mean an array is fine it will just be harder to track :stuck_out_tongue: so just seeing if something like this was possible, thanks!

AFAIK, There is no such easy way.
Here is same issue. Advanced String format with named/numbered parameters · Issue #5493 · godotengine/godot · GitHub

volzhs | 2016-08-20 15:23

@volzhs thanks, looks like it might get implemented down the road, maybe? I hope? :smiley:

wombatTurkey | 2016-08-20 20:21