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

[1.7.10] Desktop throwing error

Started by Elrol_Arrowsend, 06 March 2018 - 09:02 PM
Elrol_Arrowsend #1
Posted 06 March 2018 - 10:02 PM
I have changed my code a bit recently, to add a few more menus and to also change a bit of how they work. I also added a small reactor monitor to start the process of having this computer run my base. Now it is throwing this error when I click anywhere on the screen, the program loads up just fine but crashes on click:



The code can be found here: https://pastebin.com/SRva7cRv

Any help would be awesome!
Lupus590 #2
Posted 06 March 2018 - 10:13 PM
try running through this and give the error: http://www.computercraft.info/forums2/index.php?/topic/27844-trace-simple-stack-traces-for-errors/
Elrol_Arrowsend #3
Posted 07 March 2018 - 12:42 AM
Well, I got the program and used: "trace startup" and I got this:



I get the whole "got nil" thing, but nothing else makes sense, I dont know where the "nil" is being called.
SuperDyl19 #4
Posted 07 March 2018 - 05:09 AM
Just a shot in the dark, but I tried following a bit and I have some places you could possibly check. Nil might be coming from the click event function in line 225. There're a lot of menus you can check, so try running the program with some extra functions to write to a file (as your screen will probably erase print lines). You could also use a combination of print and pause functions to see debug info as you run the program.

I can imagine that the problem could come from lines 17 and 18. The values of those are used in line 227 to call the function drawscreen() in line 131. This is important because the bcol variable for running the clear() function (which runs in line 79) comes from drawscreen() which gets bcol from terminalclick() in line 227. The value first assigned to what becomes bcol to be used to set the background color in line 80 should be a string and comes all the way from the value of _bgcolor in line 17.

_bgcolor may be the problem. Try running the program but print the value of _bgcolor in line 18 and have the program pause for a bit. If it outputs nil instead of a color string then you'll need to find "config" within the files near DS_DATA/kernal. (Or at least where the kernal API collects its data with the kerneal.getLine() function.

This may be entirely wrong, but just give a try at testing the value of _bgcolor. If that's not the issue, then try looking a bit through the terminalClick() function in line 225 and see where the different menu functions lead. You may end up needing to use comments to temporarily disable code so you can have the bare minimum left of what may be causing your issues. Good luck!
Bomb Bloke #5
Posted 07 March 2018 - 10:18 AM
Given that the errors are being spawned from within CC's code, it'd be a bit easier to track what's triggering them if you provided the version number for your CC install. The code in concern has changed a bit over time.
Elrol_Arrowsend #6
Posted 07 March 2018 - 02:23 PM
Well, in response to Bomb Bloke, the version number Im assuming is the 1.7 (if the start screen for the computers is any indicator) and its for minecraft 1.7.10, For SuperDyl, I will check and see what I can do in regards to all that and see if I cant locate the issue that way.
KingofGamesYami #7
Posted 07 March 2018 - 03:45 PM
Your CC version is not the CraftOS version.

You've narrowed it down to 1.64, 1.65, 1.7, 1.71-3, 1.74, or 1.75.
Elrol_Arrowsend #8
Posted 07 March 2018 - 04:16 PM
Sorry about that, I responded before my brain woke up (had just gotten up) the cc version is 1.75
EveryOS #9
Posted 07 March 2018 - 04:51 PM
This is caused by term.blit()

Are you using any special characters?
Did you check all of your colors validity?

I would pay special attention to these calls:

window.clearLine()
window.blit()
window.write()
window.setTextColor()
window.setBackgroundColor()

--After a redirect
print()
write()

You should also debug around the following calls:

window.reposition()
window.setVisible()
window.clear()
window.scroll()
window.redraw()

Basically, anything that uses color, text, or redraws the screen
Edited on 07 March 2018 - 04:01 PM
Elrol_Arrowsend #10
Posted 07 March 2018 - 05:41 PM
Well, I managed to completly miss the error, near the very end of the file, I call my function "clear()" however the function requires a color, so adding colors.black to clear() will make it work, I found that out while I was rewritting my program from an earlier date. Thanks for the help, but it was just a slight oversight.