Jump to content




Essentia Refill System


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

#1 _UndeadMC_

  • New Members
  • 1 posts

Posted 19 June 2014 - 07:49 AM

Please help me, in this code:

full code is here

and i getting error with the 44. line.

function scanJars()
  local myEmptyJars = 0
  local myTotalJars = 0
  local jars = {}
  local jarID = 1
  local aspect
  local aspectCount
  local i, j

  for i,j in ipairs(peripheral.getNames()) do
    if peripheral.getType(j) == "tilejar" then
          base = peripheral.call(j, "getAspects")[1.0]
          aspect = base["name"]
      aspectCount = base["quantity"]

      if (aspectCount > 0) then
        jars[jarID] = {}
        jars[jarID]["aspect"] = aspect
        jars[jarID]["count"] = aspectCount
        jarID = jarID + 1
        myTotalJars = myTotalJars + 1
      elseif (aspectCount == 0) then
        myEmptyJars = myEmptyJars + 1
        myTotalJars = myTotalJars + 1
      end
    end
  end

  emptyJars = myEmptyJars
  totalJars = myTotalJars

  return jars
end

function updateEssentia()
  local myJars
  local myEssentia
  local i, j

  myJars = scanJars()
  myEssentia = essentiaList()

  for i in pairs(myJars) do
    myEssentia[myJars[i]["aspect"]] = myEssentia[myJars[i]["aspect"]] + myJars[i]["count"]
  end

  for i,j in sortEss(myEssentia) do
    if (essentia[i] ~= j) then
      essentia[i] = j
    end
  end
end

Edited by theoriginalbit, 19 June 2014 - 08:49 AM.
fixed pastebin link / code


#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 19 June 2014 - 08:30 AM

split into new topic

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 19 June 2014 - 08:44 AM

View Post_UndeadMC_, on 19 June 2014 - 07:49 AM, said:

and i getting error with the 44. line.

Which line do you mean, exactly? This one?

                myEssentia[myJars[i]["aspect"]] = myEssentia[myJars[i]["aspect"]] + myJars[i]["count"]

What does the error actually state?

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 19 June 2014 - 08:56 AM

line 44 on the pastebin is a comment, so yeah, please provide us more information.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users