Advertisement
Guest User

Rammstein Item Classification

a guest
Apr 25th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. --EITHER nHave OR nWant HAVE TO BE OVER 10 TO BE USED UNLESS THE OTHER IS ZERO!
  2. nHave = 14 --How many Discogs users have this release.
  3. nWant = 73 --How many Discogs users want this release.
  4. nMade = 500 --How many of this release were made (don't know? leave it at 0.)
  5.  
  6. ENUM_COMPARATIVE = 10000
  7. ENUM_CATFOUR = 100
  8. ENUM_CATTHREE = 80
  9. ENUM_CATTWO = 60
  10. ENUM_CATONE = 11
  11. ENUM_CATX = 6
  12.  
  13. function fcExecuteCalculation()
  14.     local sFinal = ""
  15.     local iDiscogsNum = 0
  16.     local iDispatchNum = 0
  17.     local iCombined = 0
  18.     if not(nHave == 0 or nWant == 0) then
  19.         iDiscogsNum = (nHave/nWant)*100
  20.     elseif nHave == 0 and nWant ~= 0 then
  21.         iDiscogsNum = 1/(1+math.exp(-nWant))*-100
  22.     elseif nHave ~= 0 and nWant == 0 then
  23.         iDiscogsNum = 1/(1+math.exp(-nWant))*100
  24.     end
  25.  
  26.     if nMade == 0 then --Meaning we don't know how many were created.
  27.         iDispatchNum = (nMade / ENUM_COMPARATIVE)*100
  28.     end
  29.  
  30.     iCombined = iDispatchNum + iDiscogsNum
  31.  
  32.     if iCombined >= ENUM_CATFOUR then
  33.         sFinal = "Category 4"
  34.     elseif iCombined >= ENUM_CATTHREE and iCombined < ENUM_CATFOUR then
  35.         sFinal = "Category 3"
  36.     elseif iCombined >= ENUM_CATTWO and iCombined < ENUM_CATTHREE then
  37.         sFinal = "Category 2"
  38.     elseif iCombined >= ENUM_CATONE and iCombined < ENUM_CATTWO then
  39.         sFinal = "Category 1"
  40.     elseif iCombined >= ENUM_CATX and iCombined < ENUM_CATONE then
  41.         sFinal = "Category X"
  42.     end
  43.  
  44.     return sFinal
  45. end
  46.  
  47. print(fcExecuteCalculation())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement