Reading tilemap data

BlitzMax Forums/BlitzMax Beginners Area/Reading tilemap data

I have a question about how to import tile mapdata.

The following example (just the type, it will not run on its own) is taken from Sloan Kelly's BlitzMax book, it will read the tilemap data from an external file with the numbers 0-9. The problem is how do I get it to accept numbers from 10 and up. I need to be able to just insert an comma between the numbers, and be able to take a number with more than two digits. Any suggetions? It does not need to use the example below


Type TMap

Field image:TImage
Field blocks:TList = CreateList()

Method LoadBlocks(img:String)
image = LoadAnimImage(img, 25, 25, 0, 4)
End Method

Method LoadMap(map:String)
x:Int = 0
y:Int = 0

ClearList(blocks)

file = OpenFile(map)
While Not Eof(file)

'Cls
'DrawText("Processing Map", 50, 50)
'DrawText("X = " + X, 50, 60)
'DrawText("Y = " + Y, 50, 70)
'Flip


s:String = ReadLine(file)
'If s:String <> "," Then '''' egen
For i:Int = 1 To Len(s)
block:TBlock = New TBlock
block.X = x
block.Y = y
block.Index = Int(Mid(s, i, 1)) - 1

blocks.AddLast(block)

x = x + 25

If x >= 800
x = 0
y = y + 25
End If

Next
'EndIf ''''egen
Wend

End Method

Method DrawMap()
For b:TBlock = EachIn blocks
DrawImage(image, b.X, b.Y, b.Index)
Next
End Method


Function Create:TMap(path:String, image:String)
o:TMap = New TMap
o.LoadBlocks(image)
o.LoadMap(path)
Return o
End Function


End Type