Posted 30 September 2012 - 11:42 PM
With the new command blocks coming up, computercraft needs a way to communicate with them, and this does just that.
With the command peripheral, you get a item that you can attach to a computer (only for admins, no recipe) and it will execute commands.
The commands will be executed like this:
Why would this be useful? You can use it to create emails or computers that can connect to the minecraft chat. Another example could be item shops, this is a function that could give a player a item:
Images of what it could look like:
With the command peripheral, you get a item that you can attach to a computer (only for admins, no recipe) and it will execute commands.
The commands will be executed like this:
cmd = peripheral.wrap("side")
cmd.execute("Command","Arguments")
Why would this be useful? You can use it to create emails or computers that can connect to the minecraft chat. Another example could be item shops, this is a function that could give a player a item:
sender = peripheral.wrap("front")
while true do
id, message = rednet.receive()
if string.sub(message,1,4) == "ITEM" then
itemID = rednet.receive(0)
playerID = rednet.receive(0)
price = sender.execute("worth",itemID) --essentials
playersBAL = fs.open(".accounts/" ..playerID, "r")
local tBal = tonumber(playersBAL.readAll())
playersBAL.close()
if tBal > price then
print(sender.execute("give",playerID,itemID)) --prints "Giving <player> <id>"
print("Complete!")
end
end
Images of what it could look like: