Text Skipping Protection

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 09:31, 21 August 2023 by EK (talk | contribs) (Created page with "{| class="ts" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By |- | Text Skipping Protection || Definit...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Name Type By
Text Skipping Protection Definition AFRLme (& others)

This script keeps the user from skipping character and narration texts accidentally by deactivating the cursor for a small amount of time when a text appears.


Instructions

Add the main script to the Visionaire Studio Script Editor and set the script as a definition script.


Main Script

-- Prevent accidental text skipping
function delaySkipText(text)
  if not text.Background then
    game.AlwaysAllowSkipText = false
      
    if game.HideCursor == false and game.CutsceneAction:isEmpty() then
      game.HideCursor = true
    
      setDelay(300, function() game.AlwaysAllowSkipText = true; game.HideCursor = false end)
    else
      setDelay(300, function() game.AlwaysAllowSkipText = true end)
    end
  end
end

registerEventHandler("textStarted", "delaySkipText")