Skip to content

Commit

Permalink
Merge pull request kelltom#168 from kelltom/rebrand
Browse files Browse the repository at this point in the history
Rebrand
  • Loading branch information
kelltom committed May 14, 2023
2 parents ea04c5b + 08b239f commit 5f3ee14
Show file tree
Hide file tree
Showing 26 changed files with 41 additions and 157 deletions.
64 changes: 18 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
### ⚠️ This project is in Alpha stage ⚠️

# ![](documentation/media/logo.png)
OSRS Bot COLOR (OSBC) is a desktop client for controlling and monitoring automation scripts (bots) for Old School RuneScape and private server alternatives. This application is paired with a custom library of tools for streamlining the development of new bots. Unlike most botting frameworks that employ code injection into the game client, OSBC uses a combination of color manipulation, image recognition, and optical character recognition to navigate the game. The goal of OSBC is to provide a fun learning experience for new & seasoned developers alike!
OS Bot COLOR (OSBC) is a desktop client for controlling and monitoring automation scripts. This application is paired with a toolkit for writing new scripts. Unlike popular automation frameworks that modify/inject code into a game's client, OSBC is completely hands-off; it uses a combination of color detection, image recognition, and optical character recognition to navigate the game. The goal of OSBC is to provide a fun and educational learning experience for new & seasoned developers alike, emphasizing the exploration of automation technologies and not to encourage or support activities that are in violation of any game's Terms of Service.

