Giter VIP home page Giter VIP logo

Comments (11)

martynbiz avatar martynbiz commented on June 12, 2024 1

Brilliant. Thank you. I'll have a play around with these.

from godotsteam.

martynbiz avatar martynbiz commented on June 12, 2024 1

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.

martynbiz avatar martynbiz commented on June 12, 2024 1

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.

Gramps avatar Gramps commented on June 12, 2024

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.

martynbiz avatar martynbiz commented on June 12, 2024

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.

Gramps avatar Gramps commented on June 12, 2024

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.

Gramps avatar Gramps commented on June 12, 2024

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.

martynbiz avatar martynbiz commented on June 12, 2024

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.

Gramps avatar Gramps commented on June 12, 2024

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.

Gramps avatar Gramps commented on June 12, 2024

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.

Gramps avatar Gramps commented on June 12, 2024

Yeah, if you don't need the avatars, no reason to request them.

from godotsteam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.