This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Nanobot's profile picture

How To Use A File To Store Data

Started by Nanobot, 24 July 2013 - 11:59 AM
Nanobot #1
Posted 24 July 2013 - 01:59 PM
I am trying to write a program for a simple rpg game. But I am running into a problem. The way I am setting it up is that I have to call a function for every tile in the map. I am using loops when there is a pattern to the kind of tile I am placing. However it is just too cluttered and messy. For the sake of optimization and ease of making a map I want to have a file called "map" and I would be able to take all information from it about the area, and it would look like something like this.

qqqqqqqqqqqqqqqqqqqqqqqqq
qoooooooooooooooooooooooq
qoooooooooooooooooooooooq
qooooooooyyyyyyyooooooooq
qooooooooysssssyooooooooq
qooooooooysssssyooooooooq
qooooooooysssssyooooooooq
qooooooooyyyyyyyooooooooq
qoooooooooooooooooooooooq
qoooooooooooooooooooooooq
qqqqqqqqqqqqoqqqqqqqqqqqq
So my question Is, would there a simple way to check the character in a specified row and column from another program, and would there be a way to edit the character by specifying its position in the file from another program.
Lyqyd #2
Posted 24 July 2013 - 02:17 PM
Split into new topic.
Joe3000 #3
Posted 24 July 2013 - 02:26 PM
I was creating an rpg once, and I also came into this problem, and I thought that the best way to do it was to overlay a third "map" over the game which was completely blank but consisted of all the interaction points, so if your player got to this area something would happen
Nanobot #4
Posted 25 July 2013 - 03:16 PM
I didn't see anything about this in the forum guidelines, but am I allowed to bump an unanswered question after it gets to the second page?
LBPHacker #5
Posted 25 July 2013 - 04:16 PM
Nanobot, take a look at your messages.