Naming scripts?
- Ixnatifual
- Posts: 2287
- Joined: Fri Dec 12, 2003 6:44 pm
- Contact:
- Chris
- Posts: 2971
- Joined: Thu Jul 17, 2003 12:07 am
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
True, but with a large script file, you'd have to go a ways to find it, and depending on coding style (and whether or not it's your script) it can make it pretty hard to spot.Most people put their scripts in order, starting with 1
I rest my caseAlso, the DB script editor currently has no search function

Ummmm.... You just proved my points for me.Chris wrote:True, but with a large script file, you'd have to go a ways to find it, and depending on coding style (and whether or not it's your script) it can make it pretty hard to spot.Most people put their scripts in order, starting with 1
I rest my caseAlso, the DB script editor currently has no search function
1) If the script NUMBERS are hard to spot, guess how hard a named script will be.
2) The DB script having no find function means that it's HARDER to locate NAMED scripts.
- Chris
- Posts: 2971
- Joined: Thu Jul 17, 2003 12:07 am
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
.. a lot easier since it's a unique conglomeration of words rather than a generic number that can appear multiple times? If you were writing code, would you use1) If the script NUMBERS are hard to spot, guess how hard a named script will be.
Code: Select all
void _1(char **argv, int argc);
int _2(char *filename);
char *_3(int index);
Code: Select all
void set_args(char **argv, int argc);
int find_arg(char *filename);
char *get_arg(int index);
Stop using a crappy script editor then.2) The DB script having no find function means that it's HARDER to locate NAMED scripts.

- Ty Halderman
- ... in rememberance ...
- Posts: 282
- Joined: Thu Jul 17, 2003 9:53 pm
- Location: New Orleans LA
- Contact:
Not to mention that it's handy to have standard named scripts that are #included or part of libraries. In Daedalus, we defined the "special" globally used scripts by name in a file that was #included in all levels. See D2K.ACS and D2KINCL.ACS for examples.
I wouldn't care about one that was only called from a line or sector special, since it's just a number there (though it's nice to be organized). But things that are actually called from other scripts, and in our case common things like random sound and enemy generators, elevators, etc. it was nice to have them named.
Yes, this is the first time I've been here in about a month
I wouldn't care about one that was only called from a line or sector special, since it's just a number there (though it's nice to be organized). But things that are actually called from other scripts, and in our case common things like random sound and enemy generators, elevators, etc. it was nice to have them named.
Yes, this is the first time I've been here in about a month

He really should.Chris wrote:Stop using a crappy script editor then.1) The DB script having no find function means that it's HARDER to locate NAMED scripts.
My acs scripting looks like this:
http://kai-n.gmxhome.de/test/
(including a named script example)

And all the scripts are just one doubleclick away

- Ty Halderman
- ... in rememberance ...
- Posts: 282
- Joined: Thu Jul 17, 2003 9:53 pm
- Location: New Orleans LA
- Contact:
Functions are for use as functions. For example, you can't do delays in functions, so they're not universally a substitute for a script.HotWax wrote:Ty: That's what functions are for.
Of course when we were naming our scripts, functions hadn't been implemented (I almost said "invented" but that would have been absurd). The big thing was to be able to change a script number in a central #include file in case of conflicts, etc. and not really care in the individual scripts what the actual number was.
Truth is, though, you'd never use numbers for anything like that if you had the choice of passing a name in line specials and whatnot. Numbers just aren't good variable names.
Now, I'm off to do a search on "what happened to hotwax's head."
- Ty Halderman
- ... in rememberance ...
- Posts: 282
- Joined: Thu Jul 17, 2003 9:53 pm
- Location: New Orleans LA
- Contact: