ID:736289
May 10 2012, 9:27 am
|
|
Well i looked through the screen input demo and realized it would be a great thing to add to my game. However, when i tried, it rendered all skin-macros to be un-useable. At the same time, it wouldn't let me mess with the "key_down" procedure so i could reinsert the macros there. Any ideas on how to go about this?
|
Well, i have experience using the keyboard library. But not with the way you have defined it for the input section in group huds. My game starts up with a title screen that uses Enter to pass, with the keyboard library in the input section, i cant use any macros, and i cant seem to get that working. I could add the snippits here if needed.
|
When you press the enter key at the title screen, do you use the Keyboard library's key_down() proc to handle that or did you define a macro for the enter key in the skin file? The keyboard library probably interferes with the macros you've defined in the skin file (I'm not sure, I always use the keyboard library instead of defining macros in the skin file), so you'll have to change it to use the key_down() proc.
The other option is to tell the keyboard library not to macro the enter key: client With that code in your project it'll only macro the letters, numbers, space bar, and backspace key, so your enter macro defined in the skin file should still work. |
Id like to rewrite everything to use the keyboard library but the key_down proc in the on-screen input snippit seems to stop anything i add onto it, any ideas about that?
As for the restricting enter method, i could try that. |
The client.focus var is a reference to the object whose key_down() proc is called when you press a key. When you click on the on-screen input control, client.focus is set to that screen object. When you click on something else, it sets client.focus back to your client. I'm guessing the key_down() proc you're using is defined for the mob.
The easiest way to fix this is to just add this: client You could also change the proc from being mob/key_down() in your project to being client/key_down(), or by editing the HUD Groups library to make the on-screen input control set focus back to the mob instead of the client. |
I kind of realized this, since i do a bunch of mob type handling when logging in. During a login proc, how would i set client.focus to source? I have everything working perfectly, except the enter key to continue.
EDIT: Nevermind, i figured out what you ment with the client thing. Thank you so much! On a side note i figured out how to use the library in new ways. Such as sending a key_down procedure with an undefined name to be worked with. For example this was my work around - client |
Hmm, it seems focus will not shift to the input label as it is clicked, any idea why?
|
In response to D-Cire
|
|
D-Cire wrote:
Hmm, it seems focus will not shift to the input label as it is clicked, any idea why? I think something in the library will have to change for that. I'm not sure when I'll update the Keyboard library next, but you can make the change in your local copy. If you go to line 145 in keyboard.dm (that's where the Click() proc is) and add ..() to the body of that proc, it should work. |
Actually, I had some pending changes to the Keyboard library laying around so I just posted a version that should fix this: http://www.byond.com/developer/Forum_account/Keyboard
|
You can override the key_down proc in your project instead of defining your own macros in the skin file. The Keyboard library comes with a few examples and it has some documentation, but let me know if you can't get it working.