Jump to content




[1.42][SSP][Possible]Turtle can't turn on computers


10 replies to this topic

#1 Matrixmage

  • Members
  • 116 posts
  • LocationAt my Computer coding for the Computer in my Computer

Posted 25 September 2012 - 11:13 PM

I am building a GPS tower building program, and i have been getting some help from the ask a pro section, and someone showed me the code to make a turtle turn on a computer, but once I implemented it I kept getting ":102: attempt to index ? (a nil value)". I then posted the offending code on the ask a pro section, only to have someone tell me that it should work. If its not already apparent, to reproduce the possible bug, use the peripheral.wrap code to try to turn on a computer with a turtle. If anymore info is needed, feel free to let me know. Also I'm using a wireless mining turtle.

The offending code, for reference:
local c = peripheral.wrap("front")

c.turnOn() --turn on the comp


#2 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 25 September 2012 - 11:22 PM

Works fine for me. Are you sure the computer is in front of the turtle?

Edit: the error it's in line 102, but of what file? Is it part of a program?

#3 Matrixmage

  • Members
  • 116 posts
  • LocationAt my Computer coding for the Computer in my Computer

Posted 25 September 2012 - 11:27 PM

Its just a GPS tower building program, in a function, the variable is at the top though.

#4 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 25 September 2012 - 11:33 PM

Then let us see the code, at least the function.

#5 Matrixmage

  • Members
  • 116 posts
  • LocationAt my Computer coding for the Computer in my Computer

Posted 25 September 2012 - 11:34 PM

Here's the function, also I'm 100% sure that the turtle is in front of the comp.

Spoiler


#6 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 25 September 2012 - 11:38 PM

But there's no local c = peripheral.wrap("front") there, c is not defined :P/>

#7 Matrixmage

  • Members
  • 116 posts
  • LocationAt my Computer coding for the Computer in my Computer

Posted 25 September 2012 - 11:39 PM

It is, it's at the top of the code, check my first post :P/>

#8 Matrixmage

  • Members
  • 116 posts
  • LocationAt my Computer coding for the Computer in my Computer

Posted 25 September 2012 - 11:42 PM

I have to go, wont be able to give anymore input for the next 40 min or so... I'll check when I get back.

#9 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 25 September 2012 - 11:43 PM

Post your entire code. You may be doing things wrong that we can't see.

#10 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 26 September 2012 - 12:15 AM

Wait... you wrap the peripheral before being in front of it? :P/>
You can't wrap a peripheral that's not there. How would you get it's methods otherwise?

#11 Matrixmage

  • Members
  • 116 posts
  • LocationAt my Computer coding for the Computer in my Computer

Posted 26 September 2012 - 12:25 AM

Wait what? You have to do that? Hrmmm... no one told me that.... AND when I put it in ask a pro, no one brought that up, and I'm pretty sure I mentioned that they were separate... Well that's a mystery solved, hope I didn't bug you guys TOO much :P/>

P.S. I'm sending this from my phone, so I can't test it yet, but I'm pretty sure that this will fix it, if it doesn't, I'll tell you. Again, Thanks!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users