-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SetStat always fails #38
Comments
Hey there. Hmm, I wonder if the stats issue has to do with the restructuring of the module. I assume you have "wins" set up in your Steamworks back-end. You should be able to run SetStats outside of the Steam client still. Is it possible to try a simple test like you have using the legacy branch? I can attempt a test of the newer module system this week. As for the callbacks issue, it seems a little odd it would raise the exception yet still try to run callbacks. Also I don't see the actual RunCallbacks function anywhere... so that needs fixed. Thanks for bringing this all up and let me know if you can do the legacy branch test; and if so what happens! |
Hmm so with the legacy branch I get an error on calling Steam.initialize():
…On Mon, Apr 20, 2020 at 12:37 PM GP Garcia ***@***.***> wrote:
Hey there. Hmm, I wonder if the stats issue has to do with the
restructuring of the module. I assume you have "wins" set up in your
Steamworks back-end. You should be able to run SetStats outside of the
Steam client still.
Is it possible to try a simple test like you have using the legacy branch?
I can attempt a test of the newer module system this week.
As for the callbacks issue, it seems a little odd it would raise the
exception yet still try to run callbacks. Also I don't see the actual
RunCallbacks function anywhere... so that needs fixed.
Thanks for bringing this all up and let me know if you can do the legacy
branch test; and if so what happens!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#38 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANRKFCRZTJVNIJPVEGFMYDRNR24NANCNFSM4MMLMZSQ>
.
|
Ah dammit I hit the wrong set of keys ignore this until I finish this very
long email
On Thu, Apr 23, 2020 at 8:28 AM Dylan White <[email protected]>
wrote:
… Hmm so with the legacy branch I get an error on calling Steam.initialize():
On Mon, Apr 20, 2020 at 12:37 PM GP Garcia ***@***.***>
wrote:
> Hey there. Hmm, I wonder if the stats issue has to do with the
> restructuring of the module. I assume you have "wins" set up in your
> Steamworks back-end. You should be able to run SetStats outside of the
> Steam client still.
>
> Is it possible to try a simple test like you have using the legacy
> branch? I can attempt a test of the newer module system this week.
>
> As for the callbacks issue, it seems a little odd it would raise the
> exception yet still try to run callbacks. Also I don't see the actual
> RunCallbacks function anywhere... so that needs fixed.
>
> Thanks for bringing this all up and let me know if you can do the legacy
> branch test; and if so what happens!
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#38 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AANRKFCRZTJVNIJPVEGFMYDRNR24NANCNFSM4MMLMZSQ>
> .
>
|
With the legacy branch I get:
OSError Traceback (most recent call last)
<ipython-input-4-3141e54c5501> in <module>
----> 1 steamworks.Steam.Init()
C:\PythonRL\steamworks.py in Init()
93 print("ERROR: Steam is not running")
94 # Boot up the Steam API
---> 95 InitializeResult = Steam.cdll.SteamInit()
96 if InitializeResult == 1:
97 print("INFO: Steamworks initialized!")
OSError: exception: access violation reading 0x0000000000000000
But before I go down that rabbit hole, going back to the non legacy version-
Other calls seem to work. I can check my user id, app id, and steam player
level for instance.
Looking at the documentation for stats I found this:
*You must always call this first to get the initial status of stats and
achievements.Only after the resulting callback comes back can you start
calling the rest of the stats and achievement functions for the current
user. *
Does this mean my inability to call run_callbacks is what prevents me from
getting and setting stats?
Better yet- is there working example code somewhere of stats and
achievements? I suspect I've gotten something wrong, though I'm not sure
what.
…-Dylan
On Thu, Apr 23, 2020 at 8:29 AM Dylan White <[email protected]>
wrote:
Ah dammit I hit the wrong set of keys ignore this until I finish this very
long email
On Thu, Apr 23, 2020 at 8:28 AM Dylan White ***@***.***>
wrote:
> Hmm so with the legacy branch I get an error on calling
> Steam.initialize():
>
>
> On Mon, Apr 20, 2020 at 12:37 PM GP Garcia ***@***.***>
> wrote:
>
>> Hey there. Hmm, I wonder if the stats issue has to do with the
>> restructuring of the module. I assume you have "wins" set up in your
>> Steamworks back-end. You should be able to run SetStats outside of the
>> Steam client still.
>>
>> Is it possible to try a simple test like you have using the legacy
>> branch? I can attempt a test of the newer module system this week.
>>
>> As for the callbacks issue, it seems a little odd it would raise the
>> exception yet still try to run callbacks. Also I don't see the actual
>> RunCallbacks function anywhere... so that needs fixed.
>>
>> Thanks for bringing this all up and let me know if you can do the legacy
>> branch test; and if so what happens!
>>
>> —
>> You are receiving this because you authored the thread.
>> Reply to this email directly, view it on GitHub
>> <#38 (comment)>,
>> or unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/AANRKFCRZTJVNIJPVEGFMYDRNR24NANCNFSM4MMLMZSQ>
>> .
>>
>
|
As for legacy, it would require the older version of SteamworksPy.dll, I think. Which may or may not be the cause of that issue. As far as examples, I pulled up my seven year old Python game to check and here are some relevant code chunks:
My first Python game project did not use callbacks and I was able to use stats and achievements fine. Making the call to RequestCurrentStats doesn't really need a callback; the callback just let's you know the call was successful or not, though it is generally a good idea to wait for a response before doing anything after that. Here is setting stats and achievements, StoreStats is required for Steam to recognize either has happened:
Here is getting stats and achievements:
Hopefully that helps. Right now I am going through and updating SteamworksPy to 2.1, which is a rather large update including a lot of new stuff. Callbacks is one of them. As I don't make games in Python anymore, testing might be a bit tricky, though I wager I can still use my exist Steam games with Python in test. |
Ooooo ok heres whats going on. I turned on the ipc logging in the steam
call and saw that the output was this:
00004226 python.exe:327684 > IClientUserStats::SetStat( 0, "w", 1, ) = 0,
Which was weird, because I was calling SetStat("wins", 1), not SetStat("w",
1)
So I changed the steamworks backend to have a stat called "w" instead of
wins and tried setting "w" to 1 instead.
That worked!
So I think the string being passed into SetStat is being truncated to 1
character somehow.
…-Dylan
On Thu, Apr 23, 2020 at 4:20 PM GP Garcia ***@***.***> wrote:
As for legacy, it would require the older version of SteamworksPy.dll, I
think. Which may or may not be the cause of that issue.
As far as examples, I pulled up my seven year old Python game to check and
here are some relevant code chunks:
# Boot up Steam stuff
Steam.Init()
STEAM_NAME = SteamFriends.GetPlayerName()
STEAM_FRIENDS = SteamFriends.GetFriendCount()
SteamUserStats.RequestCurrentStats()
My first Python game project did not use callbacks and I was able to use
stats and achievements fine. Making the call to *RequestCurrentStats*
doesn't really need a callback; the callback just let's you know the call
was successful or not, though it is generally a good idea to wait for a
response before doing anything after that.
Here is setting stats and achievements, StoreStats is required for Steam
to recognize either has happened:
SteamUserStats.SetStat('saboteurs', pc.BEEN_SABOTEUR)
SteamUserStats.SetAchievement(boot.ACHIEVE_NAME)
# Save statistics to Steam
SteamUserStats.StoreStats()
Here is getting stats and achievements:
pc.ASPIRIN_TOTAL = SteamUserStats.GetStatInt('immune_pills_all')
if SteamUserStats.GetAchievement('ACHIEVEMENT_1'):
pc.ACHIEVEMENTS[1] = 'y'
Hopefully that helps.
Right now I am going through and updating SteamworksPy to 2.1, which is a
rather large update including a lot of new stuff. Callbacks is one of them.
As I don't make games in Python anymore, testing might be a bit tricky,
though I wager I can still use my exist Steam games with Python in test.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#38 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANRKFBWF4KOU4ZGOU3C4XTROCPJTANCNFSM4MMLMZSQ>
.
|
Hmm, that is definitely a truncation issue. I know in C++ that'll happen if you use the wrong quotes; ' instead of " will not allow multiple characters. Since we have a direct cause, that'll make it easy to solve and I'll make sure it is in the update I'm working on. Thanks for the info! |
I figured out what was going on- The following works fine: ` sw = STEAMWORKS() sw.initialize() sw.RequestCurrentStats() sw.SetStat('wins'.encode('ascii'), 1) ` |
Huh, somewhat convenient it does that but not with Ctypes! That's really good to know and will help fix a few other things that don't quite work correctly. Good find! |
This also occurs with GetStat - would it be possible to have both GetStat functions and the SetStat function always encode the name variable as ascii?
|
Definitely. If one is changed then it's partner should be changed too. |
SetStatInt fails every time, returning false and printing no other info. Is there any way to debug whats going on?
My code is:
I've also tried calling
which produces the following error each time:
I feel like I must be doing something fundamentally incorrect here, but I have no idea what it might be.
The text was updated successfully, but these errors were encountered: