data

BlitzPlus Forums/BlitzPlus Programming/data

Sure .. at some point, you read the map from the Data.
Right after that, you can put this map in a file.
I made a 'short version' that shows this:
Const 	Map_Length=49
Const	Map_Height=49

Dim Map$(Map_Length,Map_Height)

;;;Goto skipsave ;;<-- remove the comments after running it once

	;------------------
	;read map from Data
	;------------------
		
		Restore level0
		For y=0 To Map_Height
			Read Value$ 
			For x=0 To Map_Length
				Map(x,y)=Mid(Value$,x+1,1)
			Next
		Next
	
	;------------------
	;write data to file
	;------------------
	   ff = WriteFile("map.dat")
	   For y = 0 To Map_Height
	       For x = 0 To Map_Length
	           WriteByte ff, Asc(Map(x, y)) 
			   ;you could also use WriteString, but this way, the file is smaller
	       Next
	   Next
	   CloseFile ff
	

.skipsave

;-------------------
;read data from file
;-------------------
   ff = ReadFile("map.dat")
   For y = 0 To Map_Height
       For x = 0 To Map_Length
           Map(x, y) = Chr$(ReadByte(ff))
		   ;Chr$ converts the number back into the app. character
       Next
   Next
   CloseFile ff

;---------
;test/show
;---------

Graphics 800, 600, 0, 2
Cls

For y = 0 To Map_Height
For x = 0 To Map_Length
	
	Text x * 12, y * 12, Map$(x, y)
	
Next
Next

WaitKey()
End


.level0
Data "00000000000000000000000000000000000000000000000000";1
Data "00000000000000000000000000000000000000000000000000";2
Data "00000000000000000000000000000000000000000000000000";3
Data "00000000000000000000000000000000000000000000000000";4
Data "00000000000000000000000000000000000000000000000000";5
Data "00000000000000000000000000000000000000000000000000";6
Data "00000000000000000000000000000000000000000000000000";7
Data "00000000000000000000000000000000000000000000000000";8
Data "00000000000000000000000000000000000000000000000000";9
Data "00000000000000000000000000000000000000000000000000";10
Data "00000000000000000000000000000000000000000000000000";11
Data "00000000000000000000000000000000000000000000000000";12
Data "00000000000000000000000000000000000000000000000000";13
Data "00000000000000000000000000000000000000000000000000";14
Data "00000000000000000000000000000000000000000000000000";15
Data "00000000000000000000000000000000000000000000000000";16
Data "00000000000000000000000000000000000000000000000000";17
Data "00000000000000000000000000000000000000000000000000";18
Data "00000000000000000000000000000000000000000000000000";19
Data "00000000000000000000000000000000000000000000000000";20
Data "00000000000000000000000000000000000000000000000000";21
Data "00000000000000000000000333000000000000000000000000";22
Data "0000000000000000G000003333300000000000000000000000";23
Data "3333333000033333Z333333333333333333333333333333333";24
Data "313F3DZ0000EZ333Z333333363333333333333333333333323";25
Data "3333333000033333Z333333333333333333333333333333333";26
Data "0000000000000000Z000003333300000000000000000000000";27
Data "00000000000000000000000333000000000000000000000000";28
Data "00000000000000000000000000000000000000000000000000";29
Data "00000000000000000000000000000000000000000000000000";30
Data "00000000000000000000000000000000000000000000000000";31
Data "00000000000000000000000000000000000000000000000000";32
Data "00000000000000000000000000000000000000000000000000";33
Data "00000000000000000000000000000000000000000000000000";34
Data "00000000000000000000000000000000000000000000000000";35
Data "00000000000000000000000000000000000000000000000000";36
Data "00000000000000000000000000000000000000000000000000";37
Data "00000000000000000000000000000000000000000000000000";38
Data "00000000000000000000000000000000000000000000000000";39
Data "00000000000000000000000000000000000000000000000000";40
Data "00000000000000000000000000000000000000000000000000";41
Data "00000000000000000000000000000000000000000000000000";42
Data "00000000000000000000000000000000000000000000000000";43
Data "00000000000000000000000000000000000000000000000000";44
Data "00000000000000000000000000000000000000000000000000";45
Data "00000000000000000000000000000000000000000000000000";46
Data "00000000000000000000000000000000000000000000000000";47
Data "00000000000000000000000000000000000000000000000000";48
Data "00000000000000000000000000000000000000000000000000";49
Data "00000000000000000000000000000000000000000000000000";50