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

It saids then is missing but its there? or am i missing something?

Started by Hellreaper, 11 September 2016 - 03:56 PM
Hellreaper #1
Posted 11 September 2016 - 05:56 PM
I am very confused, the error message reads:
"line 12: then expected" but as far as i can see it looks like its there…

http://pastebin.com/RKYHVTDB


powerCore = peripheral.wrap("draconic_storage_0")
glassesBridge = peripheral.wrap("left")
--PowerCore monitoring
previousPowerLvl = powerCore.getEnergyStored()
while true do
  glassesBridge.clear()
  currentPowerLvl = powerCore.getEnergyStored()
  if previousPowerLvl > currentPowerLvl then
	status = "decreasing"
  elseif previousPowerLvl = currentPowerLvl then --This is the line according to the computer(bottom right line indicator)
	status = "stable"
  elseif previousPowerLvl < currentPowerLvl then
	status = "increasing"
  end
  power = powerCore.getEnergyStored()/powerCore.getMaxEnergyStored()
  power = math.floor(power)
  glassesBridge.addText(5, 5, power.." % power capacity")
  glassesBridge.addText(5, 10,"Power "..status)
  glassesBridge.sync()
  sleep(1)
  previousPowerLvl = currentPowerLvl
end
Admicos #2
Posted 11 September 2016 - 06:09 PM

previousPowerLvl = currentPowerLvl

you need two equals(=)
Edited on 11 September 2016 - 04:09 PM
Dog #3
Posted 11 September 2016 - 06:45 PM
To build a little on Admicos' answer…

On line ten (the line you've marked) you are setting previousPowerLvl to the value of currentPowerLvl (using one equal sign) - you want to do a comparison, so you would use two equal signs.
Edited on 11 September 2016 - 04:46 PM
Hellreaper #4
Posted 11 September 2016 - 07:27 PM
always those minor things that i seem to miss… tyvm


It works now, cant believe I didnt see that though(although i am quite sleep deprived so i ll blame it on that)
Edited on 11 September 2016 - 05:29 PM