The magic step by step guide to using the API
Toby dijo
hace mucho tiempo | Publicación #2 <3
blissj01 dijo
hace mucho tiempo | Publicación #3 Achievements? But thanks for this anyways.
Chris dijo
hace mucho tiempo | Publicación #4 blissj01 achievements are about the same procedure
blissj01 dijo
hace mucho tiempo | Publicación #5 its working!!! yey!
You dijo
hace mucho tiempo | Publicación #6 I have a question.. how long does it take before high scores start showing up?
I'm trying to get this whole high score thing working, and can't get it to actually post any results..
I even went as far as putting the following code on a button just to force a high score listing:
on (release) {
NonobaAPI.SubmitScore("besttime", 40, function(response:String){
switch(response){
case NonobaAPI.SUCCESS:{
trace("The score was submitted successfully")
break;
}
case NonobaAPI.NOT_LOGGED_IN:{
trace("The user is not logged in")
break;
}
case NonobaAPI.ERROR:{
trace("An error occurred.")
break;
}
}
})
}
"besttime" is the name of the key, and in this instance, I'm just trying to force it to put 40 seconds. Am I doing something wrong?
And yes, the "Nonoba" folder is in the same directory as the .fla (and inside that is: api > NonobaAPI.as).
Any help would be appreciated! :)
-Eric
I'm trying to get this whole high score thing working, and can't get it to actually post any results..
I even went as far as putting the following code on a button just to force a high score listing:
on (release) {
NonobaAPI.SubmitScore("besttime", 40, function(response:String){
switch(response){
case NonobaAPI.SUCCESS:{
trace("The score was submitted successfully")
break;
}
case NonobaAPI.NOT_LOGGED_IN:{
trace("The user is not logged in")
break;
}
case NonobaAPI.ERROR:{
trace("An error occurred.")
break;
}
}
})
}
"besttime" is the name of the key, and in this instance, I'm just trying to force it to put 40 seconds. Am I doing something wrong?
And yes, the "Nonoba" folder is in the same directory as the .fla (and inside that is: api > NonobaAPI.as).
Any help would be appreciated! :)
-Eric
Publicación #7 eliminada
Chris dijo
hace mucho tiempo | Publicación #8 | en respuesta a #6The scores should take from 2-5 min to show up in the list.
Also swap to one of the other timespans, chances are its not cached yet and will show the score asap.
Also swap to one of the other timespans, chances are its not cached yet and will show the score asap.
rdz dijo
hace mucho tiempo | Publicación #9 I have 2 questions on this subject.
1) Can i test this stuff offline?
2) When simply adding 1 for each won game, do i first need to read the previous score as a string and then convert to number and add 1?
thank you in advance.
1) Can i test this stuff offline?
2) When simply adding 1 for each won game, do i first need to read the previous score as a string and then convert to number and add 1?
thank you in advance.
Chris dijo
hace mucho tiempo | Publicación #10 1) The system will not work if you do not have an internet connection as of now.
2) You can make a ranking score and simply submit delats.
2) You can make a ranking score and simply submit delats.
rdz dijo
hace mucho tiempo | Publicación #11 Thanks, i got it working now.
1- Okay
2- Indeed, delta's :-)
1- Okay
2- Indeed, delta's :-)
Contestar al tema
Regístrate ahora para responder a éste tema
Chris dijo
hace mucho tiempo | Publicación #1Creating the highscore
First we go create the highscore list on the site, this is done under the edit game button on your home page. The url should be something like http://www.nonoba.com/my/games/[game name] and you should click the Highscore tab, then the new Highscore list.
Now fill in Name(What score is this) and Column Header(What does it say in the list) then choose what type and what order.
Now we need to fill in the key value, use something you can remember here as we need to use it later!
Getting the API into the right folder
So you managed to make the highscore list? Oki then, lets try to get the files we need to implement it into the game.
Download the newest version of the api from here http://www.nonoba.com/developers/downloads and unzip the file into some temp location.
Now we need to know if our game is ActionScript 2 or ActionScript 3 (you can see this in your export options for your flash file) double-click the folder for the flash version you use, in it you will find a folder called Nonoba, copy this folder into the same folder as your .fla file.
Lets retry that, the folder you need to copy is called Nonoba, not ActionScript 2 or api, its the Nonoba one we want. It also must be in the same folder as your fla file or this will not work.
Adding the code to your game
Goto the frame where you want to submit the highscore and write
import Nonoba.api.NonobaAPI
This tells flash that you want to include the NonobaAPI class, nothing will work if you don't do this!
Now if you use ActionScript 2 go copy the example code from http://www.nonoba.com/developers/documentation/actionscript2#SubmitScoreand paste it after the import line
If you are using ActionScript 3 you want to copy the code from http://www.nonoba.com/developers/documentation/actionscript3#SubmitScore
In the first line of this example code you will see a string called "kills" and the number 100. Replace "kills" with your key (Yes the one you had to remember?)
So if you typed in shots in the key value you want to replace "kills" with "shots"
The 100 number is the value you want to submit to the score, I assume you got this as some variable so replace 100 with the variable name.
Some more
You should be done now, you might want the code to only execute when you click a button? If so put the code you copied and replaced in into the click event handler for that button.
Also the code will just trace "An error occurred." when you try it in your flash environment, don't panic! The api only works when the file is on the nonoba site.
You likely also want your code to do something more interesting then just tracing some string when either an error occurs or the highscore is submitted, so put in some code that goes to another frame or similar instead of the traces that are there now.
That should be about it..
Anything I missed?