Naming scripts?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
Ixnatifual
Posts: 2287
Joined: Fri Dec 12, 2003 6:44 pm
Contact:

Post by Ixnatifual »

I place my scripts alphabetically.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Uhhh, Chris... Most people put their scripts in order, starting with 1. Therefore it's easier to find script 123 because it's after 122 and before 124. If it has a name, it could be anywhere.

Also, the DB script editor currently has no search function.
User avatar
Chris
Posts: 2971
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Post by Chris »

Most people put their scripts in order, starting with 1
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.
Also, the DB script editor currently has no search function
I rest my case ;)
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Chris wrote:
Most people put their scripts in order, starting with 1
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.
Also, the DB script editor currently has no search function
I rest my case ;)
Ummmm.... You just proved my points for me.

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.
User avatar
Chris
Posts: 2971
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Post by Chris »

1) If the script NUMBERS are hard to spot, guess how hard a named script will be.
.. 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 use

Code: Select all

void _1(char **argv, int argc);
int _2(char *filename);
char *_3(int index);
Or

Code: Select all

void set_args(char **argv, int argc);
int find_arg(char *filename);
char *get_arg(int index);
2) The DB script having no find function means that it's HARDER to locate NAMED scripts.
Stop using a crappy script editor then. :P
User avatar
Ty Halderman
... in rememberance ...
Posts: 282
Joined: Thu Jul 17, 2003 9:53 pm
Location: New Orleans LA
Contact:

Post by Ty Halderman »

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 :)
User avatar
cccp_leha
Posts: 1816
Joined: Wed Jul 16, 2003 7:21 am
Location: NJ, USA
Contact:

Post by cccp_leha »

Hey, welcome back Ty, long time no see! Ragnarok...
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Ty: That's what functions are for.
GameArena
Posts: 182
Joined: Wed Jul 16, 2003 4:35 pm
Location: Outside of a bubble... Looking at all the humans inside.

Post by GameArena »

A function such as SetScriptAlias(Name, Number) would be very easy to create and may be useful.
User avatar
kn
Posts: 28
Joined: Wed Jul 30, 2003 4:45 pm
Location: NRW
Contact:

Post by kn »

Chris wrote:
1) The DB script having no find function means that it's HARDER to locate NAMED scripts.
Stop using a crappy script editor then. :P
He really should.

My acs scripting looks like this:

http://kai-n.gmxhome.de/test/

(including a named script example) 8-)

And all the scripts are just one doubleclick away ;)
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Post by Xaser »

Heh. A Foreign Language Script Editor. :P
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Xaser wrote:Heh. A Foreign Language Script Editor. :P

Not for me! :P
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Post by Xaser »

OMFG GERMAN!!!
User avatar
Ty Halderman
... in rememberance ...
Posts: 282
Joined: Thu Jul 17, 2003 9:53 pm
Location: New Orleans LA
Contact:

Post by Ty Halderman »

HotWax wrote:Ty: That's what functions are for.
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.

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."
User avatar
Ty Halderman
... in rememberance ...
Posts: 282
Joined: Thu Jul 17, 2003 9:53 pm
Location: New Orleans LA
Contact:

Post by Ty Halderman »

cccp_leha wrote:Ragnarok...
:x
Post Reply

Return to “General”