[ZScript] Event Handlers and Titlemaps

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.

[ZScript] Event Handlers and Titlemaps

Postby Nero » Sun Sep 12, 2021 8:22 pm

Hello everyone! Quick question about event handlers and titlemaps, are network events not processed by event handlers in a titlemap? That's pretty much it, thanks! :D
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: [ZScript] Event Handlers and Titlemaps

Postby Player701 » Tue Sep 14, 2021 1:33 am

No, events are only processed within playable levels, there is a check in the source code for that. On titlemaps, gamestate is GS_TITLELEVEL and not GS_LEVEL, so events do not work.
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [ZScript] Event Handlers and Titlemaps

Postby Nero » Tue Sep 14, 2021 4:10 pm

Ok, that's a wrench in my gears, I have code trying to communicate through net events during the titlemap. So what is the reason behind disabling net events on titlemaps? Also what if the titlemap is nothing more than a launch point to transfer to one of the actual game maps to be used as the titlemap? The gamestate remains the same but now I've potentially got a broken level. Just curious, I can investigate a workaround, thanks for the response!
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: [ZScript] Event Handlers and Titlemaps

Postby Player701 » Wed Sep 15, 2021 12:11 am

Nero wrote:So what is the reason behind disabling net events on titlemaps?

I can't say for sure, but I know that network events are primarily intended for the user (i.e. player) to send information to the playsim in a multiplayer-friendly way. But on a titlemap, there is no multiplayer, and the player is not supposed to interact with the map at all, which makes this mechanism kind of pointless. It's quite likely that what you are trying to do can be accomplished in some other way, without using network events.
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [ZScript] Event Handlers and Titlemaps

Postby Nero » Wed Sep 15, 2021 5:41 pm

I'm trying to display graphics on the screen during the title sequence, which I could do with ACS, but I kinda spent a bunch of time writing ZScript Windows to do that so I don't have to write ACS :P
The net events are a critical component of making ZScript Windows multiplayer-friendly, and if ZScript Windows actors can't communicate with the event handler, then everything's broke. That's a pickle.
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: [ZScript] Event Handlers and Titlemaps

Postby Player701 » Wed Sep 15, 2021 11:46 pm

UI-related functions such as UiTick and RenderOverlay should work on titlemaps, so you can add a special check there (e.g. if (Level.MapName == "TITLEMAP")) and create your windows directly instead of using an event. This shouldn't break anything because titlemaps themselves do not support multiplayer, like I said before.
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [ZScript] Event Handlers and Titlemaps

Postby Nero » Thu Sep 16, 2021 5:57 pm

Looks like this will be a fairly straightforward workaround, but new question, is it possible to check the gamestate? Looking for the map name to be "TITLEMAP" breaks teleporting to a different map.

Scratch that, yes it is. Looks like I got this handled, no pun intended :P Thanks!
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.


Return to Scripting

Who is online

Users browsing this forum: No registered users and 3 guests