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

How to disable cursor blinking on startup?

Started by Allydra, 05 October 2017 - 03:14 AM
Allydra #1
Posted 05 October 2017 - 05:14 AM
The cursor blinking really annoys me, is there a way to turn it off? I tried a file called startup in the root folder with the following line:
term.setCursorBlink(false)
as well as the inverse (setting it to true) and neither seemed to do anything, even if running it manually.
Bomb Bloke #2
Posted 05 October 2017 - 01:37 PM
Technically that works, but the shell operates by calling the read() function over and over again - and that function enables cursor-blinking while it's executing (it also disables it again when it's done, but then the shell calls it again so the user can enter another command, so…).

Thus your options boil down to "prevent the shell from asking for commands". I'm not sure why you want to prevent the blinking - are you talking about the texture that appears on the front of a computer block, or are you talking about the cursor that appears in the computer's GUI? If it's just the former that's bugging you, then I suggest simply turning your computers off when you're not using them! (Ctrl+S)
Dave-ee Jones #3
Posted 05 October 2017 - 11:18 PM
If it is your screen's cursor, you can override the 'read()' function.

function io.read(_str)
  -- copy the read() function from 'bios.lua'
  -- remove all blinking functions
end

read = io.read

Put that code in your 'startup' program and all the programs that don't reset the read() function (including shell) will use THAT read function instead of the bios' one.
Luca_S #4
Posted 24 October 2017 - 02:58 PM
To prevent all cursor blinking you could also do this:

term.setCursorBlink(false)
function term.setCursorBlink() end
This will disable cursorblinking and then prevent programs from re enabling it by overriding the term.setCursorBlink() function.