excactly what i did, but it still doesnt work, here's the code:
the saving function
the loading function
the actual output of the saving function :
and finally, the CreateBrick function:
the problem is that when loading this, i get an error message in the function CreateBrick(). On the command "SetBuffer ImageBuffer(b\id)", I get the error message: "Image does not exhist!".
the function works fine when called with non-read variables.
the saving function
Function Save(filename$) file = WriteFile("maps"+filename$+".bb") file = OpenFile("maps"+filename$+".bb") For b.bricks = Each bricks WriteLine file, b\x WriteLine file, b\y WriteLine file, b\w / 30 WriteLine file, b\cr WriteLine file, b\cg WriteLine file, b\cb Next CloseFile file End Function
the loading function
Function Load(filename$) file = OpenFile("maps"+filename$+".bb") For n = 0 To Eof(file) Local x = Int ReadLine(file) Local y = Int ReadLine(file) Local s# = Float ReadLine(file) Local cr = Int ReadLine(file) Local cg = Int ReadLine(file) Local cb = Int ReadLine(file) CreateBrick(x, y, s, cr, cg, cb) Next CloseFile file End Function
the actual output of the saving function :
427 315 2 255 0 0
and finally, the CreateBrick function:
Function CreateBrick(x, y, s#, cr, cg, cb) b.bricks = New bricks b\x = x b\y = y b\w = s*30 b\h = s*10 b\cr = cr b\cg = cg b\cb = cb b\id = CreateImage(b\w, b\h) SetBuffer ImageBuffer(b\id) Color cr, cg, cb Rect 0, 0, b\w, b\h SetBuffer BackBuffer() End Function
the problem is that when loading this, i get an error message in the function CreateBrick(). On the command "SetBuffer ImageBuffer(b\id)", I get the error message: "Image does not exhist!".
the function works fine when called with non-read variables.