- Introduction
- Why ZScript?
- Classes instead of actors
- Anonymous functions
- Variables and data types
- Overview
- Turning variables into actor properties
- Access modifiers
- Data types
- Pointers and casting
- Basic pointers
- Using pointers in ZScript
- Casting and custom pointers
- Type casting
- Custom functions
- Non-void functions and return values
- Virtual Functions
- ZScript Virtual Functions
- Common ZScript virtual functions
- Event Handlers
- Arrays (TBA)
- Constants and enums (TBA)
- Flow Control
- Best Practices and Rules of Thumb
Everyone is talking about ZScript. DECORATE is dead, they say. You should be using ZScript, they say. I’m not gonna help you with your awful hacky DECORATE code, they say.
You look around, confused. You’ve been using DECORATE for years now. You check ZDoom Wiki, and it’s still almost all about DECORATE. ZScript is barely documented. They tell you to look into ZScript code in gzdoom.pk3, and when you do, it makes your head spin. DECORATE is plain and simple, and with ZScript you don’t understand what’s going on at all.
Confusion leads to frustration, frustration leads to resentment. All the cool kids are playing with ZScript, and you don’t even know how and where to start. You wonder if your Doom modding career is over.
Sounds familiar?
That’s where lots of DECORATE users (some of them—known and respected modders even) have been finding themselves ever since ZScript became a thing. The reason is simple: ZScript is basically a programming language, and DECORATE has barely anything to do with that concept. As a result, there are plenty of people who’ve been doing just fine with DECORATE, and just a handful of people with previous programming experience who find it much easier to use ZScript. And it’s not surprising, ZScript is easier to use (more on that later) but it’s not easy for a non-programmer to begin.
I decided to write this short entry guide to help alleviate exactly that: it covers some basic programming concepts in simple terms which will help you to get started. Starting, after all, is the hardest part.
-
This guide is aimed at people with prior DECORATE (and possibly ACS) knowledge. It implies that you know what GZDoom is, what actors are, how they're structured, how they interact with each other. All of those aspects are covered by ZDoom Wiki, so I don't feel there's a need to describe them within this guide.
-
While all 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.