steam_publish_workshop_file(filename, preview_image, title, description);
Argument | Description |
---|---|
filename | The name of the Steam Cloud synchronised file to upload (a string). |
previewImage | The name of the Steam Cloud synchronised image file to upload (a string). |
title | The title of the file to be shown on the Workshop (a string). |
description | A description of the file to be shown on the Workshop page (a string). Maximum 8000 characters. |
Returns: Real
This function will add the given file to the Steam Workshop section for your game. The file to be shared must have been synchronised to the Steam Cloud previously, using the
steam_file_write function for example, as must the image to be shared, and if you do not wish to supply an image for the file, you can use an empty string "".
Since this function will automatically share the file when it is called, you do not need to share it yourself nor wait for the Cloud synchronisation on game end. The function will return a value of 0
if it fails for whatever reason and a value greater than 0 if it succeeds.
NOTE: Publishing files requires that the title be unique for all users and will return an error if any user has a file that was shared with the same title.
WARNING! This function has since been deprecated in favour of the newer UGC functions, so you should not use this any more and is covered here to support legacy games only.
var file = steam_get_persona_name() + "_CatchTheHaggisLevelMap.txt";
steam_file_write_file(file, "CatchTheHaggisLevelMap.txt");
steam_publish_workshop_file(file, "", "Catch The Haggis level Map", "This map was made by " + steam_get_persona_name() + " for Catch The Haggis by MacSweeney Games");
The above code will copy a file to the steam cloud and then synchronise the file to the Steam Workshop.