Posted 09 December 2013 - 08:19 PM
I was playing FTB Mindcrack Pack (a minecraft mod pack with Computer Craft) and thought to myself, I really want some storage automation. I have minimal knowlege of lua and turtles, but i do know thier basic functions/Api (and the rednet API) and have looked at basic lua. I am a programmer; I have a lot of experience in c++, however, am hopeless every time i try lua and CC :)/> . However, I would like to know what the best way to tackle auto retrieving and pushing things to a storage system would be.
The way I would do it in c++ (i only understand c++, lua looks like gobbledeegook) :
I have been using c++ for so long, I don't even begin to understand lua. Everything I try to write is semicoloned and with {} brackets :)/> If someone will give me pointers as to how i could convert this to lua, i would be very happy. Ty. :D/>
The way I would do it in c++ (i only understand c++, lua looks like gobbledeegook) :
// - double slash = comment in c++/java for lua-only people :)/>/>/>
// computer 1
string itemType = " "
string amount = " "
std::cout << "type Item type"; // standard c++ output
std::cin >> itemType; //standard c++ input
rednet.open ("right");
rednet.broadcast (itemType);
id, message = rednet.recieve();
if (message == "has item")
{
std::cout << "Amount?";
std::cin >> amount;
rednet.broadcast (amount);
id, message = rednet.recieve();
if (message == "has amount")
{
std::cout << "Everything clear. Will recieve items.";
}
if (message != "has item") // != is the not operator in c++ / any language w/ boolean operators
{
std::cout << "Not enough Items, sorry.";
}
}
if (message != "has item")
{
std::cout << "No item of that type in storage, sorry."
}
I have been using c++ for so long, I don't even begin to understand lua. Everything I try to write is semicoloned and with {} brackets :)/> If someone will give me pointers as to how i could convert this to lua, i would be very happy. Ty. :D/>
Edited on 09 December 2013 - 08:15 PM