WAV
#1
Posted 13 September 2011 - 03:28 PM
Is there literally no way a script can tell the WAV file to stop playing when I leave the screen?
#2
Posted 13 September 2011 - 03:30 PM
#3
Posted 13 September 2011 - 03:40 PM
Edited by Cukeman, 13 September 2011 - 03:48 PM.
#4
Posted 13 September 2011 - 04:18 PM
// --------------------------------------
// DESCRIPTION
// This script will play a sound effect
// specified by the user. It is capable
// of crude looping when a delay is specified.
// --------------------------------------
// USER ARGUMENTS
// D0 (sfx_slot)
// This is the slot number of the sfx you will be playing.
// D1 (sfx_delay)
// This is the delay between each play of the SFX *in TICS*.
// **Leaving this at zero will make the SFX only play once.**
// There are no REAL sound effects that are 0 tics long, after all.
// Most people will want to set this to the length of the sfx.
// SECOND TO TIC CONVERSION: Seconds / (1/60) OR Seconds / 0.0166
// Alternatively (or if I got that wrong), just check things in the ZQuest F9 dialog.
// --------------------------------------
// #####This is the main code that ZQuest will execute#####
ffc script sfx_player {
void run(int sfx_slot, int sfx_delay) { // Begin run function.
int counter = 0; // This is the counter that will be used.
// It's used to produce the delay specified.
do{ // Run this block of code once before checking the status of sfx_delay.
if (counter == 0) // If the counter is zero, play the sfx in this iteration of the loop.
{
Game->PlaySound(sfx_slot); // Play sound # "sfx_slot." This action happens each time this is executed.
counter = sfx_delay; // (Re)start the counter by setting it to sfx_delay.
}//!End if statement for counter
else
{
counter--; // Subtract one tic from the counter
}//!End else statement for counter
Waitframe(); // Makes the script wait a frame before looping again.
}while(sfx_delay != 0);//! End of internal do-while loop. If sfx_delay is not 0, it will loop until the ffc is terminated.
}//! End of run function
}//! End of ffc script
#5
Posted 13 September 2011 - 09:36 PM
I'll try it out today!
EDIT: If you know who wrote that script I'll credit them.
EDIT:
I regret to say this script does not do what I need it to.
I wanted a script which will make a WAV file stop playing when I leave the screen.
I tested this script, and when I left the screen, the WAV continued to play until it reached
the end of the sound.
Edited by Cukeman, 13 September 2011 - 09:36 PM.
#6
Posted 14 September 2011 - 09:25 PM
Could there be a script on-screen that forces ambient sounds to stop playing?
It has to work for WAV files, though, or it's useless.
#7
Posted 14 September 2011 - 09:31 PM
I must be thinking an older version. In RC2, just go into Screen Data and look under S.Data 2 and pick you desired sound from the list. :3
#8
Posted 14 September 2011 - 09:33 PM
There's a built-in function that does this.
Under Screen Data/Flags (can't recall off hand) there should be a checkbox for 'Use Ocean SFX' or something. Check that. Under another tab, you can set what sound to play. It should repeat the sound as long as the player is on the screen. :3
Sorry, but that is exactly what I am using, the ambient sound...
The problem is that my WAV files keep playing after I leave the screen
(until they reach the end of the sound)
I want them to stop playing immediately when I change screens.
Edited by Cukeman, 14 September 2011 - 09:34 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users