Name Typ Von
Stummschalten/Lautstärke wiederherstellen Definition AFRLme

Mit diesem Skript schaltest du die Lautstärke aller Soundtypen stumm oder stellst sie wieder her. Seit Visionaire Studio 4.0 geht das auch über den neuen Befehl eGlobalVolume, siehe Methode mit eGlobalVolume.

Zusätzliche Informationen
Derzeit verfügbare Volume-Typen...
eMusicVolume(0), eSoundVolume(1), eSpeechVolume(2), eMovieVolume(3), eGlobalVolume(4)

Anweisungen

1. Füge das Hauptskript im Skripteditor von Visionaire Studio hinzu und lege es als Definitionsskript fest.
2. Lege die Bedingung "cond_mute" an und setze den Standardwert auf false.
3. Lege 5 Werte an: vol_0, vol_1, vol_2, vol_3 und vol_4. Darin werden die Lautstärken gespeichert.
4. Zum Stummschalten und Wiederherstellen fügst du einer Taste, einem Button oder einem Szenenobjekt einen Aktionsteil Skript ausführen hinzu mit ...

globalMute()

Hauptskript

--[[
Mute/Restore Volume [V1] (20/03/2014)
Written by AFRLme [Lee Clarke]
-- + --
email: afrlme@outlook.com
paypal: afrlme@zoho.com
patreon: https://www.patreon.com/AFRLme
portfolio: https://afrl.me
-- + --
This script is donation optional. In game credit is non-negotiable.
You are free to: ¹ use it in your game(s). ² modify the script.
Do not remove - or edit - this comment block.
--]]

-- * local variables * --
local cond = getObject("Conditions[cond_mute]") -- store muted condition

-- * function that determines if sound should be muted or restored * --
function globalMute()
 if not cond:getBool(VConditionValue) then -- if not muted then...
  for i = 0, 4 do -- (0, 2) if you are still on 3.7.1 or below (eMovieVolume(3) & eGlobalVolume(4) from visionaire studio 4.0 onwards)
   getObject("Values[vol_" .. i .. "]"):setValue(VValueInt, getVolume(i)) -- store volume i into linked editor value
   setVolume(i, 0) -- set volume i to 0
  end
  cond:setValue(VConditionValue, true) -- set muted condition to true
 else -- if already muted then do...
  for i = 0, 4 do -- (0, 2) if you are still on 3.7.1 or below (eMovieVolume(3) & eGlobalVolume(4) from visionaire studio 4.0 onwards)
   setVolume(i, getObject("Values[vol_" .. i .. "]"):getInt(VValueInt)) -- return volume level for i based on linked editor value
  end
  cond:setValue(VConditionValue, false) -- set muted condition to false
 end
 -- startVolSlider() -- uncomment this line if you are also using the volume slider script
end

eGlobalVolume-Methode

--[[
Mute/Restore Volume (global method; visionaire studio 4.0+ only) [V1] (20/03/2014)
Written by AFRLme [Lee Clarke]
-- + --
email: afrlme@outlook.com
paypal: afrlme@zoho.com
patreon: https://www.patreon.com/AFRLme
portfolio: https://afrl.me
-- + --
This script is donation optional. In game credit is non-negotiable.
You are free to: ¹ use it in your game(s). ² modify the script.
Do not remove - or edit - this comment block.
--]]

-- * local variables * --
local cond = getObject("Conditions[cond_mute]") -- store muted condition

-- * function that determines if sound should be muted or restored * --
function globalMute()
 if not cond:getBool(VConditionValue) then setVolume(eGlobalVolume, 0); cond:setValue(VConditionValue, true) else setVolume(eGlobalVolume, 100); cond:setValue(VConditionValue, false) end
end


Relevante Seiten: Lautstärkeregelung