Rename run.py to main.py (#223)

This commit is contained in:
aeon0
2021-12-07 08:01:10 +01:00
committed by GitHub
parent 18c5344af7
commit 571f2101e8
6 changed files with 7 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ It is highly recommended to let botty run with /nopickup active. This will reduc
### 1) Graphics and Gameplay Settings
All settings will automatically be set when you execute `run.exe` and press the hotkey for "Adjust D2R settings" (default f9). Note that D2R should not run during this process, or if it does you will have to restart afterwards. It is not a 100% thing, in rare cases you might still have to fiddle around with your brightness. I suggest using the "Graphic Debugger" to verify your settings.
All settings will automatically be set when you execute `main.exe` and press the hotkey for "Adjust D2R settings" (default f9). Note that D2R should not run during this process, or if it does you will have to restart afterwards. It is not a 100% thing, in rare cases you might still have to fiddle around with your brightness. I suggest using the "Graphic Debugger" to verify your settings.
**Note**: There have been issues reported with image sharpening being truned on via the graphic card settings itself outside of D2R. Try turning it off when running botty. Also HDR should be truned off.
### 2) Supported builds
@@ -38,7 +38,7 @@ Open up D2R and wait till you are at the hero selection screen. Make sure the ch
### 4) Start Botty
You can either run from python. Follow [development.md](development.md) for that. Or you download the a prebuilt release [here](https://github.com/aeon0/botty/releases). Start `run.exe` in the botty folder. Focus your D2R window window and press the start key (default f11). You can always force stop botty with f12.
You can either run from python. Follow [development.md](development.md) for that. Or you download the a prebuilt release [here](https://github.com/aeon0/botty/releases). Start `main.exe` in the botty folder. Focus your D2R window window and press the start key (default f11). You can always force stop botty with f12.
## Graphic Debugger

View File

@@ -10,7 +10,7 @@ git clone https://github.com/aeon0/botty.git
cd botty
conda env create environment.yml
conda activate botty
python src/run.py
python src/main.py
```
Important info for Powershell users:
```bash
@@ -56,7 +56,7 @@ Want to implement a new char or build. Check this folder out. You will have to i
Utilities functions and scripts e.g. for easily creating templates to traverse nodes and automatically generate code for it</br>
## Code routine
run.py contains the main() function and is the entry point for botty. It will start 3 threads: death monitoring (death_manager.py), health monitoring (health_manager.py) and the bot (bot.py) itself. Whenever the two monitors either detect a player's death or chicken out of the game, the bot thread will be killed and restarted.</br>
main.py contains the main() function and is the entry point for botty. It will start 3 threads: death monitoring (death_manager.py), health monitoring (health_manager.py) and the bot (bot.py) itself. Whenever the two monitors either detect a player's death or chicken out of the game, the bot thread will be killed and restarted.</br>
In bot.py is a state machine in its core an executes different actions based on the current state. The goal is to remove as much implementation details as possible from bot.py and "hide" them in different manager classes (e.g. pickit.py, pather.py, npc_manager.py, etc.)
## State Diagram

View File

@@ -53,7 +53,7 @@ if __name__ == "__main__":
shutil.rmtree(path)
shutil.rmtree(botty_dir)
installer_cmd = f"pyinstaller --onefile --distpath {botty_dir} --exclude-module graphviz --paths .\\src --paths {args.conda_path}\\envs\\botty\\lib\\site-packages src\\run.py"
installer_cmd = f"pyinstaller --onefile --distpath {botty_dir} --exclude-module graphviz --paths .\\src --paths {args.conda_path}\\envs\\botty\\lib\\site-packages src\\main.py"
os.system(installer_cmd)
os.system(f"mkdir {botty_dir}")

View File

@@ -73,7 +73,7 @@ class DeathManager:
while self._do_monitor:
if self._died: continue
time.sleep(self._loop_delay) # no need to do this too frequent, when we died we are not in a hurry...
# Wait until the flag is reset by run.py
# Wait until the flag is reset by main.py
if self._died: continue
self.handle_death_screen()
Logger.debug("Stop death monitoring")

View File

@@ -105,7 +105,7 @@ class HealthManager:
start = time.time()
while self._do_monitor:
time.sleep(0.1)
# Wait until the flag is reset by run.py
# Wait until the flag is reset by main.py
if self._did_chicken or self._pausing: continue
img = self._screen.grab()
# TODO: Check if in town or not! Otherwise risk endless chicken loop