+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: E2: sound help

  1. #1
    Wirererer MixZim's Avatar
    Join Date
    Jul 2008
    Posts
    157

    Question E2: sound help

    interval(10)

    if (!clk() & A) {soundPlay(1,1,"Something")}



    I need the interval, and I need the sound NOT to repeat.

    -If I remove "!clk()" the sound will repeat constantly if A is true.
    -If I use the "!clk()" the sound doesn't play at all

    any help with making E2: sounds WITH an interval(10,20,30...) but the sound does NOT repeat?

    David Bowie is very disappointed in you!

    You probably didn't know that David Bowie is very disappointed in you, but...now you do. And no, we don't know why

  2. #2
    Developer Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    3,109

    Default Re: E2: sound help

    Try:

    if (~A & A) {soundPlay(1,1,"Something")}

    It checks wether or not the expression was executed by A changing. It will work as long as A is an input.
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr

  3. #3
    Wirererer MixZim's Avatar
    Join Date
    Jul 2008
    Posts
    157

    Unhappy Re: E2: sound help

    But the A isn't an Input, thats the thing

    David Bowie is very disappointed in you!

    You probably didn't know that David Bowie is very disappointed in you, but...now you do. And no, we don't know why

  4. #4
    Wire Sofaking nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,299

    Default Re: E2: sound help

    Persist it, and it will also work. (You can't use tilde on nonpersisted vars, and inputs and outputs are automatically persisted)

  5. #5
    Wirererer MixZim's Avatar
    Join Date
    Jul 2008
    Posts
    157

    Default Re: E2: sound help

    This is exactly what I am trying to do...

    Inputs
    Outputs
    Persist E:entity Use

    interval(10)

    E=owner()
    Use=E:keyUse()

    if (!clk() & Use == 1) {E:soundPlay(1,1,"Whatever")}

    if I don't use "!clk()" it will repeat
    if I use "!clk()" there is no sound at all

    David Bowie is very disappointed in you!

    You probably didn't know that David Bowie is very disappointed in you, but...now you do. And no, we don't know why

  6. #6
    Developer Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    3,109

    Default Re: E2: sound help

    Quote Originally Posted by nescalona View Post
    Persist it, and it will also work. (You can't use tilde on nonpersisted vars, and inputs and outputs are automatically persisted)
    A persisted var can't execute an expression, so the tilde won't work on them.



    Try this:
    Code:
    @persist E:entity Use
    
    runOnTick(1)
    
    E=owner()
    Use=E:keyUse()
    
    if ($Use>0) {E:soundPlay(1,1,"Whatever")}
    Use = Use
    Last edited by Matte; 08-07-2009 at 03:32 PM.
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr

  7. #7
    Wire Sofaking nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,299

    Default Re: E2: sound help

    Aw dang you're right. What's wrong with me. Confused it with $. Try this:

    if (!clk() & Use == 1 & $Use == 1)

    EDIT: yeah Matte's is less redundant than mine. Don't need to check Use==1.
    Last edited by nescalona; 08-07-2009 at 03:30 PM.

  8. #8
    Banned Nicolai1's Avatar
    Join Date
    Nov 2008
    Location
    Denmark.
    Posts
    1,251

    Default Re: E2: sound help

    You can't use ~ on persistant variables.
    ~ checks if an input has executed the E2.

    Edit:
    Holy shit I just got triple ninja'd

  9. #9
    Wirererer MixZim's Avatar
    Join Date
    Jul 2008
    Posts
    157

    Default Re: E2: sound help

    so why does "$" makes any difference?

    David Bowie is very disappointed in you!

    You probably didn't know that David Bowie is very disappointed in you, but...now you do. And no, we don't know why

  10. #10
    Wire Sofaking nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,299

    Default Re: E2: sound help


+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Adding sound files to sound emitter
    By Dragonheart in forum Installation and Malfunctions Support
    Replies: 2
    Last Post: 07-04-2009, 10:33 PM
  2. Adding A Sound To The Sound Emitter?
    By SneakyTaco in forum Installation and Malfunctions Support
    Replies: 3
    Last Post: 04-16-2009, 05:47 PM
  3. Sound Emitter Sound level.
    By ICDWILL117 in forum Wiremod General Chat
    Replies: 5
    Last Post: 11-18-2008, 05:06 PM
  4. advanced sound emitter emits only 1 sound
    By rickumans in forum Installation and Malfunctions Support
    Replies: 0
    Last Post: 02-27-2008, 06:41 AM
  5. Is It Possible To End A Looping Sound From The Sound Emitter?
    By hizzeh in forum Installation and Malfunctions Support
    Replies: 0
    Last Post: 05-06-2007, 09:13 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots