You need to use the registerEventHandler function to disable the ESC key as needed.
function keyboardHandler(eventType, character, keycode, modifiers)
if Conditions["enable_esc"].ConditionValue == false and keycode == eKeyEscape then return true end
Add the above script as a definition script. Create a condition anywhere you like (somewhere easy to access / remember) & name it enable_esc
. Then to enable / disable the ESC key, just toggle the condition between true & false. True = enabled. False = disabled. Simple.
P.S: I'm not sure if this works for videos. The last time I tried it (earlier 4.x build) it did not prevent the skipping of videos. It did prevent ESC in general & skipping of cut-scenes. I believe I asked for an option a while ago in the dev tracker for preventing the skipping of videos. I don't know if it will get added or not mind.