Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --EITHER nHave OR nWant HAVE TO BE OVER 10 TO BE USED UNLESS THE OTHER IS ZERO!
- nHave = 14 --How many Discogs users have this release.
- nWant = 73 --How many Discogs users want this release.
- nMade = 500 --How many of this release were made (don't know? leave it at 0.)
- ENUM_COMPARATIVE = 10000
- ENUM_CATFOUR = 100
- ENUM_CATTHREE = 80
- ENUM_CATTWO = 60
- ENUM_CATONE = 11
- ENUM_CATX = 6
- function fcExecuteCalculation()
- local sFinal = ""
- local iDiscogsNum = 0
- local iDispatchNum = 0
- local iCombined = 0
- if not(nHave == 0 or nWant == 0) then
- iDiscogsNum = (nHave/nWant)*100
- elseif nHave == 0 and nWant ~= 0 then
- iDiscogsNum = 1/(1+math.exp(-nWant))*-100
- elseif nHave ~= 0 and nWant == 0 then
- iDiscogsNum = 1/(1+math.exp(-nWant))*100
- end
- if nMade == 0 then --Meaning we don't know how many were created.
- iDispatchNum = (nMade / ENUM_COMPARATIVE)*100
- end
- iCombined = iDispatchNum + iDiscogsNum
- if iCombined >= ENUM_CATFOUR then
- sFinal = "Category 4"
- elseif iCombined >= ENUM_CATTHREE and iCombined < ENUM_CATFOUR then
- sFinal = "Category 3"
- elseif iCombined >= ENUM_CATTWO and iCombined < ENUM_CATTHREE then
- sFinal = "Category 2"
- elseif iCombined >= ENUM_CATONE and iCombined < ENUM_CATTWO then
- sFinal = "Category 1"
- elseif iCombined >= ENUM_CATX and iCombined < ENUM_CATONE then
- sFinal = "Category X"
- end
- return sFinal
- end
- print(fcExecuteCalculation())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement