If you don't mind dealing with Lua, 'tonumber()' would suffice to convert a string with numeric matches.
I have prepared a mod for you so that you have an example.
Check the dependency in the readme file.
source:
https://github.com/DjFRedy/X4-Extension ... f_lua_help
z_df_lua_help.7z:
https://github.com/DjFRedy/X4-Extensions/releases
To create a call in your code, something like this:
Code: Select all
<set_value name="$speakline" exact="$Ship_SpeakLine"/>
<set_value name="$is_numeric_line" exact="(typeof $speakline).isnumeric"/>
<do_if value="$is_numeric_line">
<debug_text text="'speakline: ' + $speakline" chance="100"/>
<speak actor="player.computer" page="20101" line="$speakline" priority="100"/>
</do_if>
<do_else>
<debug_text text="'line ' + $speakline +' is a string value, convert to number'" chance="100"/>
<signal_cue_instantly cue="md.LuaHelp.StringToNumber" param="$speakline"/>
</do_else>
'StringToNumber' calls the previously created Lua event, 'onConvertStringToNumber()' converts the value, 'SpeakShipName' waits for the already converted value. You can move 'SpeakShipName' to your own cue, it's just the reception example. mm check it all out and see if it works for you.