Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Changes client detection / bot initialization. #150

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ThatOneGuyScripts
Copy link
Contributor

@ThatOneGuyScripts ThatOneGuyScripts commented Mar 27, 2023

Fixes OSR-53

This changes the way the game client is detected. It uses a combination of name and pid. This allows to OSBC to be ran on a system with more than one instance of the game client open while ensuring the correct window is interacted with. This will be vital to introducing remote input and multi-client coming in the future. All included OSBC bots have been updated to work with this new system.

Current scripts will need to be updated as follows.

In the Initialization function 3 variables need to be added.
self.Client_Info = None
self.win_name = None
self.pid_number = None

In the create_options function add the following option.
self.options_builder.add_process_selector("Client_Info")

in the save options function add the following.
elif option == "Client_Info":
self.Client_Info = options[option]
client_info = str(self.Client_Info)
win_name, pid_number = client_info.split(" : ")
self.win_name = win_name
self.pid_number = int(pid_number)
self.win.window_title = self.win_name
self.win.window_pid = self.pid_number

Optionally you can add these log_msgs to print in the box what client is chosen when options are saved.
self.log_msg(f"{self.win_name}")
self.log_msg(f"{self.pid_number}")

@kelltom kelltom added the type: feature request New feature or request label Apr 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants