Hulgore Posted January 8, 2024 Share Posted January 8, 2024 Hello, I'm having a bit of trouble figuring this out : I just want to write a short script that prints a message on screen in-game if I press a key. The issue is that instead of printing the message when I press the key, there is a weird delay where I have to hold the key for several seconds before it actually prints the message. That delay may varies, spamming the key doesn't work, I have to hold it Here's the script : short KeyPress begin gamemode set KeyPress to OnKeyDown 56 if KeyPress == 1 Message "Pressed" endif end I have tried this with various keybinds, I have tried to use IsKeyPressed2 and IsKeyPressed3 instead, and the message will eventually show up but always with a delay. I have also tried to insert a modifier for my character to increase it's speed attribute, and it works, but not before 3 or 4 seconds of holding that key. I can't make any sense out of it Link to comment Share on other sites More sharing options...
Surilindur Posted January 8, 2024 Share Posted January 8, 2024 It sounds like the script might be attached to a quest? Quests, by default, run their GameMode block every 5 seconds (unlike object scripts which run it every frame if I remember correctly). You can change it by declaring the fQuestDelayTime variable in your quest script and setting it to a lower value. More information here: https://cs.uesp.net/wiki/FQuestDelayTime scriptname ExampleQuestScript float fQuestDelayTime begin _GameMode if (fQuestDelayTime != 1) let fQuestDelayTime := 1 ; run script once a second after this endif if (IsKeyPressed3 56) ; or another key code Message "Key pressed!" endif end Hopefully that helps a bit! Link to comment Share on other sites More sharing options...
Hulgore Posted January 8, 2024 Author Share Posted January 8, 2024 You are right, the script is indeed attached to a quest. I had no idea about that. I'm going to try to fix this. Many thanks for your answer Link to comment Share on other sites More sharing options...
Recommended Posts