philippj / SteamworksPy

A working Python API system for Valve's Steamworks.
MIT License
212 stars 39 forks source link

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

Open niemasd opened 3 years ago

niemasd commented 3 years ago

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:

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 😄

philippj commented 3 years ago

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.

niemasd commented 3 years ago

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

niemasd commented 3 years ago

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

sudasana commented 3 years ago

I think you need to call

steamworks.run_callbacks()

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

rejedai commented 2 years ago

try (b'FINISHED_CHAP_01')