Posted 21 September 2012 - 08:25 PM
So here's the 2 things i'm working on…i know the basics but i don't know the lua syntax…
first is a item to UU code… it has stuff like:
and so on… now what i want to do in my main() is this…
so how would i best write the getUU function?
and second question… trees…
what if i want to define something like this…
iron, base item
copper, base item
redstone, base item
rubber, base item
copper_cable, 1/2 copper, 1 rubber
refined iron, 1 iron
electronic circuit, 1 refined iron, 2 redstone, 6 copper cable
and when i do input = io.read() and input == "electronic circuit"
the output is "1 iron, 2 redstone, 3 copper, 6 rubber"…
i know of ways to do it, but since it's been years since i've worked on a "good code" it would be too messy… the other potential would be a forestry bee breeding program… you enter a type of bee or a product you want and it tells you how to get to the bee you want…
say you enter cultivated and it tells you:
cultivated = common + any natural beed
common = any natural + any natural
so… any clean solutions to my word to variable and find all the members in a tree solution? :)/>/>
thanks in advance ^^
edit:
is it possible to do something like this in lua…
mining_turtle.diamond_pick = 1
mining_turtle.turtle = 1
diamond_pick.diamond = 3
diamond_pick.stick = 2
stick.plank = 1/2
plank.wood = 1/4
turtle.iron = 7
turtle.chest = 1
turtle.computer = 1
chest.plank = 8
computer.stone = 7
computer.redstone = 1
computer.glass_pane = 1
glass_pane.glass = 6/16
and somehow if i ask for the mining turtle mats it tells me 3 diamonds, 8.25 wood, 7 stone, 7 iron, 0.375 glass, 1 redstone… and how…
i really have no clue how lua handles classes…
would be even better if i can tell it that 1 diamond is 9 UU and after giving me that, it tells me the total UU cost…
first is a item to UU code… it has stuff like:
iron = 5/4
copper = 3/10
rubber = 4/63
copper_cable = copper/2 + rubber
and so on… now what i want to do in my main() is this…
function main()
print("Enter the item you want to craft: ")
item = io.read()
print("That item costs ",getUU(item)," UU to make.")
end
so how would i best write the getUU function?
and second question… trees…
what if i want to define something like this…
iron, base item
copper, base item
redstone, base item
rubber, base item
copper_cable, 1/2 copper, 1 rubber
refined iron, 1 iron
electronic circuit, 1 refined iron, 2 redstone, 6 copper cable
and when i do input = io.read() and input == "electronic circuit"
the output is "1 iron, 2 redstone, 3 copper, 6 rubber"…
i know of ways to do it, but since it's been years since i've worked on a "good code" it would be too messy… the other potential would be a forestry bee breeding program… you enter a type of bee or a product you want and it tells you how to get to the bee you want…
say you enter cultivated and it tells you:
cultivated = common + any natural beed
common = any natural + any natural
so… any clean solutions to my word to variable and find all the members in a tree solution? :)/>/>
thanks in advance ^^
edit:
is it possible to do something like this in lua…
mining_turtle.diamond_pick = 1
mining_turtle.turtle = 1
diamond_pick.diamond = 3
diamond_pick.stick = 2
stick.plank = 1/2
plank.wood = 1/4
turtle.iron = 7
turtle.chest = 1
turtle.computer = 1
chest.plank = 8
computer.stone = 7
computer.redstone = 1
computer.glass_pane = 1
glass_pane.glass = 6/16
and somehow if i ask for the mining turtle mats it tells me 3 diamonds, 8.25 wood, 7 stone, 7 iron, 0.375 glass, 1 redstone… and how…
i really have no clue how lua handles classes…
would be even better if i can tell it that 1 diamond is 9 UU and after giving me that, it tells me the total UU cost…