Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Thu 27/01/2005 10:52:29

Title: Keyboard assign with sound. [SOLVED]
Post by: on Thu 27/01/2005 10:52:29
Hi Forum...
This might by a little hard, but i'll give it a shot..

I need a script that tells your keyboard to play a sound
Fx:
If you push the "f" key it well play a sound from a piano

I'm not that good of a scripter, but i know its possible. So if any of you guys know how its done PLEASE tell...

thanks
Magnus
Title: Re: Keyboard assign with sound.
Post by: Gilbert on Thu 27/01/2005 11:08:06
Just in the on_key_press() global script function add something like:

if (keycode=='A') PlaySound(5);
if (keycode=='B') PlaySound(6);
  .
  .
  .

Simple as that.
If you want that to happen only in a certain room, just create a on_key_press() in that room's room script, like:

function on_key_press(int keycode){
  if (keycode=='A') PlaySound(5);
  if (keycode=='B') PlaySound(6);
  .
  .
  .
}
Title: Re: Keyboard assign with sound.
Post by: on Thu 27/01/2005 12:24:06

javascript:replaceText('%20;D',%20document.postmodify.message);
okay thats simple, thank you i'll try that....
peace!


Quote from: Gilbot V7000a on Thu 27/01/2005 11:08:06
Just in the on_key_press() global script function add something like:

if (keycode=='A') PlaySound(5);
if (keycode=='B') PlaySound(6);
Ã,  .
Ã,  .
Ã,  .

Simple as that.
If you want that to happen only in a certain room, just create a on_key_press() in that room's room script, like:

function on_key_press(int keycode){
Ã,  if (keycode=='A') PlaySound(5);
Ã,  if (keycode=='B') PlaySound(6);
Ã,  .
Ã,  .
Ã,  .
}