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

Trying to hack my way through.. ;)

Started by Letherin, 22 December 2013 - 06:15 PM
Letherin #1
Posted 22 December 2013 - 07:15 PM
A lot of the example code use some pretty interesting ways to display text and graphs usually on advanced computers.

I'm just trying to print a variable ;)/>

What am I doing wrong here? Either the variable is empty, or I'm doing something syntactically incorrect.. ;)/>

(It's my first program that actually does something)

pastebin.com/sfNtsJ3c

Thanks for any help.
Edited on 22 December 2013 - 06:15 PM
jay5476 #2
Posted 22 December 2013 - 07:18 PM
call the function

local power = batbox.getStored()
edit: You may also want to add that into your while loop so the variable keeps updating with the current powerr
Edited on 22 December 2013 - 06:18 PM
Alice #3
Posted 22 December 2013 - 07:27 PM
local power = batbox.getStored() sets power to a number
Where you have print(power), change it to print(power())
Letherin #4
Posted 22 December 2013 - 07:52 PM
Yeah I've made those changes (including adding it to the while loop) but am now getting an error:
test:5: attempt to call nil

pastebin: jAMpt8vc
Edited on 22 December 2013 - 06:54 PM
theoriginalbit #5
Posted 22 December 2013 - 08:21 PM
You may be using a newer version of OpenPeripheral, use getEUStored or getStoredEU (I can't remember which way around it is)
Edited on 23 December 2013 - 06:12 AM
Letherin #6
Posted 23 December 2013 - 02:16 AM
No worries thanks for the heads up.

(That may have been my original issue as I was originally copying code from oldish posts).
Letherin #7
Posted 23 December 2013 - 02:29 AM
Something weird going on, I am on an FTB server for 1.6.4 - latest version which came out last week - I'd imagine it's not using a version of OpenP that's too cutting edge given the 1.6.4 nature of it though.

I also tried MFSU Monitor here:
http://www.computerc...post__p__157694

This is giving me the same issue.

Having written something to return the methods the correct method seems to be "getEUStored", however I'm still getting the attempt to call nil from that above program.
Edited on 23 December 2013 - 01:44 AM
Letherin #8
Posted 23 December 2013 - 02:54 AM
http://pastebin.com/pfqSjABJ

Finally got this working, thanks for all the help - onto the next iterations - I'll be back when I've made it 50 times more complicated lol

Edited on 23 December 2013 - 01:58 AM