00:00
00:00
Newgrounds Background Image Theme

Etwig just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Medals don't unlock

3,067 Views | 35 Replies
New Topic Respond to this Topic

Medals don't unlock 2013-03-13 01:07:46


I added Metals to my game http://www.newgrounds.com/portal/view/612788. but it doesn't seem to be unlocking medals. On the preview page, it shows it being unlocked in the API Output when i call API.unlockMedal(inString). But the icon is still locked when i test it on the actual game. Am I missing a step or something?

Any help would be great.

Response to Medals don't unlock 2013-03-13 06:02:27


Have you dragged the medal component onto your stage?

Response to Medals don't unlock 2013-03-13 10:24:26


At 3/13/13 06:02 AM, FlyingColours wrote: Have you dragged the medal component onto your stage?

The component is just for display purposes, and shouldn't effect unlocking.

Have your medals been approved? Check the status column on your medals page.

Response to Medals don't unlock 2013-03-13 18:59:11


They say un-tested. is there a special procedure to test them?

In the api output i get something along these lines
10 medals initialized.
0 scoreboards initialized.
0 save groups initialized.
Connection complete!
Loading flash ad...
Ad destroyed.
Unlocking medal "Basics"...

At 3/13/13 10:24 AM, Mattster wrote:
At 3/13/13 06:02 AM, FlyingColours wrote: Have you dragged the medal component onto your stage?
The component is just for display purposes, and shouldn't effect unlocking.

Have your medals been approved? Check the status column on your medals page.

Response to Medals don't unlock 2013-03-13 19:07:23


At 3/13/13 06:59 PM, ZeroCreativity1 wrote: They say un-tested. is there a special procedure to test them?

Ah. Try unlocking them on your Project page (NOT the portal page). If that doesn't work, try just unlocking them locally.

Response to Medals don't unlock 2013-03-13 19:17:10


Just an afterthought... You didn't publish it in Debug mode did you?

Response to Medals don't unlock 2013-03-13 21:22:49


What determines if the flash is in Debug Mode?

At 3/13/13 07:17 PM, Mattster wrote: Just an afterthought... You didn't publish it in Debug mode did you?

Response to Medals don't unlock 2013-03-13 21:39:20


At 3/13/13 09:22 PM, ZeroCreativity1 wrote: What determines if the flash is in Debug Mode?
At 3/13/13 07:17 PM, Mattster wrote: Just an afterthought... You didn't publish it in Debug mode did you?

Not the flash, but the API. If you use the connector, there would be a property on the component inspector. If it's done in code, then you'd have a line specifying so (which I assume you don't)

Response to Medals don't unlock 2013-03-13 21:42:16


At 3/13/13 09:39 PM, Mattster wrote:
At 3/13/13 09:22 PM, ZeroCreativity1 wrote: What determines if the flash is in Debug Mode?
At 3/13/13 07:17 PM, Mattster wrote: Just an afterthought... You didn't publish it in Debug mode did you?
Not the flash, but the API. If you use the connector, there would be a property on the component inspector. If it's done in code, then you'd have a line specifying so (which I assume you don't)

i added API.debugMode = API.RELEASE_MODE; to the code. but it doesn't seem to make a difference.

Response to Medals don't unlock 2013-03-21 01:20:45


At 3/13/13 09:39 PM, Mattster wrote:
At 3/13/13 09:22 PM, ZeroCreativity1 wrote: What determines if the flash is in Debug Mode?
At 3/13/13 07:17 PM, Mattster wrote: Just an afterthought... You didn't publish it in Debug mode did you?
Not the flash, but the API. If you use the connector, there would be a property on the component inspector. If it's done in code, then you'd have a line specifying so (which I assume you don't)

well i put i try catch around the unlockmedal function, and i get ReferenceError: Error #1074. when its on the newgrounds server. any ideas?

Response to Medals don't unlock 2013-03-21 06:19:10


have you done this step:
Enter your API Entry information into the API Connector parameters.
In Flash CS5 or higher, look in the Properties tab. Enter your API ID and Encryption Key in the available fields. You can find your API entry information in the API Tools section of your project.


RangeError: Error #1125: The index 4 is out of range 4.

Response to Medals don't unlock 2013-03-21 07:47:56


Can you post the code you are using to unock them?

Response to Medals don't unlock 2013-03-21 10:41:03


At 3/21/13 07:47 AM, Mattster wrote: Can you post the code you are using to unock them?

try
{
API.unlockMedal(inString);
}
catch(e:Error)
{
//Global Textfield added to stage so i can see the error.
Constants.DebugText.text = "ERROR " + e;
}

Response to Medals don't unlock 2013-03-21 21:08:59


At 3/21/13 06:19 AM, nitokov wrote: have you done this step:
Enter your API Entry information into the API Connector parameters.
In Flash CS5 or higher, look in the Properties tab. Enter your API ID and Encryption Key in the available fields. You can find your API entry information in the API Tools section of your project.

I've been using api id and encryption key when i call API.connect. It seems to be working for ads, so i don't imagine the problem for medals. I am not using adobe cs for me project though.

Response to Medals don't unlock 2014-08-18 07:14:51


I'm having the same problem of unlocking medals for my game:

I did what you have done, and no luck. Then I uploaded a debug version of my game and connected it to the debugger. It gave the following output when unlocking a medal:

[Newgrounds API] :: User is not logged in. Medal "Cut Your Teeth" unlocked locally.

I believe I was logged in when preview the game (as project member). The medal still remains unlocked and "untested" . How should I test them anyway?

Response to Medals don't unlock 2014-08-18 20:13:39


At 3/13/13 06:59 PM, ZeroCreativity1 wrote: They say un-tested. is there a special procedure to test them?

This is why. Do what Mattster said and unlock them inside the preview section of your project settings here on NG. They say untested because you (or people that you have as beta testers before you publish the game for everyone to play) haven't unlocked them in the preview window I mentioned above. This is to ensure that you don't create a medal so ridiculously hard to achieve that not even you (or beta-testers) can unlock it.

In short, unlock it in project preview and then it will be available to general public. If you do everything specifically like I stated and then go to the actual game in the Portal and play it and it doesn't unlock - simply clear your web browser cache (only after doing everything I said you need to do) and then it should work fine.

Response to Medals don't unlock 2014-08-19 09:19:43


At 8/18/14 08:13 PM, Hero101 wrote:
At 3/13/13 06:59 PM, ZeroCreativity1 wrote: They say un-tested. is there a special procedure to test them?
This is why. Do what Mattster said and unlock them inside the preview section of your project settings here on NG. They say untested because you (or people that you have as beta testers before you publish the game for everyone to play) haven't unlocked them in the preview window I mentioned above. This is to ensure that you don't create a medal so ridiculously hard to achieve that not even you (or beta-testers) can unlock it.

In short, unlock it in project preview and then it will be available to general public. If you do everything specifically like I stated and then go to the actual game in the Portal and play it and it doesn't unlock - simply clear your web browser cache (only after doing everything I said you need to do) and then it should work fine.

I have tried to unlock some medals inside the preview section, using both manager account and tester account, but still didn't work. However, when logged in as a tester, the medals are displayed as "locked" instead of "untested". Still not sure if the players can get the medals.

Response to Medals don't unlock 2014-08-19 19:09:42


I have tried to unlock some medals inside the preview section, using both manager account and tester account, but still didn't work. However, when logged in as a tester, the medals are displayed as "locked" instead of "untested".

That is weird. Were you at least able to "unlock" them when locally while you were building the game? Or did you just add them after you had already posted the swf to Newgrounds?

Still not sure if the players can get the medals.

No they are not. I tried your game and the finish tutorial medal never fired off. Nice game, btw.

Response to Medals don't unlock 2014-08-19 19:33:53


At 8/19/14 07:09 PM, Hero101 wrote:
I have tried to unlock some medals inside the preview section, using both manager account and tester account, but still didn't work. However, when logged in as a tester, the medals are displayed as "locked" instead of "untested".
That is weird. Were you at least able to "unlock" them when locally while you were building the game? Or did you just add them after you had already posted the swf to Newgrounds?

Still not sure if the players can get the medals.
No they are not. I tried your game and the finish tutorial medal never fired off. Nice game, btw.

Thanks!

I can unlock them locally. If you see a popup on the top-right, that means the achievement is finished, and that's when I do this:
if (API.connected)
API.unlockMedal(acv.name);

According to the debug output, the code is executed but IN THE PREVIEW PAGE the medal doesn't unlock for me because "User is not logged in. Medal unlocked locally."

Response to Medals don't unlock 2014-08-19 19:54:33


I can unlock them locally. If you see a popup on the top-right, that means the achievement is finished, and that's when I do this:
if (API.connected)
API.unlockMedal(acv.name);

According to the debug output, the code is executed but IN THE PREVIEW PAGE the medal doesn't unlock for me because "User is not logged in. Medal unlocked locally."

What are you coding with?

Response to Medals don't unlock 2014-08-19 20:01:33


At 8/19/14 07:54 PM, Hero101 wrote:
According to the debug output, the code is executed but IN THE PREVIEW PAGE the medal doesn't unlock for me because "User is not logged in. Medal unlocked locally."
What are you coding with?

Also, do you have the API's debugMode set to logged out user or something?

Response to Medals don't unlock 2014-08-19 22:09:34


At 8/19/14 08:01 PM, MSGhero wrote:
At 8/19/14 07:54 PM, Hero101 wrote:
According to the debug output, the code is executed but IN THE PREVIEW PAGE the medal doesn't unlock for me because "User is not logged in. Medal unlocked locally."
What are you coding with?
Also, do you have the API's debugMode set to logged out user or something?

I'm coding with FlashDevelop. Here's what I do for initializing the connection:
API.debugMode = API.RELEASE_MODE;
API.addEventListener(APIEvent.API_CONNECTED, onConnected);
API.connect(root, myApiID, myEncryptionKey);

The "onConnected" doesn't seem to be called in the game page, but it's always called when I debug in FlashDevelop.

Response to Medals don't unlock 2014-08-19 23:30:42


I'm coding with FlashDevelop. Here's what I do for initializing the connection:
API.debugMode = API.RELEASE_MODE;
API.addEventListener(APIEvent.API_CONNECTED, onConnected);
API.connect(root, myApiID, myEncryptionKey);

The "onConnected" doesn't seem to be called in the game page, but it's always called when I debug in FlashDevelop.

Maybe someone that uses Flash Develop could bring more insight as I haven't made there switch to that yet (very soon tho). However, I did code everything with NG's API rather than using the components on stage.

I didn't bother setting the debug mode like you did - I just omitted it which I assume just leaves it in its default state. I also didn't do: PI.addEventListener(APIEvent.API_CONNECTED, onConnected); like you did - left that out as well.

I just added all the necessary imports for NG's API at the top of my game manager class and did
API.connect(root, myApiID, myEncryptionKey); like you did in the constructor.
Then simply did API.unlockMedal("medal name"); where a medal needed to be unlocked.

Response to Medals don't unlock 2014-08-20 00:14:13


At 8/19/14 10:09 PM, indiest wrote: I'm coding with FlashDevelop. Here's what I do for initializing the connection:
API.debugMode = API.RELEASE_MODE;
API.addEventListener(APIEvent.API_CONNECTED, onConnected);
API.connect(root, myApiID, myEncryptionKey);

The "onConnected" doesn't seem to be called in the game page, but it's always called when I debug in FlashDevelop.

Leave the release mode as the default and see what onConnected says. If that doesn't work, you need to give us more code.

Response to Medals don't unlock 2014-08-20 03:09:25


At 8/20/14 12:14 AM, MSGhero wrote:
At 8/19/14 10:09 PM, indiest wrote: I'm coding with FlashDevelop. Here's what I do for initializing the connection:
API.debugMode = API.RELEASE_MODE;
API.addEventListener(APIEvent.API_CONNECTED, onConnected);
API.connect(root, myApiID, myEncryptionKey);

The "onConnected" doesn't seem to be called in the game page, but it's always called when I debug in FlashDevelop.
Leave the release mode as the default and see what onConnected says. If that doesn't work, you need to give us more code.

I commented out the first line to leave the debug mode as the default. OnConnected was called (sorry I was wrong), but API.hasUserSession=false. I guess that's why the medals keep unlocking locally?

Response to Medals don't unlock 2014-08-20 10:06:35


At 8/20/14 03:09 AM, indiest wrote: I commented out the first line to leave the debug mode as the default. OnConnected was called (sorry I was wrong), but API.hasUserSession=false. I guess that's why the medals keep unlocking locally?

That's a bit weird, yes that's why they unlock locally. Try testing in the project preview, but put a textfield somewhere visible on the screen and put hasUserSession in that to see what its value is.

Response to Medals don't unlock 2014-08-20 12:07:31


At 8/20/14 10:06 AM, MSGhero wrote:
At 8/20/14 03:09 AM, indiest wrote: I commented out the first line to leave the debug mode as the default. OnConnected was called (sorry I was wrong), but API.hasUserSession=false. I guess that's why the medals keep unlocking locally?
That's a bit weird, yes that's why they unlock locally. Try testing in the project preview, but put a textfield somewhere visible on the screen and put hasUserSession in that to see what its value is.

I added a textfield on the top-left, and in the project preview it shows:

Is Newgrounds:false
Has User Session:false
User Name:null

Medals don't unlock

Response to Medals don't unlock 2014-08-20 12:43:25


At 8/20/14 12:07 PM, indiest wrote: I added a textfield on the top-left, and in the project preview it shows:

Is Newgrounds:false
Has User Session:false
User Name:null

Are you checking those values in or after the onConnect callback? They will all be null until the API has finished connecting.

Response to Medals don't unlock 2014-08-20 21:50:23


At 8/20/14 12:43 PM, MSGhero wrote:
At 8/20/14 12:07 PM, indiest wrote: I added a textfield on the top-left, and in the project preview it shows:

Is Newgrounds:false
Has User Session:false
User Name:null
Are you checking those values in or after the onConnect callback? They will all be null until the API has finished connecting.

Both. And I'm sure the values remain the same after successfully connected.

Response to Medals don't unlock 2014-08-20 21:54:19


At 8/20/14 09:50 PM, indiest wrote:
At 8/20/14 12:43 PM, MSGhero wrote:
At 8/20/14 12:07 PM, indiest wrote: I added a textfield on the top-left, and in the project preview it shows:

Is Newgrounds:false
Has User Session:false
User Name:null
Are you checking those values in or after the onConnect callback? They will all be null until the API has finished connecting.
Both. And I'm sure the values remain the same after successfully connected.

BTW, the format I used to upload is HTML5 Archive(zip) instead of Flash Game(swf), because my game has many resource files besides the main SWF. I'm also using swfobject.js in index.html.