Hi, I’m trying to convert a text variable into a numerical string in Sugarcube, so I can jumble up the variables in my training game, and have the user email me the jumbled up code, for me to un-jumble it and see how they did and add them to a leaderboard.
On the forums I found one suggestion to use the following code at Binary Converter
“for (c of ‘banana’) console.log(c, c.charCodeAt(0).toString(2).padStart(8, ‘0’))”
So I tried other approaches - I also found I can get the first character using $text.first()
This is useful as I can then convert the character into a number using a series of 26 “if” statements, but how do I get the second character etc?
There doesn’t seem to be a $text.second() nor is there a $text.deletefirst() which would enable me to query $text.first again
Any help much appreciated!
Twine Version: 2.3.9
Story Format: Sugarcube 2.31.1