i've got a bug in my skripts and i dont know what to do and i how to track it down any further.
The basic gist is, that a master pc sends out a calculated message via rednet and a standard skript should receive and process it.
The problem is now (and thats whats really wierd about this) that the 7th or so turtle doesnt receive anything at all. But the master pc can print out the message it should send and the skript is the same for every turtle.
I know its confusing but thats why i made a short little video to show the problem:
[media]http://www.youtube.com/watch?v=NsyRCSoeMuo[/media]
This is the part of the master skript thats responsible for sending the data:
function launchT()
rednet.open("right")
for i = 1, gridsize do
for i = 1, 12 do
a = turtle.getItemCount(i+4)
b = b + a
--print(B)/>/>/>
end
if (turtle.getItemCount(slot)) == 0 then
slot = slot + 1
end
turtle.select(slot)
for i = 1, 12 do
c = turtle.getItemCount(i+4)
d = d + c
--print(B)/>/>/>
end
if d < gridsize then
print("require more slaves!")
break
end
turtle.place()
peripheral.call("front","turnOn")
id, message = rednet.receive()
print("message incoming")
rednet.send(id,tostring(targetPos[idpos]["tx"]))
rednet.send(id,tostring(targetPos[idpos]["ty"]))
rednet.send(id,tostring(targetPos[idpos]["tz"]))
rednet.send(id,tostring(dirdata["dir"]))
rednet.send(id,tostring(dirdata["tdir"]))
print("data sent to: "..idpos)
print("")
idpos = idpos + 1
sleep(1.5)
end
rednet.close("right")
end
and this is the part of the slave skript responsible for receiving the data:
function receiveData()
print("receiving data from master "..mID)
rednet.send(mID, "im ready for launch")
id, tx = rednet.receive()
id, ty = rednet.receive()
id, tz = rednet.receive()
id, dir = rednet.receive()
id, tdir = rednet.receive()
gdata["tx"] = tonumber(tx)
gdata["ty"] = tonumber(ty)
gdata["tz"] = tonumber(tz)
gdata["tdir"] = tonumber(tdir)
dirdata["dir"] = tonumber(dir)
print(gdata["tx"])
print(gdata["ty"])
print(gdata["tz"])
print(gdata["tdir"])
mapi.saveData(gdata,"gstate")
print("saved gridposition")
mapi.saveData(dirdata,"dir")
return gdata
end
If you have any idea why this bug happens every time and in multiple test world please let me know, i would really like to finally finish this project and maybe publish it if its good enough
Thanks and Greetings from germany :)/>