(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Hosted Projects > Reinventing the Craft > Miscellaneous

Miscellaneous A forum for a variety of functions where users may also request other features.

Reply
 
LinkBack Thread Tools Display Modes
Old 11-24-2007, 07:13 PM   #1 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

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
MindWorX is offline   Reply With Quote
Old 11-24-2007, 08:13 PM   #2 (permalink)
Model & Tutorial Moderator
 
Pyritie's Avatar

 
Join Date: Nov 2006
Posts: 7,328

Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)

Super Donor: This user has donated at least $100 to The Hive. Hero Contest #1 Winner: Slatie 

So this basically adds events which can detect any key press instead of just up/down/left/right/Esc?
Pyritie is offline   Reply With Quote
Old 11-24-2007, 08:18 PM   #3 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

Yes, and allows blocking and forcing keys too.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 11-24-2007, 08:21 PM   #4 (permalink)
Model & Tutorial Moderator
 
Pyritie's Avatar

 
Join Date: Nov 2006
Posts: 7,328

Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)

Super Donor: This user has donated at least $100 to The Hive. Hero Contest #1 Winner: Slatie 

Oh sweet. I could actually have a use for this.

*Runs off to install and revamp entire campaign (as usual)*
Pyritie is offline   Reply With Quote
Old 12-20-2007, 06:07 PM   #5 (permalink)
Gox
 
Gox's Avatar

Big Orange Mutant Lizard
 
Join Date: Dec 2007
Posts: 5

Gox has little to show at this moment (2)


Question

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.
Gox is offline   Reply With Quote
Old 12-20-2007, 06:12 PM   #6 (permalink)
Model & Tutorial Moderator
 
Pyritie's Avatar

 
Join Date: Nov 2006
Posts: 7,328

Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)

Super Donor: This user has donated at least $100 to The Hive. Hero Contest #1 Winner: Slatie 

Question: how fast are these compared to the regular keyboard press events?
Pyritie is offline   Reply With Quote
Old 12-20-2007, 06:59 PM   #7 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

Quote:
Originally Posted by Gox View Post
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 View Post
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!"
MindWorX is offline   Reply With Quote
Old 12-21-2007, 04:57 AM   #8 (permalink)
Gox
 
Gox's Avatar

Big Orange Mutant Lizard
 
Join Date: Dec 2007
Posts: 5

Gox has little to show at this moment (2)


Thanks, then I'll try to make this natives work with RtC.
Gox is offline   Reply With Quote
Old 02-16-2008, 11:32 PM   #9 (permalink)
 
Wizardum's Avatar

Wiz
 
Join Date: Sep 2007
Posts: 198

Wizardum has little to show at this moment (11)Wizardum has little to show at this moment (11)


Can you post an example of a trigger using the detection of a key? for example "W". Please, it's kinda confusioning.
__________________
The hero selection system for my naruto map:

http://www.hiveworkshop.com/forums/f...konoha-112668/

it has a video sample of the system.
Wizardum is offline   Reply With Quote
Old 02-18-2008, 07:30 AM   #10 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

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!"
MindWorX is offline   Reply With Quote
Old 02-18-2008, 11:43 AM   #11 (permalink)
Model & Tutorial Moderator
 
Pyritie's Avatar

 
Join Date: Nov 2006
Posts: 7,328

Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)Pyritie has much of which to be proud (1028)

Super Donor: This user has donated at least $100 to The Hive. Hero Contest #1 Winner: Slatie 

Is the integer value the character's ASCII value?
Pyritie is offline   Reply With Quote
Old 02-18-2008, 12:02 PM   #12 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

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!"
MindWorX is offline   Reply With Quote
Old 02-18-2008, 12:44 PM   #13 (permalink)
 
SFilip's Avatar

Jack of all trades
 
Join Date: Nov 2005
Posts: 291

SFilip has little to show at this moment (34)SFilip has little to show at this moment (34)SFilip has little to show at this moment (34)SFilip has little to show at this moment (34)


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.
SFilip is offline   Reply With Quote
Old 02-18-2008, 06:26 PM   #14 (permalink)
 
Wizardum's Avatar

Wiz
 
Join Date: Sep 2007
Posts: 198

Wizardum has little to show at this moment (11)Wizardum has little to show at this moment (11)


How do I know the right integer for each key button?
__________________
The hero selection system for my naruto map:

http://www.hiveworkshop.com/forums/f...konoha-112668/

it has a video sample of the system.
Wizardum is offline   Reply With Quote
Old 02-18-2008, 10:14 PM   #15 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

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!"
MindWorX is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

All times are GMT. The time now is 09:22 AM.