This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
Changes client detection / bot initialization. #150
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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}")