Legacy GM Help![GML] Write text in a specific position in file

V

Vanthex

Guest
Hi, I have a file that contains lots of real numbers separated by spaces. Eg: 0 2 3 1 0 0 2
When the player left clicks with their mouse on obj_tile, i use obj_tile's x and y to determine which number in the file I should substitute to 0. I do know how to open and close a file, but I don't know how to tell gamemaker to specifically replace the number at a certain place.
 
W

whale_cancer

Guest
I am not sure there is a way, as I have never had reason to try. That being said, why aren't you just using a ds_grid, converting that to a file, and then saving that as a string to the file? I can't imagine an application in which the way you want to do it is better than a ds_grid. You could even convert the ds_grid into a file like you like after using a ds_grid to handle the data.
 
D

Dengar

Guest
string parsing
load the entire string from the file, then parse the string, then resave the data.
 
V

Vanthex

Guest
I am not sure there is a way, as I have never had reason to try. That being said, why aren't you just using a ds_grid, converting that to a file, and then saving that as a string to the file? I can't imagine an application in which the way you want to do it is better than a ds_grid. You could even convert the ds_grid into a file like you like after using a ds_grid to handle the data.
Oh lol, I'm new so I don't know a lot about GML yet. The ds_grid is really helpful for me, it makes thing so much easier, except my code doesn't work right now. I need some help :) link
 
Top