Hi, I'm new with GDevelop

Hello folks, I’ve tried for a few days GDevelop, really it looks good the way it does things.
I would like to create this topic for all the questions that I arise about GDeveleop :stuck_out_tongue:

I think I understood how to do to save data to a file. But I see it only works natively, ie, compiled for Windows in my case. but i need also this work with web build,

Can someone show me how?

Sorry for my English.

See there : wiki.compilgames.net/doku.php/gd … tml5_games
It explains how the “files” (it’s not really one) are stored for HTML5 games. The actions should work the same way though.

I’m not sure why it doesn’t works for you, in case of HTML5 it should be using web storage automatically.
Check this project to see if it works for you:
storage.zip (4.23 KB)
I have tested and it works for me in Firefox, Chrome and IE.

victor: True, it was my mistake, “HTML5 games can’t access the the OS filesystem for security reasons” answered my doub :slight_smile:

ddabrahim: Thank you very much for the example, This will be helpful for me :smiley:
I would like to make a file with 10 questions for example, and that the game load this file at random and with their respective answer.
Something like “Who Wants to Be a Millionaire?” ofcourse i need something simpler, only to learn how load questions randomly from a file and make a questionary.

Again I apologize for my English, I can not say exactly what I need, at least not perfectly. but I guess you understand me :stuck_out_tongue:

Thank you very much again guys.

What I would try to do is I would have 1 file with all the questions included and a file for each question containing the respective answers.

Maybe I can’t explain it in an easy to understand way, but here we go:

Each question would be stored in separated groups inside the same file, and each group’s name would be a number, such as 1,2,3,4,5,6,7,8…etc.
For example:

group 0 “Question 1”
group 1 “Question 2”
group 3 “Question 3”

To load a random question, first, create a variable with a random number between 0 and the number of questions you have. If you have 10 question, create a variable with the value Random(9) (9 because 0 also included ).
So it would be let say rndQuestion = Random(9)
The variable going to be used to load a question from random group and also as reference for what question is loaded. So to load a random question using the variable as group name you can enter the following expression:

Group:
“”+ToString(Variable(rndQuestion))

Since the name of the groups are numbers and the value of rndQuestion is a random number, it going to load a question of a random group, technically a random question.

Now, each question would have it own file containing the answers. The group 1 question would have it answers in a file called “1”, group 2 question would have it answers in the file called “2” and so on. So once you have loaded the question, the only thing you need to do is to load the answers from the file with the same name as the group name of the question, so as a file name to load answers you can use the rndQuestion variable again like so:

File name:
“”+ToString(Variable(rndQuestion)).

In case you want to decide which answer is the correct answer, you can start with the group names. Each question would have let say 3 wrong and 1 correct answer. The only thing you need to do, is to use groups like so:

group wrong1 “Wrong answer1”
group wrong2 “Wrong answer2”
group wrong3 “Wrong answer3”
group correct “Correct answer”

And just simply read all the answers from the groups and display them in separated text objects, and since all the answers are displayed in separated text objects, you can simply check if wrong or correct text object have been selected, obviously you would have 3 text object to display 3 wrong answer and 1 correct text object to display the only correct answer the question has and check if the wrong or correct text object is selected/clicked.

I know, maybe it difficult to understand especially if you are new to GDevelop, I’m not very good in explaining things, but I hope it helps somewhat. :slight_smile: