# Tutorials

**URL:** https://heroiclabs.com/docs/hiro/cpp/tutorials/
**Keywords:** tutorials, hiro
**Categories:** hiro, cpp, tutorials

---


# Tutorials

Read more about the Tutorials system in Hiro [here](../../concepts/tutorials/).

## Get all tutorials

Get the tutorials and current progress step for the player.

```cpp
void onTutorialsGet(const Hiro::TutorialList& tutorialList)
{
    for (auto it = tutorialList.tutorials.begin(); it != tutorialList.tutorials.end(); it++)
    {
        std::cout << "Found tutorial: " << it->second.id << ". Progress: " << it->second.current << '/' << it->second.max << '\n';
    }
}

void onError(const Nakama::NError& error)
{
    std::cout << Nakama::toString(error.code) << ": " << error.message << '\n';
}

hiroClient->tutorialsGet(session, onTutorialsGet, onError);
```

## Accept a tutorial

Accept an offer to step through a tutorial.

```cpp
void onTutorialsAccept(const Hiro::Tutorial& tutorial)
{
    std::cout << "Successfully accepted tutorial: " << tutorial.id << '\n';
}

void onError(const Nakama::NError& error)
{
    std::cout << Nakama::toString(error.code) << ": " << error.message << '\n';
}

Hiro::TutorialAcceptRequest request;
request.id = "tutorial_1";

hiroClient->tutorialsAccept(session, request, onTutorialsAccept, onError);
```

## Decline a tutorial

Decline an offer to start a tutorial.

```cpp
void onTutorialsDecline(const Hiro::Tutorial& tutorial)
{
    std::cout << "Successfully declined tutorial: " << tutorial.id << '\n';
}

void onError(const Nakama::NError& error)
{
    std::cout << Nakama::toString(error.code) << ": " << error.message << '\n';
}

Hiro::TutorialDeclineRequest request;
request.id = "tutorial_1";

hiroClient->tutorialsDecline(session, request, onTutorialsDecline, onError);
```

## Abandon a tutorial

Abandon progress on a tutorial.

```cpp
void onTutorialsAbandon(const Hiro::Tutorial& tutorial)
{
    std::cout << "Successfully abandoned tutorial: " << tutorial.id << '\n';
}

void onError(const Nakama::NError& error)
{
    std::cout << Nakama::toString(error.code) << ": " << error.message << '\n';
}

Hiro::TutorialAbandonRequest request;
request.id = "tutorial_1";

hiroClient->tutorialsAbandon(session, request, onTutorialsAbandon, onError);
```

## Update progress of a tutorial

Update the current progress step in the tutorial by ID.

```cpp
void onTutorialsUpdate(const Hiro::TutorialList& tutorialList)
{
    for (auto it = tutorialList.tutorials.begin(); it != tutorialList.tutorials.end(); it++)
    {
        std::cout << "Found tutorial: " << it->second.id << ". Progress: " << it->second.current << '/' << it->second.max << '\n';
    }
}

void onError(const Nakama::NError& error)
{
    std::cout << Nakama::toString(error.code) << ": " << error.message << '\n';
}

Hiro::TutorialUpdateRequest request;
request.id = "tutorial_1";
request.step = 1;

hiroClient->tutorialsUpdate(session, request, onTutorialsUpdate, onError);
```