sombody who has the nick name of Zehper48 recently wrote:is there a way you can make a txt number where you can write in it, and below it theres a save button and load button. is there a way when you type somthing, and hit save it saves that txt, and when you click load it loads the txt you saved?
Yes:
1. Create an actor called "tactor".
2. Configure the input the way you want.
2.1. (if you don't know how to configure the input.) Bring up the actor control for your text actor and click on the text button
near the upper right part of your actor control window.
After you have done this another little window should pop up.
Select your font and your font size and colour (and weither you want it to be soft or not.)
Now click on Okay. The window where you selcect your font will go away. Now type in the text you want to appear
as your default text actors text. (If you want it for making notes just make it a | and 254 spaces after that. (255 characters is the maximum for copying text.)
Now click on the input button to the bottom left of that window. Now set it up (this part is easy to figure out) the way you want it.
Now for the coding part!
3. Create an actor called "save".
4. Create an actor called "load".
5. Add the save and load button images for the save and load actors.
6. Put this code on the mouse button down event of save:
- Code: Select all
FILE*file;
file = fopen("TextNote.txt", "w+");
fwrite(&tactor.text, sizeof(tactor.text), 1, file);
fclose(file);
7. put this code on the mouse button down event of load:
- Code: Select all
FILE*file;
char tdoc[255];
file = fopen("TextNote.txt", "r+");
fread(&tdoc, sizeof(tdoc), 1, file);
fclose(file);
strcpy(tactor.text, tdoc);
8. Save your game then you are done. If you want a more advanced version (with many more things,)
please let me know and I will make a demo.