ZScript Discussion

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 Discussion

Postby Graf Zahl » Mon Dec 05, 2016 9:02 am

The Loremaster uses DoSpecialDamage.

The difference is, DoSpecialDamage is called when it is decided that the projectile actually should damage the target, after it has already collided. SpecialMissileHit is for performing special actions BEFORE the projectile is exploded. This is used by a few Hexen projectiles that perform special actions on collision and do not explode, like the lightining attack. Do not confuse this with collision exclusion. It may sound similar on the surface but really is not.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby Major Cooke » Mon Dec 05, 2016 9:18 am

Does it take the HIT* pointer flags into account before SpecialMissileHit function is checked?
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript Discussion

Postby Blue Shadow » Mon Dec 05, 2016 9:36 am

MaxED wrote:Can ZScript class be inherited from DECORATE actor?
Graf Zahl wrote:No. Since DECORATE is parsed last the info is not available.

This is important and should emphasized, because this means that if you have mod A, which uses ZSCRIPT, and mod B, which uses DECORATE, and you want mod A to inherit classes from mod B, well, you won't be able to do that.
User avatar
Blue Shadow
 
 
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: ZScript Discussion

Postby Graf Zahl » Mon Dec 05, 2016 9:43 am

Major Cooke wrote:Does it take the HIT* pointer flags into account before SpecialMissileHit function is checked?


Can't say. SpecialMissileHit gets called right before deciding if ExplodeMissile needs to be callsed.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby Major Cooke » Mon Dec 05, 2016 10:02 am

Oh wait, I don't need those. It takes an actor called victim instead which is all I needed.

To clarify about this recent new addition of 'let p = Classtype(objectvar)'... If 'p' is not, say, MinotaurFriend like the change you made, would it return null even though it exists as something else? That is, if it's a different class instead of minotaurfriend. Would p be null?
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript Discussion

Postby Graf Zahl » Mon Dec 05, 2016 10:15 am

Yes. That's the entire point of a dynamic cast - it prevents that you access an incompatible object through a pointer.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby Major Cooke » Mon Dec 05, 2016 10:38 am

Okay, so what other 'special' words are there besides 'is' and 'let'? It's time to start adding these all to the wiki again.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript Discussion

Postby Graf Zahl » Mon Dec 05, 2016 11:35 am

Take a look at sc_man_scanner.re That contains all the reserved words, although many of them are just reserved but not used. Or do you only want to know the ones that do something? That list is in zcc_parser.cpp.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby Major Cooke » Mon Dec 05, 2016 12:12 pm

The latter. And okay. Now I need clarification on what the following are:

  • until
  • in
  • out
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript Discussion

Postby Graf Zahl » Mon Dec 05, 2016 12:30 pm

'until' is sometimes used as a negative 'while'. Although being parsed it's currently not being processed by the compiler.
In and Out are qualifiers for function parameters, 'out' causes a parameter being passed by reference. 'In' can be added as well, but has no function, it merely serves as means of documentation.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby Major Cooke » Mon Dec 05, 2016 1:19 pm

Alright.

Next question, how does GetSpriteIndex work? Does it convert the frame's A-Z (or whatever limit it is, I forgot) from 0 to that limit? Is the 'sprite' property what we use to compare/find what sprite an actor currently has?
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript Discussion

Postby Graf Zahl » Mon Dec 05, 2016 1:43 pm

No, it takes the four character name and returns the internal index for it.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby Xaser » Mon Dec 05, 2016 1:52 pm

Oh, that's interesting. Could that function be used to set an actor's sprite property directly via something like:
Code: Select allExpand view
self.sprite = GetSpriteIndex("SHTG");

?

(Can't test that code presently but that seems to be way thingdef_states.cpp is using said function internally. This would be extremely useful for a thing I'm planning on making).
User avatar
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Re: ZScript Discussion

Postby Graf Zahl » Mon Dec 05, 2016 2:00 pm

Yes, that should work.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript Discussion

Postby D2JK » Mon Dec 05, 2016 4:48 pm

Suggestion: could someone please make a wiki page or section about iterators, documenting any of the following:

- brief introduction, their purpose, and how they work
- iterator types (ActorIterator, ThinkerIterator, anything else?)
- what sort of task does each type excel at
- perhaps a brief explanation of the performance cost
- usage instructions, the options available, example code
D2JK
 
Joined: 30 Aug 2014

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: Awario [RSS] and 0 guests