Since nobody posted a reply to my previous post about encoding/encrypting data, i have written the script myself:
CAUTION!: the following code is advanced-experienced user rated and may baffle novice users
This tutorial is written for string variables only. If you have real variables convert the real variable into a string by using the string(variable name here) function.
Firstly open up save object.
If you are saving already defined string you have too create a duplicate of the variable so the code doesn't overwrite your original variable. Call the new variable temp_(variable
Code1. In this tutorial I'm going to save the variable var1. In the create event put:
temp_var1 = var1
Code2. Also in the create event put the following code:
//This will be used to tell the program the place where the program should change the letter/number.
//This will be used later! There must be a space at the end if the string.
random_string="//put in you random letters here"
// Remember random_string must be exactly the same length as the alphabet string.
//Also do not repeat any letters otherwise you will have major problems when loading.
//This is for encoding numbers. Again do not repeat numbers!
I will be using all of these variables later and you should be able to understand it better then.
Code3. The next bit of code may take a while to explain:
Again put it in the create event.
repeat(string_length(temp_var1))//Basically it says repeat this however long temp_var1 is.
//Sets the letter that is going to be replaced. It gets the character at the place (string_position), looks where it is //in the alphabet and returns the letter in random_string at the same position.
//Deletes the letter at string_position
//Replaces the letter you just deleted with replace_letter.
//Sets the string position to +1 so when the code is repeated it moves to the next letter.
Thats it for encoding! All you have to do is save the temp_var1 like in the original tutorial.
When you load the file you will need to decode it. Do this by loading like in the original tutorial but put only the last 2 codes in to load object.
Put the first bit of code in the create event and the second code in the left pressed event AFTER the original code if your using the same principles of the original tutorial.
Now got to that second code and where it says replace_letter=....,alphabet)) switch random_string with alphabet and alphabet with random_string. This code should now do
the exact opposite of what it did in save object and replace the random_string letter with the letter from the alphabet. If you have done everything exactly how i have designed
this should work.
Remember that variable you made called no_line? This is to save numbers. you can do this by changing wherever it says alphabet in code3 to no_line. Simple as that!
If the code doesn't work and you are getting really frustrated bug me enough and i might make an example file.
I will try to make the example file any way but it depends on if i have enough time.
Happy saving and loading!