it converts steam ids
made it for myself but i may as well post it here
usage:
- idconv(<input steam id to convert from>, <steamid format you want it converted to>)
- idconv("STEAM_0:0:102877480", "steam3ID") --> "[U:1:205754960]"
- idconv("76561198166020688", "accountID") --> "205754960"
- etc
- default output format is steamid64, so idconv("205754960") --> "76561198166020688"
- it's not case-sensitive btw
bug:
- wontfix: idconv(1, "steamid32") returns STEAM_0:1:-1 which isn't a valid id (who would need to convert that anyway)
- doesn't work on ahk v2 but nobody uses that anyway
not a bug:
- it doesn't do error checking of any kind,format and trim the inputted string urself
get it here:
Code: Select all
/* accepted formats are:
| accountID: 205754960
| steam3ID: [U:1:205754960]
| steamID32: STEAM_0:0:102877480
| steamID64: 76561198166020688
*/
idconv(id, to:="steamID64") {
(from:=(instr(id,"a")?"steamID32":instr(id,"[")?"steam3ID":strlen(id)=17?"steamID64":"accountID"))
return (from="accountID"?(to="accountID"?id:to="steam3ID"?"[U:1:" id "]":to="steamID32"?"STEAM_0:"(((id&1)!=0)?1:0)":"round((id)/2-(((id&1)!=0)?1:0)):to="steamID64"?id+76561197960265728:"error"):from="steam3ID"?(to="accountID"?substr(id,6,strlen(id)-6):to="steam3ID"?id:to="steamID32"?"STEAM_0:"(((substr(id,6,strlen(id)-6)&1)!=0)?1:0)":"round(substr(id,6,strlen(id)-6)/2-(((substr(id,6,strlen(id)-6)&1)!=0)?1:0)):to="steamID64"?substr(id,6,strlen(id)-6)+76561197960265728:"error"):from="steamID32"?(to="accountID"?substr(id,11,strlen(id)-10)*2+substr(id,9,1):to="steam3ID"?"[U:1:"substr(id,11,strlen(id)-10)*2+substr(id,9,1)"]":to="steamID32"?id:to="steamID64"?substr(id,11,strlen(id)-10)*2+76561197960265728+substr(id,9,1):"error"):from="steamID64"?(to="accountID"?id-76561197960265728:to="steam3ID"?"[U:1:"id-76561197960265728 "]":to="steamID32"?"STEAM_0:"(((id&1)!=0)?1:0)":"round((id-76561197960265728)/2-(((id&1)!=0)?1:0)):to="steamID64"?id:"error"):"error")
}
works on AHK_L unicode 64-bit 1.1.16.5, not sure about other versions because i don't use them 8)
yeah