Messages from the server, such as status and session information, have been organized.
Currently, only 3 calls are implemented, and it is designed to work on the same machine as the server, or you can modify the source code.
pull welcomes
This guide will help you install and run your Python application on Windows.
-
Download Python:
- Go to the official Python website.
- Download the latest version of Python for Windows (choose the version for your architecture: 32-bit or 64-bit).
-
Install Python:
- Run the Python installer.
- Make sure to check the option "Add Python to PATH".
- Click on "Install Now" and follow the instructions on the screen.
-
Verify the Installation:
- Open Command Prompt (press
Win + R, typecmd, and press Enter). - Type the command:
python --version
- If the installation was successful, you will see the version of Python.
- Open Command Prompt (press
-
Open Command Prompt:
- If you are not in the command prompt already, open it.
-
Install Dependencies:
- Run the following command to install the required libraries:
pip install click requests configparser
- Run the following command to install the required libraries:
- Set Server URL:
- Open the
winCLI-EN.pyorwinCLI-RU.pyfile in a text editor. - Find the line:
@click.option('--host', 'host', default="localhost:7777", help='Host:port to connect to') - Replace localhost with the IP address of your server if it is on another machine. For example:
@click.option('--host', 'host', default="192.168.1.10:7777", help='Host:port to connect to') - Open the
- Run the Program:
- In the command prompt, navigate to the directory where your
winCLI-EN.pyorwinCLI-RU.pyfile is located:cd path\to\your\project
- Run the program using the command:
python winCLI-RU.py # Or winCLI-EN.py
- In the command prompt, navigate to the directory where your
-
Install PyInstaller:
- In the command prompt, run the following command:
pip install pyinstaller
- In the command prompt, run the following command:
-
Compile the Program:
- Navigate to the directory with your script:
cd path\to\your\project
- Run the command to compile:
pyinstaller --onefile winCLI-RU.py # Or winCLI-EN.py - This process will create several folders, including
dist, where your executable file will be located.
- Navigate to the directory with your script:
-
Run the Compiled File:
- Navigate to the
distfolder:cd dist - Run the compiled file:
winCLI-RU.exe # Or winCLI-EN.exe
- Navigate to the
-
Navigate to the Program Directory: Open a terminal or command prompt and navigate to the directory where the Python script is located.
-
Execute the Script: Run the script using the following command:
python winCLI-EN.pyWhen you run the program, you can use the following command-line options:
--host: Specify the host and port for connecting to the server. The default islocalhost:7777.--password: Provide the password for authentication with the server (it will be hidden when typed).--command: Specify a command to execute immediately. Possible commands include:status: Get the current server status.save: Save the game.shutdown: Shut down the server.sessions: List available sessions.options: Get server options.
--save_name: Specify the name to use when saving the game (used with thesavecommand).
Here are a few examples of how to use the program:
- Connect to the Server and Show Status:
python winCLI-EN.py --host localhost:7777 --password your_password --command status- Save the Game:
python winCLI-EN.py --host localhost:7777 --password your_password --command save --save_name "MySave"- Shutdown the Server:
python winCLI-EN.py --host localhost:7777 --password your_password --command shutdown- List Sessions:
python winCLI-EN.py --host localhost:7777 --password your_password --command sessions- Get Server Options:
python winCLI-EN.py --host localhost:7777 --password your_password --command optionsIf you run the script without specifying a command, it will enter an interactive mode where you can select commands from a menu. Here's how to interact in this mode:
- Run the Script:
python winCLI-EN.py --host localhost:7777 --password your_password- Select a Command: After the authentication, the program will display a menu:
Select a command:
1. Show server status
2. Save game
3. Shut down server
4. List sessions
5. Show server options
6. Exit
-
Enter the Command Number: Type the number of the command you want to execute and press Enter.
-
Follow Prompts: If additional information is needed (e.g., save name), the program will prompt you to provide it.
-
Exit the Program: Choose the "Exit" option from the menu to close the program.
