Posted 06 February 2013 - 05:07 PM
I am trying to compare the values of the variable 'x' to the squareroot of another variable
right now it says 'attempt to call a nil value' or some variation
here is my code.
i dont know what to do
right now it says 'attempt to call a nil value' or some variation
here is my code.
i dont know what to do
sticks = 5
woodenTools = 10
scrap = 15
woodBlocks = 15
mushroomBlocks = 15
woodenScaffolding = 15
coal = 80
charcoal = 80
peat = 80
blazeRod = 120
coalCoke = 320
biofuelCan = 520
lava = 1000
coalfuelCan = 1520
--if square root of lenth * width is less than or greater than something, give that as recommended fuel.
if x <= sqrt(sticks) then
recomendedFuel = "Sticks"
fuel = sticks
end
if sqrt(sticks) <= x <= sqrt(woodenTools) then
recomendedFuel = "Wooden Tools"
fuel = woodenTools
end
if sqrt(woodenTools) <= x <= sqrt(scrap) then
recomendedFuel = "Scrap, Wood Blocks, Mushroom Blocks, Wooden Scaffolding"
fuel = scrap
end
if sqrt(scrap) <= x <= sqrt(coal) then
recomendedFuel = "Coal/ Charcoal, Peat"
fuel = coal
end
if sqrt(coal) <= x <= sqrt(blazeRod) then
recomendedFuel = "Blaze Rod"
fuel = blazeRod
end
if sqrt(blazeRod) <= x <= sqrt(coalCoke) then
recomendedFuel = "Coal Coke"
fuel = coalCoke
end
if sqrt(coalCoke) <= x <= sqrt(biofuelCan) then
recomendedFuel = "Biofuel Can"
fuel = biofuelCan
end
if sqrt(biofuelCan) <= x <= sqrt(lava) then
recomendedFuel = "Lava"
fuel = lava
end
if sqrt(lava) <= x <= sqrt(coalfuelCan) then
recomendedFuel = "Coalfuel Can"
fuel = coalfuelCan
end