I agree with @llamazing and @MetalZelda that putting names to new text surfaces in the dialog_box is really unnecessary. The idea I had in mind when I coded that was to allow to go back to the previous text surface if needed, to reduce the number of surfaces, but since the dialog box is small we should not worry about this kind of things. Better to reduce the syntax as the ones you use.
A good idea, and probably a better syntax, would be allowing to call functions in dialogs. So I propose a slight modification of the same syntax, which is even shorter:
$function_identifier
The functions associated to each "function_identifier" would be defined in the dialog box as usual: "dialog_box:function_name()".
To avoid using long function names in the dialog box (the syntax would be too long) and at the same time keep the long name in the definition of the functions of the form "dialog_box:function_name()" (which is clearer), we could use a short identifier after the dollar symbol "$" instead of the name of the function. For this purpose, another function "dialog_box:start_function(short_id, parameters)" would be needed, just to start the convenient function assotiated to that "short id" used in the syntax.
Furthermore, to keep the dialog as clean as possible, the parameters of each function should better be given as properties of the dialog and not in the middle of the text. For instance, if the color is changed 3 times in a dialog, we would define an array of color properties, and each time $c is called, the next color of the array would be applied.
Remark: $c could be used to call a function "dialog_box:set_color(color)". This function should be overloaded to be compatible too with this other useful syntax: "dialog_box:set_color(r, g, b)", whose parameters would be sent as strings and then "dialog_box:set_color(r, g, b)" would first convert the three strings into integers and then make the color change.
An example to change color and a shaking effect:
dialog{
id = "_cannot_lift_too_heavy",
skip = "all",
color = {"red", "white", {200, 0, 100}},
movement = {{"horizontal", "fast"}, nil, {"vertical", "slow"}, nil},
text = [[
Oh là là, c'est l'$camour$c !
$cWe will $mshake$m and $mbounce$m !
]]
}
I propose some short function ids (i.e., for the dialog syntax):
$0, $1, $2, $3, etc: as usual, for the "text speed"
$c: change color; allows color_id_string or (r, g, b) as parameters
$s: change the size of the text; integer parameter
$f: change the font type; font_id_string parameter
$m: movements and shaking effects; parameters: movement_type_string, and other optional_parameters
$d: "dynamic" (i.e., continuous) color changes (rainbow color-shift, etc). parameters: effect_id_string, and others
$b: change the "beeping" sounds, which may be different for different NPCs, etc; parameter: sound_id_string
$i: draw image/icon (the width may be given as parameter if necessary). parameters: image_id_string, etc
If you have more ideas for other different effects that we may implement, or a suggestion for a different syntax, we can discuss it.
A different syntax, much clearer for translators and easier to read, but harder to code (because there could be a "nested" use), would be to use "{", "}" symbols (these could be optional) to indicate where the effects will be applied. For instance:
blablabla this $c{word} and $c{this} are in red.
Another example:
dialog{
id = "_cannot_lift_too_heavy",
skip = "all",
color = {"red", {200, 0, 100}},
movement = {{"horizontal", "fast"}, {"vertical", "slow"}},
text = [[
Oh là là, c'est l'$c{amour} !
We will $c{$m{shake} and $m{bounce}} !
]]
}