Jump to content




making a Power monitoring programm


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

#1 Tomgnus

  • Members
  • 5 posts

Posted 22 May 2016 - 12:26 AM

hi need som help with my program when i run it i get this error:
bios:14: [string "prog"]:19 '=' expected
what can be wrong?
--peripheral warp--
r1 = peripheral.warp("tile_thermalexpansion_cell_resonant_name_0")
d1 = peripheral.warp("tile_thermalexpansion_dynamo_magmatic_name_0")
f1 = peripheral.warp("tile_thermalexpansion_machine_furnace_name_0")
while true do
levelr1 = r1.getEnergyStored()
levelr1max = r1.getMaxEnergyStored()
  
leveld1 = d1.getEnergyStored()
leveld1max = d1.getMaxEnergyStored()
d1tick = d1.getEnergyPerTickInfo()
  
term.clear
term.setCursorPos(1,1)
term.setTextColor(colors.white)
print("------CELLS------")
term.setTextColor("colors.green")
  
if levelr1 == levelr1max then
print(">Resonant Cell[01] "..levelr1.." RF -- Full")
else
print(">Resonant Cell[01] "..levelr1.." RF")
end
  
term.setTextColor(colors.white)
print("------DYNAMOS------")
term.setTextColor(colors.blue)
  
if leveld1 == leveld1max then
print(">Magmatic Dynamo"..leveld1.." @ "..d1tick.." RF/t --full")
else
print(">Magmatic Dynamo"..leveld1.." @ "..d1tick.." RF/t")
end
sleep(1)
end


#2 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 22 May 2016 - 12:38 AM

term.clear should be term.clear()

#3 Dog

  • Members
  • 1,179 posts
  • LocationEarth orbit

Posted 22 May 2016 - 12:43 AM

You also need to change peripheral.warp to peripheral.wrap - note the 'wrap' vs. your 'warp'

#4 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 22 May 2016 - 01:00 AM

View PostDog, on 22 May 2016 - 12:39 AM, said:

It's peripheral.wrap, not peripheral.warp - notice 'wrap' vs. 'warp'

On that note, check over your code if you ever get an error like this when working with peripherals, or anything really. A lot of the time this can be caused because of a simple typo.

#5 Tomgnus

  • Members
  • 5 posts

Posted 22 May 2016 - 11:03 AM

hi tnx for the help on that but now i got a error that says:

prog:14: attempt to index ? (a nil value)

#6 Bomb Bloke

    Hobbyist Coder

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

Posted 22 May 2016 - 11:13 AM

You're trying to treat something that isn't a table as if it were a table. This'll likely either be r1, d1, or f1, which may be nil if peripheral.wrap() fails to find any of the peripherals you've named.

#7 Tomgnus

  • Members
  • 5 posts

Posted 22 May 2016 - 11:18 AM

starting to get mad xD :P now i only get the
------CELLS------
prog:22: Expected a number

#8 Bomb Bloke

    Hobbyist Coder

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

Posted 22 May 2016 - 12:31 PM

"colors.green", in quotes like that, is a string - not a number.

#9 Tomgnus

  • Members
  • 5 posts

Posted 22 May 2016 - 03:31 PM

Awsome it works now thx so mutch for the help guys :D





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users