-
Notifications
You must be signed in to change notification settings - Fork 5
Getting started
PyLoader uses the Python programming language. If you're familiar with Python, you're already good to go. If not, take a look below,
The PyLoader installation instructions are the same as here. I recommend using Visual Studio Code as the editor but you're free to use anything you prefer. If you choose to use VS Code take a look at this video tutorial to get you started to set up your editor and IntelliSense.
If you're having issues with the process, open up an issue on the repo.
PyLoader supports scripts to be reloaded on runtime. Meaning you don't need to keep closing & opening your game to check every single change. There's already a premade script for that. Just put it inside your PyLoader folder. Press Left Ctrl + R to reload your script.
PyLoader has a structured directory system. Try to follow them to avoid issues.
-
PyLoader\.
is where PyLoader scripts are placed. The loader searches for all.py
files & loads or reloads them. -
PyLoader\python
is reserved for first-party python files & modules. -
PyLoader\libstd
is reserved for PyLoader files & modules. -
PyLoader\lib
is where you'd want to put your modules. Create a folder inside with a unique name and put them there so it doesn't cause issues with other mods.
After you've done all of these, let's run the below script to check if everything's working correctly.
# HelloWorld.py
import libstd.common as common
from libstd.game_sa.hud import *
from libstd.vk_codes import *
while True:
if common.key_pressed(keys.VK_TAB):
CHud.set_help_message("Hello World")
common.wait(0) # Really important!
Create a file called HelloWorld.py
inside the PyLoader folder & paste them there. Then run the game and press Tab. A popup should come up with the text "Hello World". Yay, you're written your first PyLoader script.
At first, we're importing the modules we're gonna use. Then inside a while
loop, we're running our code. One important thing to keep in mind is that
common.wait(0)
. You can use a larger amount of time but it must be present in every loop. Not having that wait statement may cause your game to take up high amount of CPU usage or even crash
If you're interested to check some more examples, check here