Jump to content




Smartshop Something Doesn't Get Read :s


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

#1 plazter

  • Members
  • 134 posts

Posted 10 October 2013 - 08:46 AM

Hello Pro's! :)

im makeing a turtle aka computer shop, right now at the moment im working on the turtle only, and it kinda works sometimes.. but mostly not ..

i was hopeing you could tell me my error here :P

link: http://pastebin.com/N2ZYCeLs

Spoiler

The error is that, it keeps saying "Error Wrong item." and, the item is gold and it should return true :S and execute one of the actions,
could you help me, then i will appreciate it alot!, thanks in advance!
Regards Plazter

#2 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 10 October 2013 - 08:50 AM

Based on the way your program acts, it's obvious that comp is false. That brings up two questions:
  • Which slot of your turtle is selected when you run this program and what's in it?
  • What's in slot #16?


#3 plazter

  • Members
  • 134 posts

Posted 10 October 2013 - 08:53 AM

View PostLBPHacker, on 10 October 2013 - 08:50 AM, said:

Based on the way your program acts, it's obvious that comp is false. That brings up two questions:
  • Which slot of your turtle is selected when you run this program and what's in it?
  • What's in slot #16?

Slot 1 is selected when it boots up, and when it receives the "ok" then it selects slots 1 again to be safe.
- slot 16 is a gold ingot
and it pulls up gold ingots :P

#4 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 10 October 2013 - 08:59 AM

View Postplazter, on 10 October 2013 - 08:53 AM, said:

and it pulls up gold ingots :P
Aha... Thing is, the first slot is checked only once - and that's when the turtle boots up, when it sopposedly has no gold in its first slot. If that's the case, put the slot-checking part into run.

#5 plazter

  • Members
  • 134 posts

Posted 10 October 2013 - 09:04 AM

View PostLBPHacker, on 10 October 2013 - 08:59 AM, said:

View Postplazter, on 10 October 2013 - 08:53 AM, said:

and it pulls up gold ingots :P
Aha... Thing is, the first slot is checked only once - and that's when the turtle boots up, when it sopposedly has no gold in its first slot. If that's the case, put the slot-checking part into run.

function run()
 turtle.suckDown()
  if comp == true then

its being run every time it has received the message "ok" in the ok() function oO

- Not sure what you mean tho :/

#6 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 10 October 2013 - 09:06 AM

Try
if turtle.compareTo(16) then
instead of
if comp == true then
Believe me; in the original code, you call turtle.compareTo only once.

#7 plazter

  • Members
  • 134 posts

Posted 10 October 2013 - 09:09 AM

Hmm... That made it go on to equal and not the above :/ damn it .. i had it yesterday in a much more messy code and now i lost it so i cant even go back and check xD Damn me!

EDIT: I figured it out, i had to type it insted of makeing a shortcut Sorry

#8 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 10 October 2013 - 04:35 PM

View Postplazter, on 10 October 2013 - 09:04 AM, said:

function run()
 turtle.suckDown()
  if comp == true then

its being run every time it has received the message "ok" in the ok() function oO

But this part:
local comp = turtle.compareTo(16)
is being run only once, at the start.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users