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

ASCII Logo on Monitor

Started by Czarified, 19 February 2013 - 03:50 PM
Czarified #1
Posted 19 February 2013 - 04:50 PM
Hello. I'm trying to use an ASCII logo on a monitor. I was initally just trying to test and see how big of a monitor i needed with the smallest text scale. However, I can't get the logo to display on the monitor at all. If I use "monitor top test" and modify it slightly i can get it to print, but then i can't really tell what it printed. I know i wrapped the peripheral right, and I can get it to display the (commented currently) "Testing…" line, but it won't display the Logo variable.

Any suggestions, and whats the easiest/best/most efficient way to do this?



local Logo = [[
  _  __									  _					  ___				  
| |/ /	___	_ __	  _ _   __ _	__| |	___	  o O O  / __|	___		  
| ' <	/ _ \  | '  \	| '_| / _' |  / _' |   / -_)	o	  | (__	/ _ \	 _	
|_|\_\   \___/  |_|_|_|  _|_|_  \__,_|  \__,_|   \___|   TS__[O]  \___|   \___/   _(_)_  
_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""|
"'-0-0-'"'-0-0-'"'-0-0-'"'-0-0-'"'-0-0-'"'-0-0-'"'-0-0-'./o--000'"'-0-0-'"'-0-0-'"'-0-0-'
]]

mon = peripheral.wrap("top")
mon.setTextScale(1)
mon.clear()
mon.setCursorPos(1,1)
mon.print(Logo)
--mon.write("Testing...")
--sleep(1.5)
--mon.clear()
--mon.setCursorPos(1,1)
theoriginalbit #2
Posted 19 February 2013 - 05:06 PM
Something like this should work fine:

local Logo = {
  [[  _  __                                      _                      ___                   ]],
  [[ | |/ /    ___    _ __      _ _   __ _    __| |    ___      o O O  / __|    ___           ]],
  [[ | ' <    / _ \  | '  \    | '_| / _' |  / _' |   / -_)    o      | (__    / _ \     _    ]],
  [[ |_|\_\   \___/  |_|_|_|  _|_|_  \__,_|  \__,_|   \___|   TS__[O]  \___|   \___/   _(_)_  ]],
  [[_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""| ]],
  [["'-0-0-'"'-0-0-'"'-0-0-'"'-0-0-'"'-0-0-'"'-0-0-'"'-0-0-'./o--000'"'-0-0-'"'-0-0-'"'-0-0-' ]],
}
local mon = peripheral.wrap("top")
mon.setTextScale(1)
term.redirect(mon)
term.clear()
term.setCursorPos(1,1)
for i = 1, #Logo do
  print(Logo[i])
end
term.restore()
If you have any questions about how it works just ask.
Czarified #3
Posted 20 February 2013 - 08:28 AM
Thank you very much BIT. I'll play with it a little bit.
theoriginalbit #4
Posted 20 February 2013 - 08:32 AM
Thank you very much BIT. I'll play with it a little bit.
No problems :)/> I really like your ASCII :)/> its cool :)/>
Czarified #5
Posted 20 February 2013 - 08:40 AM
No problems :)/> I really like your ASCII :)/> its cool :)/>

Thanks! I was trying to follow a tutorial I found on the forums here, but it doesn't really explain the best way to use this on a monitor. There's a link to an ASCII generator in the thread.
theoriginalbit #6
Posted 20 February 2013 - 08:42 AM
Thanks! I was trying to follow a tutorial I found on the forums here, but it doesn't really explain the best way to use this on a monitor. There's a link to an ASCII generator in the thread.
Oh is it that 'easy ascii art' one? I've been meaning to look at that tutorial properly. yeh you may need a big-ish monitor to display that full logo.
Czarified #7
Posted 20 February 2013 - 09:20 AM
Yep that's the one! And I was afraid of that..I was mainly seeing how big it needed to be. Haven't had a chance to test it yet in game though.
theoriginalbit #8
Posted 20 February 2013 - 09:24 AM
well its 91 chars. and iirc its 9 chars to a monitor width. so about 11 monitors. I think thats more than the width. although don't quote me on any of those figures, really tired atm. no sleep.
Czarified #9
Posted 20 February 2013 - 01:00 PM
It does work with the max width monitor and displays better with the period erased. is there an easy-ish way to make it marquee through, with overlapping?
Czarified #10
Posted 26 February 2013 - 12:26 PM
So I was trying to see if I could animate this logo. Currently I made a new variable for each frame, but I don't really know how to put them into a matrix for easy printing in the animation. How can I do this, when each ASCII variable is a table already?
Kingdaro #11
Posted 26 February 2013 - 12:37 PM
I just tested this code and it seems to work:


for frame = 1, #logo[1] + 1 do
	term.clear()
	for line = 1, #logo do
		local left = logo[line]:sub(frame)
		local right = logo[line]:sub(1, frame-1)
		term.setCursorPos(1, line)
		term.write(left..right)
	end
	sleep(0.1)
end

Where "logo" is your table with all of your lines for your logo.
Czarified #12
Posted 26 February 2013 - 12:50 PM
I just tested this code and it seems to work:


for frame = 1, #logo[1] + 1 do
	term.clear()
	for line = 1, #logo do
		local left = logo[line]:sub(frame)
		local right = logo[line]:sub(1, frame-1)
		term.setCursorPos(1, line)
		term.write(left..right)
	end
	sleep(0.1)
end

Where "logo" is your table with all of your lines for your logo.

So currently i have 111 different variables for my animation frames. (Logo1 - Logo111). But instead I could have just used this simple for loop? lol Wish I had known that before I spent an hour typing it all out… I figured there was a way to do it, I just didn't know how, since i wanted it to overlap. But I see the "left" and "right" variables there are how you're accomplishing that. Thank you very much!
Kingdaro #13
Posted 26 February 2013 - 01:06 PM
Just a tip for the future: go ahead and ask if there's an easier way, rather than going about the harder way. ;)/>
Czarified #14
Posted 26 February 2013 - 01:10 PM
Just a tip for the future: go ahead and ask if there's an easier way, rather than going about the harder way. ;)/>

Will definitely do than from now on! I've been asking for a lot of help though recently and I didn't want it to seem like I just wanted you guys to write all my code. :)/> Thanks again! And happy 800th post!