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

Extra Arguments

Recommended Posts

Is there any possible way to add extra arguments in a script (particularly ACS_Execute/Always)? I'm trying to use a few lines of script to operate every spark in my map by feeding an extra argument (which supplies the TID) through ACS_ExecuteAlways.

Thanks in advance and sorry for the second help thread in a few days...

Share this post

Link to post

Not quite sure what you're asking here.

You want a single script to continuously loop through each spark thing and activate it? Not sure what you mean by an extra argument though, as scripts can only have three (not quite sure if functions can have more).

If it were me, I would have a script that loops through each spark thing (using a range of tids, or an array that holds all tids of the spark things), and calls another script via ACS_ExecuteAlways() that waits a random amount of time (so the sparks don't "sync") and the spark is activated.

Maybe something like:

#define MINSPARK 100  // All spark things in the map use a TID
#define MAXSPARK 120  // between 100 and 120...

Script 100 Open
  // Loop through each spark thing and call "sparking" script.
  For ( int X = MINSPARK; X <= MAXSPARK; X++)
    // The first script argument (third below), is
    // the TID of the spark thing to activate.
    ACS_ExecuteAlways(200, 0, X, 0, 0);
  Delay(70);  // Give all sparks enough time to finish.
  Restart;    // Fire off all sparks again.

// Sparking script. First argument (X from above) is the TID.
Script 200 (int TID)
  Delay(Random(0, 70));  // Get a random time to wait before sparking.
  Thing_Activate(TID);   // Now spark that bitch!
The first script controls sparking indefinitely, while the second script would actually activate the spark. A random delay is used so that the sparks do not all spark at the same instant. ACS_ExecuteAlways() is used, so the same script can be used under multiple instances, although each time it's called, the TID is different, and the random delay is as well.

Edit: You can also use the second script directly if you want to activate a particular spark. So, if you want to call the second script from another script, just copy the above ACS_ExecuteAlways() line and change the X to the TID you want to spark.

I didn't test it (thus I don't know how it looks in-game), and I might have got something wrong, so don't hold it against me. This is probably how I would approach the problem, although it would inevitably require some tweaking. :)

Share this post

Link to post

That's exactly what I was trying to accomplish, I think I need to get into C or C++ sometime so I can gain the competency of making scripts like these.

Thank you, I'm slowly learning ACS D=

Share this post

Link to post

Well, a difficult thing to understand is how arguments "line up". So I can sort of see your confusion regarding the "extra" arguments.

The ACS_Execute and ACS_ExecuteAlways specials require 5 parameters, however, only the last three arguments are passed to the actual script. The first one is the script to call and the second is which map (usually this is 0). The names of the argument variables in the actual script do not matter, but there order does.

So if I call:

ACS_Execute(200, 0, X, Y, Z);
Then script 200 which was just called should accept 3 arguments:
Script 200 (int ArgX, int ArgY, int ArgZ) { /* Code */ }
You can of course, omit any of those arguments. If the script is called with all 3 arguments, but the script really only uses 2 of them, the last one is simply ignored.

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
Sign in to follow this