Hi guys!
Had a look around the interwebs but couldn’t find anything!
I have tried uploading a game to Games4J, the game itself worked absolutely fine on my server prior to implementing the Highscore API, however when trying to retrieve the high scores list using:
highscores = Highscore.getHighscores(applet, 10, 1);
(highscores is declared as a private static List in the class as per the Game4J guidance, and applet is a reference to my game applet)
I get the following error in the console:
java.lang.NumberFormatException: For input string: "<?xml version="1.0" encoding="UTF-8" ?>"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at com.games4j.webAPI.Highscore.a(SourceFile:115)
at com.games4j.webAPI.Highscore.getHighscores(SourceFile:93)
at com.games4j.webAPI.Highscore.getHighscores(SourceFile:75)
at alieninvaders.GamePanel.<init>(GamePanel.java:87)
at alieninvaders.GameApplet.init(GameApplet.java:31)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Which would suggest that it is trying to read the wrong part of the XML file which I assume stores the high scores… It doesn’t seem like the sort of thing which would point to a mistake I have made, but the fact that everyone else seems to manage is making me think i’ve done something silly!
Furthermore, I am using the code that “saves” the high scores, which isn’t giving me an error… but equally it’s not actually sending the scores… well they’re not showing on the page anyway, and also the “isLoggedIn()” code returns false, regardless of whether I am logged in or not, which makes me think that nothing in the Highscores API is actually working.
Has anybody else come across this problem and found how to fix it? I’m sure i’ve just missed something simple but its driving me mad now!
Thanks
Dave