Experts!! Need some simple help trying to implement this Awesome Online Leaderboard

I found this great tutorial on how to create and implement your own leaderboard. This allows each developer to create simply their leaderboard and query it as they wish. Please take a look at the article.

http://icodeblog.com/2009/10/29/iphone-coding-tutorial-creating-an-online-leaderboard-for-your-games/

On Page 4 there is some Xcode code that I know can be simply reproduced in Lua for Corona. I just don’t know how.

It would be awesome if someone could help with this as it will allow anyone to easily create their own leaderboards on their own servers.

Thanks for the help. [import]uid: 8192 topic_id: 3932 reply_id: 303932[/import]

Why don’t you just try using openfeint? It implements leaderboards online and off and makes it easy to implement leaderboards etc… Less work than managing your own database and there’s an existing user base.

Anyway, I’m sure THIS WEBSITE is related to what you’re trying to do. Particularly section 4 about posting the variable to the website through the App. [import]uid: 11024 topic_id: 3932 reply_id: 11979[/import]

@finnk Thanks for the suggestions. Unfortunately neither OpenFeint nor Facebook integration is what I am looking for although what Jonbeebe implemented is close.

I am just looking for a simple way to store and post my own leaderboard without using other services since I need to query the database as I wish. [import]uid: 8192 topic_id: 3932 reply_id: 11999[/import]

Someone posted a tutorial the other day linking corona with php for highscore table into Facebook. It’s gone missing off the forum , anyone bookmark it? Thanks j [import]uid: 6645 topic_id: 3932 reply_id: 12011[/import]

Yes. It’s the link that finnk posted I think.

This is different. Well at least part of it. First it bypasses Facebook. Secondly if you read the article I linked it allows you to do some neat things in a really easy way with some parameters. Like the number of results you want back etc.
[import]uid: 8192 topic_id: 3932 reply_id: 12013[/import]

Guilty of not really reading. I get the whole web side of things of handling PHP and sending parameters via the url. Building a database and setting up that side is easy.

I just have no clue how to POST that info via a link through Corona and then to GET the returned info.

If I could get that returned value into a long string, I could gmatch and concat it into vars/arrays to make it useful in Corona.

There’s basically just that void of knowledge, which I haven’t taken the time to look through, but I assumed was in that facebook link. Which aspect of the process were you having trouble with? [import]uid: 11024 topic_id: 3932 reply_id: 12017[/import]

Sorry you’re right! Thanks [import]uid: 6645 topic_id: 3932 reply_id: 12018[/import]

@finnk. Exactly. That’s what I don’t know how to do. How to communicate from Corona. [import]uid: 8192 topic_id: 3932 reply_id: 12019[/import]

Hmm… well for starters, you can send a URL using:

native.showWebPopup( url [, options] )
or
native.showWebPopup( x, y, width, height, url [, options]

and

native.cancelWebPopup()
to cancel it, though I assume the info is already sent by then

I’ll look into getting content data though. [import]uid: 11024 topic_id: 3932 reply_id: 12022[/import]

@finnk. Awesome.

So I am still way behind though. Looking at this page, http://icodeblog.com/2009/10/29/iphone-coding-tutorial-creating-an-online-leaderboard-for-your-games/4/

(Which for me is like Ancient Greek, by the way) it seems that we have to create some methods (functions in lua) to:

  1. submit the score
  2. Display the leaderboard with the various parameters
    [import]uid: 8192 topic_id: 3932 reply_id: 12025[/import]
  1. With the code above, you can let PHP accept and handle the score without interrupting the user. Just pass a specific url with the necessary parameters.

http://yoursite.com/codescores.php?newscore=10000
Where codescores.php will check the score and then update a database on its own.

  1. As for part 2, it’s more complicated. Haven’t tested this, but I think it would work like this:
    After getting info from a url like [http://yoursite.com/getScore.php] into a variable…

[lua]contents = http.request{ url = “http://yoursite.com/getScore.php”, sink = ltn12.sink.file(io.stdout) }

– Search and extract all key = value pairs
for key, value in string.gmatch(contents, “(%w+)%s*=%s*(%w+)”) do
scoreInfo[key] = value
end

print ( scoreInfo.score1, scoreInfo.score2, scoreInfo.score2 )[/lua]

where the php file echos this:
[lua]score1 = 1000
score2 = 200
score3 = 10[/lua] [import]uid: 11024 topic_id: 3932 reply_id: 12026[/import]

@finnk. I understand the general concept. But what I would like to do and don’t know how to do since I know 0 about php. Is to have something that plugs in to the code that I linked. Instead of having to rewrite the PHP.

Take a look at the whole document. It does it all for you so no PHP has to be written. All we have to do is figure out the Lua part and write the functions to set the HighScore and display the leaderboard with parameters. We could even put the parameters in our function so you can pass them to the string.

I don’t know if you have already but check the document from page 1/4. [import]uid: 8192 topic_id: 3932 reply_id: 12028[/import]

Unfortunately, translating Objective C and especially the InterfaceBuilder-based stuff into Lua would be an uphill battle for me (I guess that’s why I’m using Corona). I could more easily write PHP around the stuff above, and even then the Lua side of things would still need an interface to be designed/built graphically to make use of it.

Maybe someone else around here with the time to do that could create a class for this specific form of implementation. [import]uid: 11024 topic_id: 3932 reply_id: 12030[/import]

I can do the graphical interface no problem. Just need the code to send and receive to display. [import]uid: 8192 topic_id: 3932 reply_id: 12034[/import]

– Removing this code because it doesn’t work… [import]uid: 11024 topic_id: 3932 reply_id: 12024[/import]