ZScript Language Documentation (WIP)

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Re: ZScript Language Documentation (WIP)

Postby Marrub » Sun Nov 25, 2018 1:51 pm

Player701 wrote:
Marrub wrote:Thanks, rewrote the description. Apparently I wrote the description before I knew what PClass was, so now it actually tells you properly what it does.

Thank you too. A minor correction, though: right now it is not required to mark the returned value as transient, though I wish it were. Apparently, it is not that easy to implement because it's difficult to tell what objects are supposed to be serialized (and would thus need to enforce this rule) and what aren't. I would definitely recommend marking these fields transient, though - makes the code easier to understand.

The document refers to what the user must do to not cause erroneous behaviour, so the current wording is correct.
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: ZScript Language Documentation (WIP)

Postby Marrub » Sun Dec 30, 2018 4:03 pm

Updated existing documentation for 3.7.0 including the new flagdef keyword, finished documentation for TexMan, State and Font, and documented Screen.DrawTexture & Screen.VirtualToRealCoords. I also have split the files so as to make it easier to read.
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: ZScript Language Documentation (WIP)

Postby Major Cooke » Sun Dec 30, 2018 4:52 pm

Masterful stuff man. This is exceptionally handy. Well done!
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript Language Documentation (WIP)

Postby Marrub » Mon Dec 31, 2018 8:43 am

Major Cooke wrote:Masterful stuff man. This is exceptionally handy. Well done!

Thanks. If there's anything you need documented feel free to suggest or make a pull request.
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: ZScript Language Documentation (WIP)

Postby Major Cooke » Sat Feb 02, 2019 4:40 pm

Dynamic Arrays: Whenever changing the size of one, it's important to immediately initialize anything new, unless it was Push()'d. I just tested it: trying to check the new stuff after doing a Reserve crashes GZDoom. Best to record the old size and, after the array grows bigger, fill it with default values - in particular, object arrays with nulls. Otherwise GZDoom looks into an empty container and just dies.

Perhaps that should be added as a warning on the dynamic array page?
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript Language Documentation (WIP)

Postby Marrub » Sat Feb 02, 2019 8:21 pm

Major Cooke wrote:Dynamic Arrays: Whenever changing the size of one, it's important to immediately initialize anything new, unless it was Push()'d. I just tested it: trying to check the new stuff after doing a Reserve crashes GZDoom. Best to record the old size and, after the array grows bigger, fill it with default values - in particular, object arrays with nulls. Otherwise GZDoom looks into an empty container and just dies.

Perhaps that should be added as a warning on the dynamic array page?

I've expanded the description to clarify how it works more exactly.
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: ZScript Language Documentation (WIP)

Postby Major Cooke » Mon Feb 11, 2019 1:57 pm

Documentation wrote:Adds amount new empty-constructed objects at the end of the array, increasing Size and calling Grow if necessary. Value types are initialized to zero and reference types to null.


If you do a reserve on an object array in ZScript and then try null checking inside it without manual initialization, it will crash. Might be something to do with a difference between an internal null and ZScript null?

Whatever the case, it must be manually initialized or it will kill the game.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript Language Documentation (WIP)

Postby Marrub » Tue Feb 12, 2019 1:30 am

Major Cooke wrote:
Documentation wrote:Adds amount new empty-constructed objects at the end of the array, increasing Size and calling Grow if necessary. Value types are initialized to zero and reference types to null.


If you do a reserve on an object array in ZScript and then try null checking inside it without manual initialization, it will crash. Might be something to do with a difference between an internal null and ZScript null?

Whatever the case, it must be manually initialized or it will kill the game.

This sounds like an engine bug, which shouldn't be documented. I suggest reporting it. (If it isn't a bug, I'll add clarification.)
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: ZScript Language Documentation (WIP)

Postby Josko » Mon Jun 24, 2019 11:59 pm

So still not finished eh? You still working on it? ^^
Josko
 
Joined: 22 Sep 2017

Re: ZScript Language Documentation (WIP)

Postby Marrub » Tue Jun 25, 2019 2:26 am

Josko wrote:So still not finished eh? You still working on it? ^^

Not at the moment, I have other projects taking priority, and lots of real-life stuff going on.
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: ZScript Language Documentation (WIP)

Postby Josko » Tue Jun 25, 2019 2:50 am

Alright, understandable :)

But how far on is this documentation? How much " Complete " is it? :P
Josko
 
Joined: 22 Sep 2017

Re: ZScript Language Documentation (WIP)

Postby Marrub » Tue Jun 25, 2019 2:53 am

Josko wrote:Alright, understandable :)

But how far on is this documentation? How much " Complete " is it? :P

It depends on what you need it for. Some parts of the documentation are very complete, whereas others are quite lacking and ridden with to-do markers.
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Previous

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests