-
Notifications
You must be signed in to change notification settings - Fork 141
Launching a Bot With Custom Settings
This tutorial assumes you already have a bot class to work from. This tutorial is relevant for any bot for any RuneLite-based game.
I will refer to your bot class as <bot>
, and the game it's for as <game>
.
In some cases, your bot may benefit from a further-customized RuneLite plugin configuration. For instance, if you bot requires numerous objects on screen to be highlighted various colors, it is not ideal to force the user to do that manually each time they use the bot. This tutorial will show you how to add a launch game
button to your bot's control panel.
- Launch OSBC.
- Navigate to your game's Home View via the sidebar.
- Launch RuneLite via the
Launch <game>
button. - Manually configure the RuneLite plugins to your liking via the RuneLite interface.
- Sometimes you need to stay logged in for a few minutes for the changes to take effect.
- It is wise to not change object/tile/npc tagging plugin properties, such as their width and feathering. This may negatively affect OSBC's ability to locate outlined objects. You can safely adjust their colors though if you intend to pre-tag objects with specific colors.
- Log out, and close RuneLite. Your custom settings have been saved to
src/runelite_settings/temp.properties
.
- In
src/model/<game>/
create a new folder where your bot file & settings file will live.- Give it a name relevant to
<bot>
.
- Give it a name relevant to
- Move your bot file into this new folder.
- In
src/model/<game>/__init__.py
, adjust the reference to your bot such that it points to the new location (from .<folder>.<bot_filename> import <bot>
). - Copy
src/runelite_settings/temp.properties
into the new folder. Call itcustom_settings.properties
. - Edit this file, removing any lines that contain
rsprofile
. These lines may expose your account name, so it is best to remove them.
- In
src/model/<game>/<bot>.py
, import thegame_launcher
utility, andpathlib
.
import utilities.game_launcher as launcher
import pathlib
- Make your bot inherit from
launcher.Launchable
.
# your bot will likely inherit a game-specific baseclass instead of RuneLiteBot
class BotName(RuneLiteBot, launcher.Launchable):
- Add a
launch_game
method to your bot. I like to put it above themain_loop()
method.
def launch_game(self):
pass
- In the
launch_game
method, identify the path to your custom settings file, and pass it to thelaunch_runelite_with_settings
method.
def launch_game(self):
settings = pathlib.Path(__file__).parent.joinpath("custom_settings.properties")
launcher.launch_runelite_with_settings(self, settings)
- (Optional) If it is important that the user does not have an instance of RuneLite already running, add this:
def launch_game(self):
if launcher.is_program_running("RuneLite"):
self.log_msg("RuneLite is already running. Please close it and try again.")
return
settings = pathlib.Path(__file__).parent.joinpath("custom_settings.properties")
launcher.launch_runelite_with_settings(self, settings)
- Close RuneLite if it's running.
- Launch OSBC.
- Navigate to your game's Home View via the sidebar.
- Select
skip
to unlock the scripts in the sidebar.
- Select
- Select your bot from the sidebar.
- The bot should now have a
Launch
button in its control panel. It is disabled until you've configured your bot's options. - Launch RuneLite via the
Launch
button.
Since the Launch
button waits for your bot to be configured, you have an opportunity to further modify your custom settings file before launching RuneLite. For instance, the OSRSCombat
bot's option menu allows users to identify what items should be looted, and then the settings file is modified automatically to highlight those items.