Sign in to follow this  
Followers 0
jvanegmond

Steam Community ID to Steam ID and Steam ID to Steam Community ID

12 posts in this topic

#1 ·  Posted (edited)

Steam Community ID to Steam ID

Steam ID to Steam Community ID

This turns any Steam ID into a Steam Community ID using a simple algorithm.

This turns any Steam Community ID into a Steam ID using a simple algorithm.

Example is included in the script.

Dim Const $COMM_ID_START = 76561197960265728

Dim $CommID = "76561197990033787"
Dim $SteamID = "STEAM_0:0:12857027"

Print( _SteamIDToCommunityID($SteamID) )
Print( _CommunityIDToSteamID($CommID) )
Print( _CommunityProfileFromCommunityID($CommID) )
Print( _CommunityProfileFromSteamID($SteamID) )

; Func _SteamIDToCommunityID($sSteamID)
; Succes returns community id
; Fail returns ""
Func _SteamIDToCommunityID($sSteamID)
    Local $sResult, $expl, $serverid, $accountid
    
    $expl = StringSplit($sSteamID,":")
    
    if ( UBound($expl) == 4 ) Then
        $serverid = Number($expl[2])
        $accountid = Number($expl[3])
    
        $sResult = ( $accountid * 2 ) + $COMM_ID_START + $serverid
    EndIf
    
    Return $sResult
EndFunc

; Func _CommunityIDToSteamID($sComID)
; Returns steam id in this format: STEAM_x:y:z
; Fail returns wrong results, so make sure parameter is correct
Func _CommunityIDToSteamID($sComID)
    $sComID = Number($sComID)
    
    $a = ($sComID - $COMM_ID_START) / 2
    $b = Floor($a)
    $c = Round( Mod($a,Floor($a)) )
    
    Return "STEAM_0:" & String( $c ) & ":" & String( $b ) 
EndFunc

; Func _GetCommunityProfileFromCommunityID($sComID)
; Returns community profile URL
; Fail returns wrong results, so make sure parameter is correct
Func _CommunityProfileFromCommunityID($sComID)
    Return "http://steamcommunity.com/profiles/" & String($sComID)
EndFunc

; Func _GetCommunityProfileFromSteamID($sSteamID)
; Returns community profile URL
; Fail returns wrong results, so make sure parameter is correct
Func _CommunityProfileFromSteamID($sSteamID)
    Return "http://steamcommunity.com/profiles/" & _SteamIDToCommunityID($sSteamID)
EndFunc

; Func Print($s)
; Equivalent to ConsoleWriteLine
Func Print($s)
    ConsoleWrite($s & @CRLF)
EndFunc
Edited by Manadar

Share this post


Link to post
Share on other sites



Just 4 note:

76561197960265728 = 2^32 + 2^52 + 2^56

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Not in UDF. But it is a shorter form. You need the Math UDF from the forum here.

;STEAM_0:0:1683585
;76561197960265728
;~ Friend ID's with even numbers are the 1 auth server.
;~ Friend ID's with odd numbers are the 0 auth server. 
#include <Math.au3>
$Id = 22741331
If _IsEven($Id) Then
    $auth = 1
Else
    $auth = 0
EndIf
;~ $auth = 0
InputBox("", "", "http://steamcommunity.com/profiles/" & $Id*2+76561197960265728+$auth, "", 500, 120)

Only 1 way, but you can just reverse it for the other way.

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

Hm, this won't work everytime, because ther're steam IDs looking like this too:

STEAM_1:1:1234567

STEAM_0:1:1234567

And you can't calculate the first two numbers.

Share this post


Link to post
Share on other sites

Hm, this won't work everytime, because ther're steam IDs looking like this too:

STEAM_1:1:1234567

STEAM_0:1:1234567

And you can't calculate the first two numbers.

I can calculate the second number. Updated UDF.

STEAM_X:0:1234567 or STEAM_X:1:1234567 now work. The first number can not be calculated from the community id.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hm, this won't work everytime, because ther're steam IDs looking like this too:

STEAM_1:1:1234567

STEAM_0:1:1234567

And you can't calculate the first two numbers.

A steamid works like this...

STEAM_X:Y:Z

  • X represents the "Universe" the steam account belongs to (which is identified by an unsigned 8-bit value)
  • Y represents the type of account and is represented as an unsigned 4-bit value
  • Z is the ID number for the account (the "account number") identified by a 32-bit unsigned value. Z is not unique.
The remaining 20 bits are used to represent the 'instance' of this account and only applies for a special type of account called a 'Multiseat' account (an account for which many users can log into at the same time, for instance at cybercafes).

Universes Available for Steam Accounts

There are 8 universes of Steam accounts.

Number Type

0 Individual / Unspecified

1 Public

2 Beta

3 Internal

4 Dev

5 RC

Types of Steam Accounts

There are ten known account types for a Steam account, of which only 4 can be created today.

Number Type Can Be Used?

0 Invalid / Unspecified Yes

1 Individual Yes

2 Multiseat Yes

3 GameServer Yes

4 AnonGameServer Yes

5 Pending No

6 ContentServer Unknown

7 Clan Unknown

8 Chat Unknown

9 P2P SuperSeeder No

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

anyone ever looked at the steam api??

I found this but its abit above me...

this is copied from the web site coz you need to log in

http://supex0.co.uk/steam/

Share this post


Link to post
Share on other sites

well , I would'nt mind being able to login and fetch user info like vac status etc , account type etc

heres a steam.dll function list

http://209.85.229.132/search?q=cache:nGCQTkBUNSYJ:https://www.freesteam.org/forums/programming-chat-support/2341-all-functions-steam-dll.html+steam.dll+functions&cd=1&hl=en&ct=clnk&gl=uk

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0