00:00
00:00
Newgrounds Background Image Theme

Someone gifted MetalSlayer69 supporter status!

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!

Edits to post #26717872 by Titilonic

Edited

Wah, I tried to use the Newgrounds.io API in Wick (it uses Javascript so I just copy-pasted from here) but it gives me an unexpected error when trying to give a Medal.


Console output:

Medal.getList: 7
Get Medal " EZPZ " ID...
Medal Found! EZPZ = 62301
Error@Medal.unlock( This is Fine ): Unexpected Server Response


Code:

ngio.getValidSession(function() {
    if (ngio.user) {
        var medals = null;
        ngio.callComponent('Medal.getList', {}, function(result) {
            if (result.success) {
                medals = result.medals;
                unlockMedal("EZPZ", medals);
            }
        });
    }
});

var unlockMedal = function(medal_name, medals) {
    if (ngio.user) {
        var medal;
        for (var i = 0; i < medals.length; i++) {
            medal = medals[i];

            /* look for a matching medal name */
            if (medal.name == medal_name) {
                console.log('Medal Found!', medal_name, '=', medal.id);
 
               /* we can skip unlocking a medal that's already been earned */
                if (!medal.unlocked) {
                    /* unlock the medal from the server */
                    ngio.callComponent('Medal.unlock', {id:medal.id}, function(result) {
                        if (result.success) {
                            console.log('Medal.unlock(', medal, '):', result);
                        } else {
                            console.log('Error@Medal.unlock(', medal.name, '):', result.error.message);
                        }
                    });
                }
            }
        }
    }
}


Why is NGIO trying to give the wrong Medal? (EZPZ = 62301, first Medal, This is Fine = 62303, last Medal)

It's like calling Medal.unlock changes the medal object. Or could it be some async bullhickie?


Wah, I tried to use the Newgrounds.io API in Wick (it uses Javascript so I just copy-pasted from here) but it gives me an unexpected error when trying to give a Medal.


Console output:

Medal.getList: 7
Get Medal " EZPZ " ID...
Medal Found! EZPZ = 62301
Error@Medal.unlock( This is Fine ): Unexpected Server Response


Code:

ngio.getValidSession(function() {
    if (ngio.user) {
        var medals = null;
        ngio.callComponent('Medal.getList', {}, function(result) {
            if (result.success) {
                medals = result.medals;
                unlockMedal("EZPZ", medals);
            }
        });
    }
});

var unlockMedal = function(medal_name, medals) {
    if (ngio.user) {
        var medal;
        for (var i = 0; i < medals.length; i++) {
            medal = medals[i];

            /* look for a matching medal name */
            if (medal.name == medal_name) {
                console.log('Medal Found!', medal_name, '=', medal.id);
 
               /* we can skip unlocking a medal that's already been earned */
                if (!medal.unlocked) {
                    /* unlock the medal from the server */
                    ngio.callComponent('Medal.unlock', {id:medal.id}, function(result) {
                        if (result.success) {
                            console.log('Medal.unlock(', medal, '):', result);
                        } else {
                            console.log('Error@Medal.unlock(', medal.name, '):', result.error.message);
                        }
                    });
                }
            }
        }
    }
}


Why is NGIO trying to give the wrong Medal? (EZPZ = 62301, first Medal, This is Fine = 62303, last Medal)

It's like calling Medal.unlock changes the medal object. Or could it be some async bullhickie?

Edited

Wah, I tried to use the Newgrounds.io API in Wick (it uses Javascript so I just copy-pasted from here) but it gives me an unexpected error when trying to give a Medal.


Console output:

Medal.getList: 7
Get Medal " EZPZ " ID...
Medal Found! EZPZ = 62301
Error@Medal.unlock( This is Fine ): Unexpected Server Response


Code:

ngio.getValidSession(function() {
    if (ngio.user) {
        var medals = null;
        ngio.callComponent('Medal.getList', {}, function(result) {
            if (result.success) {
                medals = result.medals;
                unlockMedal("EZPZ", medals);
            }
        });
    }
});

