Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Can you print the value of an argument?

Recommended Posts


It would be useful to see what value an argument is currently holding, but at least A_Print doesn't seem to work too well for this.

This code crashes on startup:

And if I write this instead...
...it will just print "args_3_" in the game.

Are there any other options?

Share this post

Link to post

Arguments are identified by a name. Don't you give names to the arguments in the script's head definition? Such as:

script 1 (int a, int b, int c, int d) {
In the code above, d is your args[3].

EDIT: I'm sorry, disregard the above, I thought you were talking about Print in ACS.

EDIT2: Well, A_Print can only have 3 arguments, so perhaps you have to call args[2]. Args[0] is the 1st argument. Args[3] would be a 4th one.

Share this post

Link to post

Sorry, I meant I was trying to achieve this in the decorate code without using scripts, like so:

 TNT1 A 0 A_Print(args[3])
// TNT1 A 0 A_Print("args 3 is currently equal to: " + args[3])
Is scripting the only way to do this, then?


Ok, I've now read your edit above, and tried with args[2], but it crashes on startup as well.

Share this post

Link to post

Now I see - my advice above is pretty stupid, because it's not about parameters for A_Print (of course!), but the thing's arguments.

Try to pass all A_Print parameters.

If you're testing the wad with Zandronum source port, try ZDoom, because Zandronum doesn't support some features (yet).

If it fails, I don't know then. I can only recommend ACS script.

EDIT: And also, what exactly do you mean by "crashes on startup"? Is there any error message? Is it startup of a map or the whole wad?

Share this post

Link to post

It's the WAD that crashes on startup, because of having 'args[2]' inside the A_Print. The error message says it expected a ',' but got a '[' instead. I guess A_Print can only take strings and nothing else?

Maybe I'll give this another shot using scripts instead, I'll just first have to refresh my memory on those since it's been a while.

Share this post

Link to post
D2Jk said:

I guess A_Print can only take strings and nothing else?

It's quite possible, the wiki page implies it.

Print function in ACS is definitely more flexible.

Share this post

Link to post

Now trying with this script:

Script "PrintArgument" (int Test)
  print (d:Test);
And for testing, I'm using this code in a Ready-state of a weapon:
  CHGG A 1 A_WeaponReady
  TNT1 A 0 A_SetArg(2, args[2]+1)
  TNT1 A 0 ACS_NamedExecute("PrintArgument", 0, args[2])
The printed message on the screen doesn't seem to update; it prints "0" once, and doesn't come back after it's faded out, despite being continously called in the looped ready-state. Why is this?

EDIT 1: Nevermind, suddenly it began working (?). Thanks for the help. :-)

EDIT 2: Is it possible to control player's FoV with ACS?

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now