Page 1 of 2
two different wads with the same script numbers.
Posted: Tue Jun 23, 2009 5:43 pm
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]
Re: two different wads with the same script numbers.
Posted: Tue Jun 23, 2009 5:45 pm
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.
Re: two different wads with the same script numbers.
Posted: Tue Jun 23, 2009 6:35 pm
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.
Re: two different wads with the same script numbers.
Posted: Tue Jun 23, 2009 6:56 pm
by Duducrazy
will this conflict happen even if one of the wads have a custom acs library?
Re: two different wads with the same script numbers.
Posted: Tue Jun 23, 2009 7:18 pm
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.
Re: two different wads with the same script numbers.
Posted: Tue Jun 23, 2009 7:51 pm
by Duducrazy
and how can i avoid these conflicts? is there any script number which not many wads uses it?
Re: two different wads with the same script numbers.
Posted: Tue Jun 23, 2009 8:54 pm
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.
Re: two different wads with the same script numbers.
Posted: Tue Jun 23, 2009 11:40 pm
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.
Re: two different wads with the same script numbers.
Posted: Wed Jun 24, 2009 1:04 pm
by Duducrazy
well, i was going to request this in the feature suggestion thread, but it would probably be a waste of time.
Re: two different wads with the same script numbers.
Posted: Wed Jun 24, 2009 5:17 pm
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.
Re: two different wads with the same script numbers.
Posted: Wed Jun 24, 2009 6:37 pm
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.
Re: two different wads with the same script numbers.
Posted: Fri Jun 26, 2009 12:45 pm
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.
Re: two different wads with the same script numbers.
Posted: Fri Jun 26, 2009 1:51 pm
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!
Re: two different wads with the same script numbers.
Posted: Fri Jun 26, 2009 2:09 pm
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.
Re: two different wads with the same script numbers.
Posted: Fri Jun 26, 2009 2:21 pm
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?