function ConfigSave()
File$="config11.txt"
f=OpenTowrite(File$,0)
if f
WriteString ( f, Config.FileVersion$ )
WriteString ( f, Config.PlayerName$ )
WriteString ( f, Config.NetworkName$ )
WriteString ( f, Config.ServerIP$ )
Writeinteger( f, Config.ServerPort )
Writeinteger( f, Config.BackgroundColor)
Writeinteger( f, Config.BackgroundMaterial)
Writeinteger( f, Config.Board)
Writeinteger( f, Config.Notation)
Writeinteger( f, Config.GridSnap)
closefile(f)
endif
endfunction
function ConfigLoad()
File$="config11.txt"
if GetFileExists( File$ ) =0 then exitfunction
f=OpenToRead(File$)
if f
Config.FileVersion$=readString (f)
Config.PlayerName$ =readString (f)
Config.NetworkName$=readString (f)
Config.ServerIP$ =readString (f)
Config.ServerPort =readinteger(f)
Config.BackgroundColor=readinteger(f)
Config.BackgroundMaterial=readinteger(f)
Config.Board=readinteger(f)
Config.Notation=readinteger(f)
Config.GridSnap=readinteger(f)
closefile(f)
endif
endfunction
flow/hint for understanding at pc situation: a template file exist at sub folder in your agk project\ media\test.txt here is no test.txt C:\Users\Name\AppData\Local\AGKApps\project\media\ load "test.txt" will load media\test.txt save "test.txt" will save in C:\Users\Name\AppData\Local\AGKApps\project\media\test.txt load "test.txt" will load from C:\Users\Name\AppData\Local\AGKApps\project\media\test.txt
function LevelLoad(filename$) //message("Load") ret=0 if GetFileExists( filename$ ) =0 message("file "+filename$+" not found") exitfunction ret endif file = OpenToRead(filename$) r$=Readline(file) //Info //message(r$) Level.color=readInteger( file ) Level.style=readInteger( file ) //Hole x,y count=readInteger(file) Level.holes=0 for i=1 to count x#=readFloat(file) y#=readFloat(file) MakeHole(x#,y#,Level.imghole) next //Start x,y x#=readFloat(file) y#=readFloat(file) MakeStart(x#,y#,Level.imgstartpoint) //Ende x,y x#=readFloat(file) y#=readFloat(file) MakeGoal(x#,y#,Level.imggoalpoint) //Block x,y,a count=readInteger(file) Level.blocks=0 for i=1 to count x#=readFloat(file) y#=readFloat(file) a#=readFloat(file) MakeBlock(x#,y#,a#,Level.imgblock) next //Pin x,y,a count=readInteger(file) Level.pins=0 for i=1 to count x#=readFloat(file) y#=readFloat(file) a#=readFloat(file) MakePin(x#,y#,a#,Level.imgpin) next //Wall x,y,a count=readInteger(file) Level.walls=0 for i=1 to count x#=readFloat(file) y#=readFloat(file) a#=readFloat(file) MakeWall(x#,y#,a#,Level.imgwall) next //Way x,y,a count=readInteger(file) Level.waypoints=0 for i=1 to count x#=readFloat(file) y#=readFloat(file) a#=readFloat(file) MakeWayPoint(x#,y#,a#,Level.imgway) next CloseFile ( file ) MakeBackgroundSprite() MakeBall(Level.imgball) LevelColorize() ret=1 endfunction ret