Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I organize hundreds of complicated values?

Asked by 7 years ago

Hello! I've been working on an American Ninja Warrior simulation game in which 1 player faces off against 149 computer players. I've created a script that generates all of the results of each computer player, but I have no idea how to organize the CPUs in order of Result/Time.

Here's my script that goes into each CPU:

local Result = script.Parent.Result.Value
local Time = script.Parent.Time.Value

wait(2)
Result = (math.random(1, 24))
wait(0.1)
if Result == 1 then
    Time = (math.random(1,4)) + (math.random())
elseif Result == 2 then
    Time = (math.random(5,8)) + (math.random())
elseif Result == 3 then
    Time = (math.random(9,12)) + (math.random())
elseif Result == 4 then
    Time = (math.random(13,16)) + (math.random())
elseif Result == 5 then
    Time = (math.random(12,15)) + (math.random())
elseif Result == 6 then
    Time = (math.random(8,11)) + (math.random())
elseif Result == 7 then
    Time = (math.random(4,7)) + (math.random())
elseif Result == 8 then
    Time = (math.random(21,25)) + (math.random())
elseif Result == 9 then
    Time = (math.random(15,20)) + (math.random())
elseif Result == 10 then
    Time = (math.random(10,14)) + (math.random())
elseif Result == 11 then
    Time = (math.random(26,31)) + (math.random())
elseif Result == 12 then
    Time = (math.random(20,25)) + (math.random())
elseif Result == 13 then
    Time = (math.random(14,19)) + (math.random())
elseif Result == 14 then
    Time = (math.random(39,45)) + (math.random())
elseif Result == 15 then
    Time = (math.random(32,38)) + (math.random())
elseif Result == 16 then
    Time = (math.random(25,31)) + (math.random())
elseif Result == 17 then
    Time = (math.random(18,24)) + (math.random())
elseif Result == 18 then
    Time = (math.random(56,72)) + (math.random())
elseif Result == 19 then
    Time = (math.random(41,55)) + (math.random())
elseif Result == 20 then
    Time = (math.random(25,40)) + (math.random())
elseif Result == 21 then
    Time = (math.random(131,220)) + (math.random())
elseif Result == 22 then
    Time = (math.random(81,130)) + (math.random())
elseif Result == 23 then
    Time = (math.random(66,80)) + (math.random())
elseif Result == 24 then
    Time = (math.random(49,65)) + (math.random())
end

local Time = math.floor(Time * 10)/10

print(script.Parent.Name)

if Result < 4 then
    print("Quad Steps")
    print(Time)
elseif Result > 3 and Result < 8 then
    print("Rope Swing")
    print(Time)
elseif Result > 7 and Result < 11 then
    print("Bridge of Blades")
    print(Time)
elseif Result > 10 and Result < 14 then
    print("Jump Hang")
    print(Time)
elseif Result > 13 and Result < 18 then
    print("Pipe Slider")
    print(Time)
elseif Result > 17 and Result < 21 then
    print("Warped Wall")
    print(Time)
elseif Result < 20 then
    print("CLEAR")
    print(Time)
end

--[===[
1 - 3 = Quad Steps
4 - 7 = Rope Swing
8 - 10 = Bridge of Blades
11 - 13 = Jump Hang
14 - 17 = Pipe Slider
18 - 20 = Warped Wall
21 - 24 = CLEAR
]===]

I would like to set up a 150 person leader board at the end of the player's run using these results. Does anyone know how I can form an algorithm to organize all of these values?

Answer this question