On-line ScoreBoard [Not maintained .. new extension available ]

mdotedot

  • Posts: 1654
Hello Chitro,

The extension is made so that for each user it shows only one score. So if you have only one username in your test you will see only the last score. You could hack it so that it shows more scores but then you have to do something obfuscating with for example the username like mdotedot_1 and strip off the last part including the _ .
Then you could have multiple scores for each username.
But again the current extension only works with a high score and not all the other scores that users can make / have.

If this is not your question, please elaborate more since I didn't quite new if that was what you are looking for.

Best regards from
M.E.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

Chitro

  • Posts: 3
Thanks for the reply mdotedot,

What I am asking is that can this extension be used to create a public scoreboard? I mean we need a scoreboard system which will show the top 10 highest scores with a table containing the usernames and the scores.  Any user using the app can access this table and see who is at the top (provided, they are connected to the internet of course). The user will also be able to submit his/her scores and if it is high enough, the scoreboard will be updated. So, basically, an online leaderboard.

A picture that might help me get my point across:
http://i60.tinypic.com/30dgpc5.png

Oh and I am not asking if a single username can have multiple scores. Once again, sorry if this is a noob question man, and any help is greatly greatly appreciated.

Thanks,
Chitro

mdotedot

  • Posts: 1654
Well that is what the extension is made for. An online scoreboard.
So yes this can be made with the extension.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

Chitro

  • Posts: 3
That's perfect! Sorry for so many questions, but how do we achieve this?  How can we display exactly 10 best scores worldwide when the button is clicked?

Thank you so much, once again,
Chitro

mdotedot

  • Posts: 1654
Hello Chitro,

Create the Example on page 1 of this thread

* Change Playername: 'MdotEdot'  into   a text concatenation block:   [ [Player] & [random number between [111] and [999]] ]
* Change number of rows from 100 to 10

Run the example and press the mouse 11 times with interval of a second and you have 10 scores listed.

For all other things : follow crash course and make Stencyl your friend!

Hope this helps.

Best regards from
M.E.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

Timtrik

  • Posts: 14
Hello,thank you so much for making this.I have a question,how can i use the get player score block? How can i set the score i retrieve to an attribute? The problem im having is that when a score is submitted with the same name as one already on the server,it will replace it even if the score is lower. The way i tought to prevent this is to check for a score with the same name on the server everytime a score is submitted,then use an if block. Can i do this with the get player score block? If not how else can i stop this?
Thanks

mdotedot

  • Posts: 1654
Hello Timtrik,

Yes, you first request score for playername. Inside the request block you get the score and compare it with the new score from the player. If the request for score is NULL then you don't have a score on the scoreboard for that player and then you can submit new score. You should use comparison before you upload the higher score.

Hope this helps.

Best regards from
M.E.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

Timtrik

  • Posts: 14
Thanks for your answer  :) Could you take a look at the attachment please? Now it's not submitting any scores at all,so im obviously doing it wrong  :-\
Thanks

mdotedot

  • Posts: 1654
Hello Timtrik,

You are nearly there. The point is that the list contains a list !!
So the High Scores should be iterated using for each or you have to investigate the list inside the list.

For example:
ScoreList=get item #0 from HighScore
if Score > get item #1 from ScoreList

Hope this helps!

Best regards from
M.E.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

Timtrik

  • Posts: 14
Thank you very much that fixed it :) I have another question,how do i get the scores to refresh? I noticed that even if a new record is made it won't show until you close and start the game again. I've been trying to empty my list once the leaderboard screen is closed,but it always goes back to the first list downloaded from the server,so im guessing once the scores are downloaded they will stay the same for the whole play session? Is there a way to reset them and download them again every time? Sorry for the many questions,thank you for your kindness

cabinfever

  • Posts: 159
Known issue. See fix on page 3, the last post from mdotedot
http://community.stencyl.com/index.php/topic,37281.30.html

Joraanpe

  • Posts: 287
heya @mdotedot i need to bother you a little.
I got pretty lost with that you said we should uncomment and comment stuff in the .hx .... Would you mind uploading a copy of the ScoreBoard.hx fixed for 3.3, or be a little more clear about what to do?

Also wanted to ask you... Ive noted that sometimes when i click my actor to request the score board, the game freezes some seconds; I've seen somewhere in the forum that you told someone that this happens when you use https links, but in our case it uses the http for the server conection only.... any idea why would still freeze on these cases?

Thanks again my friend

mdotedot

  • Posts: 1654
Hello Joraanpe,

For 3.3 the only thing you need to do is to edit the ScoreBoard.hx and replace the 'nme'  import text to 'openfl'
example: import nme.net.URLRequest;  would become: import openfl.net.URLRequest;
Since 3.3 is not the official available version yet so I didn't change it in the source files but left it to nme so it compiles under > 3.0

There are two things to remember with 'freezing' when you connect to a server/resource on the internet.

1. Sometimes referred to as Blocking I/O or non-blocking I/O : this is in the core of the library calls that Stencyl uses. Haxe uses blocking I/O for HTTPS calls which means whatever you do it always waits for data before the client can continue.
Non-Blocking I/O is used for HTTP requests which means that the client can continue to do things and have a callback when data has arrived.

2. Apart from the blocking mechanism the Extension that I wrote uses wrapper blocks. Wrapper blocks are blocks that look like :
+=== Do something === and then  do:
|
|     Code inside this block gets called from the 'wrapper' function
|
+===========================
I use wrapper blocks to ensure that the data has been loaded before Stencyl goes further and you use the blocks to get data for example.

My guess is that the latter is causing you 'the freeze'.
The connection to the free server that I provide is poor, not guaranteed and could be unstable : hence FREE service :)
When you use the wrapper block to get data my guess is that it takes quite a bit of time to retrieve the data.

My suggestion would be to use a kind of loading actor that displays during the time it takes to request the data and to display the data.

Something like this

1. setGameAttribute WAIT to true
2. wrapper block: request score
3. inside wrapper block: setGameAttribute WAIT to false
4. Make a draw event on the 'loading' actor
5. Inside draw event: if getGameAttribute WAIT   draw text 'loading'

Hope this helps!

Best regards from
M.E.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

porkwaffle

  • Posts: 10
Hey all,

First off thanks for the extension; it's great!  I currently am only getting a single score back from the server and it's an old outdated score.  No matter what I do, I only get that score back.  When I log into my app as another user, I am only able to see the score from the other account.  Attached is a screenshot; any help would be greatly appreciated!
Asteroid Survival - FREE


   Android
   Amazon

mdotedot

  • Posts: 1654
Hello Porkwaffle,

Did you download the latest Extension => modification to the URL call?

Also: Avoid initializing the ScoreBoard Server more than once!
Currently you initialize the scoreboard server with a mouse press AND on an event 'Highscore'.
Usually the initialization is done in a when created event.

I'm not really sure what is happening when you do an initialization twice. There are some variables used in the Extension that are set to zero or null. I would have expected the request list to be empty and not to have previous values in them.
Either way : try it with just one 'ScoreBoard: Server URL:'  block in a Created event of the Scene.

Hope this helps.

Best regards from
M.E.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.