GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 Re: GML Code Help » INI file not using the default value » 2014-05-02 11:16:38

Hi, I'm just reporting in what i did in a last couple of days so that it could help someone else.
I did indeed encoded the arc4 data with base64 which is now actualy in gms itself, so that was quick. But then I've found out that while it was working nicely in Windows, it wasn't working on Android. And then I've found that the ini file which is gm creating on first lounch isn't utf8 which seems to be the problem. So I've just added the right one to the Included files. Now it works just how it should ;)
Thank you for a much needed help! :]

#2 GML Code Help » INI file not using the default value » 2014-04-25 17:39:19

Sorsy
Replies: 3

Hello!
I'm trying to use the rc4 script to encrypt my INI file. Everything is working fine except that I can't seem to be able to change the default value that INI sets itself if it cannot find existing INI file.
Here is what scripts I have:
scr_cr - rc4 itself
{
    var str,key,out,len,i,S,j,temp,pos,t;
    str = argument0;
    key = argument1;
    out = "";
    len = string_length(key);
    for (i=0; i<256; i+=1) S[i] = i;
    j = 0;
    for (i=0; i<256; i+=1) {
        j = (j + S[i] + ord(string_char_at(key,(i mod len)+1))) mod 256;
        temp = S[i];
        S[i] = S[j];
        S[j] = temp;
    }
    i = 0;
    j = 0;
    for (pos=0; pos<string_length(str); pos+=1) {
        i = (i + 1) mod 256;
        j = (j + S[i]) mod 256;
        temp = S[i];
        S[i] = S[j];
        S[j] = temp;
        t = (S[i] + S[j]) mod 256;
        out += chr(ord(string_char_at(str,pos+1)) ^ S[t]);
    }
    return out;
}

And I call it with this:
ini_read_real_encrypted
{
var section,key,encryption_key,value;
section = argument0;
key = argument1;
encryption_key = argument2;
value = ini_read_string(section,key,1);
value = scr_cr(value,encryption_key);
return value;
}

The problem is that when I change the default value of ini_read_string(section,key,1) in ini_read_real_encrypted it doesn't do anything, it is still setting the default to 0.
Could someone look at this and tell me if I'm doing something wrong? I can provide some more info if needed.
Thanks in advance!

Board footer

Powered by FluxBB