Your first script
Start with a text file, a callback, and something you can see.
1. Create a Lua file
Save a plain UTF-8 text file named hello_soggy.lua in the folder containing csgo.exe. Make sure your editor does not add a hidden .txt extension.
2. Add a paint callback
client.log("hello_soggy loaded")
client.set_event_callback("paint", function()
renderer.text(24, 24, 182, 228, 110, 255,
"", 0, "hello, soggy.")
end)client.log writes a message to the console. paint is the callback used for in-game drawing. The text arguments are position, RGBA color, flags, maximum width, then the message.
3. Load it in-game
Open Misc → Lua, find your script and load it. Join a map to see the paint example. If it fails, check the console for the filename, line number and error message.
4. Choose automatic loading
Use the in-game Load on inject checkbox if you want the script to start on future loads. Workshop subscriptions download files; they do not choose your autoload settings.
Where next?
- renderer — draw shapes, text and textures.
- ui — add controls and read values.
- Events — react to game activity.
- Compatibility — check assumptions before porting a script.