Jump to content




Need some help with a radio-detonated bomb


5 replies to this topic

#1 Dunel

  • New Members
  • 2 posts

Posted 15 April 2012 - 05:36 PM

Hi.
I am new to this forum.
I need help with a radio-detonated bomb. Theorethically, I know what to do, but:
1.I don't know how to send a message(fell free to call me a noob :)/> ).
2.I don't know if the receiving program works. Here it is.
Spoiler

Thanks for any help!

#2 cant_delete_account

  • Members
  • 484 posts

Posted 15 April 2012 - 06:31 PM

Code (for WIRELESS turtle, put a turtle or mining turtle with a wireless modem in crafting table, name this file 'startup'):
rednet.open("right")
local event, p1, p2, p3, p4, p5 = os.pullEvent()
if event == "rednet_message" and p2 == "boom" then
print("We've received a message from ID #"..p1.."!")
print("The message is:")
print(p2)
print("Message was received from "..p3.." blocks away!")
shell.run("boom")
end

Code (computer with modem on RIGHT side, attach it by holding shift and right clicking on the right side of the computer):
rednet.open("right")
print("Sending message...")
rednet.broadcast("boom")
sleep(0.6)
print("Done!")

Code (for WIRELESS turtle, the same one with the rednet receiver program, put TNT in first slot of turtle):
local times = 4
print("Bombing...")
for ijkl=1,times do
turtle.forward()
end
turtle.select(1)
turtle.placeDown()
rs.setOutput("bottom",true)
sleep(0.1)
rs.setOutput("bottom",false)
for ijkl=1,times do
turtle.back()
end


#3 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 15 April 2012 - 06:35 PM

View PostDunel, on 15 April 2012 - 05:36 PM, said:

Hi.
I am new to this forum.
I need help with a radio-detonated bomb. Theorethically, I know what to do, but:
1.I don't know how to send a message(fell free to call me a noob :)/> ).
2.I don't know if the receiving program works. Here it is.
Spoiler

Thanks for any help!

for send do:
rednet.open("side of modem")
print("press any key to detonate")
os.pullEvent("key")
rednet.broadcast("boom")

for recieve do:
rednet.open("side of modem")
while true do
id, msg = rednet.receive()
if msg == "boom" then
redstone.setOutput("back", true)
end
end


#4 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 15 April 2012 - 06:36 PM

View Postthesbros, on 15 April 2012 - 06:31 PM, said:

Code (for WIRELESS turtle, put a turtle or mining turtle with a wireless modem in crafting table, name this file 'startup'):
rednet.open("right")
local event, p1, p2, p3, p4, p5 = os.pullEvent()
if event == "rednet_message" and p2 == "boom" then
print("We've received a message from ID #"..p1.."!")
print("The message is:")
print(p2)
print("Message was received from "..p3.." blocks away!")
shell.run("boom")
end

Code (computer with modem on RIGHT side, attach it by holding shift and right clicking on the right side of the computer):
rednet.open("right")
print("Sending message...")
rednet.broadcast("boom")
sleep(0.6)
print("Done!")

Code (for WIRELESS turtle, the same one with the rednet receiver program, put TNT in first slot of turtle):
local times = 4
print("Bombing...")
for ijkl=1,times do
turtle.forward()
end
turtle.select(1)
turtle.placeDown()
rs.setOutput("bottom",true)
sleep(0.1)
rs.setOutput("bottom",false)
for ijkl=1,times do
turtle.back()
end


Friggin Ninjas

#5 Dunel

  • New Members
  • 2 posts

Posted 15 April 2012 - 07:59 PM

Thanks, these codes are great :)/>!
Edit: Used Kolpa's code, it's great! Thanks, man!

#6 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 16 April 2012 - 02:25 PM

no problem mate :)/>
u can also pm me for further questions :)/>





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users