Gabila0099

Lumikit - RGB virtual dimmer

May 21st, 2020
478
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Author: Gabriel Klabunde
  2. // Date: 21/05/2020
  3. // Script: RGB virtual dimmer
  4.  
  5. //Ui Build for fixtures select
  6. procedure OnRegister;
  7. begin
  8.   RegisterUIFixtureBox(1, 'Select Fixtures');
  9. end;
  10.  
  11. procedure OnExecute;
  12. var
  13.   f,r,g,b,dim,nr,ng,nb: integer;
  14. begin
  15.   IteratorUIReset(1);
  16.  
  17.   //Get fixtures from UI and set in var i
  18.   while IteratorUIRead(1, f) do
  19.   begin
  20.     //Get values from RGB params
  21.     r:= GetFixParam(f, CT_CYANRED);
  22.     g:= GetFixParam(f, CT_MAGENTAGREEN);
  23.     b:= GetFixParam(f, CT_YELLOWBLUE);
  24.     dim:= GetFixParam(f, CT_DIMMER);
  25.  
  26.     //Calcule new values
  27.     nr:= r*dim / 255;
  28.     ng:= g*dim / 255;
  29.     nb:= b*dim / 255;
  30.  
  31.     //Set new values
  32.     SetFixParam(f, CT_CYANRED, nr);
  33.     SetFixParam(f, CT_MAGENTAGREEN, ng);
  34.     SetFixParam(f, CT_YELLOWBLUE, nb);
  35.   end;
  36.  
  37. end;
  38.  
  39. //Terminate Script
  40. procedure OnTerminate;
  41. begin
  42.   DoTerminate;
  43. end;
RAW Paste Data