This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Zepher48's profile picture

Turning on a turtle without touching it

Started by Zepher48, 05 September 2012 - 11:58 PM
Zepher48 #1
Posted 06 September 2012 - 01:58 AM
Hey, Is it possible to make a turtle run startup code without touching it.
for example, if a turtle is created with a deployer, the console is blank and even if it has startup code it wont run unless you right click it to turn it on, my question is if there is a way to make it run startup code without having to touch it?
Thank you
Pharap #2
Posted 06 September 2012 - 02:14 AM
You can make another turtle/computer turn it on like so:

T = peripheral.wrap("back") -- assuming turtle is at back of unit turning it on
T.turnOn()
If you want I can also supply you with the code to make sure it is a turtle that is being turned on, as well as auto-detecting the side.

Otherwise, rightclicking is the only way to turn your turtle on.
If you want this done because you don't want have to turn on every individual computer in your world when you enter it after closing it down, best thing to do is have a group of turtles that are pre-programmed to turn on every other turtle/computer after switching them on, thus reducing the amount of things you have to switch on.
Zepher48 #3
Posted 06 September 2012 - 11:34 AM
Thank you, but when i run this

T = peripheral.wrap("back") -- assuming turtle is at back of unit turning it on
T.turnOn()
I get "test:2: attempt to index ? (a nil value)"
KaoS #4
Posted 06 September 2012 - 11:37 AM
try

peripheral.call(side, 'turnOn')
where side is the side that the turtle is on

EDIT: And make sure the 'turnOn' has a capital 'O'
Zepher48 #5
Posted 11 September 2012 - 11:54 PM
Thank you KaoS! It works!! =D
KaoS #6
Posted 12 September 2012 - 12:48 PM
my pleasure, a way to enhance this is to use RP2 deployers to place turtles and a disk drive with a startup to be run
Ninjawolf0007 #7
Posted 01 April 2013 - 08:34 AM
I have a computer("C") and a Deployer("D") setup that deploys turtles automatically. But >peripheral.call(back, "turnOn")< gives me a >startup:1: Expected string< error, how do I fix this?
The Deployer deploys turtles up and the computer has that line of code on it's startup, but then it gives me the stupid error :(/>
Do you know how I could fix this? I'm using CraftOS 1.5 and Feed The Beast Ultimate pack if that's any help. (GregTech disabled). Thank you for any help or suggestions.
sjele #8
Posted 01 April 2013 - 08:37 AM
You need to make the side back a string like this:

peripheral.call("back", "turnOn")
Ninjawolf0007 #9
Posted 01 April 2013 - 08:38 AM
Do I just have to put quotaitions around back so it would be this: peripheral.call("back", "turnOn")
Ninjawolf0007 #10
Posted 01 April 2013 - 08:48 AM
You need to make the side back a string like this:

peripheral.call("back", "turnOn")

Thank you. How do I make the deployed turtles run a program? Do I just put a disk drive next to where they are deployed with a startup program that tells them to do what I want them to? So would something like this for the disks startup work?

for i=1, 4, 1 do
turtle.turnLeft()
end
turtle.forward()
How come when I tell it to move it doesn't?
It still needs me to click it in order to run the program. Why?
sjele #11
Posted 01 April 2013 - 08:53 AM
You could do it that way I belive.
Ninjawolf0007 #12
Posted 01 April 2013 - 10:15 AM
You could do it that way I belive.
Which way
lewisholcombe #13
Posted 01 April 2013 - 10:20 AM
You could also turn it on via redstone.
If your running tekkit a wireless redstone receive receiver would do the job.
Here's the code (sorry it's not in a box I'm on my phone.
if rs.getInput("side.startup") then
end
Obviously change side to the input side.
sjele #14
Posted 01 April 2013 - 10:21 AM
You could do it that way I belive.
Which way

Startup method with disk drive
Ninjawolf0007 #15
Posted 01 April 2013 - 10:24 AM
You could also turn it on via redstone.
If your running tekkit a wireless redstone receive receiver would do the job.
Here's the code (sorry it's not in a box I'm on my phone.
if rs.getInput("side.startup") then
end
Obviously change side to the input side.

I know I can turn it on with redstone but I'm trying to use a setup with very little physical inputs. like it's all code basically is what I want… But if I can't I will use wireless redstone. Also I use Feed The Beast Ultimate Pack… Not Tekkit.

Which way

Startup method with disk drive

I tried but for some reason it's not loading the startup program. And I don't know why. It also won't move either.
Thank you everyone for your help, I greatly appreciate it.
lewisholcombe #16
Posted 01 April 2013 - 11:06 AM
You could also turn it on via redstone.
If your running tekkit a wireless redstone receive receiver would do the job.
Here's the code (sorry it's not in a box I'm on my phone.
if rs.getInput("side.startup") then
end
Obviously change side to the input side.

I know I can turn it on with redstone but I'm trying to use a setup with very little physical inputs. like it's all code basically is what I want… But if I can't I will use wireless redstone. Also I use Feed The Beast Ultimate Pack… Not Tekkit.

Which way

Startup method with disk drive

I tried but for some reason it's not loading the startup program. And I don't know why. It also won't move either.
Thank you everyone for your help, I greatly appreciate it.
I get you now and Ultimate is the best by far :)/>
(Off topic)
Do you usually play on a feed the beast ultimate server?
Ninjawolf0007 #17
Posted 01 April 2013 - 11:22 AM
I get you now and Ultimate is the best by far :)/>
(Off topic)
Do you usually play on a feed the beast ultimate server?
No… Sorry…

Do you know what might be going wrong?
Like why I still need to click on the turtles and why they won't move? << Nevermind I need fuel >.> I failed… Haha :)/>
If not, it's fine but I could really use the help… Once I get it I will pastebin the code and put the link here for poeple who are having issues.
How do I turn
 peripheral.call("back", "turnOn") 
into an infinite loop? wether there is a turtle in back or not?
Ninjawolf0007 #18
Posted 01 April 2013 - 01:38 PM
place a chest full of charcoal to the right on the same level turtles a deployed on.

computer > edit startup >
while true do
if peripheral.isPresent("back") == true then
peripheral.call("back","turnOn")
sleep(5)
end

if not peripheral.isPresent("back") == true then
sleep(5)
end
end

OR


while true do
event, par1 = os.pullEvent()
if event == "peripheral" and par1 == "back" then
peripheral.call("back","turnOn")
end
end


​Can someone test to make sure these actually work? Can you let us/me know the results by replying on this forum? Thank you.