License from €75 Log in
DE EN FR ES IT CZ

Simple Mute Button?

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 10 years ago
    I want to have a simple button (or tiggered by the M key) that will shut off all sounds, and then turn them back on when clicked/pressed again. 

    I know there is a guide on how to do this in the Wiki, but I really know nothing about scripting (but intend on learning more).

    Can someone either walk me through the steps, or recommend a simpler way to do this?


    Thanks so much!
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 10 years ago
    There was 2 additional volume channels added into Visionaire Studio 4.x. eGlobalVolume & eMovieVolume. The global volume channel is essentially the master volume channel that all the different volume channels are linked to, so you could easily toggle it like so...

    1. create a key action for "m (released)" - note the released bit, it's important.
    2. inside of that action create an execute a script action part & add this block of code to it...
    if getVolume(eGlobalVolume) > 0 then
     setVolume(eGlobalVolume, 0)
    else
     setVolume(eGlobalVolume, 100)
    end

    & that should do it. smile
  4. · 10 years ago
    This worked perfectly, thank you!

    One question:
    I set up Space and Esc to show a pause menu, and S to execute an autosave.  
    Should I change them to be on key released?  If so, why?
    What is the difference if it is just for a single button press?

    Thanks!
  5. · 10 years ago
    Key (released) only triggers the actions once the player lets go of the key, whereas the regular key actions work like the turbo button on a gamepad; in other words if you use a regular key action, then it ends up looping through the actions indefinitely while the player is keeping the key pushed down which isn't a good thing if the actions are saving something or are toggling between one thing & another.

    Example. Let's say you are using ESC to toggle between the main menu & also to switch back to the previous scene, now because you are toggling between the two scenes it will keep switching between them until the player lets go.

    Regular key press would be more desired for say sliding something out or moving a character. Anyway... I always recommend using Key (released) key events unless a situation requires the regular key event type.
  6. · 10 years ago
    Perfect, thank you!

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?