[Help] How to get any key?

Started by longhackmc, Jul 07, 2017, 03:19 PM

Previous topic - Next topic

longhackmc


I want to use BindKey(true, AnyKey, 0,0)
But I do not know how to get AnyKey
help me. I apologize for the poor english



KAKAN

there you go:
anykey <- array(100, false);
function onPlayerJoin( player ){
player.Msg( "Press any key to continue.");
anykey[ player.ID ] = true;
}

function onKeyDown( player, key ){
if( anykey[ player.ID ] ){
player.Msg( "YOU PRESSED 'ANY' KEY, SO SMD!" );
anykey[ player.ID ] = false; // or he'll keep getting the threatening messages.
}
oh no

Anik

#4
FFS stop posting in wrong boards.

longhackmc

Quote from: Anik on Jul 08, 2017, 06:23 AMFFS stop posting in wrong boards.

Sorry for posting the wrong post but after finding the required function I will delete the post.
Is there any function similar to getch () in C ++?

KAKAN

Quote from: longhackmc on Jul 08, 2017, 06:38 AM
Quote from: Anik on Jul 08, 2017, 06:23 AMFFS stop posting in wrong boards.

Sorry for posting the wrong post but after finding the required function I will delete the post.
Is there any function similar to getch () in C ++?
you wanted any key to continue. So, what, are you going to loop over all keys? I've provided a very easy example to follow, it's in squirrel. Look up. The topic's discussion ends here :)
oh no

Thijn

I doubt that example will work. The onKeyDown event will probably (I didn't test) only be called for keys that were binded.

So no, unless you're going to bind to all keys (Which is a bad idea) this isn't possible.

KAKAN

Quote from: Thijn on Jul 09, 2017, 10:46 AMI doubt that example will work. The onKeyDown event will probably (I didn't test) only be called for keys that were binded.
My antivirus wouldn't mark VCMP as a "KeyLogger" if it did what you said so.
oh no



Thijn

Quote from: KAKAN on Jul 09, 2017, 12:14 PM
Quote from: Thijn on Jul 09, 2017, 10:46 AMI doubt that example will work. The onKeyDown event will probably (I didn't test) only be called for keys that were binded.
My antivirus wouldn't mark VCMP as a "KeyLogger" if it did what you said so.
Of course it would. There's a difference between logging it and calling an event.

KAKAN

Quote from: Thijn on Jul 11, 2017, 05:08 PM
Quote from: KAKAN on Jul 09, 2017, 12:14 PM
Quote from: Thijn on Jul 09, 2017, 10:46 AMI doubt that example will work. The onKeyDown event will probably (I didn't test) only be called for keys that were binded.
My antivirus wouldn't mark VCMP as a "KeyLogger" if it did what you said so.
Of course it would. There's a difference between logging it and calling an event.
From my point of view, VCMP captures all the keybinds even if we have only one key to capture.
According to you, Discord( push-to-talk ) should be marked as a KeyLogger as well, but it isn't.
https://en.wikipedia.org/wiki/Keystroke_logging
KeyLogger means something else than just binding a single key.
oh no

Thijn

Quote from: KAKAN on Jul 11, 2017, 05:38 PM
Quote from: Thijn on Jul 11, 2017, 05:08 PM
Quote from: KAKAN on Jul 09, 2017, 12:14 PM
Quote from: Thijn on Jul 09, 2017, 10:46 AMI doubt that example will work. The onKeyDown event will probably (I didn't test) only be called for keys that were binded.
My antivirus wouldn't mark VCMP as a "KeyLogger" if it did what you said so.
Of course it would. There's a difference between logging it and calling an event.
From my point of view, VCMP captures all the keybinds even if we have only one key to capture.
According to you, Discord( push-to-talk ) should be marked as a KeyLogger as well, but it isn't.
https://en.wikipedia.org/wiki/Keystroke_logging
KeyLogger means something else than just binding a single key.
Read my reply again. I'm not saying the client isn't listening for all keys, I'm saying the client will only send it's key statuses when it's binded to the server. Otherwise the bandwidth will be way too high.

vito1

There is no reason to use serverside keybinds since we have clientside one. So we can use bandwidth wisely.
Simple example:
vito_keys <- {
"as_array" : []
"by_id" : {},
"binds" : {}
};
vito_keys.as_array = [];
for(local i = 0; i < 300; i++){
vito_keys.as_array.push([i.tostring(), i]);
}
foreach(vito_key in ::vito_keys.as_array){
::vito_keys.by_id.rawset(vito_key[1], vito_key[0]);
};
foreach(vito_key in ::vito_keys.as_array){
::vito_keys.binds.rawset(vito_key[0],[KeyBind(vito_key[1]), vito_key[1], vito_key[0]]);
};
function KeyBind::OnDown(keybind) {
foreach(vito_keybind_key, vito_keybind in ::vito_keys.binds){
if(vito_keybind[0] == keybind){
::Console.Print("keydown key_id="+vito_keybind[1]+" key_name="+vito_keybind[2]);
}
}
}