2019-01-06 06:30:58 (edited by dash 2019-01-06 06:31:11)

How i can do it?

You must know... Cats are soft!

2019-01-06 06:45:20 (edited by cartertemm 2019-01-06 06:46:19)

Go to the start screen, find bgt, then help
Or if you prefer, open up
"C:\Program Files (x86)\BGT\bgt.chm"

Either way, references/foundation layer/object reference/file. Enter on the topic and f6 to read text. I'm purposely not providing code, as your first step on the programming journey will have to be figuring out the basics

Thumbs up

2019-01-06 09:55:25

There's an example of this in the file object chapter. It's very easy to do. I strongly recommend you go through the help section. Otherwise, here goes an example.
//I'll skip void main because putting braces seems to break things on the forum.
file f;
string file_contents;
f.open("outfile.txt", "rb");
And as long as the file in quotes is valid, you now have a string containing the file contents of outfile.txt:
Also, you can eliminate a line by going.
file f;
f.open("outfile.txt", "rb");
string file_contents=f.read();
But I'm overcomplicating ever slightly. I hope this helps! smile

Thumbs up

2019-01-06 12:57:46

Thanks for informations.
I was just curious if it was possible. smile

You must know... Cats are soft!

2019-01-06 15:21:50

I mean I got bored enough to make a virtual notepad in bgt (without using audio form) and didn't get passed being able to view the file with your arrow keys because how massively useless the audio form object is, but that's a story and rant for another day.
And yeah, this right here is the basics of saving and loading data, passing the contents of a file to a string. Your supposed to serialise it using dictionaries but aaaaaaaaaaaaa dictionaries! Dictionaries and bgt aren't a combination I would recommend if your after a stable bgt script.

Thumbs up

2019-01-11 01:25:25

I actually created a note taking program in BGT many moons ago. Note to self, must port to python.

Nathan Smith
Managing Director of Nathan Tech
It's not disability
It's ability!

2019-01-11 15:22:26

Heh, I just got bored and wanted to see if it could be done without using audio form. Spoiler alert, it can, but it's ever tricky and is likely to end up with massive massive glitches, somewhere. Where? No idea yet. Why? No idea either.
The way I'm doing it is using Arrays and for every true newline I skip empty lines is inserted a new element with the string data. yeah, it's an explanation as vague as trying to read braille sheet music for your first time but there you have it.

Thumbs up