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

problem on peripheral.call reboot

Started by corisco1917, 16 January 2013 - 03:58 PM
corisco1917 #1
Posted 16 January 2013 - 04:58 PM
i'm writing a program to setup satelites in minecraft… so far i've wrinten this code:

Spoiler

local tArgs = { ... }
local uY, tX, tY, tZ = 1, tArgs[1], tArgs[2], tArgs[3]

function goToSky()
  while turtle.up() do
	uY = uY + 1
  end
  tY = tY + uY
  placeComputer()
end

function placeComputer()
  turtle.select(1) -- select the computer
  turtle.place()
  turtle.back()
  turtle.select(2) -- select wireless modem
  turtle.place()
  turtle.down()
  turtle.forward()
  turtle.select(4) -- select disk drive
  turtle.place()
  turtle.select(3) -- select floppy disk
  turtle.drop()
  setComputer()
end

function setComputer()
  turtle.down()
  turtle.forward()
  turtle.forward()
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.up()
  setUpDisk(tX,tY,tZ)
  turtle.up()
  peripheral.call("front", "turnOn")
  turtle.down()
  turtle.suck() --take out floppy disk
  turtle.dig() -- take back disk drive
  turtle.up()
  peripheral.call("front", "reboot")
end

function setUpDisk(x,y,z)
-- DISK is set so it sets the computer startup
  local st = fs.open("disk/startup", "w")
  local gps_run = "shell.run('gps','host',"..x..","..y..","..z..")"
  st.writeLine("local startup = fs.open('startup', 'w')")
  st.writeLine("startup.writeLine(\""..gps_run.."\")")
  st.writeLine("startup.close()")
  st.close()
end

goToSky()

my problem is on line 43 where i wrote(the last command on setComputer function:

peripheral.call("front", "reboot")

i've tried everything, like sleep before calling peripheral and sleep before some other stuff, but the turtle never reboots the computer…

is that might be a bug, or am i doing something wrong?
theoriginalbit #2
Posted 16 January 2013 - 05:01 PM
not sure why that isn't working… try it like this

local comp = peripheral.wrap("front")
comp.reboot()
corisco1917 #3
Posted 16 January 2013 - 05:07 PM
that is very odd… i am able to turn it on, but can't reboot! just like what happened when i used call method.
Luanub #4
Posted 16 January 2013 - 05:10 PM
Run this on the computer and make sure the reboot method is showing like it should be. Your syntax and everything looks good. What version of Minecraft/Computer Craft are you using?


local tMethods = peripheral.getMethods("front")

for _,sMethod in pairs(tMethods) do
   print(sMethod)
end
corisco1917 #5
Posted 16 January 2013 - 05:14 PM
Luanub, the method is there… because i am able to do the peripheral.call("front", "reboot") on lua command line.. and reboot command on terminal also works… it doesnt work only inside my programm…

im using the latest version of minecraft 1.4.7 and 1.481 of computercraft. im using the latest version of minecraftforge….

i've tried to delete all files from save/computer, but that didn't work either… i guess it is a bug then.


—-edit

i've tried to turn it off than on again… it turns off ok but doesnt turn on.

this very odd indeed.
Luanub #6
Posted 16 January 2013 - 05:21 PM
It's sounding that way. I'll see if I can't duplicate it when I get home. I have a program that has this type of functionality and it used to work. I have not tried to reboot another computer with it since before the last update so I can not say that it is working now.
theoriginalbit #7
Posted 16 January 2013 - 05:23 PM
I'll test it now… what kind of turtle and computer are you using?
corisco1917 #8
Posted 16 January 2013 - 05:24 PM
i would very mutch apreciate that…

to run the program you have to run like:

setup_gps x y z

the slots order is:
slot 1 = computer
slot 2 = wireless modem
slot 3 = floppy disk
slot 4 = disk drive

i am using wireless mining-turtle and regular computer.
corisco1917 #9
Posted 16 January 2013 - 06:23 PM
[SOLVED]

i solved this using a 2 secounds sleep before calling reboot.

thanks for the quick answare guys.(no irony)
theoriginalbit #10
Posted 16 January 2013 - 06:25 PM
its actually odd, was about to come back and say that it worked for me except for a div on nil error…
corisco1917 #11
Posted 16 January 2013 - 06:30 PM
orignalBIT that happens because i didnt set any defaults for tX,tY,tZ… so when u call the program u must inform axis…

thanks anyway. i really apreciatted your concern and the fast responses. :D/>
Luanub #12
Posted 16 January 2013 - 06:33 PM
It's probably related to this in that case http://www.computercraft.info/forums2/index.php?/topic/4582-computerturnon-only-works-part-of-the-time/page__p__35719#entry35719
corisco1917 #13
Posted 16 January 2013 - 06:38 PM
It's probably related to this in that case http://www.computerc...5719#entry35719

very interesting and usefull info, thanks.