Author Topic: MODULE: KeyPressAlways v1.0.0 - Key presses during speech (and stuff)!  (Read 1946 times)

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
It's been something I've struggled with for some time, trying to find a decent way of intercepting key-presses during speech and other blocking events, but thanks goes to naltimari for tipping me off as to how to accomplish this goal.

So, after much ado, I present the KeyPressAlways module!

Download

Does this mean I will need to put all my key-press interactions into the module script?

No! This was the concept I built from, but I disliked it for obvious reasons. You can set up an on_key_press_always function in any script! Here's how it's done:

Code: [Select]
// any script (following the module of course!)
function on_key_press_always(int keycode) {
  // place your key-press interactions here
}

function repeatedly_execute_always() {
  if ((KeyPressAlways.Enabled) && (KeyPressAlways.Keycode)) on_key_press_always(KeyPressAlways.Keycode);
}

NOTE: If you have already utilized the repeatedly_execute_always function, just add this line and place on_key_press_always above the function.

Is there any way to disable these "always" key-presses?

Of course! You can use the KeyPressAlways.Enabled property to completely disable "always" key-presses at any time.

Can I disable the normal key-press interactions?

You can use the KeyPressAlways.BlockNormalInteraction event at any time to block the normal key-press interactions being run.

Will ClaimEvent() work with on_key_press_always?

Unfortunately the built-in ClaimEvent function is very specialized and will not work with on_key_press_always. However, all is not lost. We can prevent further "always" interactions by using KeyPressAlways.ClaimAlwaysEvent(). To prevent "normal" interactions we can use KeyPressAlways.BlockNormalInteractions and/or the built-in ClaimEvent function.

What the hell is with that license? It sounds as though you're trying to sell gay Swedish bestiality porn to a traveling troupe of garden gnomes!

The included license was written at 4:30 in the morning and I accept no responsibility for its contents or any damage caused by anyone reading them. Should you choose to take legal action against me, I assure you, I will cry like a sissy.

Where do I send the check?

I will send you my PayPal information via PM! :=

Edit: 14 October 2009 - Updated the primary download link.
« Last Edit: 10 Nov 2016, 07:04 by monkey0506 »

Rui 'Trovatore' Pires

  • Lunge da lei per me non v'ha diletto!
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
---------------------------
Error
---------------------------
C:\AGS\Modules\KeyPressAlways_1_0_0.rar
The archive is either in unknown format or damaged
---------------------------
OK   
---------------------------

 :'( :'( :'(
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Sorry about that...Brinkster's acting up again. I think if you go to the "Hotlinking forbidden" page and then refresh you should be able to download it. My other webhosting got canceled due to my inactivity. I'll upload it to one of the AGS servers, I was pretty tired this morning and just wanted to be done with it! :=