[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.

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!)
Post Reply
User avatar
Sarah
Posts: 551
Joined: Wed Sep 06, 2006 12:36 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): Debian 11 (bullseye), Windows 10
Location: Middle of Nowheresville Il.
Contact:

[ZScript] Event Handlers and Titlemaps

Post by Sarah »

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
Player701
 
 
Posts: 1709
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: [ZScript] Event Handlers and Titlemaps

Post by Player701 »

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
Sarah
Posts: 551
Joined: Wed Sep 06, 2006 12:36 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): Debian 11 (bullseye), Windows 10
Location: Middle of Nowheresville Il.
Contact:

Re: [ZScript] Event Handlers and Titlemaps

Post by Sarah »

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
Player701
 
 
Posts: 1709
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: [ZScript] Event Handlers and Titlemaps

Post by Player701 »

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
Sarah
Posts: 551
Joined: Wed Sep 06, 2006 12:36 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): Debian 11 (bullseye), Windows 10
Location: Middle of Nowheresville Il.
Contact:

Re: [ZScript] Event Handlers and Titlemaps

Post by Sarah »

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
Player701
 
 
Posts: 1709
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: [ZScript] Event Handlers and Titlemaps

Post by Player701 »

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
Sarah
Posts: 551
Joined: Wed Sep 06, 2006 12:36 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): Debian 11 (bullseye), Windows 10
Location: Middle of Nowheresville Il.
Contact:

Re: [ZScript] Event Handlers and Titlemaps

Post by Sarah »

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!
Post Reply

Return to “Scripting”