Closed JujuAdams closed 1 year ago
Good idea. Another possibility would be to make use of the new string builder functionality if running on 2022.11+. Maybe have the option to use either?
@biyectivo How would you use string_concat()
/ string_concat_ext()
in this context?
I was referring to something like:
scribble(string("You have {0} coins and {1} hearts", coins, hearts));
maybe we could do:
scribble("You have {0} coins and {1} hearts", coins, hearts);
I see, thank you
Proposal largely met with positive reactions on Discord. Concerns against the change were
The second point cannot adequately be addressed at this point. Point 1 can with the addition of a SCRIBBLE_LEGACY_FUNCTION
macro
Current setup is
function scribble(value, [uniqueID])
. Most of the time,uniqueID
is not used. However, it is very common for developers to want to build strings by concatenating many values together e.g.scribble("You have " + string(coins) + " coins and " + string(hearts) + " hearts.")
. This manual concatenation is inconvenient.Proposal is to embrace concatenation as the default behaviour:
function scribble(value, ...)
Concatenates values together into a string for drawing e.g.
scribble("You have ", coins, " coins and ", hearts, " hearts.")
Unique IDs are still critically important in some situations so we'd also need
function scribble_unique(uniqueID, value, ...)
. Ifundefined
is passed asuniqueID
then a random number is generated (using an internal PRNG), guaranteeing a uniqueuniqueID
.