Wick tells me that I can't open the widgets at all. Any fix?
HO HO HOPE you become a Newgrounds Supporter this year!
We're working hard to give you the best site possible, but we have bills to pay and community support is vital to keep things going and growing. Thank you for considering!
Wick tells me that I can't open the widgets at all. Any fix?
At 6/14/22 04:16 PM, suspct wrote:Wick tells me that I can't open the widgets at all. Any fix?
Wick Editor? Have you tried this guide to set up Newgrounds.io? Or could you describe where you're stuck?
I just tried to plug it in a test project I had lying around, followed it step-by-step and it seems like it still does work.
I was able to get the user session and unlock a medal in the preview (here's the source wick file).
Will GameMaker Studio 2 get Ads like the Flash API? Just seeing like it would be a great feature to add to it so content creators can make some advertisement money on the side.
At 7/20/22 08:55 PM, mastorkey wrote:Will GameMaker Studio 2 get Ads like the Flash API? Just seeing like it would be a great feature to add to it so content creators can make some advertisement money on the side.
The advertising stuff is all deprecated and won't be coming back. Frankly, there's just no value in it anymore.
Bro why I can't play any song please help
I'm testing out cloud save support in my Godot implementation for the API and it seems like if the data string has embedded quotes it ends up not working, even if I try to add backslashes in front to escape them. It looks like it works if there are no quotes, but that puts a damper on saving complex data as a JSON encoded string.
I could workaround by having my API implementation replace quotes with some other string of characters that would be unlikely to ever be used by any dev whenever it sends or receives data, but first wanted to check whether strings with embedded quotes are known to work? If they do and I'm just overlooking something (maybe an issue with how my script is handling things before it sends the API request) I'll spend more time trying to fix the underlying problem if possible before resorting to a kludgey workaround.
At 8/7/22 06:50 PM, 3p0ch wrote:I'm testing out cloud save support in my Godot implementation for the API and it seems like if the data string has embedded quotes it ends up not working, even if I try to add backslashes in front to escape them. It looks like it works if there are no quotes, but that puts a damper on saving complex data as a JSON encoded string.
I could workaround by having my API implementation replace quotes with some other string of characters that would be unlikely to ever be used by any dev whenever it sends or receives data, but first wanted to check whether strings with embedded quotes are known to work? If they do and I'm just overlooking something (maybe an issue with how my script is handling things before it sends the API request) I'll spend more time trying to fix the underlying problem if possible before resorting to a kludgey workaround.
I'm not sure how you're encoding the JSON in your implementation, but you should be escaping things like quotes and slashes when encoding string data.
So if your "data" value in the cloud save was a JSON string like:
{"characterName": "Drip Tinkler", "level": 12}
When you encode that in the larger JSON object it would look like:
"{\"characterName\": \"Drip Tinkler\", \"level\": 12}"
Someone else named planktonfun made a Newgrounds API extension for GDevelop, it should probably added to newgrounds.io along the other implementation.
https://gdevelop.io/game-example/newgrounds-api
https://wiki.gdevelop.io/gdevelop5/extensions/newgrounds-api/reference
Hi. I wanted to get a feel on how newgrounds.io api works but in reality i cannot even made the simplest of calls myself . Im using postman. Im using this adress https://www.newgrounds.io/gateway_v3.php . Im selecting method POST and then in the body section im clicking raw and then selecting JSON. then I already tried to send this 3 JSON objects:
1.
{
"app_id": "test",
"debug": true,
"execute": {
"component": "Gateway.getDatetime",
"parameters": {},
"echo": "Hello World!"
}
}
2.
{ "app_id": 'test', "session_id": null, "call": { "component": "Gateway.getVersion" } }
3.
{ "app_id": "test", "session_id": null, "call": { "component": "Gateway.getVersion" } }
In all 3 cases im getting the same response :
{
"success": false,
"error": {
"message": "Missing required request",
"code": 100
},
"api_version": "3.0.0",
"help_url": "http://www.newgrounds.com/wiki/creator-resources/newgrounds-apis/newgrounds-io"
}
What em i doing wrong? Please help.
At 2/24/23 09:00 PM, bodziozet wrote:Hi. I wanted to get a feel on how newgrounds.io api works but in reality i cannot even made the simplest of calls myself . Im using postman.
I suspect it's something to do with how the post is structured by Postman, but you probably don't need to use Postman in the first place. What engine / framework are you making your game in? There are probably already implementations at https://www.newgrounds.io/get-started/#step-4-learn-how-to-use-the-api-components for whatever you're using, and even if you're making something from scratch there should be easier ways of doing it than having to use something like Postman, so it probably wouldn't be worth worrying about details of how to make Postman do what you want if that's not ultimately what would make sense to use in a game.
At 2/25/23 09:40 AM, 3p0ch wrote:At 2/24/23 09:00 PM, bodziozet wrote:Hi. I wanted to get a feel on how newgrounds.io api works but in reality i cannot even made the simplest of calls myself . Im using postman.I suspect it's something to do with how the post is structured by Postman, but you probably don't need to use Postman in the first place. What engine / framework are you making your game in? There are probably already implementations at https://www.newgrounds.io/get-started/#step-4-learn-how-to-use-the-api-components for whatever you're using, and even if you're making something from scratch there should be easier ways of doing it than having to use something like Postman, so it probably wouldn't be worth worrying about details of how to make Postman do what you want if that's not ultimately what would make sense to use in a game.
Hi thanks for your reply. I'm making my game in GameMaker2 and i already have a library of functions imported but i don't like how i cannot find documentation on how are these functions working and what are they returning so i tried to get a feel on how the api works and i cannot even make the call using postman or even i tried do the same in some online site that works like postman and i could not get success response. Using Game maker 2 functions i was unable to do what i wanted to do. I dont even understand if ng_connect function really connects to the server or only instantiate an object with app id and encryption keys that other functions will use.
Hi i have a question about newgounds.io functions inside Game Maker 2 Studio. How to use ng_getScores() function? Under the hood the function seems to be asynchronous so the var score = ng_getScores(app_id, board_id) does not work properly or maybe i'm missing something?
At 2/24/23 09:00 PM, bodziozet wrote:Hi. I wanted to get a feel on how newgrounds.io api works but in reality i cannot even made the simplest of calls myself . Im using postman. Im using this adress https://www.newgrounds.io/gateway_v3.php . Im selecting method POST and then in the body section im clicking raw and then selecting JSON. then I already tried to send this 3 JSON objects:
1.
{
: "app_id": "test",
: "debug": true,
: "execute": {
: "component": "Gateway.getDatetime",
: "parameters": {},
: "echo": "Hello World!"
: }
}
2.
3.
In all 3 cases im getting the same response :
{
: "success": false,
: "error": {
: "message": "Missing required request",
: "code": 100
: },
: "api_version": "3.0.0",
: "help_url": "http://www.newgrounds.com/wiki/creator-resources/newgrounds-apis/newgrounds-io"
}
What em i doing wrong? Please help.
Ok. So at least i think i know what is happening in this situation. All these API calls do not work because newgrounds.api expect you to send something more than a JSON string. It wants a key : value pair where key is either request or input and the value is a JSON string. It's like you would submit a form to the gateway it would send a key : value pair where the key is the name of the textarea in which you wrote the JSON String. So if somebody wants to test the api with postman you have to send the JSON not as raw JSON butas form-data and then you add new key value pair where key is request and value is your JSON string.
At 3/4/23 10:28 AM, bodziozet wrote:At 2/24/23 09:00 PM, bodziozet wrote:Hi. I wanted to get a feel on how newgrounds.io api works but in reality i cannot even made the simplest of calls myself . Im using postman. Im using this adress https://www.newgrounds.io/gateway_v3.php . Im selecting method POST and then in the body section im clicking raw and then selecting JSON. then I already tried to send this 3 JSON objects:
1.
{
"app_id": "test",
"debug": true,
"execute": {
"component": "Gateway.getDatetime",
"parameters": {},
"echo": "Hello World!"
}
}
2.
3.
In all 3 cases im getting the same response :
{
"success": false,
"error": {
"message": "Missing required request",
"code": 100
},
"api_version": "3.0.0",
"help_url": "http://www.newgrounds.com/wiki/creator-resources/newgrounds-apis/newgrounds-io"
}
What em i doing wrong? Please help.
Ok. So at least i think i know what is happening in this situation. All these API calls do not work because newgrounds.api expect you to send something more than a JSON string. It wants a key : value pair where key is either request or input and the value is a JSON string. It's like you would submit a form to the gateway it would send a key : value pair where the key is the name of the textarea in which you wrote the JSON String. So if somebody wants to test the api with postman you have to send the JSON not as raw JSON butas form-data and then you add new key value pair where key is request and value is your JSON string.
Furthermore if you want to make an api call for example using native Game Maker Studio 2 functions other than the newgrounds.api extension for example http_post_string you do not post only json string but to the json string you append at the begining something like "request=".
At 3/4/23 10:57 AM, bodziozet wrote:At 3/4/23 10:28 AM, bodziozet wrote:At 2/24/23 09:00 PM, bodziozet wrote:Hi. I wanted to get a feel on how newgrounds.io api works but in reality i cannot even made the simplest of calls myself . Im using postman. Im using this adress https://www.newgrounds.io/gateway_v3.php . Im selecting method POST and then in the body section im clicking raw and then selecting JSON. then I already tried to send this 3 JSON objects:
1.
{
"app_id": "test",
"debug": true,
"execute": {
"component": "Gateway.getDatetime",
"parameters": {},
"echo": "Hello World!"
}
}
2.
3.
In all 3 cases im getting the same response :
{
"success": false,
"error": {
"message": "Missing required request",
"code": 100
},
"api_version": "3.0.0",
"help_url": "http://www.newgrounds.com/wiki/creator-resources/newgrounds-apis/newgrounds-io"
}
What em i doing wrong? Please help.
Ok. So at least i think i know what is happening in this situation. All these API calls do not work because newgrounds.api expect you to send something more than a JSON string. It wants a key : value pair where key is either request or input and the value is a JSON string. It's like you would submit a form to the gateway it would send a key : value pair where the key is the name of the textarea in which you wrote the JSON String. So if somebody wants to test the api with postman you have to send the JSON not as raw JSON butas form-data and then you add new key value pair where key is request and value is your JSON string.
Furthermore if you want to make an api call for example using native Game Maker Studio 2 functions other than the newgrounds.api extension for example http_post_string you do not post only json string but to the json string you append at the begining something like "request=".
Im sory for posting another reply to myself but i cannot edit the reply before. So I want to use a native Game maker Studio 2 function like http_post_string() because i do not understand how the newgorunds.api extension function for Game maker Studio 2 called ng_getScores supposed to work. When im looking at the source code the implementation looks like that:
function ng_getScores(board_app_id, board_id, board_limit, board_period, board_skip, board_social, board_tag, user_id_or_name) { if (!ngio.user) return ""; for (var i = 0; i < scoreboards.length; i++) { scoreboard = scoreboards[i]; if (board_id == scoreboard.id || board_id == scoreboard.name) { thescoreboard = ngio.callComponent('ScoreBoard.getScores', { app_id: board_app_id, id: scoreboard.id, limit: board_limit, period: board_period, skip: board_skip, social: board_social, tag: board_tag, user: user_id_or_name }); return thescoreboard; } } }
So the function returns thescoreboard so it probably should be used like that var thescoreboard = ng_getScores(parameters). But this function under the hood uses ngio.callComponent() which looks like an asynchronous call. So this not supposed to work. When im using native function like http_post_string then when the function returns then an Asynchronous Http event will be triggerd in which i can handle the response.
Is something up with NGIO right now? I'm getting cors policy error both in my editor previews and when I export to newgrounds
Access to XMLHttpRequest at 'https://newgrounds.io/gateway_v3.php' from origin 'https://isolated.ungrounded.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I'm also getting 429 errors (too many requests?) but I've never had an issue before today.
Getting this error in the browser console after building the game. Im using NGIO for Unity and it all works perfectly in the Unity Editor, so I'm not sure what to do
At 9/30/23 11:25 AM, DevGio wrote:
Getting this error in the browser console after building the game. Im using NGIO for Unity and it all works perfectly in the Unity Editor, so I'm not sure what to do
It might be an error with Unity 2022+, I've been trying to fix the same thing for the past couple days and seen other people a couple other people have the same problem with no solution besides copying a project that's confirmed working and then adding your project into that
Hello,
I've started testing Newgrounds API to figure out how it works. Unfortunately I've encountered a problem.
I'm using official NewgroundsIO-JS library.
I'm trying to retrieve user name if game is run on Newgrounds and with logged in user.
The problem is that no matter if script is run on Newgrounds and user is logged in, API always requests a login and to grant permission to retrieve data.
Only after granting permission it works as intended.
I don't understand why it requires such permission when it runs on Newgrounds and user is logged in?
Other games don't require it.
Am I doing something wrong / not understanding something?
Should I use a different library?
Expected behavior:
Script connects with API.
If game is run on Newgrounds and user is logged in on Newgrounds retrieve user's name.
If game is not on Newgrounds or user is not logged in ignore.
Actual behavior:
API requests login (granting permission through Newgrounds passport popup) no matter if it's running on Newgrounds and user is logged in.
If permission is not granted or login page skipped status don't change to NGIO.STATUS_READY and you can't retrieve user data.
This step is skipped only if you granted permission earlier.
Here's code sample based on library's docs:
// init options NGIO.init("App ID","Encryption Key", { version: "1.0.0", checkHostLicense: true, autoLogNewView: true, preloadMedals: false, preloadScoreBoards: false, preloadSaveSlots: false, debugMode: true }); // simulate game loop setInterval(() => { NGIO.getConnectionStatus(function(status) { /* * additional code */ // check the actual connection status switch (status) { /* * additional case: NGIO.STATUS_LOCAL_VERSION_CHECKED */ // user needs to log in // always fires (unless you granted permission in ) case NGIO.STATUS_LOGIN_REQUIRED: console.log('status login required'); console.log('has user', NGIO.hasUser); // returns true console.log('user', NGIO.user) // returns User object console.log(NGIO.user.id, NGIO.user.name, NGIO.user.icon); // all parameters are null //shows login page NGIO.openLoginPage(); //skips login for tests //NGIO.skipLogin(); break; /* * additional case: NGIO.STATUS_WAITING_FOR_USER */ // user needs to log in // fires only if you granted permission in Newgrounds passport popup. case NGIO.STATUS_READY: // Everything should be loaded. // If NGIO.hasUser is false, the user opted not to sign in, so you may // need to do some special handling in your game. console.log('ready') console.log('has user', NGIO.hasUser); // returns true console.log(NGIO.user); // returns User object console.log(NGIO.user.id, NGIO.user.name, NGIO.user.icon); //returns suer id, name and icon break; } }); }, 200);
At 5/31/24 05:22 PM, Wiserim wrote:Hello,
I've started testing Newgrounds API to figure out how it works. Unfortunately I've encountered a problem.
I'm using official NewgroundsIO-JS library.
I'm trying to retrieve user name if game is run on Newgrounds and with logged in user.
The problem is that no matter if script is run on Newgrounds and user is logged in, API always requests a login and to grant permission to retrieve data.
Only after granting permission it works as intended.
I don't understand why it requires such permission when it runs on Newgrounds and user is logged in?
Other games don't require it.
Am I doing something wrong / not understanding something?
Should I use a different library?
Expected behavior:
Script connects with API.
If game is run on Newgrounds and user is logged in on Newgrounds retrieve user's name.
If game is not on Newgrounds or user is not logged in ignore.
Actual behavior:
API requests login (granting permission through Newgrounds passport popup) no matter if it's running on Newgrounds and user is logged in.
If permission is not granted or login page skipped status don't change to NGIO.STATUS_READY and you can't retrieve user data.
This step is skipped only if you granted permission earlier.
I've made my own script to handle API and everything works fine.
After checking official library's API requests and code I've noticed that it has a bug:
It retrieves session id from query, but never uses it and starts new session instead (I'll prepare issue on GitHub tomorrow).
I have a little doubt about sessions. When I create sessions (with Newgrounds.js or even posting messages directly to the gateway), I receive NULL as the user and an URL to a page that looks like:
Grant permission is the only way I know to obtain a SessionID without NULL as the user, so I can use them to unlock medals. But i've played some games in Newgrounds with medals and they don't ask me for permission.
So, is there any way to unlock medals without asking permission every time?
At 6/17/24 01:00 PM, 12kittens wrote:Grant permission is the only way I know to obtain a SessionID without NULL as the user, so I can use them to unlock medals. But i've played some games in Newgrounds with medals and they don't ask me for permission.
Wiserim above you mentioned a quite similar issue (if I understand you well), and also included a supposed fix that hasn't yet been merged into the main branch.
You can try the fix yourself, and see if it resolves the problem.
At 6/17/24 01:00 PM, 12kittens wrote: When I create sessions (with Newgrounds.js or even posting messages directly to the gateway), I receive NULL as the user
However, if you have the same problem with the gateway, too, then the fix probably won't help.
Based on the wording of your post, do you “create a session” every time? And every time meaning every page refresh, or every time you want to unlock a medal? If the latter, then you should be able to check and retrieve the existing session like this. I personally never needed to grant permission more than once per game.
If it's the former, and the proposed fix from Wiserim doesn't help, then you might have better luck asking on the official Discord, which is followed by more people than this topic so you might get a smarter response faster.
Keep in mind that the other games on Newgrounds might be using an older version of the library (depending on what you played), especially Flash games.
Is newgrounds.io avaliable in browser without downloading It?
Just to add achivements in games easily?
Or Will be in Any Day?
At 8/5/24 06:57 PM, NK2007 wrote:Is newgrounds.io avaliable in browser without downloading It?
Just to add achivements in games easily?
You need to make the achievements a part of your game's implementation.
A browser tool wouldn't know how your game is implemented to "inject" unlocking conditions for achievements somewhere meaningfully. And game builds come in all sorts of different shapes and sizes.
The ways to potentially make this work would still involve making a web request to Newgrounds API within your game, and without downloading anything, you'd essentially be rewriting the library from scratch and that definitely wouldn't be easier than using the finished library.
And there's more to it than just the final unlocking part: initialization, user session, medal popup if you want it etc.
No platform with achievements I know (Steam, PS, Xbox) lets you hook achievements without modifying your game's implementation. Especially considering you'd probably have to redo it all the time when your build/implementation changes.
If your implementation takes place in a browser tool already (e.g. Scratch/Turbowarp), then you might not need to download anything and can just link it, but still, getting the library is the easiest part.
If you find Newgrounds.io hard and need help setting it up, please ask questions; but I'd be very surprised if what you describe happened, as it likely wouldn't actually make things any easier.
So I'm trying for the first time to add medals to a game.
I have no formal education in programming. What little I have learned, I have learned fairly late in life.
I don't consider myself a programmer.
It is a HTML5/js game made using the CTJS-editor. https://ctjs.rocks/
I have added a medal to the NG game project.
I have added the NewgroundsIO.min.js to the folder that will be the zip-file and
<script src="NewgroundsIO.min.js"></script>
in the index.html file
In what the editor compiles to a js-file, I have added
NGIO.init("58925:KLXd4p3I","LvgkmtITM62NRCoViF5iRQ==", { version: "1.0.0", checkHostLicense: true, autoLogNewView: true, preloadMedals: true, preloadScoreBoards: false, preloadSaveSlots: false, debugMode: false });
at the point that the game starts (it runs once)
and
NGIO.unlockMedal(80322);
at the point where the player have successfully completed level 1
In preview I can play the game passed the point where the medal should unlocked and I don't get any error in the browsers inspector. I don't see any sign that the medal actually is being unlocked. (which could just be that it is in preview mode)
----
I would appreciate advice on how to proceed (or start over if I'm doing it all wrong).
Assume I don't know just about anything. Baby steps, please.
See my profile page for link to showroom
At 8/27/24 05:24 AM, PerKGrok wrote:So I'm trying for the first time to add medals to a game.
In what the editor compiles to a js-file, I have added NGIO.init at the point that the game starts (it runs once)
and
NGIO.unlockMedal at the point where the player have successfully completed level 1.
You are most likely missing a call to NGIO.getConnectionStatus in between the initialization and the call to unlock the medal to check and apply the user session – more details here.
It essentially boils down to two cases you should handle – request to log in or grant permission to use the API, and having the library ready, at which point you can start using it for what you need.
// inside your game loop NGIO.getConnectionStatus(function(status) { console.log(`The current Newgrounds.io status is: ${status}`); switch (status) { case NGIO.STATUS_LOGIN_REQUIRED: // prompt the user to login in or grant permission // a popup with "NGIO.openLoginPage();" break; case NGIO.STATUS_READY: // everything is prepared now if (NGIO.hasUser) { // the user is logged in and has a valid session, knock yourself out unlockMedal(80322); } else { // The user refused to sign in, so no point in doing stuff. } break; } });
Did you find the working example included with the library? You can download the individual files and examine what you're doing differently. Particularly starting with this line.
A lot of the example actually handles the timers and visuals which will be different in your game (although similar conceptually).
So to find the important parts, search the test.js file for all “NGIO.” calls.
But the summary really is:
At 8/27/24 03:18 PM, RaIix wrote:At 8/27/24 05:24 AM, PerKGrok wrote:So I'm trying for the first time to add medals to a game.
In what the editor compiles to a js-file, I have added NGIO.init at the point that the game starts (it runs once)
and
NGIO.unlockMedal at the point where the player have successfully completed level 1.
You are most likely missing a call to NGIO.getConnectionStatus in between the initialization and the call to unlock the medal to check and apply the user session – more details here.
It essentially boils down to two cases you should handle – request to log in or grant permission to use the API, and having the library ready, at which point you can start using it for what you need.
Did you find the working example included with the library? You can download the individual files and examine what you're doing differently. Particularly starting with this line.
A lot of the example actually handles the timers and visuals which will be different in your game (although similar conceptually).
So to find the important parts, search the test.js file for all “NGIO.” calls.
But the summary really is:
------------------------------
Thank you for trying to help me.
Unfortunately I'm still stuck.
the line
console.log(`The current Newgrounds.io status is: ${status}`);
runs two times (can't see why 2 times) giving
The current Newgrounds.io status is: checking-local-version The current Newgrounds.io status is: local-version-checked
Which is not what I would expect. Don't seem to give anything useful.
Adding a console.log line in the case options gives no response. None of them is running.
Adding
console.log(NGIO.hasUser);
after "the status-console.log line", returns "false" (one time after each of the 2 current status prints)
Which seems like a major problem. Obviously I am logged in, but 'NGIO' is not aware of it?
What I want to do is;
if the user is logged in, they get medals,
if they are not, the game plays without medals and it does not break where medals would have been awarded.
I don't want any pop-ups for log-in, or anything like that.
I would expect that something like
NGIO.getConnectionStatus(function(status) { if (NGIO.hasUser) { console.log("Has User"); unlockMedal(80322);} else{console.log("No User");} });
should do that, but it only returns "No User".
I had already looked at the different information I have been able to find, including the test.js file. The test.js file is not helpful to me. I don't doubt that there is useful stuff in there for what I want to do, but I cannot extract it.
There is a reason that I, in the original post, said: "Assume I don't know just about anything. Baby steps, please."
See my profile page for link to showroom
At 8/28/24 06:53 AM, PerKGrok wrote:There is a reason that I, in the original post, said: "Assume I don't know just about anything. Baby steps, please."
I apologize. I tried to describe the key steps in the summary, but it's hard to give detailed advice with a thorough explanation if I know nothing about your implementation.
Would you be willing to PM me your source files so I could try taking a look at what's wrong?
Or I could try making a minimal CTJS-editor project, but then it might not fit your implementation.
At 8/28/24 07:21 AM, RaIix wrote:At 8/28/24 06:53 AM, PerKGrok wrote:There is a reason that I, in the original post, said: "Assume I don't know just about anything. Baby steps, please."
I apologize. I tried to describe the key steps in the summary, but it's hard to give detailed advice with a thorough explanation if I know nothing about your implementation.
Would you be willing to PM me your source files so I could try taking a look at what's wrong?
Or I could try making a minimal CTJS-editor project, but then it might not fit your implementation.
PM sent
Nothing to apologize for. Finding the best level of communication can always be difficult.
Very grateful for your help.
See my profile page for link to showroom