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

Displaying characters in grid

Started by Waitdev_, 06 March 2016 - 10:01 AM
Waitdev_ #1
Posted 06 March 2016 - 11:01 AM
Kind of like what I've seen Bomb Bloke do, I was hoping to be able to see ascii characters in a grid. pretty much 8*4, with characters 127 - 159.
Bomb Bloke #2
Posted 06 March 2016 - 11:39 AM
I for one am unsure what you mean. What was the question? Are you talking about this sort of thing?
Dragon53535 #3
Posted 06 March 2016 - 07:19 PM
I think he means like the gif on this
Waitdev_ #4
Posted 09 March 2016 - 08:07 AM
Yeah, what dragon said. for example:



a b c d
e f g h
i j k l
m n o p
valithor #5
Posted 09 March 2016 - 08:18 AM
You just have to loop through the range and use string.char to get the numbers

ex:


term.setCursorPos(1,1)

for i = 128, 159 do
  if (i-128)%8 == 0 and i~=128 then
	print("")
  end
  term.write(string.char(i).." ")
end

note 127-159 is 33 characters, so it will not fit evenly in a 8*4 pattern.
Edited on 09 March 2016 - 07:22 AM
Waitdev_ #6
Posted 09 March 2016 - 09:11 AM
You just have to loop through the range and use string.char to get the numbers

ex:


term.setCursorPos(1,1)

for i = 128, 159 do
  if (i-128)%8 == 0 and i~=128 then
	print("")
  end
  term.write(string.char(i).." ")
end

note 127-159 is 33 characters, so it will not fit evenly in a 8*4 pattern.

Thanks for the help :)/>