Steamworks SDK - listener not providing data?

Pinging @britzl for help! I’m not getting any data from the steamworks SDK listener. I have it set up as below in the init for my script ( steam_extension_enabled is definitely true because the stats line gets called). I bundle the game in debug mode, add the steam_appid.txt file and launch the game with Steam open. I can then open the Steam overlay using Shift+Tab, which I would expect to trigger the GameOverlayActivated_t (callback) event - but I get nothing. Any ideas for what I’ve missed?

if steam_extension_enabled then
	steamworks.init()
	print("Steamworks: Requesting current stats. Completed?", steamworks.user_stats_request_current_stats())

	steamworks.set_listener(function(self, e, t)
		print(e)
		pprint(t)
	end)
end

Which version are you using? The new one which I released a few days ago or the old one? @Pkeod is this working for you?

I just tested https://github.com/britzl/steamworks-defold/releases/tag/2.0.0 and steamworks.set_listener does work for me, I went through the example UIs and everything seemed to work. I tried launching from the editor and from a bundled version.

I am testing on Windows 10 that may matter.

Tested opening / closing overlay on friends tab and this works too

DEBUG:SCRIPT: GameOverlayActivated_t
DEBUG:SCRIPT: 
{ --[[000001869C8B7D40]]
  m_bActive = 1
}
INFO:STEAMWORKS: SteamCallbackWrapper::OnGameOverlayActivated_t

DEBUG:SCRIPT: GameOverlayActivated_t
DEBUG:SCRIPT: 
{ --[[000001869C8F6CB0]]
  m_bActive = 0
}
1 Like

@Alex_8BitSkull and @Pkeod can you please compare your setup to try and figure out what’s wrong?

@Ivan_Lytkin you’re using the Steamworks extension as well right? Is everything working for you as well?

1 Like

Win 7 and Steamworks 1.4.1. I will try 2.0.0 first and if no luck I will test on my Win 10 machine.

Edit: I have downloaded the example (2.0.0) and I get the callback there, so it is not an issue with the OS version. Something is wrong with my implementation because updating to 2.0.0 in my project still does not work.

Edit2: Yeah I’m a bit stuck. I’m definitely connected to Steam because I am able to call my verify_achievements() function right before the listener is set up, and my achievements are printed out as expected.

if steam_extension_enabled then
	steamworks.init()
	print("Steamworks: Requesting current stats. Completed?", steamworks.user_stats_request_current_stats())

	verify_achievements()

	steamworks.set_listener(function(self, e, t)
		print(e)
		pprint(t)
	end)
end

Edit3: Just confirming that my Win 10 machine behaves in exactly the same way as Edit2.

1 Like

i use this as dependence:
https://github.com/britzl/steamworks-defold/archive/master.zip

yes, all is working
steam.script (2.2 KB)

2 Likes

So the example project for sure works, both versions of the extension work, and it works on Win7 and Win10, but not in your project still?

Is the set_listener in your main bootstrap script that’s never unloaded?

I am not sure what would be wrong if you are getting achievements as expected.

Either try to copy your project and strip it down so it still breaks but is shareable, or share your project with @britzl to take a look?

1 Like

What if you don’t call this? And don’t call any other Steam API functions? Or try the same steam.script as Ivan shared?

@Pkeod
Yep I think you’ve got a good summary of what I’m experiencing. Not 100% sure what you mean by “Is the set_listener in your main bootstrap script that’s never unloaded?” but I have tried a few variations (e.g. setting up the listener on a timer to allow the init() function to complete and by creating a dedicated callback handling function like in Ivan’s script).

@britzl
I actually didn’t call that function before, but added it in there just to verify that the Steam connection was working. I will try it without any other Steam API functions and use the script Ivan shared as well.

1 Like

Got it. Calling user_stats_request_current_stats() before set_listener() prevented the latter from working. I feel like I could have experimented my way into uncovering that, but it’s such a pain to bundle the project every two minutes :sweat_smile:

Thanks for your help everyone.

1 Like

Hmm, this almost sounds like a bug to me.

1 Like

I would like to add, that if listener is not working even when user_stats_request_current_stats() is called after setting this listener (like in my case) you should add in update() method this call steamworks.update(). @britzl I think that this should be also mentioned in documentation in usage section.

And i have question regarding user_stats_get_stat_int. In documentation and in SteamAPI this method is suppose to be called with two parameters pchName and pData, where pData will have the value of requested stat. But whenever i call this method, pData doesn’t not return any value. And to return any value from the stat i call this:

local status, stat = steamworks.user_stats_get_stat_int(pchName,pData)

Is this a bug or design decision?

Oh, I see. The .scipt_api is wrong. Like you concluded the function returns two values: success and the requested user stat

Hmm, I’m honestly not sure why I designed it this way. It would make more sense I think to let the extension automatically call the update function.

I’ve updated the generated docs to reflect actual parameters and return values.

1 Like

Thanks. I was stuck there for a while)

1 Like

There are two messages I’m not receiving in the steamworks listener:
GetAuthSessionTicketResponse_t
GamepadTextInputDismissed_t

Both have issue reports on GitHub: