OPEN/ENTER script order discrepency

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.
Locked
User avatar
Ijon Tichy
Posts: 104
Joined: Fri Dec 31, 2010 9:22 pm
Location: Basically I don't exist
Contact:

OPEN/ENTER script order discrepency

Post by Ijon Tichy »

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?
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: OPEN/ENTER script order discrepency

Post by edward850 »

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. :P
User avatar
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

Post by Ijon Tichy »

I did.

Image

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.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: OPEN/ENTER script order discrepency

Post by edward850 »

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.
User avatar
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

Post by Ijon Tichy »

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?

Image

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 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
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49229
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: OPEN/ENTER script order discrepency

Post by Graf Zahl »

The order is undefined. Starting a script merely means queuing it for execution. Execution itself depends on the order in the script table.
User avatar
TerminusEst13
Posts: 1625
Joined: Mon Nov 09, 2009 3:08 pm
Contact:

Re: OPEN/ENTER script order discrepency

Post by TerminusEst13 »

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.
I just swapped around the order of the Enter script and the Open script so that the Enter script was before Open.
Open still ran before Enter.

Image

Image

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
Locked

Return to “Editing (Archive)”