Assigning properties in GZDoom Builder?

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, 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.
Post Reply
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Assigning properties in GZDoom Builder?

Post by Major Cooke »

Is it possible where, say if you have a ZScript actor with a variable:

Code: Select all

Class MyActor : Actor
{
    int MyVar;
}
Is it currently possible to use the Custom tab to assign that variable directly?
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Assigning properties in GZDoom Builder?

Post by AFADoomer »

Only if it's name starts with 'user_' (e.g., 'user_MyVar' - and you're using UDMF, obviously). Then you can set the custom property to any integer value (so you can set ints, bools, and doubles with no decimal value, but setting string values is still broken in the engine's UDMF parser - everything parsed in is assumed to be an integer).

Graf very directly [No]ed adding the ability to directly set non-user-prefixed variables, since that's not in line with the UDMF spec... I still think that not allowing this artificially limits the mapper's abilities to customize individual actors, but it *is* against the spec as written.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Assigning properties in GZDoom Builder?

Post by Major Cooke »

Aaah. Well I can still work with that (though doubles without decimals is like... wat?).

Same thing for arrays?
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Assigning properties in GZDoom Builder?

Post by AFADoomer »

I don't know that setting array values is supported at all. Haven't tested it, though.

The problem is (or starts, at least) here in the UDMF parsing code. The current parser expects that any user_* variable will have an integer value, and doesn't handle any other type of input. The code is present to parse floats, strings, etc. (as seen in the hardcoded default properties in the same file), but there aren't any other token type checks performed on user_* attributes.

I vaguely remember a thread where Graf acknowledged that this was incorrect, but I don't think it was high on the priority list to fix...
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: Assigning properties in GZDoom Builder?

Post by Matt »

Are these "user_" things defined in ZScript the same way as other variables? I tried putting "var int user_<name>;" in the default block and GZDoom won't recognize it.
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: Assigning properties in GZDoom Builder?

Post by Matt »

Can someone please answer my question? I have no way to test this at all.
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Assigning properties in GZDoom Builder?

Post by AFADoomer »

Sorry! Leave out the initial "var " part and put the declaration outside of the Default block. Should work then. You should be able to use double, string, bool, etc., as the type as well.

You *can* declare variables without prepending "user_", but those won't be settable from GZDB.
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: Assigning properties in GZDoom Builder?

Post by Matt »

Thanks! So they really are just normal ZScript actor variables with "user_" before them, at least from the point of view of someone declaring them...
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Assigning properties in GZDoom Builder?

Post by AFADoomer »

Yes, that's correct.
Post Reply

Return to “Mapping”