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

Here with some questions

Started by Rangicus, 13 September 2012 - 09:31 PM
Rangicus #1
Posted 13 September 2012 - 11:31 PM
PLACEHOLDER: #3
No questions for now
Oh and please answer questions in this format:
Spoiler#1: bla bla bla
OmegaVest #2
Posted 13 September 2012 - 11:42 PM
#1: RichardG had the turtle make the computer a peripheral (peripheral.wrap("front")) and then have it reset, which I think is something like per.shutdown(), per.start(), where per is the variable for the wrapped computer.

#2: That depends on what you are doing, but most times, you are going to be using os.pullEvent("key"), which will wait for a key to be pressed. Then, just have an if statement looking for those specific keys, and have them do what you want.

#3: You can find this in the config file. For most programs, though, you will want to check it, by using x, y = term.getSize(). The x variable will be the number you are looking for.
Cranium #3
Posted 13 September 2012 - 11:45 PM
  1. You can use the Peripheral API, since computers and turtles are treated as peripherals.
  2. You would want the os.pullEvent() function.
    1. Like this:
      
      				local event,p1 = os.pullEvent()
      				if p1 == KEYCODE then
      				--do stuff here
      				end
      				
  3. What do you mean how many columns?
edit: keycodes can be found here: http://www.minecraftwiki.net/wiki/Key_Codes