Functions - Achievements¶
Related Oculus Platform documentation:
Functions¶
achievements_add_count¶
achievements_add_count(achievement_name : String
, count : int
)
Adds count
to the achievement with the given name. The achievement must be of type COUNT.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the achievement's state if fulfilled. The promise will error if the request couldn't be completed.
Example response:
achievements_add_fields¶
achievements_add_fields(achievement_name : String
, fields : String
)
Unlocks fields of an achievement of type BITFIELD. The fields
argument must be a String
containing either "0" or "1" characters. Every "1" will unlock the field in the corresponding position. For example, if the bitfield is 10011
and you call this function with fields = 00110
, the result will be 10111
.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the achievement's state if fulfilled. The promise will error if the request couldn't be completed.
Example response:
achievements_unlock¶
achievements_unlock(achievement_name : String
)
Unlocks the achievement with the given achievement_name
. The achievement can be of any type.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with information about the achievement's state if fulfilled. The promise will error if the request couldn't be completed.
Example response:
Example
achievements_get_all_definitions¶
achievements_get_all_definitions()
Requests all achievement definitions of this app.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with two keys: data
and next_page_url
. Data will contain information about all the achievements if fulfilled. The promise will error if the request couldn't be completed.
Example response:
More info about next_page_url.
Note
type
can be SIMPLE
, COUNT
or BITFIELD
.
Example
achievements_get_all_progress¶
achievements_get_all_progress()
Requests all the progress of the achievements of this app.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with two keys: data
and next_page_url
. The data
key will contain information about the user's progress in all the achievements if fulfilled. The promise will error if the request couldn't be completed.
Example response:
More info about next_page_url.
Note
unlock_time
is a UNIX timestamp (in seconds).
The response only includes achievements where the user is "participating", meaning that if for example you have an achievement of type COUNT
and the user has not made progress towards this achievement yet, it will not be included (instead of just showing 0).
Example
achievements_get_definitions_by_name¶
achievements_get_definitions_by_name(achievement_names : Array
)
Requests achievement definitions by name of this app. The achievement_names
argument must contain String
s only.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with two keys: data
and get_next_url
. The data
key will contain information about the achievements requested if fulfilled. The promise will error if the request couldn't be completed.
Note
Take a look at the example response and the note from the achievements_get_all_definitions function to know more details about the possible response from this function.
Example
achievements_get_progress_by_name¶
achievements_get_progress_by_name(achievement_names : Array
)
Requests progress information of achievements by their name. The achievement_names
argument must contain String
s only.
Returns: A GDOculusPlatformPromise
that will contain a Dictionary
with two keys: data
and next_page_url
. The data
key will contain information about progress of the achievements requested if fulfilled. The promise will error if the request couldn't be completed.
Note
Take a look at the example response and the note from the achievements_get_all_definitions function to know more details about the possible response from this function.