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

Picture Opener Error

Started by Ziriee, 07 September 2013 - 01:16 PM
Ziriee #1
Posted 07 September 2013 - 03:16 PM
Guys, I got a bug that I can't figure out. Please anyone can find a solution?
Error message: picturer:77: bad argument #1: value expected
Code: http://pastebin.com/4r4pPsTY
Thanks in advance!
Grim Reaper #2
Posted 07 September 2013 - 04:58 PM
You might be converting your hex numbers into decimal numbers incorrectly. Try using tonumber (hexNumber, 16) to convert the hex string into base 10 from base 16.
Ziriee #3
Posted 07 September 2013 - 05:14 PM
You might be converting your hex numbers into decimal numbers incorrectly. Try using tonumber (hexNumber, 16) to convert the hex string into base 10 from base 16.
It did fix the problem, but now there's a weird bracket bug that I can't trace.
Error: bios:337: [string "picturer"]:56: ')' expected
Link: http://pastebin.com/7Z6LXupD
Note: I am trying to edit a picture
PixelToast #4
Posted 07 September 2013 - 08:17 PM
this line wasnt using parentheses properly

term.setBackgroundColor(2^tonumber(string.sub(bg[pi], pj, pj), 16))
Ziriee #5
Posted 08 September 2013 - 06:32 AM
this line wasnt using parentheses properly

term.setBackgroundColor(2^tonumber(string.sub(bg[pi], pj, pj), 16))
picturer:71: attempt to perform arithmetic __pow on number and nil
theoriginalbit #6
Posted 08 September 2013 - 06:57 AM
if tonumber is returning nil then it means the string being passed to it is not valid hexadecimal. Make sure you're not giving it anything that wouldn't be valid hex.
Ziriee #7
Posted 08 September 2013 - 07:04 AM
if tonumber is returning nil then it means the string being passed to it is not valid hexadecimal. Make sure you're not giving it anything that wouldn't be valid hex.
Might be the problem, but it crashes when I try to change the BG color or text color in the editor. When I edit the numbers manually it shows the colors just fine.
Ziriee #8
Posted 09 September 2013 - 07:46 AM
FIXED. I switched the height with width, so I had '19' instead of '51'. Thanks for contributing everyone!