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

p.setFrequency() Enderstorage Help

Started by Tamtam18_2, 13 June 2015 - 08:11 AM
Tamtam18_2 #1
Posted 13 June 2015 - 10:11 AM
Pastebin ~ Test program (clean)

Pastebin ~ (OLD) Test program (don't mind the notes)

Computercraft: 1.73
EnderStorage: 1.7.10-1.4.7.33-universal
Survival Multiplayer

This program uses Enderchests to restock items, only one enderchest specifically by using setFrequency() to change between different enderchests. Slot 16 is where this chest goes.

When the program runs for the first time (turtle placed, chest put in inv) it runs until it hits line 33 in function restock() and returns an attempt to index ? error. if run for a second time afterwards, it runs perfectly fine without errors. Run it for a third time and it breaks again only because the turtle picked it up from the last run and in this run it placed it before setting the frequency.

setFrequency() works fine outside of the function with a table reference, a value, or an integer. As you can see, I've spent a while working on what the problem is or finding a work about. what ever it may be, it seems to not update until after the program runs a second time.

EDIT: I've cleaned up the code to help, and the lines before the function are to help figure out what the problem is. Except now the same thing is happening as before, but it breaks on line 10 now.

test:10: attempt to index ? (a nil value)

Here's a reference photo:
Edited on 13 June 2015 - 08:14 PM
Bomb Bloke #2
Posted 13 June 2015 - 10:57 AM
Last I tried it, attempting to access a peripheral directly after having a turtle turn will bug out. Guess that's still a thing.

I can't see any good reason to perform the turns you do on lines 28/29, so deleting them should sort it out. Or just sleep immediately before wrapping the chest.
Tamtam18_2 #3
Posted 13 June 2015 - 09:40 PM
I can clean up the code and give you a better version. until then I can only give you my word that it still happens even without turtle.turn(). I thought it wasn't updating either tile entities so having the turtle turn in place would update both, but that didn't work.
Tamtam18_2 #4
Posted 13 June 2015 - 10:17 PM
I've updated the info. Should I go poking around in the bug section? I usually go here for all my cc problems but I never come across a problem big enough to be called a bug.
Bomb Bloke #5
Posted 14 June 2015 - 03:04 AM
Arg, I see it now: you're calling "peripheral.wrap()" but not bothering to assign the result to "p".

In your "clean" script, you do it correctly on line 2, but incorrectly on lines 1 and 25.
Edited on 14 June 2015 - 01:07 AM
Tamtam18_2 #6
Posted 14 June 2015 - 09:06 AM
If I note out lines 1 and 25 it still breaks. its the same situation as before.
Edited on 14 June 2015 - 07:16 AM
Bomb Bloke #7
Posted 14 June 2015 - 09:19 AM
You still need to wrap the chest after placing it. I'm saying that you also need to ensure that you capture the newly-wrapped chest in "p".
Tamtam18_2 #8
Posted 14 June 2015 - 09:35 AM
so p is storing a specific wrap, but is not able to reuse that function inside that variable later on? I see; I did what you said and the program runs fine now and as intended :D/>. thank you very much.