Category | Scripting |
Created | 10.06.2016 21:45 |
Martin Fabik (Hungar) | 10.06.2016 21:53 |
---|---|
Hi, I'm trying to create script, that will allows you to create your own note with your custom text. I need to assign backspace for deleting text from note. At first I tried to read unicode number of backspace in keyEvent callback, but all special keys (such as ctrl,alt,backspace,etc...) have number "0". So I tried to create my own input binding for this. I've tried KEY_backspace and KEY_bs - both without success. My InputBindings in modDesc.xml: <inputBindings> <input name="notesOpenClose" category="ONFOOT" key1="KEY_r" button="" /> <input name="notesDeleteNote" category="ONFOOT" key1="KEY_backspace" button="" /> </inputBindings> And in LUA code: if InputBinding.hasEvent(InputBinding.notesDeleteNote) then print("Delete some text"); end; If I set KEY_delete as key1 in inputBindings it works. Can anyone help me? Cheers Martin Fabik. |
Emil Drefers (Unknown) | 13.06.2016 06:41 |
---|---|
Hi did you have a look at the values of 'sym'? function MyMod:keyEvent(unicode, sym, modifier, isDown) Cheers, Emil |
Martin Fabik (Hungar) | 13.06.2016 21:20 |
---|---|
Hi, thanks a lot for tip. It helped me a lot :) Cheers, Martin |
Note: Log in to post. Create a new account here.