This site requires JavaScript, please enable it in your browser!
Greenfoot back
Dimak
Dimak wrote ...

2018/1/14

High score System

1
2
3
Dimak Dimak

2018/1/15

#
It crashes only when a user is not logged in or when a user is using incognito mode, so there is no output. Unless there's a button that opens a terminal somewhere.
CxVercility CxVercility

2018/1/15

#
Wait. Greenfoot itself crashes?
일리아스 wrote...
At this point i am seriously confused.
That shit actually made me laugh. Nice pic, but can u pass "Dead to me" :^)?
Dimak Dimak

2018/1/15

#
It looks like it yeah. The game is on my profile if you want to check it our for yourself, to be honest I don't know why Greenfoot crashes as I check if there is access to the server. It is definitely the highscore that does it though. Again I am guessing it is getting a true value when UserInfo.isStorageAvailable() comes in. At this point I will settle for taking it out completely if the user is logged in to the current session. But again I believe that UserInfo.isStorageAvailable() is positive so maybe greenfoots fault?
danpost danpost

2018/1/15

#
You can test it:
System.out.println("here");
Add the above line to your code. Test it out at differrent places to find out where it crashes (only at one place at a time by moving it around). Then, line by line back up until it starts showing the line again. Once it shows up again, the next line is where it crashes at. If you never get a message anywhere, then it is obvious you are just not finding the terminal window.
Dimak Dimak

2018/1/15

#
I believe the terminal window does not show up in the browser version ( which is what I am having crash ), but it shows up in greenfoot applet. Which works fine on its own. This is why it is confusing to me.
CxVercility CxVercility

2018/1/15

#
Hey again, Browsers have their own Terminals, e.g F12 for Chrome -> Console This is what it returns :
Uncaught TypeError: Cannot read property '$score2' of null
    at g_UserInfo_getScore (scenario20656.js:21629)
    at HighScore__init_ (scenario20656.js:21527)
    at MyWorld__init_ (scenario20656.js:20835)
    at NewGame_act (scenario20656.js:17648)
    at NewGame.$act (scenario20656.js:23632)
    at gc_Simulation_actActor (scenario20656.js:9209)
    at gc_Simulation_runOneLoop (scenario20656.js:9129)
    at gc_Simulation_runContent (scenario20656.js:7877)
    at gc_Simulation_run (scenario20656.js:7617)
    at gc_Simulation.$run (scenario20656.js:23469)
Edit : Seems like it just kills itself at UserInfo.getScore(), implicating a server problem ( sending a message takes me 2minutes, servers are shit rn) Edit 2 : Wait no, im retarded. When the user is not logged in, you shouldnt be checking their score, ofc this fails. So yes, im also guessing you're getting a "true" when you shouldnt. Try using Dan's approach before every line of getScore() to see which one causes this
Dimak Dimak

2018/1/15

#
It stops sending values after
highScore = myInfo.getScore();
So I assume it is getting a true for when it is checking if there is userInfo available and after that calls it which is returning something null and therefore crashing the game. Is there any other way to check if the user is logged in or not?
CxVercility CxVercility

2018/1/16

#
Maybe sth like this?
If( myInfo! = null) 
Dimak Dimak

2018/1/16

#
Okay yep that works now. Thanks everyone for the help. ( I would not have passed this class without you guys )
You need to login to post a reply.
1
2
3