MusicalCreeper01

Not receiving Robocraft in-game events

Recommended Posts

I'm working on my app for the contest, and a large part of my idea is being able to receive in-game events. 

 

I'm able to receive events like "onGameInfoUpdated" and "onGameLaunched", but my app is not receiving any Robocraft battle events.

 

Here is the code I'm trying:

overwolf.games.events.onNewEvents.addListener(
            function(result) {
                console.log(JSON.stringify(result));
            }
        );

 Is there something weird going on, like that Robocraft only sends events for one gamemode? I'm currently trying it in Team Battle and not getting anything except "onGameInfoUpdated" and "onGameLaunched" events. 

Share this post


Link to post
Share on other sites
 

... Is there something weird going on, like that Robocraft only sends events for one gamemode? ...

 

Currently, events are only sent in Battle Arena. Info updates are sent only in the Garage.

(I hadn't even thought about how any players < lvl 100 can't test battle events now, being locked to TDM...)

Edited by Vida.Sabudabu

Share this post


Link to post
Share on other sites

 

 
 

 

Currently, events are only sent in Battle Arena. Info updates are sent only in the Garage.

(I hadn't even thought about how any players < lvl 100 can't test battle events now, being locked to TDM...)

 

 

Yeah, I don't have a high enough level robot to get into a battle arena since the update :/  I'm not even close to the RP I need to get one. 

 

Do you think it would be a good idea to contact someone from Robocraft or Overwolf about this, since it limits who can enter the competition?

Share this post


Link to post
Share on other sites

Yeah, I don't have a high enough level robot to get into a battle arena since the update :/  I'm not even close to the RP I need to get one. 

 

Do you think it would be a good idea to contact someone from Robocraft or Overwolf about this, since it limits who can enter the competition?

Please try and see if the Robocraft forums will provide a solution for your problem. If not, let us know and we'll see what can be done.

Share this post


Link to post
Share on other sites

In theory, this shouldn't be a problem. As i suppose battle events are meant to be produced in all game-modes (and ideally in a test/practice/single-player mode as well).

 

My guess is that they haven't gotten around to adding the events to any other game-mode, and created this conundrum when introducing the game-mode limits on top of that.

Share this post


Link to post
Share on other sites

In theory, this shouldn't be a problem. As i suppose battle events are meant to be produced in all game-modes (and ideally in a test/practice/single-player mode as well).

 

My guess is that they haven't gotten around to adding the events to any other game-mode, and created this conundrum when introducing the game-mode limits on top of that.

 

I'm assuming thats probably what happened

Share this post


Link to post
Share on other sites

This is horrific. Only two days left till we have to submit our prototype to the Nvidia app contest and we never even had a chance to even test our application. If you knew the Robocraft API was not working, why did you include it in the games with the new APIs?

 

I've searched around a lot of Overwolf and Robocraft forum threads and nothing so far. The only thing I've seen regarding this issue is that a patch will be released "sometime within the next few months".

 

Maybe I'm being too strict about this. If the API doesn't work then how will our submission process work? Is it ok to send it in with the broken API? Because I am yet to see some code that works with it. I've got a great idea, and I'm still working on the implementation of it. If I don't get any information on this, I'll just send it in without it being able to interact with Robocraft.

Share this post


Link to post
Share on other sites

No need to panic, the first draft doesn't require a working prototype.

Just send in a screenshot with a text description of your app's general functionality (or go into details, if you wish).

 

Also, the API should be working for a couple of weeks now.

Share this post


Link to post
Share on other sites

Ok, thanks for letting us know, but I still can't get my code to work.

 

I'm trying to get basic game information, but I can't figure it out. Here's my code:

 

battleStats.html:

<!DOCTYPE html>
<html>
    <head> 
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Battle Stats</title>
        <link type="text/css" rel="stylesheet" href="style.css">
        <script type="text/javascript" src="windowManagement.js"></script>
        <script>			
			// Code for an alternative starting window
			function openMainWindow()
			{				
				overwolf.windows.obtainDeclaredWindow("MainWindow",
				    function(result)
					{
				        if (result.status == "success")
						{
				            overwolf.windows.restore(result.window.id, function(result){} );
				        }
				    });
				closeWindow();
			}
			
			//-------------------------------------------------------------------------------
			
			// Test:
			overwolf.games.events.onNewEvents.addListener(
			    function (value) {
			        var i = 0;
					for(; i < value.events.length; i++){
					    console.log('event name');
					    console.log(value.events[i].name);
					}
			    }
			);
			
			// My code
			
                    var GameInfo = overwolf.games.getRunningGameInfo(
                    function(value) {
			document.getElementById("test").innerHTML = value.title;
                }
            );
			
		var username = overwolf.games.events.Robocraft.playerData.username;
		document.getElementById("name").innerHTML = username;
			
        </script>
    </head>

    <body>
        <div onmousedown="dragResize('BottomRight');">
	        <div id="content" onmousedown="dragMove();">
		    <div class="outlined">
		        <h1>Game Stats</h1>
			    <p id="test">Robocraft is not loaded, or there are other games running.</p>
			    <p>Your player name is <span id="name">unknown</span></p>
			    <p>Your last battle was a <span id="lastBattleStatus">unknown</span></p>
		    </div>
	            <p><span class="actionButton" onclick="openMainWindow();">Close</span></p>
	        </div>
        </div>
    </body>
</html>
 

manifest.json:

{
    "manifest_version": 1,
    "type": "WebApp",
    "permissions": ["GameInfo"],
    "meta": {
        "name": "testApp",
        "version": "0.0.3",
        "minimum-overwolf-version":"0.77.10",
        "author": "stef1261",
        "icon": "IconNormal.png",
        "icon_gray": "IconGray.png",
        "description": "A Robocraft app."
    },
    "data": {
        "start_window": "MainWindow",
        "windows": {
            "MainWindow": {
                "file": "battleStats.html",
                "transparent": true,
                "resizable": false,
                "start_position": {"Top": 100, "Left": 300},
                "size": {"width": 275, "height": 333},
                "min_size": {"width": 275, "height": 333},
                "max_size": {"width": 275, "height": 333}
            }
        }
    }
}

The error says:

The property 'overwolf.games' requires the GameInfo permission. 

even though it is clearly included and also says this error message:

Uncaught TypeError: Cannot read property 'playerData' of undefined 

Am I using the API wrong?

Edited by stef1261

Share this post


Link to post
Share on other sites
 
...

var username = overwolf.games.events.Robocraft.playerData.username;

...

Am I using the API wrong?

 

 

Slightly. Since these are event data, you need to 'catch' it, before you can access it in the way you're attempting.

Something like this should work for you :
 

var playersUsername = '';

overwolf.games.events.onInfoUpdates.addListener(function (data) {
	for (var i in data.info) {
		if (data.info[i].category == "playerData" {
			if (data.info[i].key == "username")
				playersUsername = data.info[i].value;
		}
	}
});
Edited by Vida.Sabudabu

Share this post


Link to post
Share on other sites

Wow, I'm such an idiot :wallbash: . Thank you so much. All this time, I thought the API was broken, but it turns out I was broken. Thank you so much!

 

They should really update their documentation, because it's really vague what "Category: playerData" means.

Thank you!  :laugh:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now