reading a map
Blitz3D Forums/Blitz3D Programming/reading a map
| ||
I am confused about a process. Lets say, in bad pseudo code I have a text map file that is 79X79. I want to open this file and read the contents into an array THEN use that array to create a dungeon map. So first: dim dungeon (79,79) open map.txt for x = 1 to 79 read map.txt next for y = 1 to 79 read map.txt next THEN OK I am stumped... how do I get the computer to look at the array and put map pieces according to number in the array??? -RZ |
| ||
You know, that'd only read the 'first' column and row. You should structure it like so: Dim Dungeon$(79,79) For X = 1 to 79 For Y = 1 To 79 Dungeon(X,Y) = ReadSomeInfoOrWhateverFromTheMapFile() Next Next For X = 1 To 79 For Y = 1 To 79 ProcessThing(Dungeon(X,Y)) Next Next Or something like that. Basically, I can't do anything without seeing the structure of these map files. |
| ||
I used a program called ddungeon.exe to generate a text map file like in ROGUE / NETHACK. This is what I did. but the printout is a long list of the number 49... Oh the file??? It looks like this EXACTLY... you can prob cut and paste! I get no joy! I think the main problem is with print... there is no way to force it to stay on the same line so maybe use TEXT??? -RZ |
| ||
You need Write :) |
| ||
I though write only wrote to a file not to the screen??? -RZ |
| ||
Description: Writes a string to the front buffer (i.e. the screen), but doesn't then start a new line (unlike Print). |
| ||
WRITE tries to work... now can someone explain why it only writes "494949494949494949494...."" until I get a memory access violation??? -RZ |
| ||
OK I made a change or two... this is acting weird! Yes... write does the trick and it seems to read the file but the numbers make no sense! -RZ |
| ||
your getting the Ascii value of 1, which is 49! you need to render the file using writebyte |
| ||
try this |
| ||
Yeah for Neomancer!!! Now to convert it to a program that creates a dungeon in 3d and remake ROGUE/NETHACK the B3D way! -RZ Well, at least thats what I hope to do... actually I am just hoping to learn how to program better. ;) |
| ||
hehe, you "could" do it using boxes, but i have never seen ROGUE so i dont know it works or looks like :( I used to write those types of dungeons games back on the amiga |