[Snippet] Disable Transmission Skip

Scripts

13 years
edited 8 years
This library will allow you to disable/enable the feature that allows you to skip cinematic transmissions by pressing ESC. Some RPG's are ruined when other players press ESC during a cinematic because it skips the transmission for everyone. This neat script can prevent that.

Code (jass) Select
library TransmissionSkip /* v.1.0.0.0
********************************************************************
*
*   The normal GUI cinematic functions allow you to skip
*   transmissions by pressing ESC. This snippet will allow
*   you to disable/enable that feature.
*
********************************************************************
*   
*   Functions
*
*       DisableTransmissionSkip()
*
*           - Prevents players from skipping cinematic
*             transmissions by pressing ESC.
*
*       EnableTransmissionSkip()
*
*           - Allows players to skip cinematic transmissions
*             by pressing ESC, if you use the BJ/GUI functions.
*
********************************************************************/

    function DisableTransmissionSkip takes nothing returns nothing
        if bj_cineSceneBeingSkipped == null then
            call TryInitCinematicBehaviorBJ()
        endif
        call DisableTrigger(bj_cineSceneBeingSkipped)
    endfunction

    function EnableTransmissionSkip takes nothing returns nothing
        if bj_cineSceneBeingSkipped == null then
            return
        endif
        call EnableTrigger(bj_cineSceneBeingSkipped)
    endfunction
   
endlibrary


Example code:
Example Code
Code (jass) Select
scope Test initializer onInit
/*
    Implementing this code will disable skipping transmissions
    until EnableTransmissionSkip() is called
*/
    private function onInit takes nothing returns nothing
        call DisableTransmissionSkip()
    endfunction
endscope

To use it, just create a new trigger and paste the code in there. If you do not have JNGP, then here is a JASS version:
Vanilla JASS Version
Code (jass) Select
// TransmissionSkip Library
   
    function DisableTransmissionSkip takes nothing returns nothing
        if bj_cineSceneBeingSkipped == null then
            call TryInitCinematicBehaviorBJ()
        endif
        call DisableTrigger(bj_cineSceneBeingSkipped)
    endfunction

    function EnableTransmissionSkip takes nothing returns nothing
        if bj_cineSceneBeingSkipped == null then
            return
        endif
        call EnableTrigger(bj_cineSceneBeingSkipped)
    endfunction

// End TransmissionSkip Library

Simply paste that into the map header. To access the map header, open the trigger editor and click on the map name listed on the left. Paste the code there. Then you can make a trigger like so:

[trigger]
My Trigger
    Events
        Map Initialization
    Conditions
    Actions
        Custom script:    call DisableTransmissionSkip()
[/trigger]

And it should disable transmission skipping for the entire game until you call "EnableTransmissionSkip()". To disable it again, simply call "DisableTransmissionSkip()" again.

Credits to: Troll-Brain for the suggestion long ago to disable the trigger instead of doing it the odd way I did it before.
13 years
I love this kind of scripts: small and straight to the point.

~Approved
13 years
Thanks moyack :D

Yeah, I'm trying to remember all these little snippets that I used to use before I forget them. :P Oh and thanks for fixing the trigger for me.