ZScript Documentation

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

Re: ZScript Documentation

Postby Rachael » Sun Dec 11, 2016 4:37 pm

Gez wrote:A few things:

  1. DECORATE and ZScript have the same backend. Once it's compiled there is no difference for the engine whether something was coded in DECORATE or ZScript.
  2. There's no need to convert stuff just for the purpose of having converted it. Only convert what you need to convert.
  3. DECORATE will remain forever supported.

4. DECORATE will remain supported, however it will not itself be updated, only the action functions you can use. (And I believe, actually, those can be defined in ZScript anyhow, and used in DECORATE later, if I am not mistaken)
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: ZScript Documentation

Postby D2JK » Sun Dec 11, 2016 4:43 pm

I just spent some time editing in the virtual functions for thinker and actor.

If I override the CanCollideWith function, and just want to add a single rule, is it possible to end it with Super.CanCollideWith(); like with some of the other overrides? Or does it mess things up if the only thing I include in the override is that single addition of my own, and nothing else?
D2JK
 
Joined: 30 Aug 2014

Re: ZScript Documentation

Postby Major Cooke » Sun Dec 11, 2016 4:56 pm

You can do super. Any virtual function can do that but just note, if it inherits from Actor/internal class, it's pointless to do that because it's empty.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby Graf Zahl » Sun Dec 11, 2016 5:13 pm

AActor.CanCollideWith does nothing, there's no need to call it. If you want to stack rules for subclasses it can surely be used that way.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Documentation

Postby Major Cooke » Sun Dec 11, 2016 6:02 pm

Remind me again, when is the 'action' word necessary?
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby D2JK » Sun Dec 11, 2016 6:05 pm

Code: Select allExpand view
Override bool CanCollideWith(actor other, bool passive)
 {
  if (other.health < 50)            return false;
  else                              return true;
 }

This is on a projectile. Is it intended that this projectile will now always collide with -SOLID monsters (regardless of their health), but otherwise, the health check is obeyed?
D2JK
 
Joined: 30 Aug 2014

Re: ZScript Documentation

Postby Major Cooke » Sun Dec 11, 2016 6:06 pm

You forgot to add passive bool checks. Check the information carefully.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby D2JK » Sun Dec 11, 2016 6:16 pm

Ok, I think I get it. If the monster is not solid, this function will not be called in the first place, so it doesn't matter what conditions I've written in it.
D2JK
 
Joined: 30 Aug 2014

Re: ZScript Documentation

Postby Graf Zahl » Mon Dec 12, 2016 5:38 am

Major Cooke wrote:Remind me again, when is the 'action' word necessary?



Only for weapons, overlays and custom inventory states.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Documentation

Postby Enjay » Mon Dec 12, 2016 6:20 am

Something that might be useful in the documentation as a bit of a primer for people, a sort of "What can ZScript do for me" section to let people know how ZScript fits in to and dovetails with the various scripting systems and text definition options available in ZDoom and some basic suggestions of the kind of thing a modder could use ZScipt for.

I know that the page currently says "ZScript (formerly known as DoomScript) is a text-format lump used to create classes or structs for use in ZDoom. It can include the names of other lumps for processing similar to DECORATE." and that's fine as a basic introduction but something to ease people in to zscript and show them what it's all about, thereby making it more accessible, would be good IMO. I would do it myself but I don't feel expert enough in ZScript. Having missed the whole thing kicking off properly, I'm a bit behind the curve and only slowly getting to grips with it myself.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: ZScript Documentation

Postby D2JK » Mon Dec 12, 2016 4:02 pm

I'm sure it's been explained somewhere, but how do I convert a pointed class name into a string, so that I can use this string in A_Log, for example?
Code: Select allExpand view
if (target)
 {
  String S = target. <What do I write here?>
  A_Log(S);
 }

Being able to do this should help me a lot when trying to fix certain problems.
D2JK
 
Joined: 30 Aug 2014

Re: ZScript Documentation

Postby Major Cooke » Tue Dec 13, 2016 10:05 am

Does GetClass() work in that regard?
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby Major Cooke » Tue Dec 13, 2016 10:08 am

Enjay wrote:Something that might be useful in the documentation as a bit of a primer for people, a sort of "What can ZScript do for me" section to let people know how ZScript fits in to and dovetails with the various scripting systems and text definition options available in ZDoom and some basic suggestions of the kind of thing a modder could use ZScipt for.

I know that the page currently says "ZScript (formerly known as DoomScript) is a text-format lump used to create classes or structs for use in ZDoom. It can include the names of other lumps for processing similar to DECORATE." and that's fine as a basic introduction but something to ease people in to zscript and show them what it's all about, thereby making it more accessible, would be good IMO. I would do it myself but I don't feel expert enough in ZScript. Having missed the whole thing kicking off properly, I'm a bit behind the curve and only slowly getting to grips with it myself.


Join the club. We gots cookies.

Seriously though, I cannot exactly do that when I am still coming to grips with it too. I still have a lot to learn about it, and thus I cannot recommend it until someone like Graf does some of the editing himself on the wiki page.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: ZScript Documentation

Postby D2JK » Tue Dec 13, 2016 11:01 am

Does GetClass() work in that regard?

No. "Cannot convert to string".
D2JK
 
Joined: 30 Aug 2014

Re: ZScript Documentation

Postby Major Cooke » Tue Dec 13, 2016 11:03 am

Maybe this might help you.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 4 guests