Character to Ascii/Unicode conversion?

Hi GDevelop Gurus.
I’m using GD V4 (yes, I know… I’m maybe the last dinausor :smile:)
I’m trying to “secure” (i.e. make sure someone didn’t modify its content) an XML file containing text messages.
So… I try to calculate/store a checksum for each message stored to that file.

But is there a function within GD to convert a Character (ex: “A”) to its Ascii/Unicode value (ex: 65) ?
I have found a GD function “FromCodePoint” that does exactly the opposite (convert an Ascii/Unicode to a character => you pass 65 and the function returns “A”)…

But I would need a “ToCodePoint” function :joy:

Does it exist somehow? Maybe under another name?
Any workaround I could use with GD V4 if that function does not exist?
Many thanks in advance,
Best Regards,
Damien.

Not sure this is the most simple/elegant solution… But I have eventually created an Array Variable called UTF8 that I initialize that way (indexes of this array are the characters e.g. “!”, “a”, “1”, etc… and values stored by this array are the character codes e.g. 33, 97, 49, etc.)
The following code shows this array initialization:

Then, when I want to get the code (Variable CaractereValeur) of a character (VariableString “CaractereExtrait”), I’m just using:

This “trick” works for me… But I’m still convinced GD should provide a “ToCodePoint” function (or whatever other name…) as it provides today a “FromCodePoint” function :slightly_smiling_face:

Best Regards,
Damien.

You can use javascript like this

In GD5 we can get the scene variable like this :

variables = runtimeScene.getVariables();//Get all variables in this scene
nameVariable = variables.get(“UTB__variable”).getAsString();

Documentation

Thanks Bouh,
For the time beeing, Im’ not a JavaScript guru (at all…)
DEFINITELY, after I finish my current game (hum… when??? :blush:), the next one will use GD5 which seems really promising…
Damien.