Posted 17 June 2013 - 11:28 AM
It seems if I recieve too many messages in a short time then the game crashes. Is there something I am doing wrong? I have 81 turtles in a 9x9 recieving that message at the same time. If it is my fault, is there anything else I can do to send that information without crashing the server? I am suprised I am not banned yet lol.
Sending Code:
Recieving Code:
Thank you in advance. :)/>/>
Sending Code:
local modem = peripheral.wrap("back")
Kill=0
Collect=0
Update=0
function waitTime(timeToWait)
local i = timeToWait
while i>=1 do
sleep(1)
write(".")
i = i - 1
end
print()
end
function sendAnUpdate()
if Kill == 1 then
modem.transmit(66, 66,"Kill is on")
end
sleep(0.1)
if Kill == 0 then
modem.transmit(66, 66,"Kill is off")
end
sleep(0.1)
if Collect == 1 then
modem.transmit(76, 76,"Collect is on")
end
sleep(0.1)
if Collect == 0 then
modem.transmit(76, 76,"Collect is off")
end
sleep(0.1)
if Update == 1 then
modem.transmit(86, 86,"Update is on")
end
sleep(0.1)
if Update == 0 then
modem.transmit(86, 86,"Update is off")
end
sleep(0.1)
end
function check()
if rs.getInput("front")==false and Kill==0 then
Kill=1
print("Sending Kill = 1")
rs.setOutput("bottom", true)
sleep(4)
sendAnUpdate()
sleep(1)
sendAnUpdate()
sleep(1)
rs.setOutput("bottom", false)
print("Sent Kill = 1")
return
end
if rs.getInput("front") and Kill==1 then
Kill=0
print("Sending Kill = 0")
rs.setOutput("bottom", true)
sleep(4)
sendAnUpdate()
sleep(1)
sendAnUpdate()
sleep(1)
rs.setOutput("bottom", false)
print("Sent Kill = 0")
return
end
if rs.getInput("left")==false and Collect==0 then
Collect=1
print("Sending Collect = 1")
rs.setOutput("bottom", true)
sleep(4)
sendAnUpdate()
sleep(1)
sendAnUpdate()
sleep(1)
rs.setOutput("bottom", false)
print("Sent Collect = 1")
return
end
if rs.getInput("left") and Collect==1 then
Collect=0
print("Sending Collect = 0")
rs.setOutput("bottom", true)
sleep(4)
sendAnUpdate()
sleep(1)
sendAnUpdate()
sleep(1)
rs.setOutput("bottom", false)
print("Sent Collect = 0")
return
end
if rs.getInput("right")==false then
Update=1
print("Sending Update = 1")
rs.setOutput("bottom", true)
sleep(4)
sendAnUpdate()
sleep(1)
sendAnUpdate()
sleep(3)
rs.setOutput("bottom", false)
print("Sent Update = 1")
return
end
end
while true do
check()
sleep(0.1)
if Update == 1 then
write("Updating...")
waitTime(5)
shell.run("rm startup")
shell.run("pastebin get FTBGLy5y startup")
shell.run("reboot")
end
end
Recieving Code:
local modem = peripheral.wrap("right")
Kill = 0
Collect = 0
Update = 0
modem.open(66)
modem.open(76)
modem.open(86)
local function suckAndDrop(timesToSuck)
local i = timesToSuck
while i>=1 do
turtle.suckUp()
i = i - 1
end
for i = 1,16 do
if turtle.getItemCount(i)>0 then
turtle.select(i)
turtle.dropDown()
end
end
end
local function kill(number)
local i = number
while i>=1 do
turtle.attackUp()
i = i -1
end
end
local function checkAndSet()
if rs.getInput("right") or rs.getInput("back") or rs.getInput("bottom") then
rs.setOutput("front", true)
rs.setOutput("back", true)
rs.setOutput("right", true)
rs.setOutput("left", true)
local i = 3
while i>=1 do
local event, modemSide, senderChannel,
replyChannel, message, senderDistance = os.pullEvent("modem_message")
print("Recieved message from channel " ..senderChannel.. ", the message was: " ..message.. ".")
if senderChannel==66 then
Kill = message
end
if senderChannel==76 then
Collect = message
end
if senderChannel==86 then
Update = message
end
i = i - 1
end
while rs.getInput("bottom") do
sleep(0)
end
rs.setOutput("front", false)
rs.setOutput("back", false)
rs.setOutput("right", false)
rs.setOutput("left", false)
while rs.getInput("back") do
sleep(0)
end
end
end
function waitTime(timeToWait)
local i = timeToWait
while i>=1 do
sleep(1)
write(".")
i = i - 1
end
print()
end
while true do
checkAndSet()
sleep(0.1)
if Update=="Update is on" then
write("Updating...")
waitTime(5)
shell.run("label set Rooket6's Grinder Turtle")
shell.run("rm startup")
shell.run("pastebin get dyDvaxmf startup")
shell.run("reboot")
end
if Kill=="Kill is on" then
kill(40)
--print("Kill is on")
end
--[[if Kill=="Kill is off" then
print("Kill is off")
end]]
if Collect=="Collect on" then
suckAndDrop(4)
--print("Collect is on")
end
--[[if Collect=="Collect is off" then
print("Collect is off")
end]]
end
Thank you in advance. :)/>/>