So here's my genius plan...
i want 20 wireless turtles to move a certain distance at the same time from receiving a distance via a computer's red net.broadcast(). I'm making the broadcast a single number (let's use 10 for this example). The turtles are supposed to read the number broadcasted via an event, id, text =os.pullEvent script that only designates the text.
the problem is...
i have no clue how to convert the 10 from string to a number the turtles can read and act upon... I'm trying to use i=1,Num with local num=text, but i don't know how to format it.
[EDIT] It either returns as a num expected string given error or something similar to that.
Simple solution I'm missing, or is this a lot more complicated than i was hoping?
/>
[EDIT 2]
Here are the screenshots after I tried to use tonumber()
[EDIT 3]
Here is the broadcast program
0
need help programming turtle... I'm about to take a nuke to the whole thing...
Started by S16IceMan, Aug 03 2012 05:17 PM
6 replies to this topic
#1
Posted 03 August 2012 - 05:17 PM
#2
Posted 03 August 2012 - 05:29 PM
You should eb able to do this as long as the turtles are in range.
sender:
P.S. It would help to know what you want to do if you post a little of your code, so we can know in what context you want them to move...
sender:
rednet.open("side") rednet.broadcast("10")receiver:
while true do id, msg, dist = rednet.receive(1) if msg == "10" then --your placement code here else os.reboot() end endThe turtles should be able to receive 10 as a string, since you are designating it as a string already. Not sure if that's what you want. Post otherwise...
P.S. It would help to know what you want to do if you post a little of your code, so we can know in what context you want them to move...
Edited by craniumkid22, 03 August 2012 - 05:31 PM.
#3
Posted 03 August 2012 - 05:31 PM
#4
Posted 03 August 2012 - 05:57 PM
Thanks for the quick responses. I tried to use tonum() and it gave me a nil. I'll try to put in the right request this time, haha. I'll give it a shot and see if it works.
As for the code...
I'm trying to have the turtles do a bombing run over a certain distance, but because I'm running tekkit and the latest only has 1.3, I can't use place and attack, so i have to be more creative. I made the turtles place a tnt block in front, go up, place a sand block, go up, place a stone plate, then drive over it. Well... i was TRYING to make them do it.
I'll add a screenshot to the main post.
As for the code...
I'm trying to have the turtles do a bombing run over a certain distance, but because I'm running tekkit and the latest only has 1.3, I can't use place and attack, so i have to be more creative. I made the turtles place a tnt block in front, go up, place a sand block, go up, place a stone plate, then drive over it. Well... i was TRYING to make them do it.
I'll add a screenshot to the main post.
#5
Posted 03 August 2012 - 06:05 PM
S16IceMan, on 03 August 2012 - 05:57 PM, said:
Thanks for the quick responses. I tried to use tonum() and it gave me a nil. I'll try to put in the right request this time, haha. I'll give it a shot and see if it works.
local evt, id, msg = os.pullEvent("rednet_message") -- or: local id, msg = rednet.receive() local num = tonumber(msg) if num then -- check if it's a number -- do something end
S16IceMan, on 03 August 2012 - 05:57 PM, said:
As for the code...
I'm trying to have the turtles do a bombing run over a certain distance, but because I'm running tekkit and the latest only has 1.3, I can't use place and attack, so i have to be more creative. I made the turtles place a tnt block in front, go up, place a sand block, go up, place a stone plate, then drive over it. Well... i was TRYING to make them do it.
I'm trying to have the turtles do a bombing run over a certain distance, but because I'm running tekkit and the latest only has 1.3, I can't use place and attack, so i have to be more creative. I made the turtles place a tnt block in front, go up, place a sand block, go up, place a stone plate, then drive over it. Well... i was TRYING to make them do it.
turtle.place() -- place the tnt rs.setOutput("front", true) -- turn on the tnt! -- tnt falls -- boom!
#6
Posted 03 August 2012 - 06:10 PM
#7
Posted 03 August 2012 - 06:25 PM
just ran the new code you guys suggested. It works perfectly Thank you so much!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users