Page 4 of 9

Re: ZScript Documentation

PostPosted: Sun Dec 11, 2016 4:37 pm
by Rachael
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)

Re: ZScript Documentation

PostPosted: Sun Dec 11, 2016 4:43 pm
by D2JK
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?

Re: ZScript Documentation

PostPosted: Sun Dec 11, 2016 4:56 pm
by Major Cooke
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.

Re: ZScript Documentation

PostPosted: Sun Dec 11, 2016 5:13 pm
by Graf Zahl
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.

Re: ZScript Documentation

PostPosted: Sun Dec 11, 2016 6:02 pm
by Major Cooke
Remind me again, when is the 'action' word necessary?

Re: ZScript Documentation

PostPosted: Sun Dec 11, 2016 6:05 pm
by D2JK
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?

Re: ZScript Documentation

PostPosted: Sun Dec 11, 2016 6:06 pm
by Major Cooke
You forgot to add passive bool checks. Check the information carefully.

Re: ZScript Documentation

PostPosted: Sun Dec 11, 2016 6:16 pm
by D2JK
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.

Re: ZScript Documentation

PostPosted: Mon Dec 12, 2016 5:38 am
by Graf Zahl
Major Cooke wrote:Remind me again, when is the 'action' word necessary?



Only for weapons, overlays and custom inventory states.

Re: ZScript Documentation

PostPosted: Mon Dec 12, 2016 6:20 am
by Enjay
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.

Re: ZScript Documentation

PostPosted: Mon Dec 12, 2016 4:02 pm
by D2JK
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.

Re: ZScript Documentation

PostPosted: Tue Dec 13, 2016 10:05 am
by Major Cooke
Does GetClass() work in that regard?

Re: ZScript Documentation

PostPosted: Tue Dec 13, 2016 10:08 am
by Major Cooke
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.

Re: ZScript Documentation

PostPosted: Tue Dec 13, 2016 11:01 am
by D2JK
Does GetClass() work in that regard?

No. "Cannot convert to string".

Re: ZScript Documentation

PostPosted: Tue Dec 13, 2016 11:03 am
by Major Cooke
Maybe this might help you.