Posted 16 April 2015 - 08:41 PM
Hi, I'm new to computercraft but not new to programming.
My code is here: http://pastebin.com/v2pUQRpX
When I run the program it says "java exception thrown" (Yes the peripherals are in the right place).
What's going on here and how do I fix it? Thanks.
My code is here: http://pastebin.com/v2pUQRpX
local sensor = peripheral.wrap("right")
local chatbox = peripheral.wrap("left")
while true do
local allPlayers = sensor.getNearbyPlayers(300)
local string = "!!! INTRUDER ALERT !!! - "
for key, var in pairs(allPlayers) do
string = string .. var['player']
end
if string ~= "!!! INTRUDER ALERT !!! - " then
chatbox.tell("Notch", string)
end
sleep(1)
end
I'm trying to check if players are around, then tell me when it finds people.When I run the program it says "java exception thrown" (Yes the peripherals are in the right place).
What's going on here and how do I fix it? Thanks.