Get Started - Learn How To Make Your Bot!

Guides

Code Snippets

Get methods

Post methods

Web API

Useful links

List of all currently Free Items

List of Emotes

Highrise Bot SDK Changelog


📘 Introduction

This is a full guide made by an user on how to start your own Highrise Bot using the Highrise Bot SDK for Python.

Please read these messages!

<aside> 💡 Make sure to check the Pocket Worlds tutorial on this same matter, there are examples on how to setup the bot on MacOS: Introduction

</aside>

<aside> 💡 If you’re not familiar with python or programming in general and wishes to create your own Highrise Bot, I suggest that you first take a few weeks to study programing logics and how Python works. This youtube playlist might help you:

https://youtube.com/playlist?list=PLlrxD0HtieHhS8VzuMCfQD4uJ9yne1mE6&si=B6KA0EKn5IeaIxI5

</aside>

These are all the links for the offical Pocket Worlds guides:

What's a Highrise bot and how do I get one? — Highrise - Your Avatar Community Help Center

Highrise WebAPI • Highrise

highrise-bot-sdk


🔩 Setup

If you are a Replit user feel free to jump to ⚒ Setting up the bot

🔧 Installing Python 3.11

Go to the Python Download’s webpage and select your operating system:

Download Python

In this example I will show how to install it using Windows:

In this example I will show how to install it using Windows:

Untitled

Click on the link and scroll all the way down of the screen, there you will find the files to install python. If you have no experience installing compilers, use the recommended version:

Untitled

Download the .exe file, run it and install it. If you are in doubt about the configurations when intalling it, you can search for videos or tutorials detailing a bit more. If you are using VS Code as coding IDLE also download the Python Extension.

Now you have Python setted up!


👾 Setting up a Virtual Environment (optional)

This is not mandatory but it’s a good practice and helps to avoid a lot of errors since the highrise-bot-sdk is still on beta testing and every week a new version of it is released. It’s not dificult to setup a Vitual Enviroment and this video teaches you how to do it and explains how it works:

https://www.youtube.com/watch?v=KxvKCSwlUv8&ab_channel=teclado

Now that you know how to setup a Virtual Enviroment let’s move on.


⚒ Setting up the bot

🔽 Downloading the Highrise-Bot-SDK

Now we have an essencial part, the software development kit. This is being created and maintened by the Pocket Words staff and developers of Highrise. You can check the project webpage at:

highrise-bot-sdk

To install the SDK all you need to do is to open your terminal (if you’re using a Virtual Environment make sure to activate it first)* and use the followind command:

On Replit you will find your terminal as Sheel*

<aside> <img src="/icons/snippet_gray.svg" alt="/icons/snippet_gray.svg" width="40px" /> pip install highrise-bot-sdk

</aside>

This will install the latestes version of the SDK available on PIP.


🤖 Creating a bot

To setup a Highrise bot you need to create you bot account and grab his token. Go to https://create.highrise.game/dashboard/credentials/api-keys and log in with the user you intend to be owner of your bot. At the bottom of this page you'll find a New Bot button **and from here you're able to create a new bot and retrieve its API access token.


🆔 Retrieving the Room ID

Bots can only be deployed in rooms created by the bot’s owner or rooms where the bot has designer and moderator privileges. To retrieve the ID of the room that you want to deploy your bot in, you can visit the room in the Highrise App, navigate to the room info panel on the top right and select "Share this Room". This will generate a link that contains the ID of the room. You'll be able to use this ID in your API/SDK calls to send the bot to that room.


👩‍💻 Coding

▶ Starting the bot

First of all, let’s create a python file to store our bot code. This will be our bot.py file:

Untitled

Now we need to import the BaseBot class from the SDK module:

from highrise import BaseBot

Create a new class for your bot, inside of it you will be able to declare all the methods you need.

class MyBot(BaseBot):
        pass

Ok, but for the bot to be able to stablish a session in game we will need to declare a on_start method inside our bot class. To do that we will need to import some more attributes from our SDK.

from highrise.models import SessionMetadata

Now we can start a session for our bot, remember that all methods in the bot have to be asyncronous:

async def on_start(self, session_metadata: SessionMetadata) -> None:
        pass

Your code should end up like this:

from highrise import BaseBot
from highrise.models import SessionMetadata

class Mybot(BaseBot):
    async def on_start(self, session_metadata: SessionMetadata) -> None:
        pass

All you need to do now is run the script in your terminal by parsing the name of your bot file the name of your bot class, the room_id that you wish the bot to join and the bot token key. Your script will look with something like this:

<aside> <img src="/icons/snippet_gray.svg" alt="/icons/snippet_gray.svg" width="40px" /> highrise mybot:MyBot 561a511d56sdf1b6f5716 66s65dd1150f51a66a5c15d580e658qa651da066

</aside>

Congratulations! Now your bot is on your room!


🛠 Accessing the SDK methods

If you hold the key ‘ctrl’ and click on the imported module using VS Code or Replit, you will be able to see the file where the module was created. There you have access to all the methods that can be used to create your Highrise bot:

Untitled

Untitled


⚙ Post and Get methods

Inside the Highrise Module you will be able to see all pre-made methods that you can use in your bot. Those can be divided in Post and Get methods.

Get methods

These are the methods are from the BaseBot class and are used to retrieve information from the game, you need to subclass this class and implement the handlers you want to use. Here is a brief explanation of which everyone of these methods do as it’s said in the module:

⬅️Before_start

💬 On_chat

🙀 On_reaction

👣 On_user_move

🎤 On_voice_change

💬 On_message

▶️ On_start

👯 On_emote

😊 On_user_join

🤫 On_whisper

💰 On_tip

🥲 On_user_leave

😡 On_moderate

📃 Get_room_users

🪙 Get_wallet

👘Get_user_outfit

🗨️ Get_conversation

🎙️ Get_voice_status

🕴🏼Get_room_privilege

📕 Get_messages

👖 Get_inventory

👕 Get_my_outfit

Post methods

Those are the pre-made methods used to send informations to the Highrise game using your bot.


🔛 Bot example

Now that we learned how to setup our bot, let’s create an example. We are gonna to make a bot that greets everyone that joins the room.

To do that we need to know who joined the room at the time it happens, for that we can use the on_user_join method from our Get methods, don’t forget to import the User, Position and AnchorPosition classes from highrise.models (you can also use a star import to make it import automatically all needed classes from the file, it can be used as from highrise.models import *):

async def on_user_join(self, user: User, position: Position | AnchorPosition) -> None:
        pass

Now we can use the chat method to make the bot to send a greeting message to the user that joined the room, the code will look like this:

from highrise import *
from highrise.models import *

class Mybot(BaseBot):
    async def on_start(self, session_metadata: SessionMetadata) -> None:
        pass
    async def on_user_join(self, user: User, position: Position | AnchorPosition) -> None:
        await self.highrise.chat(f"Welcome {user.username}!")

Now all you need to do is to run your code and all users that join the room will receive a welcome message!

To run the code you can use the following command on your terminal (Shell for Replit users) inside of the folder that contains your bot file.py:

                      `highrise <bot file name>:<bot class name> <room id> <bot token>`

If you’re looking for a template to remove the need of using your terminal command line each time you want to start your bot, make sure to check:

▶️ Run.py Template