2017-04-23 03:24:33

Hello!
Prompt please, as in BGT to make a file of settings. For example, I have a file with the following content:
Name = John
Hp = 100
How in BGT to download and use these settings?
P.s. The file object is signed, but I do not know how to get name, hp
Thanks in advance!

2017-04-24 03:20:44

I've seen a couple different ways to manage settings files. First off, there's encrypting the file, or making it look like the following:
john,0,3,2,8
Then use string_split like:
string[] values=string_split(f.read(),",",false);
values[0]=username;
values[1]=achievements;
//and so on

And for the way you described, essentially, you'd read the file, use string_split with "\r\n", and parse item=value.

2017-04-24 20:55:00

Hi jonikster.
You seem to have a lot of questions about bgt and python. You keep making a whole bunch of new topics to ask each question. Why don't you make one topic to ask your questions, it would be easier for you and for us who read them.
Like I said I think your going to run into trouble, if you keep asking people for lines of code. If you can't figure these things out yourself, your setting yourself up for failure. You seem to know some things about bgt, I don't know why you keep needing so much help.

Guitarman.
What has been created in the laws of nature holds true in the laws of magic as well. Where there is light, there is darkness,  and where there is life, there is also death.
Aerodyne: first of the wizard order

2017-05-21 19:04:01

jonikster wrote:

Hello!
Prompt please, as in BGT to make a file of settings. For example, I have a file with the following content:
Name = John
Hp = 100
How in BGT to download and use these settings?
P.s. The file object is signed, but I do not know how to get name, hp
Thanks in advance!

I recommend that you use escape characters, such as return (\ r) and newline (\ n), to use as a separator in order to split the information with the string_split function.
In a file you can do something like:
config1=someting
config2=someting
config3=someting
And then you could have in your code something like
string[] config;
file configs;
configs.open (config.txt","r");
config=string_split(configs.read(),"\n",false);
configs.close();
And then you can make conditions like
if (config[x]=="config0=yes"){
//do someting
}
else if (config[x]=="config0=no"){
//do someting
}

I hope I have helped
Regards