Need help finding the cause of a null pointer exception
#1
Posted 31 March 2017 - 11:19 AM
Monitor setup 8 wide x 3 high
Computer setup
Error
The code I've written:
Info Panel - startup
powermeter
Remote Computer - startup
Minecraft 1.7.10 (Single Player)
ComputerCraft 1.75
I've only been using CC and learning lua for 3 days and after much searching and trying various things to fix it. Sometimes it will run for hours just fine before it throws the error, others just a few seconds after rebooting the computer.
Any help/insight would be appreciated.
#2
Posted 31 March 2017 - 04:17 PM
Does this happen when anything specific happens, or is it a general error?
#3
Posted 31 March 2017 - 04:39 PM
FuzzyLitchi, on 31 March 2017 - 04:17 PM, said:
Does this happen when anything specific happens, or is it a general error?
As far as I know it just happens randomly. Given enough time it happens. There doesn't seem to be anything in particular that triggers it.
At one point I thought it was coming from GC lag spikes, but I've ruled that out by watching it crash no where near one of those. I can hop dimensions and come back to find it still running. I've also tried different monitor sizes (and rendering sizes of the powermeter to match). I've also increased the sleep time on the computers sending data to the infopanel.
Right now I'm using a loop a user posted in an unrelated thread to keep the infopanel running along with a counter to keep track of how often it crashes.
peripheral.call("right", "clear")
c = 0
while true do
term.clear()
term.setCursorPos(1,1)
term.write("infopanel has crashed " .. c .. " time(s).")
shell.run("infopanel")
c=c+1
end
#4
Posted 31 March 2017 - 06:28 PM
#5
Posted 31 March 2017 - 10:28 PM
FuzzyLitchi, on 31 March 2017 - 06:28 PM, said:
Correct, I provided all the remote computer code just to give the whole picture of my setup. I've yet to see either of the remote computers crash back to the command line.
#6
Posted 01 April 2017 - 09:53 AM
#7
Posted 01 April 2017 - 10:39 AM
FuzzyLitchi, on 31 March 2017 - 04:17 PM, said:
I've got some thoughts on this. The screenshots in my opening post, the computers are located in the Aroma mining dimension. After a clean boot of minecraft and starting a creative world for testing. I recreated the setup and I've yet to have a problem with crashing while in the Minecraft overworld. I only let that run for about four hours so I can't say it is conclusive that the Aroma mining dimension mod has something to do with it.
Bomb Bloke, on 01 April 2017 - 09:53 AM, said:
Thanks, loaded and running in my survival world now. I'll post any output when it pops up. Also I believe you're the user that posted the code I quoted above that effectively keeps my info panel rebooting after a crash.
#8
Posted 01 April 2017 - 11:37 AM
Bomb Bloke, on 01 April 2017 - 09:53 AM, said:
Edit: Another crash
Updated files:
infopanel
powermeter
Edited by Immolus, 01 April 2017 - 12:24 PM.
#9
Posted 01 April 2017 - 01:46 PM
local ok, err = pcall(mon.write, " ")
if not ok then error("Failure to write to monitor; x/y: "..i..", "..y..", clr: "..clr) end
I do think it'd pay to refactor your code to use string.rep() and term.blit(), though. All of this "drawing single characters at a time" business adds up to some pretty slow execution, especially when you consider that ComputerCraft has to update entire lines every time you perform any write operations.
#10
Posted 01 April 2017 - 03:08 PM
Bomb Bloke, on 01 April 2017 - 01:46 PM, said:
local ok, err = pcall(mon.write, " ")
if not ok then error("Failure to write to monitor; x/y: "..i..", "..y..", clr: "..clr) end
Bomb Bloke, on 01 April 2017 - 01:46 PM, said:
I'll work on doing this.
#11
Posted 02 April 2017 - 12:04 PM
Bomb Bloke, on 01 April 2017 - 01:46 PM, said:
local ok, err = pcall(mon.write, " ")
if not ok then error("Failure to write to monitor; x/y: "..i..", "..y..", clr: "..clr) endI scrapped that code when other monitor calls started throwing the error instead. I rewrote it from the ground up using string.rep() and term.blit(). It was interesting buffering the screen with 3 tables of strings.
I'd like to say thank you to you and FuzzyLitchi for your time and help.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











