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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Gez
 
 
Posts: 17719
Joined: Fri Jul 06, 2007 3:22 pm

Re: ZScript Discussion

Post by Gez »

Graf Zahl wrote:There are people who would complain, saying that typing that 'b' is 6 characters less than 'flags.'... :mrgreen:
Clarity is often at odd with brevity, yes.
User avatar
Major Cooke
Posts: 8109
Joined: Sun Jan 28, 2007 3:55 pm

Re: ZScript Discussion

Post by Major Cooke »

To be fair, he did say the b is for boolean.
User avatar
Rachael
Admin
Posts: 13203
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: ZScript Discussion

Post by Rachael »

Graf Zahl wrote:There are people who would complain, saying that typing that 'b' is 6 characters less than 'flags.'... :mrgreen:
I prefer the "flags." method, myself.
User avatar
Major Cooke
Posts: 8109
Joined: Sun Jan 28, 2007 3:55 pm

Re: ZScript Discussion

Post by Major Cooke »

Against supporting 'flags.', it's misleading into thinking one could perform this:

Code: Select all

target.flags = tracer.flags;
Only to receive a rather unwelcome discovery, something as -- from a programmer's prospective -- I'd like to avoid unless it's ACTUALLY doable.
Gez wrote:Clarity is often at odd with brevity, yes.
And throwing ms. clarity out the window especially...
User avatar
Nash
 
 
Posts: 17340
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: ZScript Discussion

Post by Nash »

I would very much like to see iterators eventually... using ACS to assign temporary TIDs to iterate through things is such a shit way of doing things.

I personally have no issues with the variable prefix; has anyone worked with Unreal Engine? Some of you might get a headache from all that bIsShootable, iCoffeCups, SPlayerName, fDistanceToLODThreshold... :mrgreen:
User avatar
Major Cooke
Posts: 8109
Joined: Sun Jan 28, 2007 3:55 pm

Re: ZScript Discussion

Post by Major Cooke »

Ah yes, I forgot they came from there! :P

So indeed, I think it should remain as is with the b prefix.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48519
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

The reason I am against the 'flags' solution is that it implies something that isn't there. These variables are essentially properties of the actor, whether they are grouped as flags or not is irrelevant. The bigger problems will appear once structs become assignable, then this would cause a needless complication.

About merging back, I still need to do a few minor things. For example, what about the flags that cannot be changed without requiring some special actions to be performed, like NOSECTOR and NOBLOCKMAP?
User avatar
Major Cooke
Posts: 8109
Joined: Sun Jan 28, 2007 3:55 pm

Re: ZScript Discussion

Post by Major Cooke »

Well, does A_ChangeFlag still work? Could be used for those in the mean time while you figure something out.

Or create functions for those specifically and make the bitfield read only for those.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48519
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

Yeah, that's the idea. For now making them read only should be enough.
User avatar
Major Cooke
Posts: 8109
Joined: Sun Jan 28, 2007 3:55 pm

Re: ZScript Discussion

Post by Major Cooke »

I certainly dont mind A_ChangeFlag for this case, but if you want some:

Code: Select all

target.bNoBlockMap(true);
target.hasNoBlockMap
etc..
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48519
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

Of course I'll add two special setter functions here.
User avatar
FishyClockwork
Posts: 732
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: ZScript Discussion

Post by FishyClockwork »

I think I spotted a bug here.
The way the flags are cleared is like this:

Code: Select all

self->flags &= MF_NOBLOCKMAP;
Shouldn't it be with a ~ or am I missing something?

Code: Select all

self->flags &= ~MF_NOBLOCKMAP;
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48519
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

Ooops...
User avatar
FishyClockwork
Posts: 732
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference

Re: ZScript Discussion

Post by FishyClockwork »

Um, okay, so, this may sound like a really dumb/obvious question. But is this a new syntax for clearing flags?
https://github.com/rheit/zdoom/blob/zsc ... .cpp#L4870

Code: Select all

self->flags &= *MF_NOBLOCKMAP;
I've never seen it like this before; the * confuses me.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48519
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Discussion

Post by Graf Zahl »

Damnit. One should think that such trivial changes can't get wrong...

Return to “Scripting”