[ZScript] Order in Events intentionally different?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan Support
Location: The Netherlands

[ZScript] Order in Events intentionally different?

Post by gwHero »

Hi,
since I couldn't find the answer on the wiki and the several topics concerning ZScript EventHandlers, I'll post my question here.

I was surprised to find out that the PlayerEntered event is called BEFORE the WorldLoaded event.
Is this intentionally different from their ACS counterparts, where ENTER is called AFTER the OPEN event?

It's of course not a problem, but quite fundamental to know if this shift in order is indeed as designed.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 47995
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [ZScript] Order in Events intentionally different?

Post by Graf Zahl »

This is because the player enters a map BEFORE it is fully loaded - the player spawn is part of loading the map.
The reason why ACS is different is, because ACS scripts are not run when being requested, but later when the ACS thinker performs its first thinking turn and has a chance to do a bit of ordering.
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan Support
Location: The Netherlands

Re: [ZScript] Order in Events intentionally different?

Post by gwHero »

Thanks for answering, it's good to know for migrating from ACS to ZScript to keep this in mind.
User avatar
Drake Raider
Posts: 469
Joined: Fri Jul 18, 2008 12:27 pm
Location: Plane of thought.

Re: [ZScript] Order in Events intentionally different?

Post by Drake Raider »

Out of curiousity, because this may or may not relate to something I was thinking of, does this mean we can use zscript to affect things such as slopes and other stuff that used to be the exclusive domain of map definition? It would be cool to add slopes to existing doom maps ingame.

Return to “Scripting”