Keypress ctrl #1286
-
Heyall So I have this function in js file:
It detects "Key is held" but not both instances of "Key is released". |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This is not a suggested answer, but it might help. There might already be a "keyup" that you can't override without unbinding it (or something like that -- someone more knowledgeable will probably chime in soon). I find two places in the code that might be relevant: quest/PlayerController/paper.js Line 10116 in 7a03761 quest/Player/CefKeyboardHandler.vb Line 9 in 7a03761 |
Beta Was this translation helpful? Give feedback.
-
Hello. No one else saved the day, so I decided to give this another shot. if (event.key === 'Control'){
<!--Saved by Quest 5.8.6836.13983-->
<asl version="580">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Dragonoftheworld ctrl">
<gameid>bbc8351c-21a2-4536-825f-467977bc61c2</gameid>
<version>1.0</version>
<firstpublished>2024</firstpublished>
<feature_advancedscripts />
<inituserinterface type="script">
JS.eval ("var iskeyheld = false; $('body').on('keydown', function(event) { if (event.ctrlKey){ if (iskeyheld == false){ console.log('keydown: key is held'); iskeyheld = true; } } }); $('body').on('keyup', function(event) { if (event.which === 17){ console.log('keyup: key is released'); if (iskeyheld == true){ console.log('keyup: key is released and iskeyheld'); iskeyheld = false; } } });")
</inituserinterface>
</game>
<object name="room">
<isroom />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl> NOTE: If I use a JS file instead of using |
Beta Was this translation helpful? Give feedback.
Hello.
No one else saved the day, so I decided to give this another shot.
event.key
is undefined when I hit CONTROL, butevent.which
is17
. So, I tried it this way, and it seems to work: