OPEN/ENTER script order discrepency
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.
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.
- Ijon Tichy
- Posts: 104
- Joined: Fri Dec 31, 2010 9:22 pm
- Location: Basically I don't exist
- Contact:
OPEN/ENTER script order discrepency
So as a result of tracking down inconsistent script orders in Zandronum, I noticed that in ZDoom, OPEN scripts run before ENTER scripts in single player and coop, but after ENTER scripts in deathmatch. Is that intentional?
Re: OPEN/ENTER script order discrepency
It's unintentional, however this is because script execution order is undefined. Scripts that rely on it would be better off being rewritten, as the rules can change at any time.
Also, singleplayer/coop has ENTER scripts running before OPEN at the moment. You may want to recheck your analysis.
Also, singleplayer/coop has ENTER scripts running before OPEN at the moment. You may want to recheck your analysis.

- Ijon Tichy
- Posts: 104
- Joined: Fri Dec 31, 2010 9:22 pm
- Location: Basically I don't exist
- Contact:
Re: OPEN/ENTER script order discrepency
I did.

Also, considering a map needs to be opened before anyone can enter it, it seems pretty natural for OPEN to run before ENTER.
Guess Zandronum's going to be making this explicit, then.

Also, considering a map needs to be opened before anyone can enter it, it seems pretty natural for OPEN to run before ENTER.
Guess Zandronum's going to be making this explicit, then.
Re: OPEN/ENTER script order discrepency
Your analysis is false: http://pastebin.com/wyUijLKc
Take note of lines 14 and 15. You are seeing the result of how the ACSVM steps down each executed script by number, however ENTER scripts are still being called before OPEN scripts. This is exactly why the behaviour is undefined as you cannot rely on it.
Take note of lines 14 and 15. You are seeing the result of how the ACSVM steps down each executed script by number, however ENTER scripts are still being called before OPEN scripts. This is exactly why the behaviour is undefined as you cannot rely on it.
- Ijon Tichy
- Posts: 104
- Joined: Fri Dec 31, 2010 9:22 pm
- Location: Basically I don't exist
- Contact:
Re: OPEN/ENTER script order discrepency
So you're saying the very output GZDoom (checked out and compiled just 2 minutes ago from the Git repo, so I know you aren't bullshitting me) puts out is wrong?

(why the fuck does gzdoom think I'm using oss I told it to use alsa god damn why are you so dumb)
(why the fuck can I not think straight brain god damn why are you so dumb)
edit: Even flipping the order of the scripts' definitions and swapping their script numbers so that OPEN is 302 and ENTER is 301 doesn't change it. It's clearly been this way since 2.3.1, since Zandronum 1.2, based off of that release, does this too. I don't know what the hell you're seeing, but it doesn't line up with the output I'm getting.
edit2: Also, ZDoom itself isn't exactly clean of warnings and undefined behaviour itself and it still runs fine, so whatever maaaaaaaaaaaaaaaan

Code: Select all
#include "zcommon.acs"
#library "opennotfirst"
int MapVar = 0;
script 301 OPEN { Print(s:"Open has run, time = ", d:Timer(), s:", mapvar = ", d:MapVar++); }
script 302 ENTER { Print(s:"Enter has run, time = ", d:Timer(), s:", mapvar = ", d:MapVar++); }
(why the fuck can I not think straight brain god damn why are you so dumb)
edit: Even flipping the order of the scripts' definitions and swapping their script numbers so that OPEN is 302 and ENTER is 301 doesn't change it. It's clearly been this way since 2.3.1, since Zandronum 1.2, based off of that release, does this too. I don't know what the hell you're seeing, but it doesn't line up with the output I'm getting.
edit2: Also, ZDoom itself isn't exactly clean of warnings and undefined behaviour itself and it still runs fine, so whatever maaaaaaaaaaaaaaaan
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49229
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: OPEN/ENTER script order discrepency
The order is undefined. Starting a script merely means queuing it for execution. Execution itself depends on the order in the script table.
- TerminusEst13
- Posts: 1625
- Joined: Mon Nov 09, 2009 3:08 pm
- Contact:
Re: OPEN/ENTER script order discrepency
I just swapped around the order of the Enter script and the Open script so that the Enter script was before Open.Graf Zahl wrote:The order is undefined. Starting a script merely means queuing it for execution. Execution itself depends on the order in the script table.
Open still ran before Enter.


If anyone would like to check for themselves, I've uploaded a test .pk3 I made with ijon's script.
- Attachments
-
opennotfirst.pk3
- banana of hammer
- (740 Bytes) Downloaded 21 times