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

Problem with monitors

Started by Deimos, 11 December 2012 - 10:28 PM
Deimos #1
Posted 11 December 2012 - 11:28 PM
Hi all,

I am having trouble with two of my monitor displays.(These displays, show my banned items on my server). Now the problem that I am having is that the text is disappearing of the screens until I break a monitor and replace it.
my monitor is 5wide by 6 high.
This is my code I am using


local w,h = term.getSize()

local function printCenter(line)
  local width = string.len(line)
	if width < w then
		  local x,y = term.getCursorPos()
		  term.setCursorPos(w/2 - width/2,y)
	end
  print(line)
end

printCenter 'Banned Items'
printCenter ''
print([[Abyss Helmet   Anchor Cart	Black Hole Band
Blaze Rods	   Block Breaker  Builder
Cannon									  Catalytic Lens
Collector MK1  Collector MK2  Collector MK3
DM pedestal	DM Hammer		  Dest. Catalyst
DragonEgg		 Dynamite		 EnderChest
Evertide Amulet Filler	  Gravity Greaves
HurricaneBoots HyperkineticLens Infernal Armor
MFE Cart		   Mercurial Eye  Mining Laser
Nova Cataclysm Nova Catalyst  Nuke
Project Table  RM Armour		  RM Furnace
RM Katar		   RM MorningStar RM Tools
Ranged Weapons Ring of Arcana Ring of Ignition
SwiftWolf Ring Tank Cart		  Teleport Tether
TnT												TnT Cart		
Triangulator							  Transmutation Tablet
Turtles	 Void Ring	 Volcanite Amulet
				   Watch of flowing time
World Anchor							  Zero Ring]])
printCenter ''
printCenter ''
printCenter 'Collectors, RM Tool, RM Armour and Swiftwolf'
printCenter 'are Donator only'
printCenter ''
printCenter 'These items may change at anytime,'
printCenter 'please check back often to see'
printCenter 'if anything has changed'
printCenter ''
printCenter 'Banned items will turn to dirt'
printCenter 'if you craft them.This is at your expense'
printCenter 'and staff will not refund the items'
ScruffyRules #2
Posted 11 December 2012 - 11:47 PM
you want a at the end.
1lann #3
Posted 11 December 2012 - 11:58 PM
Have you considered that you might be trying to print too much text on the monitor? You sure are printing a lot and if we assume that there are 2 lines of text per monitor block, from 6 monitor blocks, you can only print 24 lines of text. But here you are definitely printing more. Also putting commas between item names one the same line will help users distinguish the items. What you can do to resolve this is to make the monitors "scroll" down slowly. One easy and cheap way of doing this is, for the first 24 or so lines of text (Try to find it out using getSize()) then slowly printing each and every individual line after that.
ScruffyRules #4
Posted 11 December 2012 - 11:58 PM
also it works for me!
Deimos #5
Posted 12 December 2012 - 09:17 AM
&amp;gt;.&amp;gt; damn it, my bad forgot the / sorry


The text fits and there is almost a full monitor down the bottom, the text displays just over a line on the bottom monitor. But the text will vanish and then I have to break one of the top monitors to get it back.
i_am_th0r #6
Posted 12 December 2012 - 04:26 PM
Tried using signs? XD jk,but it could be you have too many lines on a moniter,just use commas between your listed items like the guy earlier suggested
Deimos #7
Posted 13 December 2012 - 11:06 AM
yeah im trying to move away from signs :P/>. I have removed part of the code and it still isnt working. there is a whole monitor down the bottom.