steam_ugc_download


Description

With this function you can download a preview image for any given UGC item. The ugc_handle is the unique identifying value for the image (which you can get using the function steam_ugc_send_query()), and the destination filename is the name (and local path within the Steam sandbox) that you wish to give the image file when the download is complete.

When using this function it will trigger an Steam Asynchronous event to report the details of the image file requested containing the following key/value pairs in the async_load ds_map:


Syntax:

steam_ugc_download(ugc_handle, dest_filename);

Argument Description
ugc_handle The unique handle for the preview to be downloaded.
dest_filename The file name to save the preview with.


Returns:

Async ID


Extended Example:

In this example we first call the function and store the async ID value in a variable:

steam_get = steam_ugc_download(steam_handle, "\UGC\Preview_file.png");

This would then send off a file request to the Steam API, generating an async event which we would deal with as follows:

var event_id = async_load[? "id"];
if event_id == steam_get
    {
    var type = async_load[? "event_type"];
    if type == "ugc_download"
        {
        sprite_delete(preview_sprite);         preview_sprite = sprite_add(async_load[? "dest_filename"], 0, false, false, 0, 0);
        }
    }

The above code checks the event type and then creates a sprite from the downloaded image.