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
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.
@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.
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
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)