HOW TO: Hosting with SteamCMD and Paid Content

Discussion in 'Hosting Help' started by Christopher Elliott, Aug 1, 2017.

  1. Wow.

    Thanks a lot - mainly for doing the manual work I try to avoid ;-)

    I have done an installed (more downloaded) content updater e.g. once, which will look into common\workshop\365960 and get the SteamIDs and check with SteamCMD if there are updates:
    Code:
    #
    # Simple script to update already downloaded content
    #
    # Author: Stone, info AT simracingjustfair.org
    #
    
    #
    # source variables
    if (!(Test-Path "..\VARIABLES_SOURCE_FILE.ps1") -and !(Test-Path ".\VARIABLES_SOURCE_FILE.ps1")) {
      Write-Warning "Cannot source variables - exiting."
      exit 1
    }
    else {
      if(Test-Path "..\VARIABLES_SOURCE_FILE.ps1") { . "..\VARIABLES_SOURCE_FILE.ps1" }
      if(Test-Path ".\VARIABLES_SOURCE_FILE.ps1") { . ".\VARIABLES_SOURCE_FILE.ps1" }
    }
    
    # DEACTIVATED BECAUSE WE CAN REMOVE THE FILE AT THE END AND SO WE CAN USE THE UPDATER FOR ITEMS CHOSEN BY RF2SRV_DOWNLOAD_UI
    # remove already existing command file
    #if("$STEAMINSTALLDIR\workshop_items.cmd") { rm $STEAMINSTALLDIR"\workshop_items.cmd" }
    
    #
    # get SteamID of already downloaded items
    write-host "Reading workshop directory and building command file"
    foreach($ITEM in (gci -Directory $STEAMINSTALLDIR\steamapps\workshop\content\365960\ | select -Expand Name))
    {
     "workshop_download_item 365960 "+$ITEM+" validate" | Out-File -Append $STEAMINSTALLDIR"\workshop_items.cmd" -Encoding ASCII
    }
    
    #
    # download / update items by using command file
    $ARGUMENTS=" +login anonymous +runscript $STEAMINSTALLDIR\workshop_items.cmd +quit"
    start-process "$STEAMINSTALLDIR\steamcmd.exe" -ArgumentList $ARGUMENTS -NoNewWindow -Wait
    
    #
    # remove command file
    if("$STEAMINSTALLDIR\workshop_items.cmd") { rm $STEAMINSTALLDIR"\workshop_items.cmd" }
    What I am currently working on is a UI in Windows Forms (I am not a Powershell expert, I am more a novice) which lets you choose from the installed content in rf2\installed\vehicles and \locations in order to build a .dat file for mod generation.

    I have already finished a script for downloading items which relays on Fidgroves CSV files (I have downloaded and stored them luckily) and which I want to change to an on demand web request for getting all available paid content.

    That's why I am asking for.

    One way, but not really useable is to read my own Steam inventory for such content, but then I need to own all that content - I have not managed to read Steam Shop for such information (is it available there) and it seems SteamAPI does not provide such a function.

    So I ended up with my question ...
     
  2. Got it ...

    Code:
    curl -s https://api.steampowered.com/IInventoryService/GetItemDefMeta/v1/?key=<webapi key from steam dev>&appid=365960
    returns "$digest"

    Code:
    curl -s "https://api.steampowered.com/IGameInventory/GetItemDefArchive/v1/?key=<webapi key from steam dev>&appid=365960&digest=<digest>" | jq '.[] | {name,workshopid}'
    returns name and steamid of object
     
    Felipe Granado likes this.
  3. Felipe Granado

    Felipe Granado Registered

    Joined:
    Aug 29, 2013
    Messages:
    48
    Likes Received:
    8
    WOW! I really was searching this! I need talk to you to help me haha!

    Can you help me with the documentation of the Steam?

    Thanks in advance!
     
    Deleted member 58016 likes this.
  4. First of all - I was searching for months how to query the Steam API to get the information I want from it and I asked a lot of people who helped me a lot, but it turned out that we all were looking for the same information ... and did not know how to ;-)

    As I am familiar with shell scripting on UNiX I tried curl - for PWSH its equivalent is invoke-webrequest or invoke-restapi afaik. Syntax is pretty similar:

    Code:
    $url="https://api.steampowered.com/IGameInventory/GetItemDefArchive/v1/?key=<steam dev key>&appid=365960&digest=<digest>"
    [Array]$test = Invoke-RestMethod $url
    Unfortunately I have to say (and it will answer the 2nd question) I have major problems understanding the documentation of SteamAPI as I am not a programming guy nor I am a developer or C## programmer in general.
     
    Felipe Granado likes this.

Share This Page