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

Loading screen

Started by PatrikF1, 15 May 2015 - 07:31 PM
PatrikF1 #1
Posted 15 May 2015 - 09:31 PM
Is there a way to add a loading screen with 3 dots that loops for a certain time. Currently im using a emulator cause im using Windows 10 insider Preview so Minecraft doesnt work for me right now. But should work on normal and advanced computers. Something like the image below.

Edited on 15 May 2015 - 07:32 PM
valithor #2
Posted 15 May 2015 - 10:24 PM
Your only limitations you will find will be the lack of quality in how it looks. It is possible to have a loading screen, with something that moves accross the screen or something similar, but you have to remember computercraft computer screens are only 51x19 pixels. The only other thing is the fading in and out. You can use grey in CC, but there is nothing inbetween in order do fading.

Because of this limitation making a circle would be almost impossible, and instead you would most likely have to resort to either squares (rectangles technically), or some kind of character such as *.

So yes it is possible, but it will not look as good as you might hope.

Little example

term.setBackgroundColor(colors.white)
term.clear()
x,y = term.getSize()
local mid = math.floor((x/2)-3)
term.setCursorPos(mid,y/2)
term.setTextColor(colors.gray)
term.write("#####")
while true do
  for i = mid, mid+4 do
	term.setTextColor(colors.black)
	term.setCursorPos(i,y/2)
	term.write("#")
	term.setTextColor(colors.gray)
	term.setCursorPos((i ~= mid and i-1 or mid+4),y/2)
	term.write("#")
	sleep(.5)
  end
end
Edited on 15 May 2015 - 08:25 PM
KingofGamesYami #3
Posted 15 May 2015 - 10:25 PM
Easy Peasy, just do something like this:


term.clear()
local i = 1
while true do
  term.setCursorPos( 1, 1 )
  term.write( string.rep( ".", i + 1 ) .. "  " )
  i = (i + 1) % 3
  sleep( 1 )
end
flaghacker #4
Posted 15 May 2015 - 10:26 PM
Yea sure, print some spaces, using term.setBackgroundColor to set the color and term.setCursorPos to set the position to draw at.

What exactly are you having trouble with?

Edit: double :ph34r:/>
Edited on 15 May 2015 - 08:27 PM