I had it that way before, but I am pretty sure it still didn’t work. I will try it again now though. Just curious though, does the listener affect the submitHighScore function? Shouldn’t it run without the listener at all, or is that not how it works?
Hmm yeah still didn’t work.
So here is what I have now:
-- Leaderboard listener function ccLeaderboards( event ) if ( event.type == "ScoresSubmitted" ) then native.showAlert( "Success", "Your score was successfully submitted online.", { "OK" }) end end Runtime:addEventListener( "Leaderboards", ccLeaderboards ) function showPopup(score, boardSize) --[[This function is called after the games completion, and shows a 'popup' asking the user if they want to submit their score. --]] -- some random code -- blah -- more code -- The following is called when the submit button is pressed: local function submitPress( event ) local btn = event.target name = tostring(nameField.text) if string.len(name) \> 9 then native.showAlert( "Error", "Name cannot be longer than 9 characters.", { "OK" }) elseif name ~= nil and name ~= "" and name ~= "nil" and name ~= " " then hiscore.saveScore(name, score, boardSize) if checkbox.isOn then if preference.getValue("currentAuthToken") == nil or preference.getValue("currentAuthToken") == "" then native.showAlert( "Error", "Could not submit score online because you are not logged in. Touch Settings to log in.", { "OK" }) else --coronaCloud.submitHighScore( leaderboardID, score ) coronaCloud.submitHighScore( "[my id was here]", 100 ) end end nameField:removeSelf() namePopup:removeSelf() preference.save{lastUsedName=name} else native.showAlert( "Error", "You must enter a valid name.", { "OK" }) end native.setKeyboardFocus( nil ) end -- end submit button press end -- end show popup
Any references to name above are for saving high scores locally, and the checkbox determines if they want to submit their score to the cloud. Any more ideas?
Thanks for your timely reply by the way.
Never mind, it was submitting correctly. My listener just wasn’t working correctly because I had event.type == “ScoresSubmitted” instead of event.type == “ScoreSubmitted”
And also because I was retrieving the high score list wrong, but that is another story.
Whold be nice when you could publish the
code for both (ScoreSubmitted and High score) because there is still non demo
code published and I think others will be interested too.
Thanks
a lot
Michael
Hi amandaelinn and mohamed,
I’ve downloaded the latest ‘corona-cloud-core.lua’ file available and I’ve tested the app on the latest CoronaSDK 2013.1086.
I’ve double checked my Leaderboards ID to be sure the strings are correct.
But still no luck, nothing is registered.
I will be testing from time to time, as new releases come. If I make any progress I’ll let you now.
any news about Corona Cloud sample code? maybe I missed some news about it?? thx
Another bump for this important question. Any news on the Corona Cloud Sample and additional tutorials? Thank you very much for your efforts in this area.
I would guess that a sample will come when they have ironed out the remaning bugs and issues in corona cloud. Hopefully soon!
I certainly hope so. I really want to use the Push service to begin with but I don’t want to pull my hear trying to make sense of things using a tutorial from 2011 which pre-dates the Corona Cloud.
I am also facing the problem in score submission. On score submission it is showing an error “Document not found for class Leaderboard with attributes {:id=>”-------------"}.\nSummary:\n When calling Leaderboard.find_by with a hash of attributes, all attributes provided must match a document in the database or this error will be raised.\nResolution:\n Search for attributes that are in the database or set the Mongoid.raise_not_found_error configuration option to false, which will cause a nil to be returned instead of raising this error."}".
Any Help?
chinmay5 Corona Cloud is to be discontinued. See http://www.coronalabs.com/blog/2013/06/21/update-on-corona-cloud/