Icon representing a recipe

Recipe: function_CheckLostPoints

created by WBarme1234

Profile


Name
function_CheckLostPoints
ID
104366
Shared with
Public
Parent
None
Children
Created on
January 20, 2021 at 12:46 PM UTC
Updated on
January 20, 2021 at 12:46 PM UTC
Description

Insert function into Your recipies -
This will detect and regain lost points

Best for


Code


--Start of Modification by Wbarme1234 --Problem observed: One complete Cycle of Wiggle/Shake ends not always with the maximum of points possible --This modification will detect and regain this lost points scoreBestRanked = -999999.9 lscoreBestRanked = -999999.9 currentScore = -999999.9 scoreAtbestRanked = false scorebestchge = true function CheckLostPoints( ) currentScore = current.GetScore() -- Get current(actual) Score -- print(" - Current Score : "..currentScore) scoreBestRanked=creditbest.GetScore() -- print(" - Credited best Ranked Score : "..scoreBestRanked) --Running always to verify if best score reached if ( math.abs(scoreBestRanked - currentScore) < 1E-3 ) then if ( scoreAtbestRanked == false ) then scorebestchge = true -- show 'change to best ranked score' only once end scoreAtbestRanked = true -- Set bit: Recipe started or running along best ranked score end if ( scorebestchge == true ) then print(" - Running along my own best ranking =",scoreAtbestRanked) scorebestchge = false end --Running always after shake, wiggle, ... if ( scoreAtbestRanked and (scoreBestRanked>currentScore) and (lscoreBestRanked<scoreBestRanked) ) then creditbest.Restore() -- regain lost points print("Reseting to CreditBest-RankedScore - due to lost points detected") end lscoreBestRanked = scoreBestRanked end function Score()--return score, exploration too CheckLostPoints( ) -- Check for lost points return uo.energy and current.GetEnergyScore() or current.GetScore() end --End of Modification by Wbarme1234

Comments


WBarme1234 Lv 1

–Problem observed: One complete Cycle of Wiggle/Shake ends not always with the maximum of points possible
–This modification will detect and regain this lost points

scoreBestRanked = -999999.9
lscoreBestRanked = -999999.9
currentScore = -999999.9
scoreAtbestRanked = false
scorebestchge = true

function CheckLostPoints( )
currentScore = current.GetScore() – Get current(actual) Score
– print(" - Current Score : "..currentScore)
scoreBestRanked=creditbest.GetScore()
– print(" - Credited best Ranked Score : "..scoreBestRanked)
–Running always to verify if best score reached
if ( math.abs(scoreBestRanked - currentScore) < 1E-3 ) then
if ( scoreAtbestRanked == false ) then
scorebestchge = true – show 'change to best ranked score' only once
end
scoreAtbestRanked = true – Set bit: Recipe started or running along best ranked score
end
if ( scorebestchge == true ) then
print(" - Running along my own best ranking =",scoreAtbestRanked)
scorebestchge = false
end
–Running always after shake, wiggle, …
if ( scoreAtbestRanked and (scoreBestRanked>currentScore) and
(lscoreBestRanked<scoreBestRanked) ) then
creditbest.Restore() – regain lost points
print("Reseting to CreditBest-RankedScore - due to lost points detected")
end
lscoreBestRanked = scoreBestRanked
end

function Score()–return score, exploration too
CheckLostPoints( ) – Check for lost points
return uo.energy and current.GetEnergyScore() or current.GetScore()
end

Bruno Kestemont Lv 1

Thanks for the function !
Combining with a check of loss bonus point would be very useful at start (design) puzzles. In order to maintain achieved bonusses.