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

Warping Text

Started by bicobajas, 30 July 2012 - 09:47 AM
bicobajas #1
Posted 30 July 2012 - 11:47 AM
Hi is it possible to make text dissappear and show a new word and loop like this Apature then apature word dissappears and then Pines Come And So On Loop?
KaoS #2
Posted 30 July 2012 - 02:08 PM
yes, you just clear the screen and write again or set the cursor position to the location of where you want to overwrite and write in, use term.clear() to clear the screen and term.setCursorPos(x,y) to set the cursor position.

I have yet to see an impressive startup logo etc that is animated, good luck
bicobajas #3
Posted 30 July 2012 - 04:05 PM
But Loop?
bicobajas #4
Posted 30 July 2012 - 04:21 PM
how do i loop it
bicobajas #5
Posted 30 July 2012 - 04:30 PM
ok i did

m = peripheral.wrap("right")
m.clear()
m.setTextScale(2)
m.write("M")
sleep(2)
m.clear()
m.write("A")
sleep(2)
m.clear()

it dident come any errors but the A wouldent Show only M Btw I need Loop
KaoS #6
Posted 30 July 2012 - 06:03 PM
that's strange, let me re-write it and just give it a try


mon=peripheral.wrap("right")
mon.setTextScale(2)
while true do
mon.clear()
mon.setCursorPos(1,1)
m.write("M")
sleep(1)
mon.clear()
mon.setCursorPos(1,1)
mon.write("A")
sleep(1)
end

give it a try
bicobajas #7
Posted 02 August 2012 - 04:12 PM
ok ty
bicobajas #8
Posted 02 August 2012 - 04:17 PM
TYYYYYYYYYY IT WORKED
Cranium #9
Posted 02 August 2012 - 04:18 PM
I have yet to see an impressive startup logo etc that is animated, good luck
Challenge accepted…
I will try to do this as soon as I get home from work today. Prepare to be amazed!
Rsstn #10
Posted 02 August 2012 - 09:15 PM
This should be good!
KaoS #11
Posted 03 August 2012 - 09:15 AM
there we go! those who make OSs etc take note, this would be an epic addition, add it on startup etc
Cranium #12
Posted 03 August 2012 - 01:36 PM
Well….not so much… I thought I could use parallel to run the title loop, but it just loops over and over, not letting the input be given… But I am going to get this working! Will post code as soon as I can!
KaoS #13
Posted 03 August 2012 - 01:48 PM
just make a startup screen that has an animated logo for 3 secs
KaoS #14
Posted 03 August 2012 - 01:50 PM
and if you want to loop the logo and accept input that should work EXCEPT: you MUST set the cursor position back to its original position after generating the logo, maybe that will work
Cranium #15
Posted 03 August 2012 - 02:57 PM
just make a startup screen that has an animated logo for 3 secs
I already have a dancing kirby, but I want it to dance while waiting for an input. Right now it's either looping kirby, or stopping and waiting for the input. my code for the parallel is this: parallel.waitForAny(select(),kirbyIdle()). It depends on which one I have first as to which one will loop or stop.
and if you want to loop the logo and accept input that should work EXCEPT: you MUST set the cursor position back to its original position after generating the logo, maybe that will work
I already have the cursors doing what I want, but as I said, I don't know how I can have kirby dance the entire time while waiting for input. OH!!!! I think I just thought of something! If I have kirby Idle, and within the idle, not loop it, but call back to restart the kirbyIdle() function! I'll try that now!
Cranium #16
Posted 03 August 2012 - 03:07 PM
OK, Here's what I have so far:

-- screen functions
function border()
term/setCursorPos(1,1)
write("+------------------------------------------+")
term.setCursorPos(1,2)
write("|")
term.setCursorPos(mX,2)
write("|")
term.setCursorPos(1,3)
write("|")
term.setCursorPos(mX,3)
write("|")
write("+------------------------------------------+")
end
function kirbyEnter(mY)
term.setCursorPos(2,2)
write(">")
term.setCursorPos(2,2)
sleep(.2)
write("V)")
term.setCursorPos(2,2)
sleep(.2)
write("('.')>")
term.setCursorPos(2,2)
sleep(.2)
write(" (V')")
term.setCursorPos(2,2)
sleep(.2)
write(" <( )>")
term.setCursorPos(2,2)
sleep(.2)
write("   ('V)")
term.setCursorPos(2,2)
sleep(.2)
write("   <('.')>")
term.setCursorPos(2,2)
sleep(.2)
write("	 (V')")
term.setCursorPos(2,2)
sleep(.2)
write("	  <( )>")
term.setCursorPos(2,2)
sleep(.2)
write("		('V)")
term.setCursorPos(2,2)
sleep(.2)
write("		  <('.')>")
end
function kirbyDance(mY)
local mY = mY/2
write("^('.')>")
term.setCursorPos(12,mY)
sleep(.5)
write("<('.')^")
term.setCursorPos(12,mY)
sleep(.5)
write("^('.')>")
term.setCursorPos(12,mY)
sleep(.5)
write("<('.')^")
term.setCursorPos(12,mY)
sleep(.5)
write("^('.')>")
term.setCursorPos(12,mY)
sleep(.5)
write("<('.')^")
term.setCursorPos(12,mY)
sleep(.5)
write(" (>'.')>")
term.setCursorPos(12,mY)
sleep(.5)
write("<('.'<) ")
term.setCursorPos(12,mY)
sleep(.5)
write(" (>'.')>")
term.setCursorPos(12,mY)
sleep(.5)
write("<('.'<) ")
term.setCursorPos(12,mY)
sleep(.5)
write(" (>'.')>")
term.setCursorPos(12,mY)
sleep(.5)
write("<('.'<) ")
term.setCursorPos(12,mY)
sleep(.5)
write("<('.')> ")
sleep(2)
end
function select()
term.setCursorPos(1,9)
print("Make your selection")
print("")
print("Dance")
term.setCursorPos(1,18)
write("Selection: ")
--other options available in the future
  local input = read()
  while true do
	if input == "dance" then
	  kirbyDance(mY)
	else
	  print("INVALID")
	   sleep(1)
	  term.setCursorPos(11,18)
	end
  end
end
function kirbyIdle(mY)
term.setCursorPos(12,mY)
write("<('.')>")
sleep(5)
term.setCursorPos(12,mY)
write("<(-.-)>")
sleep(.2)
kirbyIdle(mY)
end
-- end screen functions
mX, mY = term.getSize()
border()
kirbyEnter()
parallel.waitForAny(select(),kirbyIdle())
I haven't tested this new one, so I'm counting on you guys to squash those bugs!
MysticT #17
Posted 03 August 2012 - 09:05 PM
You don't have to call the functions in the parallel call, you just pass the functions as arguments, and parallel runs them for you:

parallel.waitForAny(select, kyrbyIdle)
Basically, just remove the brackets :P/>/>

Also, don't use recursive functions to make a loop, it will overflow the stack and crash the computer.