💬 [Join the Discord](https://discord.gg/Znks7Smya4) to discuss the project, ask questions, and follow development

<!--
📹 Subscribe to [Kell's Code](https://www.youtube.com/@KellsCode/featured) on YouTube for updates and tutorials
-->

⭐ If you like this project, please leave a Star :)

<p>
<a href="https://www.buymeacoffee.com/kelltom" target="_blank">
<img src="https://i.imgur.com/5X29MVY.png" alt="Buy Me A Coffee" height="60dp">
</a>
&nbsp;&nbsp;&nbsp;
<a href="https://www.paypal.com/paypalme/kelltom" target="_blank">
<img src="https://i.imgur.com/6EFKj2m.png" alt="PayPal" height="60dp">
</a>
</p>

# Table of Contents
- [](#)
- [Table of Contents](#table-of-contents)
- [Developer Setup ](#developer-setup-)
- [Documentation](#documentation)
- [Features](#features)
- [User Interface](#user-interface)
- [Script Log](#script-log)
- [Simple Option Menus](#simple-option-menus)
- [RuneLite Launcher](#runelite-launcher)
- [Any Client Size, Anywhere](#any-client-size-anywhere)
- [Human-like Mouse Movement](#human-like-mouse-movement)
- [RuneLite Leverage](#runelite-leverage)
- [Object Detection](#object-detection)
- [API](#api)
- [Object Detection](#object-detection)
- [Random Click Distribution](#random-click-distribution)
- [Efficient Image Searching](#efficient-image-searching)
- [Lightning Fast Optical Character Recognition](#lightning-fast-optical-character-recognition)
Expand All @@ -54,7 +44,7 @@ See the [Wiki](https://github.com/kelltom/OSRS-Bot-COLOR/wiki) for tutorials, an
## User Interface
OSBC offers a clean interface for configuring, running, and monitoring your Python bots. For developers, this means that all you need to do is write a bot's logic loop, and *the UI is already built for you*.

![intro_demo](https://user-images.githubusercontent.com/44652363/197059102-27a9a942-25b6-4012-b83b-90ae8399b4e8.gif)
![intro_demo](documentation/media/intro_demo.gif)

### Script Log
The Script Log provides a clean and simple way to track your bot's progress. No more command line clutter!
Expand All @@ -75,43 +65,25 @@ def create_options(self):
self.options_builder.add_dropdown_option("menu_example", "Menu Example", ["A", "B", "C"])
```

![options_menu](https://user-images.githubusercontent.com/44652363/206808756-aac29140-e41d-4b6c-9f26-dc08ce0662b9.png)

## RuneLite Launcher
In one click, you can launch RuneLite with pre-configured, *legal* plugins that allow OSBC to work its magic. This works completely separate from your normal RuneLite installation, so your personal configuration is not affected.

![rl launcher](https://user-images.githubusercontent.com/44652363/206948553-608d0337-862c-41ca-b2e1-7cd473838060.gif)

## Any Client Size, Anywhere
Your scripts will work no matter the size or position of the game client. OSBC locates important UI elements and allows you to access them by name.

![resize support](https://user-images.githubusercontent.com/44652363/206949051-16e1bf57-a189-4eda-bbb2-1864e2849c45.gif)

## Human-like Mouse Movement
OSBC uses Bezier curves to create smooth, human-like mouse movements.

![mouse movements](https://user-images.githubusercontent.com/44652363/206948347-88e6296c-a5bf-43d4-a491-4680467ada31.gif)

## RuneLite Leverage
### Object Detection
Official RuneLite plugins exist to add quality of life to players. Many plugins offer highlighting/outlining of in-game objects with solid colors, making them easier for players to see them. Using color isolation, OSBC can quickly locate these outlined objects and extract their properties into simple data structures.

![RL object](https://user-images.githubusercontent.com/44652363/206809467-8cdefa01-235d-441f-b563-69773a2badb8.png)

### API
There are some RuneLite plugins that expose game data to a localhost API endpoint. You can leverage this data to provide a more robust botting experience without the risks associated with modifying the game client's code. See the [API utility folder](src/utilities/api/) for more.
## Object Detection
Using color isolation, OSBC can quickly locate objects/NPCs outlined by solid colors and extract their properties into simple data structures.

## Random Click Distribution
With the help of the OSBC community, we've created a randomization algorithm that distributes clicks in a way that is more human-like. We followed the same principles used by individuals who've beat the system and achieved max levels without lifting a finger.

![click dist](https://user-images.githubusercontent.com/44652363/206948686-89cb0c30-8626-4aa2-9415-f2f985c80cbc.gif)
With the help of the OSBC community, we've created a randomization algorithm that distributes clicks in a way that is more human-like.

## Efficient Image Searching
Sometimes, your bot might need to find a specific image on screen. We've modified OpenCV's template matching algorithm to be more efficient and reliable with RuneScape UI elements and sprites - even supporting images with transparency. That means you can search images directly from the OSRS Wiki.

![shark](https://user-images.githubusercontent.com/44652363/206808973-8bea1717-c227-43cf-b8af-6825316eb95d.png)
Sometimes, your bot might need to find a specific image on screen. We've modified OpenCV's template matching algorithm to be more efficient and reliable with UI elements and sprites - even supporting images with transparency.

## Lightning Fast Optical Character Recognition
We've ditched machine learned OCR in favor of a much faster and more reliable custom implementation. OSBC can locate text on screen in as little as **2 milliseconds**. That's **0.002 seconds**.

![ocr](https://user-images.githubusercontent.com/44652363/206808982-16f58a50-4709-4c27-9fc2-94b0c4edab21.png)
---

<p>
<a href="https://www.buymeacoffee.com/kelltom" target="_blank">
<img src="https://i.imgur.com/5X29MVY.png" alt="Buy Me A Coffee" height="60dp">
</a>
</p>
Binary file removed documentation/media/github_social_banner.png
Binary file not shown.
Binary file removed documentation/media/github_social_banner.psd
Binary file not shown.
Binary file modified documentation/media/intro_demo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/media/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/media/logo.psd
Binary file not shown.
Binary file removed documentation/media/logo_alt_colors.psd
Binary file not shown.
Binary file removed documentation/media/logo_alt_colors_large.png
Binary file not shown.
Binary file removed documentation/media/logo_alt_colors_large.psd
Binary file not shown.
Binary file added documentation/media/logo_large.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/media/logo_large.psd
Binary file not shown.
Binary file removed documentation/media/logo_old.png
Binary file not shown.
Binary file modified documentation/media/options_menu.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed documentation/references.docx
Binary file not shown.
2 changes: 1 addition & 1 deletion src/OSBC.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, test: bool = False):
self.build_ui()

def build_ui(self): # sourcery skip: merge-list-append, move-assign-in-block
self.title("OSRS Bot COLOR")
self.title("OS Bot COLOR")
self.geometry(f"{App.WIDTH}x{App.HEIGHT}")
self.update()
self.minsize(self.winfo_width(), self.winfo_height())
Expand Down
Binary file removed src/images/bot/run_off.png
Binary file not shown.
Binary file removed src/images/bot/run_on.png
Binary file not shown.
Binary file modified src/images/ui/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/model/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def select_combat_style(self, combat_style: str):

def toggle_run(self, toggle_on: bool):
"""
Toggles run. Assumes client window is configured.
Toggles run. Assumes client window is configured. Images not included.
Args:
toggle_on: True to turn on, False to turn off.
"""
Expand Down
5 changes: 1 addition & 4 deletions src/model/osrs/combat/combat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
class OSRSCombat(OSRSBot, launcher.Launchable):
def __init__(self):
bot_title = "Combat"
description = (
"This bot kills NPCs. Position your character near some NPCs and highlight them. After setting this bot's options, please launch RuneLite with the"
" button on the right."
)
description = "This bot kills NPCs. Position your character near some NPCs and highlight them.\nTHIS SCRIPT IS AN EXAMPLE, DO NOT USE LONGTERM."
super().__init__(bot_title=bot_title, description=description)
self.running_time: int = 1
self.loot_items: str = ""
Expand Down
8 changes: 0 additions & 8 deletions src/model/osrs/osrs_bot.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
"""
The OSRS Bot class is the base class for all OSRS bots. It inherits from the RuneLiteBot class, which
pretty much provides all of the functionality for OSRS bots as it is. The only thing this class is doing,
is setting the game title to "OSRS". Now, when you create a new bot for Old School Runescape, you can
simply inherit from this class instead of the RuneLiteBot class and not have to worry about setting
the game title. This is just a convenience class in this case, but for private servers, this is where you'd
implement any custom functionality that is specific to the private server you're writing a bot for.
"""
from abc import ABCMeta

from model.runelite_bot import RuneLiteBot, RuneLiteWindow
Expand Down
20 changes: 14 additions & 6 deletions src/model/osrs/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

class OSRSTemplate(OSRSBot):
def __init__(self):
bot_title = "<Bot name here>"
description = "<Bot description here.>"
bot_title = "<Script name here>"
description = "<Script description here>"
super().__init__(bot_title=bot_title, description=description)
# Set option variables below (initial value is only used during UI-less testing)
# Set option variables below (initial value is only used during headless testing)
self.running_time = 1

def create_options(self):
Expand All @@ -24,6 +24,9 @@ def create_options(self):
unpack the dictionary of options after the user has selected them.
"""
self.options_builder.add_slider_option("running_time", "How long to run (minutes)?", 1, 500)
self.options_builder.add_text_edit_option("text_edit_example", "Text Edit Example", "Placeholder text here")
self.options_builder.add_checkbox_option("multi_select_example", "Multi-select Example", ["A", "B", "C"])
self.options_builder.add_dropdown_option("menu_example", "Menu Example", ["A", "B", "C"])

def save_options(self, options: dict):
"""
Expand All @@ -34,6 +37,12 @@ def save_options(self, options: dict):
for option in options:
if option == "running_time":
self.running_time = options[option]
elif option == "text_edit_example":
self.log_msg(f"Text edit example: {options[option]}")
elif option == "multi_select_example":
self.log_msg(f"Multi-select example: {options[option]}")
elif option == "menu_example":
self.log_msg(f"Menu example: {options[option]}")
else:
self.log_msg(f"Unknown option: {option}")
print("Developer: ensure that the option keys are correct, and that options are being unpacked correctly.")
Expand All @@ -55,9 +64,8 @@ def main_loop(self):
- Make use of Bot/RuneLiteBot member functions. There are many functions to simplify various actions.
Visit the Wiki for more.
- Using the available APIs is highly recommended. Some of all of the API tools may be unavailable for
select private servers. To see what the APIs can offer you, see here: https://github.com/kelltom/OSRS-Bot-COLOR/tree/main/src/utilities/api.
For usage, uncomment the `api_m` and/or `api_s` lines below, and use the `.` operator to access their
functions.
select private servers. For usage, uncomment the `api_m` and/or `api_s` lines below, and use the `.`
operator to access their functions.
"""
# Setup APIs
# api_m = MorgHTTPSocket()
Expand Down
4 changes: 3 additions & 1 deletion src/model/osrs/woodcutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
class OSRSWoodcutter(OSRSBot):
def __init__(self):
bot_title = "Woodcutter"
description = "This bot power-chops wood. Position your character near some trees, tag them, and press the play button."
description = (
"This bot power-chops wood. Position your character near some trees, tag them, and press Play.\nTHIS SCRIPT IS AN EXAMPLE, DO NOT USE LONGTERM."
)
super().__init__(bot_title=bot_title, description=description)
self.running_time = 1
self.take_breaks = False
Expand Down
86 changes: 0 additions & 86 deletions src/utilities/record_mouse/record_mouse.py

This file was deleted.

5 changes: 2 additions & 3 deletions src/utilities/sprite_scraper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This module contains the SpriteScraper class, which is used to download images from the OSRS Wiki.
This module contains the SpriteScraper class, which is used to download images from the wiki API.
If you are having issues, try disabling IPv6 on your machine.
"""

Expand Down Expand Up @@ -161,8 +161,7 @@ def __extract_kwargs(self, kwargs):
# -------------------
def __get_item_infobox_data(self, item: str) -> Optional[str]:
"""
Returns a string of data from the info box for a specific item from the Old School
RuneScape Wiki.
Returns a string of data from the info box for a specific item from the Wiki.
Args:
item: The item name.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion src/view/title_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, parent, main):
self.label_logo.grid(row=1, column=0, columnspan=3, sticky="nsew", padx=15, pady=15)

# Description label
self.note = "The universal OSRS color bot.\n Select a game in the left-side menu to begin."
self.note = "Select a game in the left-side menu to begin."
self.label_note = customtkinter.CTkLabel(master=self, text=self.note, font=subheading_font())
self.label_note.bind(
"<Configure>",
Expand Down

0 comments on commit 5f3ee14

Please sign in to comment.