Code
--MurloW
--Any CI LooseFuze
startscore = current.GetScore()
numSegs = structure.GetCount()
bestscore = startscore
y = structure.GetCount()
p = print
function wig(it)
return structure.WiggleAll(it)
end
function setCI(ci)
return behavior.SetClashImportance(ci)
end
function get_ss(sn)
return structure.GetSecondaryStructure(sn)
end
function SS() --M. Suchard
p('Sewing the sheets ..')
local nSegs=structure.GetCount()
for i =2,nSegs do
for y =i+1,nSegs do
if (structure.GetDistance(i, y)< 8 and get_ss(i)=='E' and get_ss(y)=='E' )then
band.AddBetweenSegments(i,y)
end
end
end
end
function comp(numSeg, mo)
p("Squeezing ..")
for i=1, y do
band.AddBetweenSegments(i,y)
band.AddBetweenSegments(i,y/5)
if mo == true then
band.AddBetweenSegments(i,y/7)
band.AddBetweenSegments(i,y/3)
else
end
end
for i=1, band.GetCount() do
band.SetGoalLength(i,band.GetLength(i))
if band.GetLength(i)-4>0 then
band.SetGoalLength(i,band.GetLength(i)-3)
band.SetStrength(i,0.2)
else
end
end
setCI(0.1)
wig(3)
band.DisableAll()
end
function Fuzing()
p("Fuuuuuusion, hah!")
if muta == true then
Fuze1mut()
if low == false then
recentbest.Restore()
else
end
Fuze2mut()
else
Fuze1()
if low == false then
recentbest.Restore()
else
end
Fuze2()
end
wig(6)
if low == false then
recentbest.Restore()
else
end
end
function Fuze1()
setCI(0.07)
structure.ShakeSidechainsAll(1)
band.DisableAll()
setCI(cival)
wig(4)
setCI(0.03)
structure.ShakeSidechainsAll(1)
setCI(cival/3)
wig(4)
setCI(cival)
wig(4)
structure.ShakeSidechainsAll(1)
end
function Fuze2()
band.EnableAll()
setCI(cival/2)
structure.ShakeSidechainsAll(1)
wig(2)
band.DisableAll()
setCI(cival)
wig(6)
structure.ShakeSidechainsAll(1)
end
function Fuze1mut()
setCI(0.1)
structure.MutateSidechainsAll(1)
band.DisableAll()
setCI(cival)
wig(4)
setCI(0.2)
structure.MutateSidechainsAll(1)
setCI(cival/3)
wig(4)
setCI(cival)
wig(4)
structure.MutateSidechainsAll(1)
end
function Fuze2mut()
band.EnableAll()
setCI(cival/2)
structure.MutateSidechainsAll(1)
wig(2)
band.DisableAll()
setCI(cival)
wig(6)
structure.MutateSidechainsAll(1)
end
function CheckBest()
if (bestscore < current.GetScore()) then
gain = current.GetScore() - bestscore
else
gain = 0
end
end
function Loop()
if gain>mingain then
p("Loop gain:",gain,"points.")
return Fuzing()
end
end
---------------------------------------------------------------------------------------------
ask = dialog.CreateDialog("Options.")
ask.br = dialog.AddLabel("Clashing Importance")
ask.cival = dialog.AddSlider("", 0.1, 0.1, 1, 2)
ask.br2 = dialog.AddLabel("Points gain needed to loop again")
ask.minPpl = dialog.AddSlider("Minimum", 0.1, 0.1, 100, 1)
ask.loop = dialog.AddCheckbox("No looping, one fuze only.", True)
ask.br3 = dialog.AddLabel("Banding:")
ask.sew = dialog.AddCheckbox("Sew sheets together?", True)
ask.compress = dialog.AddCheckbox("Dual-cluster compression?", True)
ask.moar = dialog.AddCheckbox("Completely ball it up?", True)
ask.br4 = dialog.AddLabel("Fuzing:")
ask.lowclash = dialog.AddCheckbox("Relaxing?", True)
ask.mut = dialog.AddCheckbox("Mutate?", True)
ask.ok = dialog.AddButton("Go go!",1)
dialog.Show(ask)
cival = ask.cival.value
mo = ask.moar.value
compr = ask.compress.value
sewS = ask.sew.value
low = ask.lowclash.value
muta = ask.mut.value
loo = ask.loop.value
mingain = ask.minPpl.value
if mo == true then
compr = true
else
end
if sewS == true then
if compr == true then
ask = dialog.CreateDialog("Options.")
ask.del = dialog.AddLabel("Delete sheet bands before compression?")
ask.DelSew = dialog.AddCheckbox("Yes.", True)
ask.non = dialog.AddCheckbox("No.", True)
ask.ok = dialog.AddButton("Go go!",1)
dialog.Show(ask)
end
end
---------------------------------------------------------------------------------------------
recentbest.Save()
band.DeleteAll()
save.Quicksave(4)
if sewS == true then
SS()
setCI(cival/5)
wig(3)
structure.ShakeSidechainsAll(1)
setCI(cival)
wig(3)
if compr == true then
if ask.DelSew.value == true then
band.DeleteAll()
else
end
else
end
end
if compr == true then
comp(numSeg, mo)
else
end
if low == true then
p("Relaxing ..")
setCI(0.1)
wig(3)
setCI(0.05)
structure.ShakeSidechainsAll(1)
setCI(0.15)
wig(5)
else
end
Fuzing()
CheckBest()
if loo == false
then
Loop()
else
end
---------------------------------------------------------------------------------------------
save.Quicksave(5)
p("Score:",current.GetScore())
save.Quickload(4)
p("Startscore:",current.GetScore())
save.Quickload(5)
if low == false then
p("Gained:",gain,"points.")
p("Undo returns pre-fuze state.")
else
p("Undo returns pre-relax state.")
end