Results 1 to 7 of 7

Thread: Stop the #Loop

  1. #1
    Warrant Officer
    Join Date
    Dec 5 2001
    Location
    Orlando, Florida
    Posts
    2,003

    Unhappy

    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

  2. #2
    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&#58; exit
    playsound &#34;siren&#34;
    goto &#34;start&#34;
    [/QUOTE]

    If you want to do it your way, why not just record silence for a second and use that?

    RED

  3. #3
    Sergeant
    Join Date
    Oct 4 2003
    Location
    Dunno, haven't had a look around since OFP came by my HD.
    Posts
    192
    Personally, I would use a number instead of a boolean here as it&#39;s much better when it comes to scripts.

    StopSiren = 0
    #start
    ~2
    ? (StopSiren == 1) : exit
    playsound "siren"
    goto "start"
    Also (More?) Known As dmakatra.
    Pacifism is the only way to conduct civilized warfare.
    Frontline Commander - A Platoon Management Scripting Mod Currentley On Hold.

  4. #4
    Why is a number, that&#39;s stating an on/off value "much better than a boolean when it comes to scripts"?

  5. #5
    Warrant Officer
    Join Date
    Dec 5 2001
    Location
    Orlando, Florida
    Posts
    2,003
    Author of the Thread

    Thumbs up

    Hmmm, some good idea there guys, i will check them out post haste

  6. #6
    Master Gunnery Sergeant
    Join Date
    Jul 15 2003
    Location
    Belgium, the land of surialism
    Posts
    1,003
    Quote Originally Posted by (Artak @ Nov. 05 2004,13:28)
    Why is a number, that&#39;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
    [/QUOTE]

    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 &#58; hint &#34;event1 is active&#34;
    ?event2 &#58; hint &#34;event2 is active&#34;
    ?event3 &#58; hint &#34;event3 is active&#34;
    [/QUOTE]

    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
    [/QUOTE]

    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 &#58; hint &#34;none of the events are active&#34;
    ?event == 1 &#58; hint &#34;event1 is active&#34;
    ?event == 2 &#58; hint &#34;event2 is active&#34;
    ?event == 3 &#58; hint &#34;event3 is active&#34;
    [/QUOTE]

    Now you need only one global variable, with boleans you need three.




  7. #7
    Yes, exactly Blanco.
    I was trying to question The Real Armstrong&#39;s logic, but he&#39;s fled the country and taken his reasons with him.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •