Non-Uninterruptible cutscenes (SOLVED in V5 only)

  • #1, by brut69Saturday, 20. May 2017, 13:24 7 years ago
    Is there a way to disallow the player to skip cutscenes by clicking the ESC button?


    ps

    I am on V4 since V5 is buggy for me

    Great Poster

    266 Posts


  • #2, by sebastianSaturday, 20. May 2017, 14:35 7 years ago
    you could add this as a definition script:

    function keyboardHandler(eventType, character, keycode, modifiers)
      if not Conditions["k_esc"].ConditionValue and keycode == eKeyEscape then return true
      end 
    end
    
    registerEventHandler("keyEvent", "keyboardHandler")


    Before i start cutscenes i set the condition "k_esc" to false and afterwards to true.

    Thread Captain

    2346 Posts

  • #3, by brut69Saturday, 20. May 2017, 16:08 7 years ago
    you could add this as a definition script:

    function keyboardHandler(eventType, character, keycode, modifiers)
      if not Conditions["k_esc"].ConditionValue and keycode == eKeyEscape then return true
      end 
    end
    
    registerEventHandler("keyEvent", "keyboardHandler")


    Before i start cutscenes i set the condition "k_esc" to false and afterwards to true.
    Doesn't work on V4 but thank you though
    I get this error:

    Warning: Unsupported event 'keyEvent'.
    5:06:24 PM: [string "Script0"]:7: Failed to execute command registerEventHandler
    5:06:24 PM: stack traceback:
     [string "Script0"]:10: in function 
     [C]: in function 'registerEventHandler'
     [string "Script0"]:7: in function 
     [C]: in function 'xpcall'
     [string "Script0"]:1: in main chunk

    Great Poster

    266 Posts

  • #4, by sebastianSaturday, 20. May 2017, 16:25 7 years ago
    this should work in V4 (i used it since 4.2 - it should work since 3.6)... There must be something else missing/wrong... 
    Maybe add a "return false" before the last "end"


    Do you have already a keyboard handler script in your project?

    If you look up keyboard handler you will find some more topics related to it.

    Thread Captain

    2346 Posts

  • #5, by brut69Saturday, 20. May 2017, 16:47 7 years ago
    this should work in V4 (i used it since 4.2 - it should work since 3.6)... There must be something else missing/wrong... 
    Maybe add a "return false" before the last "end"


    Do you have already a keyboard handler script in your project?

    If you look up keyboard handler you will find some more topics related to it.

    It works on 5 though (just tested).

    Great Poster

    266 Posts

  • #6, by brut69Sunday, 21. May 2017, 13:06 7 years ago
    Just tried this : 

    function keyboardHandler(eventType, character, keycode, modifiers)
    
    
    
      if keycode == eKeyEscape then
    
       
        return true
    
      end
    
      return false  
    end 
     
    Which is a simpler version of what you wrote above ... Still not working 
    The "keyEvent" is not recognised in 4.01 even though it says that it should work from 3.6
    This it he only script that I have btw. I deleted the other ones for testing purposes
    Here is the Log file :

    registerEventHandler("keyEvent", "keyboardHandler")
    2:02:45 PM: Engine Version: 4.0.1 (Build 1173 from Build date: Aug 12 2014)
    2:02:45 PM: Time needed for preloading game: 14 msec
    2:02:45 PM: Initializing graphics interface. Surface size: 1920x1080, render size: 1920x1080
    2:02:45 PM: Using Framebuffer with texture.
    2:02:46 PM: red, green, blue, alpha, depth size: , doublebuffer , accelerated
    2:02:46 PM: Serialization finished. Needed time: 33 ms
    2:02:46 PM: SetupParents finished. Needed time: 1 ms
    2:02:46 PM: SortLinks finished. Needed time: 0 ms
    2:02:46 PM: Interfaces loaded. Needed time: 20 ms
    2:02:46 PM: Warning: Unsupported event 'keyEvent'.
    2:02:46 PM: [string "Script0"]:11: Failed to execute command registerEventHandler
    2:02:46 PM: stack traceback:
     [string "Script0"]:14: in function
     [C]: in function 'registerEventHandler'
     [string "Script0"]:11: in function
     [C]: in function 'xpcall'
     [string "Script0"]:1: in main chunk

    Great Poster

    266 Posts

  • #7, by afrlmeSunday, 21. May 2017, 14:04 7 years ago
    No, registerEventHandler might have been added in 3.6, but keyEvent wasn't added until some point in 4.x. I don't remember which version, but probably around 4.1 or 4.2 maybe? I forget, sorry.

    Imperator

    7278 Posts

  • #8, by sebastianSunday, 21. May 2017, 14:44 7 years ago
    I would not bet that there will be a fix for this VS4.X in any way...
    Maybe there is a workaround for older versions.

    Thread Captain

    2346 Posts

  • #9, by afrlmeSunday, 21. May 2017, 14:53 7 years ago
    I would not bet that there will be a fix for this VS4.X in any way...
    Maybe there is a workaround for older versions.
    Yes, there is. Use hide/show cursor wrapper instead of begin/end cutscene wrappers as cursor one can't be skipped with ESC - it actually kills all key input, though texts can still be skipped by left clicking if you enabled the option for it inside of the game properties tab.

    Imperator

    7278 Posts

  • #10, by MachtnixSunday, 21. May 2017, 15:05 7 years ago
    What about putting (kann man das sagen? *lol*) an action to stop animations into the "esc"-button?

    Thread Captain

    1097 Posts

  • #11, by brut69Sunday, 21. May 2017, 15:15 7 years ago
    I would not bet that there will be a fix for this VS4.X in any way...
    Maybe there is a workaround for older versions.
    Yes, there is. Use hide/show cursor wrapper instead of begin/end cutscene wrappers as cursor one can't be skipped with ESC - it actually kills all key input, though texts can still be skipped by left clicking if you enabled the option for it inside of the game properties tab.

    Cool! I will try that and let you know

    Great Poster

    266 Posts