Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: monkey0506 on Mon 21/04/2008 10:48:30

Title: MODULE: KeyPressAlways v1.0.0 - Key presses during speech (and stuff)!
Post by: monkey0506 on Mon 21/04/2008 10:48:30
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 (http://www.adventuregamestudio.co.uk/forums/index.php?topic=21382.msg445635#msg445635) as to how to accomplish this goal.

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

Download (https://sites.google.com/site/monkey0506/home/KeyPressAlways_1_0_0.rar?attredirects=0&d=1)

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:

// 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.
Title: Re: MODULE: KeyPressAlways v1.0.0 - Key presses during speech (and stuff)!
Post by: Rui 'Trovatore' Pires on Mon 21/04/2008 12:04:20
---------------------------
Error
---------------------------
C:\AGS\Modules\KeyPressAlways_1_0_0.rar
The archive is either in unknown format or damaged
---------------------------
OK   
---------------------------

:'( :'( :'(
Title: Re: MODULE: KeyPressAlways v1.0.0 - Key presses during speech (and stuff)!
Post by: monkey0506 on Mon 21/04/2008 19:50:06
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! :=