Hi...
Please test below on all your Internet browsers:
http://fallenangelsoftware.com/stuff/files/SpaceSwap/HTML5/index.html
The code below works, but the last part is too long horizontally and I don't know how to compact it?
Any ideas?
https://pastebin.com/XficJwuE
Thanks!
Jesse
//------------------------------------------------------------------------------------------------------------
function LoadOptionsAndHighScores ( )
if (Platform <> Web)
index as integer
if GetFileExists( DataVersion ) = 0
else
OpenToRead(1, DataVersion)
MusicVolume = readInteger( 1 )
EffectsVolume = readInteger( 1 )
GameMode = readInteger( 1 )
PlayingSyncRate = readInteger( 1 )
for index = 0 to 5
LevelSkip[index] = ReadInteger( 1 )
next index
for index = 0 to 3
SecretCode[index] = readInteger( 1 )
next index
mode as integer
rank as integer
for mode = 0 to 5
for rank = 0 to 9
HighScoreName [ mode, rank ] = readString( 1 )
HighScoreLevel [ mode, rank ] = ReadInteger( 1 )
HighScoreScore [ mode, rank ] = ReadInteger( 1 )
next rank
next mode
CloseFile ( 1 )
endif
else
cookieValue as string
cookieValue = LoadSharedVariable(HTML5DataVersion+"MusicVolume", "No Value")
if (cookieValue <> "No Value") then MusicVolume = Val(cookieValue)
cookieValue = LoadSharedVariable(HTML5DataVersion+"EffectsVolume", "No Value")
if (cookieValue <> "No Value") then EffectsVolume = Val(cookieValue)
cookieValue = LoadSharedVariable(HTML5DataVersion+"GameMode", "No Value")
if (cookieValue <> "No Value") then GameMode = Val(cookieValue)
cookieValue = LoadSharedVariable(HTML5DataVersion+"PlayingSyncRate", "No Value")
if (cookieValue <> "No Value") then PlayingSyncRate = Val(cookieValue)
for index = 0 to 5
cookieValue = LoadSharedVariable( HTML5DataVersion+"LevelSkip"+str(index), "No Value" )
if (cookieValue <> "No Value") then LevelSkip[index]= Val(cookieValue)
next index
for index = 0 to 3
cookieValue = LoadSharedVariable( HTML5DataVersion+"SecretCode"+str(index), "No Value" )
if (cookieValue <> "No Value") then SecretCode[index]= Val(cookieValue)
next index
agk_i as integer
for mode = 0 to 5
cookieValue = LoadSharedVariable( HTML5DataVersion+"HighScoreName"+str(mode), "No Value" )
if (cookieValue <> "No Value")
for agk_i = 0 to CountStringTokens(cookieValue, "*")
HighScoreName [ mode, agk_i ] = GetStringToken( cookieValue, "*", (agk_i+1) )
next agk_i
endif
cookieValue = LoadSharedVariable( HTML5DataVersion+"HighScoreLevel"+str(mode), "No Value" )
if (cookieValue <> "No Value")
for agk_i = 0 to CountStringTokens(cookieValue, "*")
HighScoreLevel [ mode, agk_i ] = Val( GetStringToken( cookieValue, "*", (agk_i+1) ) )
next agk_i
endif
cookieValue = LoadSharedVariable( HTML5DataVersion+"HighScoreScore"+str(mode), "No Value" )
if (cookieValue <> "No Value")
for agk_i = 0 to CountStringTokens(cookieValue, "*")
HighScoreScore [ mode, agk_i ] = Val( GetStringToken( cookieValue, "*", (agk_i+1) ) )
next agk_i
endif
next mode
endif
endfunction
//------------------------------------------------------------------------------------------------------------
function SaveOptionsAndHighScores ( )
if (Platform <> Web)
index as integer
OpenToWrite( 1 , DataVersion )
WriteInteger ( 1, MusicVolume )
WriteInteger ( 1, EffectsVolume )
WriteInteger ( 1, GameMode )
WriteInteger ( 1, PlayingSyncRate )
for index = 0 to 5
WriteInteger ( 1, LevelSkip[index] )
next index
for index = 0 to 3
WriteInteger ( 1, SecretCode[index] )
next index
mode as integer
rank as integer
for mode = 0 to 5
for rank = 0 to 9
WriteString ( 1, HighScoreName [ mode, rank ] )
WriteInteger ( 1, HighScoreLevel [ mode, rank ] )
WriteInteger ( 1, HighScoreScore [ mode, rank ] )
next rank
next mode
CloseFile ( 1 )
else
SaveSharedVariable( HTML5DataVersion+"MusicVolume", str(MusicVolume) )
SaveSharedVariable( HTML5DataVersion+"EffectsVolume", str(EffectsVolume) )
SaveSharedVariable( HTML5DataVersion+"GameMode", str(GameMode) )
SaveSharedVariable( HTML5DataVersion+"PlayingSyncRate", str(PlayingSyncRate) )
for index = 0 to 5
SaveSharedVariable( HTML5DataVersion+"LevelSkip"+str(index), str(LevelSkip[index]) )
next index
for index = 0 to 3
SaveSharedVariable( HTML5DataVersion+"SecretCode"+str(index), str(SecretCode[index]) )
next index
for mode = 0 to 5
SaveSharedVariable( HTML5DataVersion+"HighScoreName"+str(mode), HighScoreName [ mode, 0 ]+'*'+HighScoreName [ mode, 1 ]+'*'+HighScoreName [ mode, 2 ]+'*'+HighScoreName [ mode, 3 ]+'*'+HighScoreName [ mode, 4 ]+'*'+HighScoreName [ mode, 5 ]+'*'+HighScoreName [ mode, 6 ]+'*'+HighScoreName [ mode, 7 ]+'*'+HighScoreName [ mode, 8 ]+'*'+HighScoreName [ mode, 9 ] )
SaveSharedVariable( HTML5DataVersion+"HighScoreLevel"+str(mode), str(HighScoreLevel [ mode, 0 ])+'*'+str(HighScoreLevel [ mode, 1 ])+'*'+str(HighScoreLevel [ mode, 2 ])+'*'+str(HighScoreLevel [ mode, 3 ])+'*'+str(HighScoreLevel [ mode, 4 ])+'*'+str(HighScoreLevel [ mode, 5 ])+'*'+str(HighScoreLevel [ mode, 6 ])+'*'+str(HighScoreLevel [ mode, 7 ])+'*'+str(HighScoreLevel [ mode, 8 ])+'*'+str(HighScoreLevel [ mode, 9 ]) )
SaveSharedVariable( HTML5DataVersion+"HighScoreScore"+str(mode), str(HighScoreScore [ mode, 0 ])+'*'+str(HighScoreScore [ mode, 1 ])+'*'+str(HighScoreScore [ mode, 2 ])+'*'+str(HighScoreScore [ mode, 3 ])+'*'+str(HighScoreScore [ mode, 4 ])+'*'+str(HighScoreScore [ mode, 5 ])+'*'+str(HighScoreScore [ mode, 6 ])+'*'+str(HighScoreScore [ mode, 7 ])+'*'+str(HighScoreScore [ mode, 8 ])+'*'+str(HighScoreScore [ mode, 9 ]) )
next mode
endif
endfunction