[Computercraft] Cannot terminate progs on turtles

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here

Zerro

New Member
Jul 29, 2019
163
0
0
Greetings,

I am having problems trying to get my turtles to terminate their programs. I do ctrl+T and get the line 'Terminated' but I am unable to input any commands.

The turtle is a mining turtle with a wireless modem.

I am running Direwolf20's 'awaitCommand' prog on my turtles and a 'startup' prog. The STARTUP prog is the prog that is running because I noticed the 'awaitCommand' prog stopped everytime I left the chunk and I didn't want to have to keep running the prog on the 16turtles that I have.

Code:
startup
while true do
  shell.run("awaitCommand")
end
 
awaitCommand
rednet.open("right")
while true do
  senderID, message, distance = rednet.receive()
  print(message)
  shell.run(message)
end

Thanks for helping me to completely stop the programs so I can get back in to edit the programs.

Zerro0713
 

CenturionArcher

New Member
Jul 29, 2019
22
0
0
You need to hold CTRL+T for a few seconds while in the turtles screen.
EDIT: Sorry missed the end of the first sentence. I'm not sure what to do then.
 

Zerro

New Member
Jul 29, 2019
163
0
0
You need to hold CTRL+T for a few seconds while in the turtles screen.
EDIT: Sorry missed the end of the first sentence. I'm not sure what to do then.

I just hope that I don't have to completely recycle and make 16 new Turtles
 

Bomb Bloke

New Member
Jul 29, 2019
612
0
0
When you terminate the "awaitCommand" script, control reverts to the startup script, which for whatever reason is set to re-run the "awaitCommand" script straight away. You hence never have time to kill the startup script and it'll never end on its own. I'm not sure why you put that "while true" loop around the shell.run statement, but that's your problem.

I gather if you put a disk drive next to the turtle with a different startup script on it, you can reboot it and it'll run that instead of the broken one you've setup on its own drive. Not sure of the particulars, haven't tried it myself.
 

Zerro

New Member
Jul 29, 2019
163
0
0
When you terminate the "awaitCommand" script, control reverts to the startup script, which for whatever reason is set to re-run the "awaitCommand" script straight away. You hence never have time to kill the startup script and it'll never end on its own. I'm not sure why you put that "while true" loop around the shell.run statement, but that's your problem.

I gather if you put a disk drive next to the turtle with a different startup script on it, you can reboot it and it'll run that instead of the broken one you've setup on its own drive. Not sure of the particulars, haven't tried it myself.

I thought the 'while true' was what you need to do to keep the program running.

so just re-write startup with just 'shell.run("awaitCommand")' and it'll work fine and shutdown when ctrl+t ??
 

Bomb Bloke

New Member
Jul 29, 2019
612
0
0
Yes. The idea is that you don't want the startup script to keep running "forever" - you want it to only run for as long as the "awaitCommand" script runs.
 

Zerro

New Member
Jul 29, 2019
163
0
0
Yes. The idea is that you don't want the startup script to keep running "forever" - you want it to only run for as long as the "awaitCommand" script runs.

Okay cool. Got it working now. Thanks for the tips on Computercraft :D