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

Can't use action specials (ACS) - SOLVED

Recommended Posts

When I use them, the script does not compile. It doesn't matter whether it's ZDoom ACS or Zandronum ACS (Using GZDoom Builder here).

Had read somewhere in the wiki that I can use Action Specials as normal procedures/functions. How am I supposed to lower / raise sectors without them? Any idea why I can't use them? And this bloody compiler has no stacktrace / does not state the error.

bug.png

EDIT: Solved, sorry. Beginner mistake. Forgot to use the #include directive -.- Absolutely pathetic. Without including "zspecial.acs", it would never work.

Edited by RederickDeathwill

Share this post


Link to post

You need to initialize "SectorTag" variable first. Add a only one line "Int SectorTag;" above the first script. Not in each script. This creates conflict.

I think you'll have to create a few special variables or reconsider the structure of the scripts.

 

What exactly do you plan, if not secret?

Share this post


Link to post
5 minutes ago, StormCatcher.77 said:

You need to initialize "SectorTag" variable first. Add a only one line "Int SectorTag;" above the first script. Not in each script. This creates conflict.

I think you'll have to create a few special variables or reconsider the structure of the scripts.

 

What exactly do you plan, if not secret?

But sectorTag is just the input argument (Which I pass when I call the script). There's no reason to initialize it in global scope. When I press "use" on this sidedef I get a: "p_startscript unknown script 3" error. The ACS script is not being compiled, because I'm using action specials (They're not working for some reason). Just want to lower it :p Prefer to use scripts / get used with the actions.

 

Input Argument.png

Share this post


Link to post

I try to compile your code in empty map... no any errors.

>.< ?????

#include "zcommon.acs"

Script 1 (Void) {
    For (int i = 1; i < 6; i++) { SpawnSpot("ShotgunGuy", i); }
}

Script 2 (Int sectorTag) { 
    For (int i = 6; i < 10; i++) { SpawnspotFacing ("Cacodemon", i); }
    SpawnSpotFacing ("SuperShotgun", 10);
    Light_Fade(sectorTag, 350, 5000);
}

Script 3 (Int sectorTag) { Floor_LowerToNearest(sectorTag, 16); }

I try it in GZDoomBuilder2.3.0

 

By the way, I really did not know that scripts can have the same input arguments.

Share this post


Link to post
54 minutes ago, StormCatcher.77 said:

I try to compile your code in empty map... no any errors.

>.< ?????


#include "zcommon.acs"

Script 1 (Void) {
    For (int i = 1; i < 6; i++) { SpawnSpot("ShotgunGuy", i); }
}

Script 2 (Int sectorTag) { 
    For (int i = 6; i < 10; i++) { SpawnspotFacing ("Cacodemon", i); }
    SpawnSpotFacing ("SuperShotgun", 10);
    Light_Fade(sectorTag, 350, 5000);
}

Script 3 (Int sectorTag) { Floor_LowerToNearest(sectorTag, 16); }

I try it in GZDoomBuilder2.3.0

 

By the way, I really did not know that scripts can have the same input arguments.

Discovered in the other post. I was developing an "ammo recharger" script that can take many terminals. The terminals could only be differentiated through input arguments. I'm using input arguments for the tags of the sectors. It's way clearer than using raw numbers in the script which seem to come from nowhere (Hate that. In C++/Java/Python, I'd use constants to avoid that). In this way, when I click on the sidedef, I know to which sector the script belongs. The post had some usefulness then, because it was all about me being stupid :p Forgot to include the bloody functions!! (Probably a Python evil).

Share this post


Link to post
2 hours ago, Empyre said:

You can use constants in ACS (and DECORATE, too, also described on that page):

https://zdoom.org/wiki/Constants

In this specific case wouldn't make much sense to do something like:

#define SECTOR_ONE 1

I'm enjoying using input arguments because it's easier / clearer to identify to which script the to-be-altered sector is associated to. But yeah, quite a beautiful work the creator did with this scripting language. It's quite complete, and with a hell of a syntax for a scripting language (I mean, he could have used LUA or something instead, but nope, he reinvented the wheel using a C++ syntax, and in a quite admirable fashion). 

Share this post


Link to post
9 hours ago, RederickDeathwill said:

And this bloody compiler has no stacktrace / does not state the error.

It does display the error, but it's awkwardly hidden.

 

If you look at the bottom of the editing window you'll see a bar with two triangles:

wepd13i.png

 

That's the retractable error list. But for some reason it doesn't expand automatically when an error occurs. So if there's an error the triangles should switch to point down. Then you can drag the bar up (not on the dotted line, but to the left or right of it) to see the error. I think you have to do that once after starting the program.

 

The result will be something like this:

0yPrF8f.png

Share this post


Link to post
1 hour ago, boris said:

It does display the error, but it's awkwardly hidden.

 

If you look at the bottom of the editing window you'll see a bar with two triangles:

wepd13i.png

 

That's the retractable error list. But for some reason it doesn't expand automatically when an error occurs. So if there's an error the triangles should switch to point down. Then you can drag the bar up (not on the dotted line, but to the left or right of it) to see the error. I think you have to do that once after starting the program.

 

The result will be something like this:

0yPrF8f.png

-.-, i had clicked everywhere! Thank you very much for pointing out those arrows. 

Share this post


Link to post

I see you solved it but yes, you ALWAYS need #include "zcommon.acs" at the top or else nothing will work. I wonder why GZDoom Builder doesn't automatically add this when you go into the script editor?

Share this post


Link to post
17 minutes ago, Nevander said:

I see you solved it but yes, you ALWAYS need #include "zcommon.acs" at the top or else nothing will work. I wonder why GZDoom Builder doesn't automatically add this when you go into the script editor?

The zcommon.acs file includes the other 3 in it:

#include "zspecial.acs"
#include "zdefs.acs"
#include "zwvars.acs"

Perhaps some more "advanced" users like to use their own .acs files, with their own specific declarations. In general, it's basic stuff, the GZDoom developer probably assumes that the user wanting to play with scripting knows that. And besides, under edit there's an "insert snippet" submenu with an #include directive that inserts zcommon.acs :p 

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
×