Ok, got something working:
//------------------------------------------------------------------------------------------------------------
function LoadOptionsAndHighScores ( )
if GetFileExists( "PA3-Alpha2of3.cfg" ) = 0
else
OpenToRead(1, "PA3-Alpha2of3.cfg")
MusicVolume = readInteger( 1 )
EffectsVolume = readInteger( 1 )
GameMode = readInteger( 1 )
SelectedBackground = readInteger( 1 )
SecretCode[0] = readInteger( 1 )
SecretCode[1] = readInteger( 1 )
SecretCode[2] = readInteger( 1 )
SecretCode[3] = readInteger( 1 )
mode as integer
for mode = 0 to 2
HighScoreName [ mode, 0 ] = readString( 1 )
HighScoreName [ mode, 1 ] = readString( 1 )
HighScoreName [ mode, 2 ] = readString( 1 )
HighScoreName [ mode, 3 ] = readString( 1 )
HighScoreName [ mode, 4 ] = readString( 1 )
HighScoreName [ mode, 5 ] = readString( 1 )
HighScoreName [ mode, 6 ] = readString( 1 )
HighScoreName [ mode, 7 ] = readString( 1 )
HighScoreName [ mode, 8 ] = readString( 1 )
HighScoreName [ mode, 9 ] = readString( 1 )
HighScoreLevel [ mode, 0 ] = ReadInteger( 1 )
HighScoreLevel [ mode, 1 ] = ReadInteger( 1 )
HighScoreLevel [ mode, 2 ] = ReadInteger( 1 )
HighScoreLevel [ mode, 3 ] = ReadInteger( 1 )
HighScoreLevel [ mode, 4 ] = ReadInteger( 1 )
HighScoreLevel [ mode, 5 ] = ReadInteger( 1 )
HighScoreLevel [ mode, 6 ] = ReadInteger( 1 )
HighScoreLevel [ mode, 7 ] = ReadInteger( 1 )
HighScoreLevel [ mode, 8 ] = ReadInteger( 1 )
HighScoreLevel [ mode, 9 ] = ReadInteger( 1 )
HighScoreScore [ mode, 0 ] = ReadInteger( 1 )
HighScoreScore [ mode, 1 ] = ReadInteger( 1 )
HighScoreScore [ mode, 2 ] = ReadInteger( 1 )
HighScoreScore [ mode, 3 ] = ReadInteger( 1 )
HighScoreScore [ mode, 4 ] = ReadInteger( 1 )
HighScoreScore [ mode, 5 ] = ReadInteger( 1 )
HighScoreScore [ mode, 6 ] = ReadInteger( 1 )
HighScoreScore [ mode, 7 ] = ReadInteger( 1 )
HighScoreScore [ mode, 8 ] = ReadInteger( 1 )
HighScoreScore [ mode, 9 ] = ReadInteger( 1 )
next mode
CloseFile ( 1 )
endif
endfunction
//------------------------------------------------------------------------------------------------------------
function SaveOptionsAndHighScores ( )
OpenToWrite( 1 , "PA3-Alpha2of3.cfg" )
WriteInteger ( 1, MusicVolume )
WriteInteger ( 1, EffectsVolume )
WriteInteger ( 1, GameMode )
WriteInteger ( 1, SelectedBackground )
WriteInteger ( 1, SecretCode[0] )
WriteInteger ( 1, SecretCode[1] )
WriteInteger ( 1, SecretCode[2] )
WriteInteger ( 1, SecretCode[3] )
mode as integer
for mode = 0 to 2
WriteString ( 1, HighScoreName [ mode, 0 ] )
WriteString ( 1, HighScoreName [ mode, 1 ] )
WriteString ( 1, HighScoreName [ mode, 2 ] )
WriteString ( 1, HighScoreName [ mode, 3 ] )
WriteString ( 1, HighScoreName [ mode, 4 ] )
WriteString ( 1, HighScoreName [ mode, 5 ] )
WriteString ( 1, HighScoreName [ mode, 6 ] )
WriteString ( 1, HighScoreName [ mode, 7 ] )
WriteString ( 1, HighScoreName [ mode, 8 ] )
WriteString ( 1, HighScoreName [ mode, 9 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 0 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 1 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 2 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 3 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 4 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 5 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 6 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 7 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 8 ] )
WriteInteger ( 1, HighScoreLevel [ mode, 9 ] )
WriteInteger ( 1, HighScoreScore [ mode, 0 ] )
WriteInteger ( 1, HighScoreScore [ mode, 1 ] )
WriteInteger ( 1, HighScoreScore [ mode, 2 ] )
WriteInteger ( 1, HighScoreScore [ mode, 3 ] )
WriteInteger ( 1, HighScoreScore [ mode, 4 ] )
WriteInteger ( 1, HighScoreScore [ mode, 5 ] )
WriteInteger ( 1, HighScoreScore [ mode, 6 ] )
WriteInteger ( 1, HighScoreScore [ mode, 7 ] )
WriteInteger ( 1, HighScoreScore [ mode, 8 ] )
WriteInteger ( 1, HighScoreScore [ mode, 9 ] )
next mode
CloseFile ( 1 )
endfunction