two different wads with the same script numbers.

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Duducrazy
Posts: 600
Joined: Sat Aug 21, 2004 6:16 pm

two different wads with the same script numbers.

Post by Duducrazy »

i have a question. let's say i'm playing an zdoom/gzdoom map with a weapons mod, both of them with lots of acs scripts. i want to know what happens when both wads have the same script number.

ex:
a level uses script 666 to trigger an earthquake sequence, but a weapon uses the same script number to check for an dummy inventory item. [insert another example here]
User avatar
Captain Ventris
Posts: 4609
Joined: Mon Jul 31, 2006 4:25 pm
Location: San Antonio, TX

Re: two different wads with the same script numbers.

Post by Captain Ventris »

I'm thinking that either there would be an error message in the console, or the wad loaded last would take precedent, like in other instances of conflict.
User avatar
Project Shadowcat
Posts: 9369
Joined: Thu Jul 14, 2005 8:33 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: Blacksburg, SC USA
Contact:

Re: two different wads with the same script numbers.

Post by Project Shadowcat »

Captain Ventris wrote:I'm thinking that either there would be an error message in the console, or the wad loaded last would take precedent, like in other instances of conflict.
The latter is correct. Either way it's bad.
User avatar
Duducrazy
Posts: 600
Joined: Sat Aug 21, 2004 6:16 pm

Re: two different wads with the same script numbers.

Post by Duducrazy »

will this conflict happen even if one of the wads have a custom acs library?
User avatar
Project Shadowcat
Posts: 9369
Joined: Thu Jul 14, 2005 8:33 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: Blacksburg, SC USA
Contact:

Re: two different wads with the same script numbers.

Post by Project Shadowcat »

Duducrazy wrote:will this conflict happen even if one of the wads have a custom acs library?
It'll happen even if both scripts of the same number are in the same WAD -- let alone in different WADs. The one with the map take precedence over the one with the Global library... I think.
Doesn't matter where it is, the conflict will happen.
User avatar
Duducrazy
Posts: 600
Joined: Sat Aug 21, 2004 6:16 pm

Re: two different wads with the same script numbers.

Post by Duducrazy »

and how can i avoid these conflicts? is there any script number which not many wads uses it?
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: two different wads with the same script numbers.

Post by Gez »

Hexen-format maps can only use script numbers in the 1--255 range (not sure whether that constraint is artificially kept in UDMF or not), so libraries are encouraged to use scripts in the 256--999 range.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: two different wads with the same script numbers.

Post by HotWax »

There is unfortunately no way to guarantee your script numbers won't stomp on someone else's, as there are no "reserved" script ranges. It's been requested a couple of times to allow for scripts in different WADs to be placed in their own "scope" but so far it has not been done. I don't know how difficult it would be to code in, but it seems the developers don't want to go to the effort it would take.
User avatar
Duducrazy
Posts: 600
Joined: Sat Aug 21, 2004 6:16 pm

Re: two different wads with the same script numbers.

Post by Duducrazy »

well, i was going to request this in the feature suggestion thread, but it would probably be a waste of time.
User avatar
Reilsss
Posts: 184
Joined: Thu Mar 06, 2008 1:38 am
Location: Germany
Contact:

Re: two different wads with the same script numbers.

Post by Reilsss »

Maybe you should just try. We can think alot for Grafzahl and the others, but still it wont reflect there own thougths and edscitons. Eventually you find out a nice suprice.
User avatar
Apothem
Posts: 2070
Joined: Sat Nov 29, 2003 7:13 pm
Location: Performing open heart surgery on an ACS compiler.

Re: two different wads with the same script numbers.

Post by Apothem »

Whatever loads last is whatever has it's scripts run is the best rule of thumb. Best thing to do for script numbers is pick the rarely used numbers- try using the 500's. If there are any specific mods you want yours to work with, make sure to test your mod with those as well.
User avatar
ThatOneZDoomer
Posts: 226
Joined: Sun Jun 01, 2008 1:33 am
Preferred Pronouns: She/Her
Location: Where I'm at of course

Re: two different wads with the same script numbers.

Post by ThatOneZDoomer »

This has always bugged me, which is why if I use any ACS scripts in my stuff, I tend to keep the number of scripts as low as possible and keep the numbers in the high range. I use the upper 700s range, although I don't know how many mods also use scripts in that range. Sometimes when I look at map scripts, they can have script numbers all over the place, from the number range 1-80, yet a script or two that will randomly have something like 568 or 665. I like when scripts are just neatly numbered starting from one and only increases by one, so if a map used 23 scripts, they'll fall between 1-23, not randomly scattered between a bunch of numbers. If only there were a standard for map scripts to be in the low number range and global scripts like those used in weapon mods to be in the higher ranges to avoid any possible conflicts. What if ranges 1-255 were used for maps? Would a single map really need more then 255 scripts?

I'm not talking about changing the way things work now, since of course that would break many pre-existing mods, but rather, possibly a standard to be throughout the community for newer mods. I'm hardly the person to make sure a thing happen, but just a thought.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: two different wads with the same script numbers.

Post by wildweasel »

If I ever use ACS in my mods - which is turning into more of a rarity now that most of my stuff can be done through Decorate and character classes - I tend to use script numbers 357, 454, 556, and 762. Random selections? Nope - ammunition types!
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: two different wads with the same script numbers.

Post by Gez »

Since acceptable script numbers are in the 1--999 range, a way to make all scripts compatible would be by automatically adding a number to them according to the load order. i.e., scripts from the iwad would have 0 added to their number, scripts from the first mod loaded after the iwad would have 1000 added to their numbers, scripts from the second mod would have 2000 added to their numbers, and so on. And every call would be updated accordingly: if script 5-but-now-1005 calls script 6, the call will be translated to script 1006. The same translation would happen to ACS_Execute calls in maps and decorate code.

Such a system might require some tinkering to be implemented -- the incrementation should only happen for "top level" files loaded, so that if you have a mod that's made using the "collection of wads in a zip file" system it won't be broken as all of the wads in that archive will have the same script increment, and you might want to have the "puke" console command tell you, when it doesn't find script X, that you might want script X+1000 instead.

But it would solve the problem forever.
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Re: two different wads with the same script numbers.

Post by Ryan Cordell »

There was probably a reason "named scripts" were rejected, as in, scripts having names rather than numbers (And not by DEFINE-ing them, because it would solve nothing.), but I can't remember what was it?

EDIT: Your solution looks very sweet, Gez, but, how much could X+1000 work anywho? What if there was someone who would actually load about 10 mods that did seperate little things?
Locked

Return to “Editing (Archive)”