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 #27002704 by 3p0ch

Edited

At 9/7/21 02:46 PM, Scootakip wrote: Hey! I'm trying to get Rojekabcrojekabc's Newgrounds API plugin for Godot working, but I keep being met with a TLS handshake error. I believe I have everything set up the way it's supposed to be both in the Godot project and on the API page, the JSON file it's sending also seems to be right, but it still produces the error. This even happens in the example project that comes with the plugin. Any possible help?


I don't think I ever got that Godot plugin to work directly, but I cannibalized its code and got Godot medals and leaderboards working. The code I had for a leaderboard was

	var newgroundsio_request

	newgroundsio_request = HTTPRequest.new()
	add_child(newgroundsio_request)
	if OS.has_feature('JavaScript'):
		var request_parameters = '{"app_id": "##########", "session_id": "' + str(JavaScript.eval('var urlParams = new URLSearchParams(window.location.search); urlParams.get("ngio_session_id")', true)) + '", "call": {"component": "ScoreBoard.postScore", "parameters": {"id": ##########, "value": ' + str(ceil(SceneLoader.goo_left)) + '}}}'
		newgroundsio_request.request("https://www.newgrounds.io/gateway_v3.php", ["Content-Type: application/x-www-form-urlencoded"], true, HTTPClient.METHOD_POST,
			"input=" + request_parameters.percent_encode()
		)

You would need to put your own app ID and leaderboard ID where I have the ####, and use whatever value you want to post to the leaderboard instead of goo_left.


The code for medals was similar but the request parameters were

		var request_parameters = '{"app_id": "########", "session_id": "' + str(JavaScript.eval('var urlParams = new URLSearchParams(window.location.search); urlParams.get("ngio_session_id")', true)) + '", "call": {"component": "Medal.unlock", "parameters": {"id": ########}}}'


I would post it to NG.io but this few lines of code would hardly constitute an API.


At 9/7/21 02:46 PM, Scootakip wrote: Hey! I'm trying to get Rojekabcrojekabc's Newgrounds API plugin for Godot working, but I keep being met with a TLS handshake error. I believe I have everything set up the way it's supposed to be both in the Godot project and on the API page, the JSON file it's sending also seems to be right, but it still produces the error. This even happens in the example project that comes with the plugin. Any possible help?


I don't think I ever got that Godot plugin to work directly, but I cannibalized its code and got Godot medals and leaderboards working. The code I had for a leaderboard was

	var newgroundsio_request

	newgroundsio_request = HTTPRequest.new()
	add_child(newgroundsio_request)
	if OS.has_feature('JavaScript'):
		var request_parameters = '{"app_id": "##########", "session_id": "' + str(JavaScript.eval('var urlParams = new URLSearchParams(window.location.search); urlParams.get("ngio_session_id")', true)) + '", "call": {"component": "ScoreBoard.postScore", "parameters": {"id": ##########, "value": ' + str(ceil(SceneLoader.goo_left)) + '}}}'
		newgroundsio_request.request("https://www.newgrounds.io/gateway_v3.php", ["Content-Type: application/x-www-form-urlencoded"], true, HTTPClient.METHOD_POST,
			"input=" + request_parameters.percent_encode()
		)

You would need to put your own app ID and leaderboard ID where I have the ####, and use whatever value you want to post to the leaderboard instead of goo_left.


The code for medals was similar but the request parameters were

		var request_parameters = '{"app_id": "########", "session_id": "' + str(JavaScript.eval('var urlParams = new URLSearchParams(window.location.search); urlParams.get("ngio_session_id")', true)) + '", "call": {"component": "Medal.unlock", "parameters": {"id": ########}}}'


I would post it to NG.io but this few lines of code would hardly constitute an API. And I haven't incorporated encryption.

Edited

At 9/7/21 02:46 PM, Scootakip wrote: Hey! I'm trying to get Rojekabcrojekabc's Newgrounds API plugin for Godot working, but I keep being met with a TLS handshake error. I believe I have everything set up the way it's supposed to be both in the Godot project and on the API page, the JSON file it's sending also seems to be right, but it still produces the error. This even happens in the example project that comes with the plugin. Any possible help?


I don't think I ever got that Godot plugin to work directly, but I cannibalized its code and got Godot medals and leaderboards working. The code I had for a leaderboard was

	newgroundsio_request = HTTPRequest.new()
	add_child(newgroundsio_request)
	if OS.has_feature('JavaScript'):
		var request_parameters = '{"app_id": "##########", "session_id": "' + str(JavaScript.eval('var urlParams = new URLSearchParams(window.location.search); urlParams.get("ngio_session_id")', true)) + '", "call": {"component": "ScoreBoard.postScore", "parameters": {"id": ##########, "value": ' + str(ceil(SceneLoader.goo_left)) + '}}}'
		newgroundsio_request.request("https://www.newgrounds.io/gateway_v3.php", ["Content-Type: application/x-www-form-urlencoded"], true, HTTPClient.METHOD_POST,
			"input=" + request_parameters.percent_encode()
		)

You would need to put your own app ID and leaderboard ID where I have the ####, and use whatever value you want to post to the leaderboard instead of goo_left.


The code for medals was similar but the request parameters were

		var request_parameters = '{"app_id": "########", "session_id": "' + str(JavaScript.eval('var urlParams = new URLSearchParams(window.location.search); urlParams.get("ngio_session_id")', true)) + '", "call": {"component": "Medal.unlock", "parameters": {"id": ########}}}'


I would post it to NG.io but this few lines of code would hardly constitute an API.


At 9/7/21 02:46 PM, Scootakip wrote: Hey! I'm trying to get Rojekabcrojekabc's Newgrounds API plugin for Godot working, but I keep being met with a TLS handshake error. I believe I have everything set up the way it's supposed to be both in the Godot project and on the API page, the JSON file it's sending also seems to be right, but it still produces the error. This even happens in the example project that comes with the plugin. Any possible help?


I don't think I ever got that Godot plugin to work directly, but I cannibalized its code and got Godot medals and leaderboards working. The code I had for a leaderboard was

	var newgroundsio_request

	newgroundsio_request = HTTPRequest.new()
	add_child(newgroundsio_request)
	if OS.has_feature('JavaScript'):
		var request_parameters = '{"app_id": "##########", "session_id": "' + str(JavaScript.eval('var urlParams = new URLSearchParams(window.location.search); urlParams.get("ngio_session_id")', true)) + '", "call": {"component": "ScoreBoard.postScore", "parameters": {"id": ##########, "value": ' + str(ceil(SceneLoader.goo_left)) + '}}}'
		newgroundsio_request.request("https://www.newgrounds.io/gateway_v3.php", ["Content-Type: application/x-www-form-urlencoded"], true, HTTPClient.METHOD_POST,
			"input=" + request_parameters.percent_encode()
		)

You would need to put your own app ID and leaderboard ID where I have the ####, and use whatever value you want to post to the leaderboard instead of goo_left.


The code for medals was similar but the request parameters were

		var request_parameters = '{"app_id": "########", "session_id": "' + str(JavaScript.eval('var urlParams = new URLSearchParams(window.location.search); urlParams.get("ngio_session_id")', true)) + '", "call": {"component": "Medal.unlock", "parameters": {"id": ########}}}'


I would post it to NG.io but this few lines of code would hardly constitute an API.