Winters 1 Posted November 4, 2004 Hey all, Okie heres the deal. I have this police siren that plays on a loop, i have added actions to the player in an effort to allow him to turn the siren on/off. In my description.ext i added a sound named "off" thats attached to the added action for turning the siren off (although there is no actual sound called off) when i try to turn the siren off nothing happens. I did this in an old mission with a CD Player and it worked fine but, the music that played from the CD player was not on a loop. Any ideas? Thanks Share this post Link to post Share on other sites
RED 0 Posted November 4, 2004 Why not just put have the action menu stop the script looping? For example: player addaction ["Stop siren", StopSiren = true] <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #start ~2 ?StopSiren: exit playsound "siren" goto "start" If you want to do it your way, why not just record silence for a second and use that? RED Share this post Link to post Share on other sites
The Real Armstrong 0 Posted November 5, 2004 Personally, I would use a number instead of a boolean here as it's much better when it comes to scripts. StopSiren = 0 #start ~2 ? (StopSiren == 1) : exit playsound "siren" goto "start" Share this post Link to post Share on other sites
Artak 0 Posted November 5, 2004 Why is a number, that's stating an on/off value "much better than a boolean when it comes to scripts"? Share this post Link to post Share on other sites
Winters 1 Posted November 5, 2004 Hmmm, some good idea there guys, i will check them out post haste Share this post Link to post Share on other sites
Blanco 0 Posted November 6, 2004 Why is a number, that's stating an on/off value "much better than a boolean when it comes to scripts"? It depends on the situation imo...when I only need an on/off status I use boleans, otherwise I use numbers When you use a number , you are not restricted to two values (true or false). In some cases this could be usefull with boleans you do this : in the init.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> event1 = false event2 = false event3 = false In your scripts... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?event1 : hint "event1 is active" ?event2 : hint "event2 is active" ?event3 : hint "event3 is active" with numbers you can do this in your init.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> event = 0 in your script <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?event == 0 : hint "none of the events are active" ?event == 1 : hint "event1 is active" ?event == 2 : hint "event2 is active" ?event == 3 : hint "event3 is active" Now you need only one global variable, with boleans you need three. Share this post Link to post Share on other sites
Artak 0 Posted November 6, 2004 Yes, exactly Blanco. I was trying to question The Real Armstrong's logic, but he's fled the country and taken his reasons with him. Share this post Link to post Share on other sites