Be a Supporter!

Medals don't unlock

  • 598 Views
  • 35 Replies
New Topic Respond to this Topic
ZeroCreativity1
ZeroCreativity1
  • Member since: Mar. 6, 2011
  • Offline.
Forum Stats
Member
Level 01
Game Developer
Medals don't unlock 2013-03-13 01:07:46 Reply

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.

FlyingColours
FlyingColours
  • Member since: Jul. 3, 2011
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to Medals don't unlock 2013-03-13 06:02:27 Reply

Have you dragged the medal component onto your stage?

Mattster
Mattster
  • Member since: Nov. 21, 2007
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Response to Medals don't unlock 2013-03-13 10:24:26 Reply

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.

ZeroCreativity1
ZeroCreativity1
  • Member since: Mar. 6, 2011
  • Offline.
Forum Stats
Member
Level 01
Game Developer
Response to Medals don't unlock 2013-03-13 18:59:11 Reply

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.
Mattster
Mattster
  • Member since: Nov. 21, 2007
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Response to Medals don't unlock 2013-03-13 19:07:23 Reply

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.

Mattster
Mattster
  • Member since: Nov. 21, 2007
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Response to Medals don't unlock 2013-03-13 19:17:10 Reply

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

ZeroCreativity1
ZeroCreativity1
  • Member since: Mar. 6, 2011
  • Offline.
Forum Stats
Member
Level 01
Game Developer
Response to Medals don't unlock 2013-03-13 21:22:49 Reply

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?
Mattster
Mattster
  • Member since: Nov. 21, 2007
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Response to Medals don't unlock 2013-03-13 21:39:20 Reply

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)

ZeroCreativity1
ZeroCreativity1
  • Member since: Mar. 6, 2011
  • Offline.
Forum Stats
Member
Level 01
Game Developer
Response to Medals don't unlock 2013-03-13 21:42:16 Reply

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.

ZeroCreativity1
ZeroCreativity1
  • Member since: Mar. 6, 2011
  • Offline.
Forum Stats
Member
Level 01
Game Developer
Response to Medals don't unlock 2013-03-21 01:20:45 Reply

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?

nitokov
nitokov
  • Member since: May. 8, 2012
  • Offline.
Forum Stats
Member
Level 05
Programmer
Response to Medals don't unlock 2013-03-21 06:19:10 Reply

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.

Mattster
Mattster
  • Member since: Nov. 21, 2007
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Response to Medals don't unlock 2013-03-21 07:47:56 Reply

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

ZeroCreativity1
ZeroCreativity1
  • Member since: Mar. 6, 2011
  • Offline.
Forum Stats
Member
Level 01
Game Developer
Response to Medals don't unlock 2013-03-21 10:41:03 Reply

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;
}

ZeroCreativity1
ZeroCreativity1
  • Member since: Mar. 6, 2011
  • Offline.
Forum Stats
Member
Level 01
Game Developer
Response to Medals don't unlock 2013-03-21 21:08:59 Reply

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.

indiest
indiest
  • Member since: Sep. 26, 2013
  • Offline.
Forum Stats
Supporter
Level 01
Blank Slate
Response to Medals don't unlock 2014-08-18 07:14:51 Reply

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

  • DungeonUp
    DungeonUp by indiest

    A hybrid of roguelike and puzzler by Clewcat Games.

    Score
    3.77 / 5.00
    Type
    Game
    Popularity
    7,028 Views
    Rated
    Ages 13+

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?

Hero101
Hero101
  • Member since: Dec. 13, 2005
  • Offline.
Forum Stats
Supporter
Level 21
Game Developer
Response to Medals don't unlock 2014-08-18 20:13:39 Reply

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.


BBS Signature
indiest
indiest
  • Member since: Sep. 26, 2013
  • Offline.
Forum Stats
Supporter
Level 01
Blank Slate
Response to Medals don't unlock 2014-08-19 09:19:43 Reply

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.

Hero101
Hero101
  • Member since: Dec. 13, 2005
  • Offline.
Forum Stats
Supporter
Level 21
Game Developer
Response to Medals don't unlock 2014-08-19 19:09:42 Reply

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.


BBS Signature
indiest
indiest
  • Member since: Sep. 26, 2013
  • Offline.
Forum Stats
Supporter
Level 01
Blank Slate
Response to Medals don't unlock 2014-08-19 19:33:53 Reply

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."

Hero101
Hero101
  • Member since: Dec. 13, 2005
  • Offline.
Forum Stats
Supporter
Level 21
Game Developer
Response to Medals don't unlock 2014-08-19 19:54:33 Reply

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?


BBS Signature
MSGhero
MSGhero
  • Member since: Dec. 15, 2010
  • Offline.
Forum Stats
Supporter
Level 16
Game Developer
Response to Medals don't unlock 2014-08-19 20:01:33 Reply

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?

indiest
indiest
  • Member since: Sep. 26, 2013
  • Offline.
Forum Stats
Supporter
Level 01
Blank Slate
Response to Medals don't unlock 2014-08-19 22:09:34 Reply

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.

Hero101
Hero101
  • Member since: Dec. 13, 2005
  • Offline.
Forum Stats
Supporter
Level 21
Game Developer
Response to Medals don't unlock 2014-08-19 23:30:42 Reply

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.


BBS Signature
MSGhero
MSGhero
  • Member since: Dec. 15, 2010
  • Offline.
Forum Stats
Supporter
Level 16
Game Developer
Response to Medals don't unlock 2014-08-20 00:14:13 Reply

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.

indiest
indiest
  • Member since: Sep. 26, 2013
  • Offline.
Forum Stats
Supporter
Level 01
Blank Slate
Response to Medals don't unlock 2014-08-20 03:09:25 Reply

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?

MSGhero
MSGhero
  • Member since: Dec. 15, 2010
  • Offline.
Forum Stats
Supporter
Level 16
Game Developer
Response to Medals don't unlock 2014-08-20 10:06:35 Reply

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.

indiest
indiest
  • Member since: Sep. 26, 2013
  • Offline.
Forum Stats
Supporter
Level 01
Blank Slate
Response to Medals don't unlock 2014-08-20 12:07:31 Reply

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

MSGhero
MSGhero
  • Member since: Dec. 15, 2010
  • Offline.
Forum Stats
Supporter
Level 16
Game Developer
Response to Medals don't unlock 2014-08-20 12:43:25 Reply

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.

indiest
indiest
  • Member since: Sep. 26, 2013
  • Offline.
Forum Stats
Supporter
Level 01
Blank Slate
Response to Medals don't unlock 2014-08-20 21:50:23 Reply

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.

indiest
indiest
  • Member since: Sep. 26, 2013
  • Offline.
Forum Stats
Supporter
Level 01
Blank Slate
Response to Medals don't unlock 2014-08-20 21:54:19 Reply

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.