m.setAutoCollect(true) attempt to call nill

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

internetrush

New Member
Jul 29, 2019
5
0
0
Tryng to setup an enchanting turtle, the beginning code is :

m = peripheral.wrap("right") (the crafty part is on the right of the crafting turtle)
m.setAutoCollect(true)

On the auto collect, it fails, attempt to call nil.

Any ideas? Using FTB ultimate.
 

namiasdf

New Member
Jul 29, 2019
2,183
0
0
From what I have read (I am no expert in CC):

You are trying to call something that doesn't exist, i.e. attempting to call nil. Something is set to nil, that your program is trying to access. It is like calling x if x hasn't been declared.

I reply more later, in a game of HoN
 

namiasdf

New Member
Jul 29, 2019
2,183
0
0
What is this turtle supposed to do? What does .wrap do and what does calling m with setAutoCollect do?

(I don't know any of the commands, but I do a lot of programming at school, so I might be able to help you debug through intuition)
 

zilvarwolf

New Member
Jul 29, 2019
541
0
0
What is this turtle supposed to do? What does .wrap do and what does calling m with setAutoCollect do?

(I don't know any of the commands, but I do a lot of programming at school, so I might be able to help you debug through intuition)
OP indicated he was making an enchanting turtle. Said turtle has the ability to collect XP orbs and enchant items and books.

Peripheral.wrap() associates the adding device on the specified side to a variable for ease of reference. SetAutoCollect(true) tells the turtle to automatically pick up nearby XP orbs
 

noobbyte

Active Member
Jul 29, 2019
37
0
26
i believe you don't need to wrap a crafting table on a turtle as it is a regular computercraft peripheral
EDIT: Nevermind, didn't realize you were referring to the enchanting table since you said "crafty"
 

bigtwisty

New Member
Jul 29, 2019
164
0
0
From what I have read (I am no expert in CC):

You are trying to call something that doesn't exist, i.e. attempting to call nil. Something is set to nil, that your program is trying to access. It is like calling x if x hasn't been declared.

I reply more later, in a game of HoN

Namias is correct. The function you are calling doesn't exist. Are the two lines right next to each other in your code? It could be a problem of variable scope.

You also might try m.getXP() or m.getLevels() to see if the interface itself is wrapping at all.

Edit: just realized. The first peripheral attached to a turtle is usually on the left. I would try that before anything else. You're probably just looking at the turtle wrong.
 

Zarkov

Well-Known Member
Mar 22, 2013
428
176
69
Is it an enchanting turtle or a crafting turtle?
Tryng to setup an enchanting turtle, the beginning code is :

m = peripheral.wrap("right") (the crafty part is on the right of the crafting turtle)
m.setAutoCollect(true)

On the auto collect, it fails, attempt to call nil.

Is it an enchanting turtle (crafted with turtle + enchanting table), or something else? Your code should work.
 

internetrush

New Member
Jul 29, 2019
5
0
0
Is it an enchanting turtle or a crafting turtle?

Is it an enchanting turtle (crafted with turtle + enchanting table), or something else? Your code should work.



Feel like such an idiot, i was using the crafty turtle.not the xp turtle... Duh.
 

egor66

New Member
Jul 29, 2019
1,235
0
0
Feel like such an idiot, i was using the crafty turtle.not the xp turtle... Duh.
Hey dont beat your self up, mistakes happen, any one thats never made a mistake has never done anything, ps next time "open comment to all help requesters", plz add the pack/version as the turtle code has some minor changes from 147 to 152.