TaichiKid Posted February 1, 2013 Share Posted February 1, 2013 I would like to be able to sense when the left mouse button is clicked. I have the following script attached to an otherwise blank Quest. I have SKSE 1.6.6 installed. When I load up a test cell I see the "Looking for keys..." message, but never see the messages in the OnKeyDown event fire. I've checked my papyrus runtime log and don't see any errors from my script. I've tried registering for other keys; they don't work either. Any suggestions? Thanks in advance. Scriptname _KeyPressScript extends Quest Event OnInit() Debug.Notification("Looking for keys...") UnRegisterForUpdate() UnregisterForAllKeys() RegisterForKey(256)EndEvent Event OnKeyDown(int keyCode) Debug.Notification("keyCode = " + keyCode) if keyCode == 256 Debug.Notification("left mouse key...") EndIfEndEvent Link to comment Share on other sites More sharing options...
TaichiKid Posted March 4, 2013 Author Share Posted March 4, 2013 I eventually figured this out. In case it helps someone in the future, there was nothing wrong with my script or the way I was registering for the keys. The problem was related to loading the test cell. I was starting the game and doing a coc to my test cell from the Main Menu. No matter what I did, the OnKeyDown event would not register any keys being pressed. However, if you save immediately after doing a coc to the test cell, and then load the save, everything starts working. When testing anything I now always load my test cell, save, and load the save before trying new functionality. That seems to clear up a lot of headaches (caused by banging my head on the desk). Cheers. Link to comment Share on other sites More sharing options...
monsto Posted January 14, 2017 Share Posted January 14, 2017 (edited) I eventually figured this out. In case it helps someone in the future, there was nothing wrong with my script or the way I was registering for the keys. The problem was related to loading the test cell. I was starting the game and doing a coc to my test cell from the Main Menu. No matter what I did, the OnKeyDown event would not register any keys being pressed. However, if you save immediately after doing a coc to the test cell, and then load the save, everything starts working. When testing anything I now always load my test cell, save, and load the save before trying new functionality. That seems to clear up a lot of headaches (caused by banging my head on the desk). Cheers. MORE PEOPLE NEED TO DO THIS KIND OF FOLLOWUP. I'm here trying to figure out where to attach and read keypress, and I think your post here helped me . . . I'll use "an otherwise blank script" to attach it to, which, apparently, will be inited on a loadgame. main menu coc I guess doesn't actually "Load" anything, so it seems a some inits are probably bypassed. Thanks! Edited January 14, 2017 by monsto Link to comment Share on other sites More sharing options...
Recommended Posts