steam_ugc_send_query

Syntax:

steam_ugc_send_query(ugc_query_handle);


Argument Description
ugc_query_handle The query handle to send.


Returns: Boolean


Description

This function can be used to send a query request. You first define the query using the appropriate steam_ugc_create_query_*() functions which will return a "query Handle". This handle is then used to set filters etc.... before being used in this funtion to send off the query request. The function returns a unique async ID value which can be used to check the details correctly in the Steam Async event. This event will have the async_load DS map which will be populated with the following key/value pairs:

  1. "id" - The async ID returned by the function that triggered the event

  2. "result" - The result of the operation (a real value). This will either be the GML constant ugc_result_success or some other real number. So you should check for this constant to ensure that the call was successful, and if otherwise somthing has not worked correctly. The rest of the possible values returned are shown as the result of the Steam "EResult" value and you should see steamclientpublic.h in the SDK headers for all 89 possible values.

  3. "event_type" - The string "ugc_query"

  4. "num_results" - The number of results returned (max 50 )

  5. "total_matching" - The total number of matching results

  6. "cached_data" - Indicates whether this data was retrieved from the local on-disk cache or not (will be either true or false)

  7. "results_list" - A DS list index index, where each list entry is a DS Map index containing details of the particular item

When you get the async event type "ugc_query", you can then parse the results list and extract the following information from each of the DS maps (one map per item in the list):

  1. "published_file_id"" -Holds the unique published file id for the item

  2. "file_type" - The type of file used

  3. "creator_app_id" - The Steam ID of the item creator

  4. "consumer_app_id" - The Steam ID of the item consumer

  5. "title" - The title of the item

  6. "description" - The description of the item

  7. "steam_id_owner" - The Steam ID of the item owner

  8. "time_created" - The time the item was first created

  9. "time_updated" - The last time the item was updated

  10. "time_added_to_user_list" - The time that the item was subscribed to

  11. "visibility" - The visibility of the item (see steam_ugc_set_item_visibility() for the returned constants)

  12. "banned" - Whether the item has been banned (true) or not (false)

  13. "accepted_for_use" - Whether the item has been accepted for use (true) or not (false)

  14. "tags_truncated" - Short version of the tags as an array

  15. "tags" - A string containing the tags for the item, each one separated by a comma

  16. "handle_file" - The unique file handle for the item

  17. "handle_preview_file" - The unique handle for the image preview for the item (can be used as an argument with steam_ugc_download() to download a preview image)

  18. "filename" - The name of the item file

  19. "file_size" - The size of the item file

  20. "preview_file_size" - The size of the preview image

  21. "url" - The full URL for the item

  22. "votes_up" - The number of up-votes received

  23. "votes_down" - The number of down-votes received

  24. "score" - The overall score of the item

  25. "account_id_owner" - The account ID from the Steam ID owner (this can be used in the function steam_ugc_create_query_user_ex())


Example:

var query_handle = steam_ugc_create_query_all(ugc_query_RankedByTrend, ugc_match_Items, 1);
steam_ugc_query_add_required_tag(query_handle, "RPG");
steam_ugc_query_set_return_long_description(query_handle, true);
steam_ugc_query_set_allow_cached_response(query_handle, true);
query_ID = steam_ugc_send_query(query_handle);

The above code creates a query request and stores it's handle in a local variable for future use in the rest of the functions which further define the query request before sending the query.