Posted 03 November 2012 - 12:26 AM
Hiya,
my goal is it to control several mining turtles via Wireless (rednet)
so i made these two two code parts:
Computer:
It asks how long the tunnel should be (t1 variable) and if the tunnel should be moved down (tv1 variable)
so i can place the turtles, tell them to make a tunnel 20 long, come back, drop the items and wait. the next start will have a moving from 2 blocks down. so they mine a new tunnel, right below the former tunnel.
the question i have is: how can i transmit via rednet broadcast a variable?
the turtles are all named and have this startup file:
atm they wait to get the command "starttunnel" and they will start digging a tunnel 50 long.
my idea was to transmit a message ("tunnel") so the programm knows, now comes the variable for the tunnel lenght and then comes the broadcast with the variable t1
the next broadcast will be ("tver") and then comes the moving pattern.
is there any other options? any hints?
thank you very much :D/>/>
my goal is it to control several mining turtles via Wireless (rednet)
so i made these two two code parts:
Computer:
term.clear()
t1 = 0
tv1 = 0
rednet.open("right")
print ("Willkommen im Mining Program Version 1.1")
print ("Erstellt von Nopsi99")
print ("")
print ("")
write ("Tunnel Länge: ")
t1 = io.read()
write ("Tunnel versatz nach unten: ")
tv1 = io.read()
term.clear()
term.setCursorPos(1,1)
print ("Danke")
print ("")
print ("Starte Tunnel mit einer Länge von: " ..t1)
print ("Versatz nach unten ist: " ..tv1)
rednet.broadcast("tunnel")
rednet.broadcast(t1)
rednet.broadcast("tver")
rednet.broadcast(tv1)
It asks how long the tunnel should be (t1 variable) and if the tunnel should be moved down (tv1 variable)
so i can place the turtles, tell them to make a tunnel 20 long, come back, drop the items and wait. the next start will have a moving from 2 blocks down. so they mine a new tunnel, right below the former tunnel.
the question i have is: how can i transmit via rednet broadcast a variable?
the turtles are all named and have this startup file:
rednet.open('right')
while true do
local id,msg,dist=rednet.receive()
if msg=='starttunnel' then
shell.run('tunnel',50)
end
end
atm they wait to get the command "starttunnel" and they will start digging a tunnel 50 long.
my idea was to transmit a message ("tunnel") so the programm knows, now comes the variable for the tunnel lenght and then comes the broadcast with the variable t1
the next broadcast will be ("tver") and then comes the moving pattern.
is there any other options? any hints?
thank you very much :D/>/>