hi, i'm attempting to make an interactive for a museum. it needs to display a background image and play videos when certain keys are pressed. so you press 1 and it plays video 1 etc. while i've found on_key_press and PlayVideo in the wiki i'm none the wiser how to put them together. if anybody who actually knows what they're doing could give me an example script i could adapt that would save me a lot of head scratching.
i normally stick to the video production but offered to help with the interactive for free as they didn't have the money (£1000s) to hire one of the companies that normally makes these things. having played with AGS years ago i knew it was capable, just thought the how would be a little simpler.
anyway, posting here is a last resort after a lot of head scratching so any help would be greatly appreciated.
this is what i have atm:
function on_key_press eKey1 ()
{
PlayVideo c:\inttest\lq.avi eVideoSkipAnyKey 1
}
Hi
example in on_key_press function in the Global when pressing A key:
if (keycode == eKeyA ){
PlayVideo("BLACKNIGHT-GLOBE.mp4", eVideoSkipEscKey, 1); //Escape to stop video
so i have the on key press part in room script and the if parts in the global script?
I have it in the Global so it applies to all rooms. You can add 'conditions' that allow it to run.
example
if (keycode == eKeyA && playvideo1==false){ // and if boolean playvideo1==false
PlayVideo("BLACKNIGHT-GLOBE.mp4", eVideoSkipEscKey, 1); //Escape to stop video
playvideo1=true;
okay, got it working. thanks for your help slasher.
Just for reference, AGS will also look in the current room script for on_key_press() and if found, call it.
So if you want the app to have multiple screens where pressing 1 does something different each time, you can do that easily.
// room script
function on_key_press(eKeyCode k) {
if (k == eKeyCode1) {
PlayVideo("lq.avi", eVideoSkipAnyKey , 1);
}
if (k == eKeyCode2) {
PlayVideo("something_else.avi", eVideoSkipAnyKey , 1);
}
// ...
}
can see that coming in handy. cheers!