Jump to content




Turning on a turtle without touching it


  • You cannot reply to this topic
17 replies to this topic

#1 Zepher48

  • Members
  • 20 posts

Posted 06 September 2012 - 12: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

#2 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 06 September 2012 - 01: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.

#3 Zepher48

  • Members
  • 20 posts

Posted 06 September 2012 - 10: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)"

#4 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 06 September 2012 - 10: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'

#5 Zepher48

  • Members
  • 20 posts

Posted 11 September 2012 - 10:54 PM

Thank you KaoS! It works!! =D

#6 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 12 September 2012 - 11:48 AM

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

#7 Ninjawolf0007

  • Members
  • 46 posts

Posted 01 April 2013 - 07: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.

#8 sjele

  • Members
  • 334 posts
  • LocationSomewhere on the planet called earth

Posted 01 April 2013 - 07:37 AM

You need to make the side back a string like this:
peripheral.call("back", "turnOn")


#9 Ninjawolf0007

  • Members
  • 46 posts

Posted 01 April 2013 - 07:38 AM

Do I just have to put quotaitions around back so it would be this: peripheral.call("back", "turnOn")

#10 Ninjawolf0007

  • Members
  • 46 posts

Posted 01 April 2013 - 07:48 AM

View Postsjele, on 01 April 2013 - 07:37 AM, said:

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?

#11 sjele

  • Members
  • 334 posts
  • LocationSomewhere on the planet called earth

Posted 01 April 2013 - 07:53 AM

You could do it that way I belive.

#12 Ninjawolf0007

  • Members
  • 46 posts

Posted 01 April 2013 - 09:15 AM

View Postsjele, on 01 April 2013 - 07:53 AM, said:

You could do it that way I belive.
Which way

#13 lewisholcombe

  • Members
  • 51 posts

Posted 01 April 2013 - 09: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.

#14 sjele

  • Members
  • 334 posts
  • LocationSomewhere on the planet called earth

Posted 01 April 2013 - 09:21 AM

View PostNinjawolf0007, on 01 April 2013 - 09:15 AM, said:

View Postsjele, on 01 April 2013 - 07:53 AM, said:

You could do it that way I belive.
Which way

Startup method with disk drive

#15 Ninjawolf0007

  • Members
  • 46 posts

Posted 01 April 2013 - 09:24 AM

View Postlewisholcombe, on 01 April 2013 - 09:20 AM, said:

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.

View Postsjele, on 01 April 2013 - 09:21 AM, said:

View PostNinjawolf0007, on 01 April 2013 - 09:15 AM, said:

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.

#16 lewisholcombe

  • Members
  • 51 posts

Posted 01 April 2013 - 10:06 AM

View PostNinjawolf0007, on 01 April 2013 - 09:24 AM, said:

View Postlewisholcombe, on 01 April 2013 - 09:20 AM, said:

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.

View Postsjele, on 01 April 2013 - 09:21 AM, said:

View PostNinjawolf0007, on 01 April 2013 - 09:15 AM, said:

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?

#17 Ninjawolf0007

  • Members
  • 46 posts

Posted 01 April 2013 - 10:22 AM

View Postlewisholcombe, on 01 April 2013 - 10:06 AM, said:

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?


#18 Ninjawolf0007

  • Members
  • 46 posts

Posted 01 April 2013 - 12: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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users