ZScript Basics: A Guide for Non-Programmers (from a non-programmer)
This guide is a beginner-friendly introduction to ZScript, a primary coding language used to code gameplay, UI and menus in GZDoom source port.
☕ Support me on Boosty: https://boosty.to/agent_ash
Important notes
- This document was written by a person who learned to use ZScript without any prior programming experience. I strive to use the correct terminology and not dumb things down but I may also purposefully overexplain certain things or initially present them in a simplified manner for the sake of beginner-friendliness.
- While most code examples in the guide are made to be runnable, it’s not recommended to use them as is: many of them are purposefully inefficient, and the guide tends to iterate over them, improving various aspects while explaining new techniques. Examples are meant to be just that: examples—not ready-made solutions.
- This document is a guide, not a wiki. As such, it’s designed to be read from beginning to end. Chapters are not self-contained and often rely on information explained earlier in the guide, so it’s not recommended to skip anything. The only exception to this is the appendix chapters that can be found at the end—they contain additional information that may be referenced throughout the guide, so you may familiarize yourself with the contents of those chapters as needed.
🔶 CHOOSE YOUR PATH 🔶
-
If you do NOT have prior DECORATE experience and want to learn ZScript from scratch, start here: 🔵 » Where to start.
-
If you DO have prior DECORATE experience and are considering switching to ZScript, start here: 🔵 » Why ZScript?
Table of Contents
-
Where to start
-
Defining ZScript classes
-
Why ZScript?
-
Classes instead of actors
-
How to see your classes in the game
-
Anonymous functions
-
Variables and data types
-
Pointers and casting
-
Custom functions and function types
-
Virtual Functions
-
Event Handlers
-
Player, PlayerInfo and PlayerPawn
-
Inventory
-
Weapons, PSprite and overlays
-
Arrays and linked lists
-
Constants
-
HUD
Appendix chapters