Mon Apr 20, 2020 5:17 am
ZScript Basics: a guide for non-programmers from a non-programmer
I started on zscript in early 2019 and have been familiarizing myself with it as a person with zero coding and little math experience, having only worked with DECORATE/ACS in the past. I'm now writing and compliting this basics guide on github:The Guide:https://github.com/jekyllgrim/ZScript_Basics
You could argue that it's better to read an actual coding guide, like on C#, and you're probably right. But there are tons of people out there who have been doing DECORATE hacks for years and are now in a pickle, since all the cool kids are doing ZScript, and they don't know how to join the fun and aren't necessarily willing to learn actual coding for that. This guide is for them.
Please note the following:
- This is a work in progress. Some chapters aren't finished yet but are planned or have a draft (i.e. they're mentioned in Contents but don't have active links). Some are only in my head.
- This guide won't cover everything. The chapter names you can see under Contents are close to being a complete plan. The guide is intended for people who are willing to continue learning new stuff on their own, and it only really covers the basics of the main aspects of ZScript.
- Some examples and explanations in the guide are purposefully simplified. I try to make sure they're never incorrect for the sake of simplicity, but they can be incomplete.
- There are no collaborators right now, but once I'm done with the main bulk, I'll probably be accepting help.
Tue May 19, 2020 5:08 am
I've been reading your guide again and found one thing in Virtual Functions section that I've looked over the first couple times:
if (source && source is "Zombieman")
Can I ask what is "is"? What are the rules for using it? Until now I thought that the way to check the class of the source of the damage was
if(source.GetClass() == "Zombieman")
PS. I must say that your guide is great!
Tue May 19, 2020 9:36 am
"is" is a special keyword in ZScript
. To use the "Zombieman" example you provided,
source is "Zombieman"
will return true if source
is a class of type "Zombieman" OR is a class derived from "Zombieman". By comparison, the example you posted using GetClass will only return true if the source is a class of type "Zombieman" (and will return false for classes derived from it). To use an actual example, suppose the source is a "HellKnight" (which is derived from "BaronOfHell"). Then
source is "BaronOfHell"
will return true, while
source.GetClass() == "BaronOfHell"
or (a more common and slightly more robust way a specific class can be checked against)
source.GetClassName() == "BaronOfHell" //replace == with ~== for a case insensitive compare
will both return false.
Tue May 19, 2020 1:46 pm
Tue May 19, 2020 2:15 pm
this is a great tutorial,
not that i want to understand what all that means, but it was nice to read. I very quickly get the concept of things, and your examples from doom help a lot to get the concept behind some "code structures"
Wed May 20, 2020 12:03 am
This is just what I was looking for, thanks for putting this together!
Sat May 30, 2020 11:43 am
Appreciate tutorials like these. Thank you for making this!
Mon Aug 24, 2020 3:56 pm
This is definitely the best thing I have read so far on ZScript. I am still far from doing anything worthwhile, but at least it's a start. And it's easily understandable. Thank you.
Tue Aug 10, 2021 3:48 am
Good news everyone!
I've just pushed a big update. This isn't the first update this guide received over the past months but the first one I remembered to post about here...
I've added two chapters for people without prior DECORATE experience (Where to start and Defining ZScript classes).
Some things were moved. The updated Introduction allows you to choose which chapter to jump to based on whether you have DECORATE experience or starting fresh.
I've also finally added a chapter on Arrays. It describes static constant and dynamic arrays. No fixed size or multidimensional ones, at least for now.
Powered by phpBB © phpBB Group.
phpBB Mobile / SEO by Artodia.