|
 |   |  |  |
| Miscellaneous A forum for a variety of functions where users may also request other features. |
 |
|
11-24-2007, 07:13 PM
|
#1 (permalink)
|
Wulfy loves Nex!
Join Date: Aug 2004
Posts: 293
|
KeyboardAPI
native TriggerRegisterKeyEvent takes trigger whichTrigger, integer eventtype returns nothing native GetTriggerKey takes nothing returns integer native SetKeyBlock takes integer i, boolean doBlock returns nothing native ForceKeyDown takes integer key returns nothing native ForceKeyUp takes integer key returns nothing native ForceKeyType takes integer key returns nothing
// constants constant integer EVENT_KEYUP = 0 constant integer EVENT_KEYDOWN = 1
Tutorial: N/A
Download: N/A
Native Set Type: Single Player or WarSoc
Release: 0.10
Other: N/A
Last edited by SFilip; 11-25-2007 at 02:44 PM..
Reason: added constants
|
|
|
11-24-2007, 08:13 PM
|
#2 (permalink)
|
Model & Tutorial Moderator
Join Date: Nov 2006
Posts: 7,328
|
So this basically adds events which can detect any key press instead of just up/down/left/right/Esc?
|
|
|
11-24-2007, 08:18 PM
|
#3 (permalink)
|
Wulfy loves Nex!
Join Date: Aug 2004
Posts: 293
|
Yes, and allows blocking and forcing keys too.
__________________
"Wulfy loves Nex!"
|
|
|
11-24-2007, 08:21 PM
|
#4 (permalink)
|
Model & Tutorial Moderator
Join Date: Nov 2006
Posts: 7,328
|
Oh sweet. I could actually have a use for this.
*Runs off to install and revamp entire campaign (as usual)*
|
|
|
12-20-2007, 06:07 PM
|
#5 (permalink)
|
Big Orange Mutant Lizard
Join Date: Dec 2007
Posts: 5
|
The only way to use this natives is installing RtC, right? Isn't there any other way to detect any key pressed and released than installing RtC?Unit abilities may detect some keys when pressed yet not when released, is JASS able to do such?
BTW I've been reading about the WarSoc Project and it just rules. 
|
|
|
12-20-2007, 06:12 PM
|
#6 (permalink)
|
Model & Tutorial Moderator
Join Date: Nov 2006
Posts: 7,328
|
Question: how fast are these compared to the regular keyboard press events?
|
|
|
12-20-2007, 06:59 PM
|
#7 (permalink)
|
Wulfy loves Nex!
Join Date: Aug 2004
Posts: 293
|
Quote:
Originally Posted by Gox
The only way to use this natives is installing RtC, right? Isn't there any other way to detect any key pressed and released than installing RtC?Unit abilities may detect some keys when pressed yet not when released, is JASS able to do such?
BTW I've been reading about the WarSoc Project and it just rules. 
|
There's no way in regular wc3 to do what these native does, except for detecting arrow keys, and ofcourse the way with detecting abilities, which doesn't work very well.
Quote:
Originally Posted by Pyritie
Question: how fast are these compared to the regular keyboard press events?
|
I haven't done any speed tests, but since these work around some of warcraft III's safety things, i would guess this one is faster.
__________________
"Wulfy loves Nex!"
|
|
|
12-21-2007, 04:57 AM
|
#8 (permalink)
|
Big Orange Mutant Lizard
Join Date: Dec 2007
Posts: 5
|
Thanks, then I'll try to make this natives work with RtC.
|
|
|
02-16-2008, 11:32 PM
|
#9 (permalink)
|
Wiz
Join Date: Sep 2007
Posts: 198
|
Can you post an example of a trigger using the detection of a key? for example "W". Please, it's kinda confusioning.
|
|
|
02-18-2008, 07:30 AM
|
#10 (permalink)
|
Wulfy loves Nex!
Join Date: Aug 2004
Posts: 293
|
library Test initializer Init private function Actions takes nothing returns nothing if(GetTriggerKey() == 87) then call BJDebugMsg("W was pressed") else call BJDebugMsg("Keycode " + I2S(GetTriggerKey()) + " was pressed") endif endfunction
private function Init takes nothing returns nothing local trigger trig = CreateTrigger() call TriggerAddAction(trig, function Actions) call TriggerRegisterKeyEvent(trig, 1) endfunction endlibrary This is off the top of my head, since i'm at school atm. Basicly, call TriggerRegisterKeyEvent(trig, 1) detects when i press a key, and GetTriggerKey() returns what key it is, as an integer value.
__________________
"Wulfy loves Nex!"
|
|
|
02-18-2008, 11:43 AM
|
#11 (permalink)
|
Model & Tutorial Moderator
Join Date: Nov 2006
Posts: 7,328
|
Is the integer value the character's ASCII value?
|
|
|
02-18-2008, 12:02 PM
|
#12 (permalink)
|
Wulfy loves Nex!
Join Date: Aug 2004
Posts: 293
|
Well, for characters you can look up the upper case letters on a ASCII table, but other than that, then it's a no. It's a keyboard value. Next release will likely include an KeyboardKey2Char or something, to help this process :)
__________________
"Wulfy loves Nex!"
|
|
|
02-18-2008, 12:44 PM
|
#13 (permalink)
|
Jack of all trades
Join Date: Nov 2005
Posts: 291
|
Also note that, if I'm not mistaking, the current stable version does not support disabled triggers and conditions. It's also not recommended to destroy triggers. Preview purposes only, next version will have a fix for this stuff.
|
|
|
02-18-2008, 06:26 PM
|
#14 (permalink)
|
Wiz
Join Date: Sep 2007
Posts: 198
|
How do I know the right integer for each key button?
|
|
|
02-18-2008, 10:14 PM
|
#15 (permalink)
|
Wulfy loves Nex!
Join Date: Aug 2004
Posts: 293
|
The easiest way is to use the example code i wrote, and just try. Look at the message appearing on the screen, and then you'll know which key is which. That's how i do it.
__________________
"Wulfy loves Nex!"
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|  |  |  |  |   |  |
|
All times are GMT. The time now is 09:22 AM.
|