Is the new flagdef property okay for mods to use?

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!)
Post Reply
User avatar
phantombeta
Posts: 2084
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Is the new flagdef property okay for mods to use?

Post by phantombeta »

While looking something up in GZDoom.pk3 for someone, I noticed this new keyword - I immediately tested it to see if it worked outside of GZDoom.pk3, and it does. So, is it okay for mods to use it?

(This is more of a question for Graf, btw, since he's pretty much the only one who can really say if it's okay for mods to use it)

Tangentially related: Is it really necessary for "property prefix: <identifier>;" to be locked to GZDoom.pk3? That would be really useful for mods with somewhat lenghty base actor class names...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Is the new flagdef property okay for mods to use?

Post by Graf Zahl »

phantombeta wrote:While looking something up in GZDoom.pk3 for someone, I noticed this new keyword - I immediately tested it to see if it worked outside of GZDoom.pk3, and it does. So, is it okay for mods to use it?
Yes, it is.
Tangentially related: Is it really necessary for "property prefix: <identifier>;" to be locked to GZDoom.pk3? That would be really useful for mods with somewhat lenghty base actor class names...
The main problem here is that careless use of this feature can cause serious problems with property visibility. I only needed it because PlayerPawn properties were historically prefixed with 'player.' which in hindsight was a bad choice. The feature is also not very robustly implemented which with the limitation in place is ok, but not for general use.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Is the new flagdef property okay for mods to use?

Post by Matt »

Is there a significant functional difference between the new flagdef property and doing boolean properties the old-fashioned way, i.e. if I've already got a few cases of the latter is it worth converting them?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Is the new flagdef property okay for mods to use?

Post by Graf Zahl »

Flags consume less memory, because you can pack 32 flags into a single integer.
Aside from that, it was added so that they can defined with flag syntax.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Is the new flagdef property okay for mods to use?

Post by Matt »

So how do you use this? I can't come up with any variant on the syntax "flagdef CheatNotWeapon: WeaponFlags, 18;" that even compiles.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Is the new flagdef property okay for mods to use?

Post by Graf Zahl »

I cannot tell you what you did wrong. The syntac is 'flagdef <flagname>, <variablename>, bitnumber.
The variable must be defined explicitly before defining a flag.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Is the new flagdef property okay for mods to use?

Post by Matt »

Code: Select all

	int hdwflags;
	flagdef weaponbusy,hdwflags,1;
returns

Code: Select all

Unexpected integer constant
Expecting identifier
EDIT: Forgot about versioning. Will try again later.
Post Reply

Return to “Scripting”