Comments (11)
Brilliant. Thank you. I'll have a play around with these.
from godotsteam.
Hi. Hopefully a quickie, but if I were to do the following;
Steam.requestUserInformation(steam_id, true)
What is the signal that I need to setup a listener for? And what parameters does this take. Sorry if it's mentioned already on your docs but I couldn't see it.
Strangely, I tried getFriendPersonaName
but it returns a different username. I might need to debug this a little more, but I thought I'd try the other function too.
from godotsteam.
Ah, ok maybe the quicker one is best. I'm not sure why I'm passing the wrong steam ID but must be an error at my end. I'll look into that. Thanks for your response.
from godotsteam.
Hey there and welcome! Glad to hear everything is working. With their Steam ID you can get some information like username, avatar, etc. I believe the function you want is getFriendPersonaName()
.
from godotsteam.
Sorry, I just edited my original post. Again, you're too quick to respond :)
That looks useful, but does it only allow me to only obtain friend profiles? Contributors might not be friends.
The alternative is I just use the Steam ID e.g. "Content created by Steve Wright, 41234567898765, 469876434567and 45678098765234"
from godotsteam.
Haha, all good. I just woke up exceptional early today!
Through code, you'd use that function. Despite the name, you can get any username from any Steam user even if they are not friends. You may have to also use requestUserInformation()
to pull data that your account doesn't have cached locally.
from godotsteam.
The function requestUserInformation()
should trigger persona_state_change to let you know new data is available. Usually the username and avatar. That should be updated in our docs to reflect what it triggers actually.
What did getFriendPersonaName()
return? It will only give you usernames of users you "know about". Typically people you have played with, friends, etc. Otherwise you must request the information with getFriendPersonaName()
which will then send you the current name. If you don't need the avatars, pass false to getFriendPersonaName()
.
from godotsteam.
Thanks for that, the callbacks are triggered now. But I'm not seeing the usernames, still steam IDs. I'm doing the following:
func _ready():
Steam.connect("persona_state_change", self, "_on_Steam_persona_state_change", [], CONNECT_PERSIST)
func someFunc():
# ...
for author_id in _author_ids:
print("requestUserInformation: ", author_id)
Steam.requestUserInformation(author_id, true)
func _on_Steam_persona_state_change(username, avatar):
print("=== _on_Steam_persona_state_change")
print(".. username: ", username)
print(".. avatar: ", avatar)
Here's what I'm seeing in the output:
_author_ids: [76561199098248638, 76561199635806896]
requestUserInformation: 76561199098248638
requestUserInformation: 76561199635806896
=== _on_Steam_persona_state_change
.. username: 76561198165753551
.. avatar: 2
=== _on_Steam_persona_state_change
.. username: 76561198165753551
.. avatar: 2
I don't seem to see my actual usernames. And they don't match those sent. Plus it takes a LONG time to return > 10 seconds, and one occasion it only returned one of the requests.
When I tried getFriendPersonaName
with IDs, it comes back correct with one of them (me) but not with another:
Steam.getFriendPersonaName(76561199635806896) # returns: Martyn Bissett (correct)
Steam.getFriendPersonaName(76561199098248638) # returns: lou.gonzales11 (?? incorrect)
Anyway, not a show stopper but maybe you'll spot something at a glance.
from godotsteam.
Hmm. Valve does warn that asking for avatars too will take much longer. I guess pulling all that graphics / buffer data.
Ah, yes, my bad... persona_state_change
just tells you that new data for that Steam ID is now available locally. It passes back the Steam ID of the data changed and the flag for what did change.
After you get that callback, you can then re-run getFriendPersonaName or an avatar call which should give you the updated (local) data.
from godotsteam.
That second chunk of code you showed, those names are correct but backwards:
- 76561199635806896 is lou.gonzales11
- 76561199098248638 is Martyn Bissett
According to Steam ID lookups.
from godotsteam.
Yeah, if you don't need the avatars, no reason to request them.
from godotsteam.
Related Issues (20)
- Mono build does not have numeric values for enums HOT 5
- Mono: inconsistent usage of uint64 and int64 HOT 3
- Bitfield REMOTE_STORAGE_PLATFORM_ALL changes value per platform HOT 24
- Steam.InputGlyphStyle warnings when combining flags HOT 1
- How to use this GDExtension with platforms that are not supported HOT 15
- No console output when crashing because Steam is not running HOT 3
- getAllLobbyData overwrites data Dictionary HOT 6
- [multiplayer-peer] SteamMultiplayerPeer.close() doesn't properly close the peer HOT 4
- Steam Deck with own appid HOT 11
- 4.6.3 Not Working HOT 4
- All macOS builds after "macos-g421-s159-gs46" are listed as "damaged or incomplete" in macOS HOT 16
- PackedScene nodes at "res://" locations are not accessible by scripts in exported packages HOT 4
- item_created signal is not called HOT 5
- [SMP] Add network_session_failed signal HOT 2
- Game crashes when calling peer.disconnect_peer HOT 5
- Godot no longer detecing gamepad input after initialize steam HOT 2
- Double precision compiled Engine crashes when opening project HOT 6
- NetworkMessagesSessionRequest event expects a long argument instead of a ulong HOT 5
- Unable to join another lobby with SteamMultiplayerPeer after calling close(). HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godotsteam.