Ok,
I give up… (almost)
I am using the map function in b4a to load a file with game levels.
When I programmatically generate the file with the Savelevelsmap sub I get the hex dump as shown below.
In this case the loadlevels sub works just fine.
But, when I create the file with a text editor and then convert it to get the vbLF (0A) correct, without any vbCR’s in the file, resulting in the !!! SAME !!! hex dump as shown below. Te APP crashes on the SECOND line in loadlevelsmap. The fist line is executed correctly. So, the simple conclusion:
something is wrong with the used parameter names of something is wrong with vbCr en vbLF.
But as the hex dump does show... parameter names are ok and there is only a VBLF between lines (which is exaclty what the File.WriteMap generates
The whole idea of the MAP function is that it is convenient to generate parameters in a txt document. But I like to generate them simply in a text file, without the need of programmatically generating it.
Any tips on how to use the map function with txt files I create manually, in stead of through code?
Sample code with an alternative (working) solution is also more then welcome.
Sub Activity_Create(FirstTime AsBoolean)
File.Copy(File.DirAssets, "gamelevels.txt", File.DirInternal, "gamelevels.txt")
End sub
sub Loadlevelsmap
LevelsMap = File.ReadMap(File.DirInternal,"gamelevels.txt")
Fairysprites1(0).x = LevelsMap.Get("1Levelx")
Fairysprites1(0).y = LevelsMap.Get("1Levely")
End sub
Sub Savelevelsmap()
LevelsMap.Put("1Levelx",100)
LevelsMap.Put("1Levely",100)
File.WriteMap(File.DirInternal, "gamelevels.txt", LevelsMap)
End Sub