SHARE
TWEET

volumeControl-widget

a guest Aug 14th, 2016 25 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require "base/internal/ui/reflexcore";
  2.  
  3. volumeControl = {canHide = false; canPosition = false;};
  4.  
  5. registerWidget("volumeControl");
  6.  
  7. function volumeControl:initialize()
  8.     widgetCreateConsoleVariable("increment", "float", 0);
  9. end
  10.  
  11. function volumeControl:draw()
  12.     local volumeIncrement = clampTo4Decimal(widgetGetConsoleVariable("increment"));
  13.     if volumeIncrement ~= 0 then
  14.         local newVolume = clamp(clampTo4Decimal(consoleGetVariable("s_volume")) + volumeIncrement, 0, 1);
  15.         consolePerformCommand("s_volume " .. newVolume);
  16.         consolePrint("s_volume " .. newVolume);
  17.         widgetSetConsoleVariable("increment", 0);
  18.     end
  19. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top