[ZSCRIPT] My named arguments are not working.

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!)
yum13241
Posts: 697
Joined: Mon May 10, 2021 8:08 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): EndeavorOS (basically Arch)
Graphics Processor: Intel with Vulkan/Metal Support

[ZSCRIPT] My named arguments are not working.

Post by yum13241 »

Hate for my "back from "vacation"" to be this, but here we go.

ZSLightningGun:
Spoiler:


ZMonstrousWeapon:
Spoiler:


A_RailAttack is a LONG function, so I want to split up its arguments to make it easier to read. I'm getting an error:

Script error, "MW_ADDON_v1.0.pk3:zscripts/weapons.zs" line 528: Cannot use a named argument here - not all required arguments have been passed.

But I'm using every single argument! How do I fix this and how do I avoid it in the future?
User avatar
phantombeta
Posts: 2052
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: [ZSCRIPT] My named arguments are not working.

Post by phantombeta »

Only optional arguments can be used with names, and you're passing in a required argument by name.
yum13241
Posts: 697
Joined: Mon May 10, 2021 8:08 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): EndeavorOS (basically Arch)
Graphics Processor: Intel with Vulkan/Metal Support

Re: [ZSCRIPT] My named arguments are not working.

Post by yum13241 »

So then how do I pass a mandatory argument like that whit my current setup?
User avatar
ramon.dexter
Posts: 1387
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: [ZSCRIPT] My named arguments are not working.

Post by ramon.dexter »

Without the names. Only numbers.
yum13241
Posts: 697
Joined: Mon May 10, 2021 8:08 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): EndeavorOS (basically Arch)
Graphics Processor: Intel with Vulkan/Metal Support

Re: [ZSCRIPT] My named arguments are not working.

Post by yum13241 »

Solution: Remove the damage: part.

Return to “Scripting”