Skip to content
TheChatArchiveThe Chat Archive
gpt-4-0314· OpenAIAi2 WildChat-4.8M (AI2)

local chances = { {label = 'Rare', value = 0.7992, avp = 700}, {label = 'Mythical',…

  1. User

    local chances = { {label = 'Rare', value = 0.7992, avp = 700}, {label = 'Mythical', value = 0.1598, avp = 1500}, {label = 'Legendary', value = 0.0320, avp = 3000}, {label = 'Ancient', value = 0.0064, avp = 1000}, {label = 'Exceedingly Rare', value = 0.0026, avp = 125000} }

    LUA

    AVP is average price per rareity value is the chance of hitting between 0-1 required to make at least 40000 and no more than 55000 it takes math.random(30,60) + 7 seconds between every chance attempt randomize the number after every chance simulate running for an hour and then print the money made per hour and what was gotten if the money made wasn't within the requirement play around with the value in the chance table simulate again and repeat until within the rage the total of the value can't execde 1 so lower chances rase others until you reach the desired output

  2. Assistant

    Here's a script that simulates the randomization process and adjusts the probabilities as needed to meet the requirements:

    function simulate()
        local startTime = os.time()
        local endTime = startTime + 3600 -- 1 hour later
        local moneyMade = 0
        local itemsGotten = {}
    
        while os.time() < endTime do
            local chosenTime = math.random(30, 60) + 7
            os.execute("sleep " .. tonumber(chosenTime))
    
            local randNum = math.random()
            local totalProbability = 0
            local currentItem
    
            for _, item in ipairs(chances) do
                totalProbability = totalProbability + item.value
                if randNum < totalProbability then
                    currentItem = item
                    break
                end
            end
    
            moneyMade = moneyMade + currentItem.avp
            itemsGotten[currentItem.label] = (itemsGotten[currentItem.label] or 0) + 1
        end
    
        return moneyMade, itemsGotten
    end
    
    function adjustChances()
        local newChances = {}
        for _, item in ipairs(chances) do
            newChances[_] = {label = item.label, value = item.value, avp = item.avp}
        end
    
        local simulationResult
        repeat
            local moneyMade, itemsGotten = simulate()
            if moneyMade >= 40000 and moneyMade <= 55000 then
                simulationResult = {moneyMade = moneyMade, itemsGotten = itemsGotten}
                break
            elseif moneyMade < 40000 then
                for _, item in ipairs(newChances) do
                    item.value = item.value * 1.05
                    if item.value > 1 then item.value = 1 end
                end
            else
                for _, item in ipairs(newChances) do
                    item.value = item.value * 0.95
                    if item.value < 0 then item.value = 0 end
                end
            end
        until false
    
        return simulationResult
    end
    
    local result = adjustChances()
    print("Money made per hour: " .. result.moneyMade)
    print("Items gotten:")
    for k, v in pairs(result.itemsGotten) do
        print("\t" .. k .. ": " .. v)
    end
    

    Please note that 1 hour simulation might take a while to complete and this code snippet uses the "os.execute" function to pause the script. To run the snippet, you need to make sure that your Lua environment has the "os" module enabled.

    This script simulates the process for an hour, adjusts the chances accordingly, and prints the money made per hour and the items obtained. You can further tweak the probabilities in the "adjustChances" function if necessary.