var unlockMedal = function(medal_name, medals) {
    if (ngio.user) {
        var medal;
        for (var i = 0; i < medals.length; i++) {
            medal = medals[i];

            /* look for a matching medal name */
            if (medal.name == medal_name) {
                console.log('Medal Found!', medal_name, '=', medal.id);
 
               /* we can skip unlocking a medal that's already been earned */
                if (!medal.unlocked) {
                    /* unlock the medal from the server */
                    ngio.callComponent('Medal.unlock', {id:medal.id}, function(result) {
                        if (result.success) {
                            console.log('Medal.unlock(', medal, '):', result);
                        } else {
                            console.log('Error@Medal.unlock(', medal.name, '):', result.error.message);
                        }
                    });
                }
            }
        }
    }
}


Why is NGIO trying to give the wrong Medal? (EZPZ = 62301, first Medal, This is Fine = 62303, last Medal)


Wah, I tried to use the Newgrounds.io API in Wick (it uses Javascript so I just copy-pasted from here) but it gives me an unexpected error when trying to give a Medal.


Console output:

Medal.getList: 7
Get Medal " EZPZ " ID...
Medal Found! EZPZ = 62301
Error@Medal.unlock( This is Fine ): Unexpected Server Response


Code:

ngio.getValidSession(function() {
    if (ngio.user) {
        var medals = null;
        ngio.callComponent('Medal.getList', {}, function(result) {
            if (result.success) {
                medals = result.medals;
                unlockMedal("EZPZ", medals);
            }
        });
    }
});

var unlockMedal = function(medal_name, medals) {
    if (ngio.user) {
        var medal;
        for (var i = 0; i < medals.length; i++) {
            medal = medals[i];

            /* look for a matching medal name */
            if (medal.name == medal_name) {
                console.log('Medal Found!', medal_name, '=', medal.id);
 
               /* we can skip unlocking a medal that's already been earned */
                if (!medal.unlocked) {
                    /* unlock the medal from the server */
                    ngio.callComponent('Medal.unlock', {id:medal.id}, function(result) {
                        if (result.success) {
                            console.log('Medal.unlock(', medal, '):', result);
                        } else {
                            console.log('Error@Medal.unlock(', medal.name, '):', result.error.message);
                        }
                    });
                }
            }
        }
    }
}


Why is NGIO trying to give the wrong Medal? (EZPZ = 62301, first Medal, This is Fine = 62303, last Medal)

It's like calling Medal.unlock changes the medal object. Or could it be some async bullhickie?

Edited

Wah, I tried to use the Newgrounds.io API in Wick (it uses Javascript so I just copy-pasted from here) but it gives me an unexpected error when trying to give a Medal.


Console output:

Medal.getList: 7
Get Medal " EZPZ " ID...
Medal Found! EZPZ = 62301
Error@Medal.unlock( This is Fine ): Unexpected Server Response


Code:

ngio.getValidSession(function() {
    if (ngio.user) {
        var medals = null;
        ngio.callComponent('Medal.getList', {}, function(result) {
            if (result.success) {
                medals = result.medals;
                unlockMedal("EZPZ", medals);
            }
        });
    }
});

var unlockMedal = function(medal_name, medals) {
    if (ngio.user) {
        var medal;
        for (var i = 0; i < medals.length; i++) {
            medal = medals[i];

            /* look for a matching medal name */
            if (medal.name == medal_name) {
                console.log('Medal Found!', medal_name, '=', medal.id);
 
               /* we can skip unlocking a medal that's already been earned */
                if (!medal.unlocked) {
                    /* unlock the medal from the server */
                    ngio.callComponent('Medal.unlock', {id:medal.id}, function(result) {
                        if (result.success) {
                            console.log('Medal.unlock(', medal, '):', result);
                        } else {
                            console.log('Error@Medal.unlock(', medal.name, '):', result.error.message);
                        }
                    });
                }
            }
        }
    }
}


Why is NGIO trying to give the wrong Medal? (EZPZ = 62301 also the first Medal, This is Fine = 62303 also the last Medal)


Wah, I tried to use the Newgrounds.io API in Wick (it uses Javascript so I just copy-pasted from here) but it gives me an unexpected error when trying to give a Medal.


Console output:

Medal.getList: 7
Get Medal " EZPZ " ID...
Medal Found! EZPZ = 62301
Error@Medal.unlock( This is Fine ): Unexpected Server Response


Code:

ngio.getValidSession(function() {
    if (ngio.user) {
        var medals = null;
        ngio.callComponent('Medal.getList', {}, function(result) {
            if (result.success) {
                medals = result.medals;
                unlockMedal("EZPZ", medals);
            }
        });
    }
});

var unlockMedal = function(medal_name, medals) {
    if (ngio.user) {
        var medal;
        for (var i = 0; i < medals.length; i++) {
            medal = medals[i];

            /* look for a matching medal name */
            if (medal.name == medal_name) {
                console.log('Medal Found!', medal_name, '=', medal.id);
 
               /* we can skip unlocking a medal that's already been earned */
                if (!medal.unlocked) {
                    /* unlock the medal from the server */
                    ngio.callComponent('Medal.unlock', {id:medal.id}, function(result) {
                        if (result.success) {
                            console.log('Medal.unlock(', medal, '):', result);
                        } else {
                            console.log('Error@Medal.unlock(', medal.name, '):', result.error.message);
                        }
                    });
                }
            }
        }
    }
}


Why is NGIO trying to give the wrong Medal? (EZPZ = 62301, first Medal, This is Fine = 62303, last Medal)

Edited

Wah, I tried to use the Newgrounds.io API in Wick (it uses Javascript so I just copy-pasted from here) but it gives me an unexpected error when trying to give a Medal.


Console output:

Medal.getList: 7
Get Medal " EZPZ " ID...
Medal Found! EZPZ = 62301
Error@Medal.unlock( This is Fine ): Unexpected Server Response


Code:

ngio.getValidSession(function() {
    if (ngio.user) {
        var medals = null;
        ngio.callComponent('Medal.getList', {}, function(result) {
            if (result.success) {
                medals = result.medals;
                unlockMedal("EZPZ", medals);
            }
        });
    }
});

var unlockMedal = function(medal_name, medals) {
    if (ngio.user) {
        var medal;
        for (var i = 0; i < medals.length; i++) {
            medal = medals[i];

            /* look for a matching medal name */
            if (medal.name == medal_name) {
                console.log('Medal Found!', medal_name, '=', medal.id);
 
               /* we can skip unlocking a medal that's already been earned */
                if (!medal.unlocked) {
                    /* unlock the medal from the server */
                    ngio.callComponent('Medal.unlock', {id:medal.id}, function(result) {
                        if (result.success) {
                            console.log('Medal.unlock(', medal, '):', result);
                        } else {
                            console.log('Error@Medal.unlock(', medal.name, '):', result.error.message);
                        }
                    });
                }
            }
        }
    }
}


Why is NGIO trying to give the wrong Medal? (EZPZ = 62301 also the first Medal, This is Fine = 62303 also the last Medal)


Wah, I tried to use the Newgrounds.io API in Wick (it uses Javascript so I just copy-pasted from here) but it gives me an unexpected error when trying to give a Medal.


Console output:

Medal.getList: 7
Get Medal " EZPZ " ID...
Medal Found! EZPZ = 62301
Error@Medal.unlock( This is Fine ): Unexpected Server Response


Code:

ngio.getValidSession(function() {
    if (ngio.user) {
        var medals = null;
        ngio.callComponent('Medal.getList', {}, function(result) {
            if (result.success) {
                medals = result.medals;
                unlockMedal("EZPZ", medals);
            }
        });
    }
});

var unlockMedal = function(medal_name, medals) {
    if (ngio.user) {
        var medal;
        for (var i = 0; i < medals.length; i++) {
            medal = medals[i];

            /* look for a matching medal name */
            if (medal.name == medal_name) {
                console.log('Medal Found!', medal_name, '=', medal.id);
 
               /* we can skip unlocking a medal that's already been earned */
                if (!medal.unlocked) {
                    /* unlock the medal from the server */
                    ngio.callComponent('Medal.unlock', {id:medal.id}, function(result) {
                        if (result.success) {
                            console.log('Medal.unlock(', medal, '):', result);
                        } else {
                            console.log('Error@Medal.unlock(', medal.name, '):', result.error.message);
                        }
                    });
                }
            }
        }
    }
}


Why is NGIO trying to give the wrong Medal? (EZPZ = 62301 also the first Medal, This is Fine = 62303 also the last Medal)