Versioning ZScript - different versions in 1 project?

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
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Versioning ZScript - different versions in 1 project?

Post by Enjay »

Purely out of interest, this is not a situation that I have come across, I was wondering if differently versioned ZScript files can be used in the same project?

For example, if someone on here makes and shares a ZScript resource file of some sort and it is versioned to 3.4 and someone else provides a file versioned at 3.5, can they both be put in the same sub folder of a single PK3 and #included in the main ZScript file?

To be honest, I'm not fully sure what versioning does. I assume that it means the engine will compile the contents of the ZScript files under the rules that existed when the version that they are versioned to was current, even though the engine has since moved on to subsequent versions? What a badly worded question. :lol: Anyway, is that correct?
User avatar
AFADoomer
Posts: 1325
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Versioning ZScript - different versions in 1 project?

Post by AFADoomer »

I think that the version directive is only supposed to be used once, as the first line of your 'zscript.txt' file.

Essentially, the version number you define tells GZDoom to read your script as if you were running that version of GZDoom (with only that engine version's feature set)... If you use "2.4", your mod will be able to run on GZDoom 2.4 or newer, and only the features that were available in the GZDoom 2.4 codebase will be available to your script (I'm not 100% sure, but I think you also won't see any warnings or errors from functions that were deprecated in a later version - but I haven't tested that). If you use "3.6", all features up to and including those of the newest dev builds will be available, but your mod won't run on anything older than the dev builds.

For maximum engine compatibility (that is, to let your mod run with the oldest version of GZDoom possible), you should use the number that corresponds to the first version that contains all of the functions/classes/features that you use in your scripts. If you're not too worried about compatibility with old engine versions, you can probably get away with just using the current released GZDoom version number that you are designing for...
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Versioning ZScript - different versions in 1 project?

Post by phantombeta »

AFADoomer wrote: If you use "2.4", your mod will be able to run on GZDoom 2.4 or newer, and only the features that were available in the GZDoom 2.4 codebase will be available to your script (I'm not 100% sure, but I think you also won't see any warnings or errors from functions that were deprecated in a later version - but I haven't tested that).
This is incorrect. Most features don't use the versioning system at all. The versioning system is used for deprecations and when changes need to be made to the ZScript compiler syntax that would break mods made for a previous ZScript version, in which case, the change is only enabled for versions newer than said version. You don't need to use a version number higher than "2.4" to use most of the features available.

(You should, of course, try to use the latest version you can, if possible, due to the mentioned changes. A great example of one such change is how you can't put defaults in a virtual function override after a certain ZScript version)
Post Reply

Return to “Scripting”