[Not needed] Execute a script from a library

Moderator: Developers

Execute a script from a library

Postby HotWax » Mon Feb 05, 2007 12:46 pm

I don't know how plausible this is because I don't know how ACS scripts are currently loaded into memory.

The idea is this: A method guaranteed to execute a given script from a given library, regardless of what other scripts/libraries happen to be loaded at the same time.

The general idea is to have something like this in ACS that let's you specify the library name in addition to the script number:

Code: Select allExpand view
ACS_ExecuteEX(str Library, int Script, bool Always, int arg1, int arg2, int arg3, int arg4, int arg5)

Obviously this would have to be a built-in function as it takes a string. Note that I've removed the unnecessary Map argument and replaced it with a flag that determines whether to execute the script as normal or as if it was called with ACS_ExecuteAlways. If desired this could be done in a different way (with a separate function entirely, perhaps)

This becomes tricky at this point because the primary location for this to be useful, namely Decorate lumps, does not support built-in functions. To remedy that, I propose that A_ExecuteEX could be added and made to work the same way.

ExecuteWithResult could be added/extended in much the same way as above.

So why is this useful? It would let you specify that you want to execute script 1 from the MYLIB library, not the script 1 that happens to be on the current map, or the script 1 that belongs to the YOURLIB library. Currently this is gotten around by sticking scripts into libraries with hopefully obscure numbers that won't be reused -- however such a system is not guaranteed, especially when you start tacking on libraries. If it's desirable for mods to be made that are generic-use, as is commonly the aim of weapon mods or replacement mods, it would behoove us to have a solid way of ensuring there's no "cross-talk" between these add-ons.
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby Agent ME » Mon Feb 05, 2007 10:02 pm

I agree - could be very useful.

And maybe something like using "THISMAP" or "BEHAVIOR" instead of the Library name to guarantee that the map loads the script from itself? Or maybe a flag in the library that says its scripts can only be started by commands explicitly requesting the script from the library (but not affecting OPEN, ENTER, DEATH, RESPAWN, etc).
User avatar
Agent ME
Title Not Found
 
Joined: 22 Mar 2004
Location: California, USA

Postby HotWax » Tue Feb 06, 2007 9:50 am

Specifying BEHAVIOR should be sufficient, as I don't think anybody would be foolish enough to name their library BEHAVIOR. ;)
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby Zippy » Tue Feb 06, 2007 12:59 pm

Actually, since libraries are defined in their own namespace (A_START/A_END or /acs folder), I would imagine there really shouldn't be any limitation on the lump name, moreso since BEHAVIOR usually only has special significance when found after a map. So I think you could have a BEHAVIOR library if you really wanted, and the possibility should probably be reflected.
User avatar
Zippy
Scathing political commentary!
 
Joined: 23 Mar 2005
Location: Rochester

Postby HotWax » Tue Feb 06, 2007 2:22 pm

If it's truly desired that we maintain support for libraries named "BEHAVIOR" (which IMO is still bad practice even if it is technically allowed), we could instead use some other marker consisting of an invalid name. Perhaps "*" would work.
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby Zippy » Tue Feb 06, 2007 6:27 pm

I certainly agree that it's bad practice unless your library actually does something related to... behaving, I guess... but I've got those design standards I'm always thinking about. Something like "*" is much better since it isn't a valid lump name but is perfectably acceptable as a string argument.
User avatar
Zippy
Scathing political commentary!
 
Joined: 23 Mar 2005
Location: Rochester


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests