jvanegmond Posted March 30, 2009 Posted March 30, 2009 (edited) Steam Community ID to Steam IDSteam ID to Steam Community IDThis 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.expandcollapse popupDim 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 April 1, 2009 by Manadar github.com/jvanegmond
ZokNy Posted March 30, 2009 Posted March 30, 2009 Just 4 note: 76561197960265728 = 2^32 + 2^52 + 2^56
Skrip Posted March 31, 2009 Posted March 31, 2009 (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 March 31, 2009 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]
jvanegmond Posted March 31, 2009 Author Posted March 31, 2009 Thanks ZokNy, that explains it. github.com/jvanegmond
Sn0opy Posted April 1, 2009 Posted April 1, 2009 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.
jvanegmond Posted April 1, 2009 Author Posted April 1, 2009 Hm, this won't work everytime, because ther're steam IDs looking like this too:STEAM_1:1:1234567STEAM_0:1:1234567And 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. github.com/jvanegmond
Skrip Posted April 2, 2009 Posted April 2, 2009 (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 valueZ 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 April 2, 2009 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]
jvanegmond Posted April 2, 2009 Author Posted April 2, 2009 The conversion is a bit obscure but better than nothing. Valve hasn't sorted this out very well themselves either. github.com/jvanegmond
jvanegmond Posted April 21, 2009 Author Posted April 21, 2009 http://developer.valvesoftware.com/wiki/St...am_Community_IDSays both way does work as I implemented it. github.com/jvanegmond
bluerein Posted July 20, 2009 Posted July 20, 2009 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/
jvanegmond Posted July 20, 2009 Author Posted July 20, 2009 What about it? It doesn't look very interesting. Depends on what you want to do with it, really.. github.com/jvanegmond
bluerein Posted July 21, 2009 Posted July 21, 2009 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now