Profile
- Name
- Fuze_slots_v1.0
- ID
- 103292
- Shared with
- Public
- Parent
- None
- Children
- None
- Created on
- March 09, 2020 at 04:58 AM UTC
- Updated on
- March 09, 2020 at 04:58 AM UTC
- Description
Fuzes slots and updates slot data with fuzed solutions. Usefull after manual remix.
Best for
Code
--[[ Fuzes slots and updates slot data with fuzed solutions. Usefull after manual remix.
]]--
function RequestOptions()
ask=dialog.CreateDialog("Fuze Slots options")
ask.slotNum = dialog.AddSlider("Slots to fuze",slotNum,1,8,0)
ask.OK = dialog.AddButton("OK",1)
ask.fast_Fuze=dialog.AddCheckbox("Fast fuze only", fast_Fuze)
dialog.Show(ask)
slotNum=ask.slotNum.value
fast_Fuze=ask.fast_Fuze.value
end
function ScoreReturn()
x = current.GetEnergyScore()
return x-x%0.01
end
function FastFuze()
behavior.SetClashImportance(0.3)
structure.ShakeSidechainsAll(1)
structure.WiggleAll(2)
behavior.SetClashImportance(1)
structure.WiggleAll(20)
end
function Fuze()
behavior.SetClashImportance(0.05)
structure.ShakeSidechainsAll(1)
structure.WiggleAll(2)
behavior.SetClashImportance(0.2)
structure.ShakeSidechainsAll(1)
structure.WiggleAll(1)
behavior.SetClashImportance(1)
structure.WiggleAll(1)
behavior.SetClashImportance(0.3)
structure.ShakeSidechainsAll(1)
behavior.SetClashImportance(1)
structure.WiggleAll(20)
end
function round(x) -- round to 0.01 x-x%0.01
return
end
--
recentbest.Save()
save.Quicksave(99)
scoreCurrent=ScoreReturn()
startScore=ScoreReturn()
maxScore=ScoreReturn()
bestSlot=0
bestScore=-999999
-- counts for slots until get an empty one
j=1
while not save.QuicksaveEmpty(j) do
save.Quickload(j)
print("Slot", j, "score is:", ScoreReturn())
j=j+1
end
save.Quickload(99)
slotNum=j-1
if slotNum > 1 then print("Total number of slots is", slotNum) end
if slotNum > 8 then slotNum=8 end
if slotNum > 1 then RequestOptions() end -- show dialog if there are slots
fuzing="fuzing"
if fast_Fuze then fuzing="fast_fuzing" end
print("Start score is:", scoreCurrent,"/ "..fuzing, slotNum, "slots.")
--main
for i=1, slotNum do
if not save.QuicksaveEmpty(i) then
save.Quickload(i)
scoreCurrent=ScoreReturn()
if fast_Fuze then
FastFuze()
else Fuze() end
end
if ScoreReturn() > scoreCurrent then save.Quicksave(i) end
best=""
if ScoreReturn() > maxScore then
maxScore=ScoreReturn()
recentbest.Save()
best="*best"
end
if ScoreReturn() > bestScore then
bestSlot=i
bestScore=ScoreReturn()
end
print(i,"of", slotNum, ": finished", ScoreReturn(), "| started at", scoreCurrent," "..best)
end
save.Quickload(bestSlot)
if maxScore > startScore then
print ("Restoring best solution from slot", bestSlot, "with", bestScore, "points.")
else
print ("Best solution in slot", bestSlot, "with", bestScore,"points")
save.Quickload(99)
end
--recentbest.Restore()