Jump to content




Monitor won't print text above line h-7


  • You cannot reply to this topic
6 replies to this topic

#1 YoShIWoZ

  • Members
  • 13 posts

Posted 23 August 2015 - 03:26 PM

Hey yall CC people out there, it's been quite a while since i last played with CC. So decided to boot it up on my private server running a private modpack
Which includes the newest version of CC
So i loaded my old homemade OS. Had to change a few lines of code:
function drawDesktop()
  mon.setBackgroundColor(backgroundC)
  mon.clear()
  background = paintutils.loadImage("/disk/background")  
--  term.redirect(mon)
--  paintutils.drawImage(background,-4,1)
--  term.restore()
  menuBar()
end
As you can see i had to comment out term redirect, since this apparently doens't work anymore.
Now my problem is, when i try write text to the monitor with and above monitor h-7 it simply doesn't print the text. Which seems a bit weird, because it's not even in the buttom of the block that has the monitor in it. But it's the middle of the block. So any of the text i have in my OS does not show up if it's written above line h-7 (7 lines above bottom).
I tested this out by doing a blank file with just
  mon = peripheral..wrap("top")
  mon.setTextColor(32768)
  mon.setBackgroundColor(1)
  mon.setCursorPos(1,h-1)
  mon.write(">Programs")
  mon.setCursorPos(1,h-2)
  mon.write("		 ")
  mon.setCursorPos(1,h-3)
  mon.write("		 ")
  mon.setCursorPos(1,h-4)
  mon.write("		 ")
  mon.setCursorPos(1,h-5)
  mon.write("		 ")
  mon.setCursorPos(1,h-6)		
  mon.write("Restart  ")
  mon.setCursorPos(1,h-7)
  mon.write("Shutdown ")
It writes everything up to shutdown, i even tried adding h-8 h-9 etc. same problem.

Edit: Also tried setting the curser from top, same problem:
  mon.setCursorPos(1,13)
This works fine
but
  mon.setCursorPos(1,12)
This doesn't work.

Edited by YoShIWoZ, 23 August 2015 - 03:51 PM.


#2 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 23 August 2015 - 05:23 PM

There's a bug in CC 1.74 with monitors; Sometimes, they won't display text.

A temporary work-around is changing the text scale to a different value, then back to what you want it to be.


View PostYoShIWoZ, on 23 August 2015 - 03:26 PM, said:

As you can see i had to comment out term redirect, since this apparently doens't work anymore.

It should work... Was it giving you an error?

#3 YoShIWoZ

  • Members
  • 13 posts

Posted 23 August 2015 - 08:21 PM

View PostHPWebcamAble, on 23 August 2015 - 05:23 PM, said:

There's a bug in CC 1.74 with monitors; Sometimes, they won't display text.

A temporary work-around is changing the text scale to a different value, then back to what you want it to be.


View PostYoShIWoZ, on 23 August 2015 - 03:26 PM, said:

As you can see i had to comment out term redirect, since this apparently doens't work anymore.

It should work... Was it giving you an error?
I downgraded to 1.73. Thanks for the tip, that fixed it! :)

The problem with term redirect code part is that
term.restore()
Doesn't seem to exist anymore since it just calls out a nill

#4 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 23 August 2015 - 08:37 PM

View PostYoShIWoZ, on 23 August 2015 - 08:21 PM, said:

--snip--
The problem with term redirect code part is that
term.restore()
Doesn't seem to exist anymore since it just calls out a nill
Term.redirect now returns the old term, so if you were to redirect to a monitor you would do this:
local curr = term.redirect(mon)
--#Back to the computer!
term.redirect(curr)


#5 YoShIWoZ

  • Members
  • 13 posts

Posted 23 August 2015 - 08:51 PM

View PostDragon53535, on 23 August 2015 - 08:37 PM, said:

View PostYoShIWoZ, on 23 August 2015 - 08:21 PM, said:

--snip--
The problem with term redirect code part is that
term.restore()
Doesn't seem to exist anymore since it just calls out a nill
Term.redirect now returns the old term, so if you were to redirect to a monitor you would do this:
local curr = term.redirect(mon)
--#Back to the computer!
term.redirect(curr)
Thanks, that kind of works. :P
But now everytime i write something to the terminal (which i use for debugging, like i make it write on terminal where i click with the mouse on teh touch screen. It writes that info on the monitor instead. :P
Edit: Which actually makes sense since it's not returned to terminal, but it's returned to monitor. :P
Edit Edit: I just read on the wiki that they replaced the restore with
term.redirect(term.native()) =)

Edited by YoShIWoZ, 23 August 2015 - 08:53 PM.


#6 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 24 August 2015 - 02:07 AM

View PostYoShIWoZ, on 23 August 2015 - 08:51 PM, said:

Edit Edit: I just read on the wiki that they replaced the restore with
term.redirect(term.native()) =)

The structure Dragon suggested is better - term.native() may not be the terminal that was in use before your script started.

#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 24 August 2015 - 05:56 AM

I've removed that line from the wiki, as that's really not very good advice.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users