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

musik und sounds ausschalten?

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

  1. · 14 years ago
    moin! in meinem menü möchte ich dem spieler ein paar tasten zeigen, die er im spiel drücken kann, darunter auch eine taste, um musik und / oder sound auszuschalten, aber ich weiß nicht genau, welcher befehl dafür der richtige ist.
    "gerade gespielten sound stoppen"? oder "lautstärke ändern" (auf 0)?
  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. · 14 years ago
    could you translate to English please?

    bing translation isn't making much sense.
  4. · 14 years ago
    how can i switch off sound and / or music to mute all game sounds? i want it to be a shortcut. i know how to create the shortcut but i don't know what's the right action i must chose from the list.
  5. · 14 years ago
    best method would be to use LUA to store current volume levels in a variable so that you can toggle between mute on/off.

    here's the script - it should be set as a "definition script" in the script options! - it should work but this is off the top of my head wink
    local musicVol = getObject('Values[val_musicVol]') -- get value for storing music volume
    local soundVol = getObject('Values[val_soundVol]') -- get value for storing sound volume
    local speechVol = getObject('Values[val_speechVol]') -- get value for storing speech volume
    local getCond = getObject('Conditions[cond_muteSound]') -- get condition for checking if sound is muted or playing
    
    -- let's create a function to toggle sound muted / playing!
    function toggleSound()
     local cond = getCond:getBool(VConditionValue) -- check condition value
     if not cond then
      getCond:setValue(VConditionValue, true) -- set condition to true
      musicVol:setValue(VValueInt, getVolume(eMusicVolume)) -- store current music volume
      soundVol:setValue(VValueInt, getVolume(eSoundVolume)) -- store current sound volume 
      speechVol:setValue(VValueInt, getVolume(eSpeechVolume)) -- store current speech volume
      setVolume(eMusicVolume, 0) -- set music volume to "0"
      setVolume(eSoundVolume, 0) -- set sound volume to "0"
      setVolume(eSpeechVolume, 0) -- set speech volume to "0"
     else
      getCond:setValue(VConditionValue, false) -- set condition to false!
      setVolume(eMusicVolume, musicVol) -- restore music volume
      setVolume(eSoundVolume, soundVol) -- restore sound volume
      setVolume(eSpeechVolume, speechVol) -- restore speech volume
     end
    end
    

    call it by executing a script & typing in the function name.
    toggleSound()
  6. · 14 years ago
    cool, danke. i'll try this later when i have my first demo game finished!
  7. · 14 years ago
    hmm I was thinking it would be better to add the current values inside of values inside of the editor - that way they will be correctly set based on any save you decide to load rather than relying on the variables.

    I have updated the script (above) to reflect what I have said, above.
  8. · 14 years ago
    i created a new script created it as "definition script" and pasted your script into it. when i hit F4 i execute a script and typed "toggleSound()" but it doesn't work roll
  9. · 14 years ago
    what does it say in the log?

    the script was off the top of my head so I wasn't sure if it was correct or not ...

    did you add the conditions/values listed in the script somewhere inside of the editor?
  10. · 14 years ago
    i just copied the text and pasted it into the script
    “
    did you add the conditions/values listed in the script somewhere inside of the editor?
    „
    i think i didn't. i have no idea how scripting works, not at all smile
  11. · 14 years ago
    you need to create the values: "val_musicVol", "val_soundVol", "val_SpeechVol" & the condition: "cond_muteSound" somewhere inside of the Visionaire Studio editor.

    if it doesn't work after that, then let me know what is says in the messages.txt & visedit.txt log files.

    P.S: "m" key would be more ideal for as "m" for "mute" & it should be set as "m (released)" or whatever it is in German; so that it only performs the execute script: "toggleSound()" when the key has been released to prevent it looping between on or off.

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?