Sarge
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > Extra Arguments
 
Author
All times are GMT. The time now is 14:17. Post New Thread    Post A Reply
Eternus
Junior Member


Posts: 110
Registered: 01-08


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...

Old Post 08-24-09 00:31 #
Eternus is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
EarthQuake
9.5 on the Richter!


Posts: 2710
Registered: 05-03


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:

code:
#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. :)

Old Post 08-24-09 06:51 #
EarthQuake is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Eternus
Junior Member


Posts: 110
Registered: 01-08


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=

Old Post 08-24-09 14:29 #
Eternus is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
EarthQuake
9.5 on the Richter!


Posts: 2710
Registered: 05-03


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:

code:
ACS_Execute(200, 0, X, Y, Z);


Then script 200 which was just called should accept 3 arguments:

code:
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.

Old Post 08-24-09 21:07 #
EarthQuake is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 14:17. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > Extra Arguments

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Forums Directory