When I say "argument," I don't mean conflict or debate, I mean a value that is passed to a function, so the actor in question can be customized by a mapper, without editing the actual code. These values can be set in a map editor, to be used by the Decorate. They can be found here:
To start out, here are two helpful links:
- A_JumpIf -- A function that can jump an amount of frames based on arguments set in the editor.
- Decorate expressions -- A list of helpful things that can be used in the same way.
To use arguments in Decorate, you use the Args keyword. Args tells the decorate that you mean arguments. There are five values; 0 through 4, that correspond to arguments 1 through 5 in the editor. KEEP IN MIND,
when we use Args, for example, ZDoom uses argument 3, as set in the editor. As my computer science professor said: engineers have four fingers, because they start counting at 0.
There are two ways arguments can be incorporated into Decorate:A_JumpIf
is a very flexible jump function, capable of many things (A_JumpIf( ACS_ExecuteWithResult(###) == 1 ), "SomeState"), for example, is very powerful, and is one of the best ways of combining ACS and Decorate), and even makes some of the other Jump functions obsolete. It can also be used with the Args keyword to reference arguments. If I want to make a jump to the pain state when the fifth argument is 0, for example, I do this:
A_JumpIf(Args == 0, "Pain")
Keep in mind, A_JumpIf is like an If statement, in ACS: You have to tell it what it's comparing to. If you use A_JumpIf(Args, "Pain"), it won't work, because it doesn't know what it's doing with Args.
The second way is using Args directly in a parameter
. This is used a lot in several effects in the SFX Shoppe. If I did this:
A_CustomMissile("Projectile", Args, 0, Random(-Args, Args)
It would use whatever is set in the second argument for the height of the projectile, with a random spread depending on the third argument (plugging 5 in, in the editor, would make the spread -5 to 5). Args, to ZDoom, is just a number, and can be plugged in wherever ZDoom is looking for a number.
Also, I haven't run into this, nor do I expect anybody to, but you can use both together to avoid, for example, dividing by 0, like so:
A_JumpIf(Args < 1, "Fail")
That way, if the first argument is 0 (which can happen easily, since arguments are 0 by default), it won't even try.
I hope this helps! A lot of things, especially SFX, are a lot more useful when a mapper can customize its behavior. If a mapper doesn't have to even open up the wad to customize how an actor will act, they can set up more interesting situations or more beautiful environments for the player, for example.
(I know, some of the examples were really stupid, but it got the job done.)