Page 1 of 1

Way to disable "netevent cannot be used outside of a map"

PostPosted: Sun Dec 30, 2018 7:48 am
by m8f
1. Have a mod that has a key for calling a netevent, for example:
Code: Select allExpand view
alias test_netevent "echo test; netevent test"
AddKeySection "Test" "TestKeys"
AddMenuKey "Netevent Key" "test_netevent"

2. On the intermission screen, press the key that should case netevent;
3. Receive a message:
Code: Select allExpand view
netevent cannot be used outside of a map.

Example mod:
(149 Bytes) Downloaded 19 times

This message doesn't break anything, it just looks out of place and may confuse the end user.
It is the one of rare cases when ACS-based script does better job than ZScript-based one: "pukename something" doesn't cause a message to appear in intermission screen.

Maybe this message should be only shown if "developer" CVar is set to some non-zero value.
Or there could be a way to check if the any map is currently loaded in the console, so it can be checked in keyconf with "test" command.

It is possible to make a script that will set a CVar each time the map is loaded and unloaded, and that CVar could be tested in keyconf. But it feels hacky, and I'm not sure it will reliably work in all use cases.
It is also possible to wrap netevent call in ACS script that does a ScriptCall, but it's not a nice way either.

Re: Way to disable "netevent cannot be used outside of a map

PostPosted: Sat May 18, 2019 3:39 am
by m8f
Made a PR: made this message a warning.