Jump to content




[solved]Loop past empty chest slots using getStackInSlot?


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

#1 CreeperGoBoom

  • Members
  • 91 posts

Posted 05 December 2019 - 05:03 PM

Hi guys,
I'm building a toll operated turnstile.
What I want it to do right now is:
Loop through all 27 slots in a regular chest checking for payment type present. and then display a total based on stack qty.
problem I'm having is. Whenever my script runs into an empty slot, it stops and errors: 6:bad argument: table expected, got nil.
I was hoping that by catching all results in a table. It shouldn't error.
What am I missing?
<truncated>

Edit1:
I have one stack of 64 iron ingots. the output amount is showing as 128 for some reason.
If i add print(list["qty"]) under count=count+, the 64 qty shows up twice
If I add a second stack of 64, 64 then comes up 4 times. Why is everything being counted twice?


edit2: BAHH dumb crazy bbcode indentation!
Heres the pastebin:
https://pastebin.com/Cki8GG4W


Edit3: Solved it myself. turns out the counting code was in the wrong spot. pastebin is updated if anyone wants anything like this.

Edit4: I seem to be getting good at solving my problems, a good sign I'd say.

Edited by CreeperGoBoom, 05 December 2019 - 06:25 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users