philippj/SteamworksPy

Get/Set Stat/Achievement always return True without doing anything?

niemasd opened this issue · 5 comments

I built a game in Python that I'm trying to publish on Steam, and I have things working fine with regard to just running as well as using Steam cloud saves, but I'm trying to use SteamworksPy to get Achievements working. However, I'm running into the following issue:

  • Any time I use GetStatInt to get any stat (even ones that don't exist), it always returns 0
  • Any time I use SetStat, it returns True, but when I subsequently use GetStatInt, the value is unchanged (still 0)
  • Any time I use GetAchievement to get any achievement (even ones that don't exist), it always returns True
  • Any time I use SetAchievement, it always returns True

Here's a minimum working example of the relevant SteamworksPy code:

if version_info >= (3, 8):
    add_dll_directory(getcwd())
from steamworks import STEAMWORKS
steamworks = STEAMWORKS()
steamworks.initialize()
steamworks.RequestCurrentStats()
print(steamworks.Users.GetSteamID())
print("GetStatInt: " + str(steamworks.UserStats.GetStatInt("FINISHED_CHAP_01")))
print("SetStat:    " + str(steamworks.UserStats.SetStat("FINISHED_CHAP_01",1)))
print("StoreStats: " + str(steamworks.UserStats.StoreStats()))
print("GetStatInt: " + str(steamworks.UserStats.GetStatInt("FINISHED_CHAP_01")))
exit()

This prints the following (I've replaced the AppID and SteamID with <my correct AppID> and <my correct SteamID> for privacy):

Setting breakpad minidump AppID = <my correct AppID>
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  <my correct SteamID> [API loaded no]
<my correct SteamID>
GetStatInt: 0
SetStat:    True
StoreStats: True
GetStatInt: 0

I'm using Python 3.8.7 and the Steamworks SDK 1.5.1. I'm also using the precompiled 32-bit SteamworksPy.dll ("Master Pre-Compiles - Version 1.6.2"). Help would be greatly appreciated 😄

Hey,

the precompiles currently available under "Releases" are quite out of date. So I can not tell whether they are still functional at all. Please try if the issue persists with the newer release from https://github.com/philippj/SteamworksPy/tree/master/redist/windows.

Ah, thanks for the quick response! I ideally want it to be 32-bit, so I'll try recompiling from scratch. I'll add a comment with the results

I just tried compiling from SteamworksPy.dll from scratch from the command line using the Visual Studio tools (using Steamworks SDK 1.5.1), and I encounter the same behavior

I think you need to call

steamworks.run_callbacks()

after RequestCurrentStats() and before GetStatInt - this works for me

try (b'FINISHED_CHAP_01')