Icon representing a recipe

Recipe: Band_Control

created by Orcus

Profile


Name
Band_Control
ID
100012
Shared with
Public
Parent
None
Children
None
Created on
September 28, 2014 at 07:32 AM UTC
Updated on
September 28, 2014 at 07:32 AM UTC
Description

Disables or changes strength/length for a set of bands. Allows control of multiple band sets by categories.

Best for


Code


options = dialog.CreateDialog("Options") options.x1 = dialog.AddLabel("For any of: ") options.enable1 = dialog.AddCheckbox("enabled bands",false) options.disable1 = dialog.AddCheckbox("disabled bands",false) options.str1 = dialog.AddSlider("with strength" ,0 ,0 ,3 , 1) options.len1 = dialog.AddSlider("with length" ,0 ,0 ,5 , 1) options.x2 = dialog.AddLabel("- do them:") options.remove2 = dialog.AddCheckbox("remove",false) options.disable2 = dialog.AddCheckbox("disable",false) options.enable2 = dialog.AddCheckbox("enable",false) options.str2 = dialog.AddSlider("set Strength" ,0 ,0 ,3 , 1) options.len2 = dialog.AddSlider("set length" ,0 ,0 ,5 , 1) options.okay = dialog.AddButton("Okay",1) dialog.Show(options) enable1=options.enable1.value disable1=options.disable1.value str1=options.str1.value len1=options.len1.value remove2=options.remove2.value disable2=options.disable2.value enable2=options.enable2.value str2=options.str2.value len2=options.len2.value bcount=band.GetCount() allbands={} --print("enable1:",enable1, "; str1-2:",str1, " ", str2, "; disable2:",disable2, "; remove2:",remove2) for i=1, bcount do if enable1 then if band.IsEnabled(i) then allbands[i]=7 --print ("Band is enabled:", i) end end if disable1 then if band.IsEnabled(i)==false then allbands[i]=7 --print ("Band is disabled:", i) end end if str1~=0 then if (band.GetStrength(i)>str1-.01) and (band.GetStrength(i)<str1+.01) then allbands[i]=7 --print ("Band str is equal: ", i) end end if len1~=0 then if (band.GetGoalLength(i)>len1-.01) and (band.GetGoalLength(i)<len1+.01) then allbands[i]=7 --print ("Band str is equal: ", i) end end end for i=1, bcount do if allbands[i]==7 then if disable2 then band.Disable(i) end if enable2 then band.Enable(i) end if str2~=0 then band.SetStrength (i,str2) end if len2~=0 then band.SetGoalLength (i,len2) end end if (allbands[bcount-i+1]==7) and (remove2) then --print("removed: ", i) band.Delete(bcount-i+1) end end

Comments