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

Few questions about ACS script

Recommended Posts

I have been writing ACS script to make events in my map for a while but I still have something that I curious about.

1. If it possible to declare Class like in programming languages that support object-oriented or Subroutine other than script and function?
Well, from my research, the first one may not possible but I want to know if there a way to make something similar to it.
For the subroutine (the function that return nothing), I know that it can be done with script but I don't like a bit that it has to be bounded with number. In my map, there are many scripts in it and sometimes I have a problem to rearrange the script number (I want the scripts with similar action to be together). Maybe I should add this to wishlist (script that can be declared with name, number and both together)?

2. How can I get the number of members in array? Is there any function like .length or .count? Or I have to define it myself?

3. Some imported ACS scripts don't show blue color in coding. This is not a big deal but I wonder why? It make me think the compiler doesn't know this script for the first time -_-"

4. Is there anyway to count the untagged projectiles (rocket, fireballs) that released from monsters and get their coordinates in specific tagged sector? I think this may be hard (or even not possible for now). I want to make the event related to this if possible.

Sorry if it seems like I complain and ask for something too much. I don't want to blame the developers since they have already done a great program for everyone to make Doom map with very easy way. It's ok for me now but it will be great if there are more features.

Share this post


Link to post

I assume it's for ZDoom or a derivative, or maybe Vavoom. There's no other port at the moment which has both ACS and rockets.

ACS is very limited, and is definitely not an object-oriented language.

1. Nope. No classes, no structs, nothing. There's only one variable type in ACS, and it's int. Even the strings are really ints.
2. You're supposed to already know them. Arrays are static and will have the time they're given at compilation.
3. If you mean syntax highlighting, it just means that your configuration isn't up to date. Syntax highlighting is not made by the compiler.
4. Yes, with ThingCountNameSector or ThingCountSector.

Share this post


Link to post

Oh! Thanks a lot for info! Now I know more about ACS language. And thanks for ThingCount function (I used ZDoom in UDMF format).

Anyway, I forgot to ask another thing. As I said, right now my code have many scripts and that result in many lines of code in SCRIPT page. Can I separated these script to other pages? I have tried to create new file from toolbar but don't know how to link the pages (i.e. scripts don't be found if I place them in other pages).

Share this post


Link to post

To link to other source files, using the #include directive, like when including zcommon.acs:

#include "zcommon.acs"  // Main definitions

#include "myscripts1.acs"  // Your stuff.
#include "myscripts2.acs"
#include "myscripts3.acs"
The contents of those files will literally be inserted where your include directives are, so make sure if you have any constants or variables, that you don't try to use them before declaring them. Sometimes it's easy to miss when using #includes.

Share this post


Link to post

Yeah, but there are a few problems IIRC. For example I've heard that Doom Builder tends to delete these files, thinking they were the temporary files it created to feed them to the compiler. So be sure to keep backups, or mark them as read-only.

Share this post


Link to post

Ah, thanks. I don't use Doombuilder so I've not ran into such things. Honestly, I prefer compiling from the command line. :p

Share this post


Link to post

Hmm. I must did something wrong here. I try to include my file but the error appears after compiling, saying that "Invalid Identifier" in zspecial.acs file (I think this is from SCRIPT page). Can you tell me in more detail about importing the file (like how to properly create a file, where or which folder to put a file).

Share this post


Link to post

They'll have to be in <your Doom Builder directory>\Compilers\ZDoom.

Share this post


Link to post

Still have the same problem even though I put it in the Complilers/ZDoom folder -_-" (I even tried to edit acc.cfg to include my file.)
Anyway, I decide not to separate the scripts for now because, although it is working, this means that when I release a wad I have to upload these files together with wad file in order to make it work (am I right?). And as you said, there may be a possibility that these files may be deleted by the program. I think I don't want to deal with that problem.

By the way, thanks you two very much!

Share this post


Link to post

Wow! That solve the error problem. I tried deleting #include zcommon.acs in main page and keep it in Fafrotskies.acs and it works! Thanks Edward.

Oh! And about bounding script with number, after I rethink about it I comes up with an idea. I declare a constant, use it as temporally script name, and assign script number to it. This way I can use ACS_Execute with script name. When I rearrange script numbers, I just have to change only 2 places: at value of constant and script number so it will be less problem for me now (but it should be better if I know this earlier, at this moment I almost reach 1000 lines of code -_-").

Share this post


Link to post

For the record: You don't have to put anything in your Complilers/ZDoom folder. You can put the .acs file in the same folder as your .wad file and the compiler should be able to find it there. Also, you can use subdirectories, but you will have to specify them in your #include statement ofcourse: #include "Map01Scripts\\Fafrotskies.acs"

Share this post


Link to post

Is that a rather new addition to ACC? I don't remember ACC accepting paths to files other than in the same directory.

Share this post


Link to post

Well it has been in there for a year or so I guess ;) I added it to make scripting in DB2 easier (so you don't have to mess around with paths). Although DB2 doesn't give you options for the include paths, it automatically provides the path of your .wad file as an "include path" where the compiler will look for includes.

Share this post


Link to post

I've tried putting Fafrotskies.acs in the same folder as my wad again, now fix the #include part, and it works. So, it's only the #include part that cause of this error message. No need to put a file in compilers folder. Thanks you guys :D

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
×