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

[Monitor] monitor.autoScale()/monitor.autoSize() + More Scales

Started by TheOddByte, 21 December 2013 - 05:25 PM
TheOddByte #1
Posted 21 December 2013 - 06:25 PM
Well I've recently been using monitors alot and messed around with them, And most of the scales seems pretty weird.. (1.5, 2.5, 3.5, 4.5)
I'm wondering if there could be more scales for the monitor that would fit better for them and a function called 'monitor.autoScale()' or 'monitor.autoSize()' that would pretty much match the monitor size with the terminal size.
- Hellkid98
Lyqyd #2
Posted 21 December 2013 - 09:29 PM
This is pretty easy to do in Lua.


local mon = peripheral.wrap("top")
local scale = 5
local x, y
repeat
  mon.setTextScale(scale)
  scale = scale - 0.5
  x, y = mon.getSize()
until (x >= 51 and y >= 19) or scale < 0.5

I don't see any particular point in adding a function to the Java side that can be accomplished fairly trivially in Lua. That essentially falls under Enhancements in the Things Not To Suggest list.
Alice #3
Posted 22 December 2013 - 07:24 PM
I like your idea for more scales on the monitor.
It would be awesome to have the scale 0.6, 0.7 …
awsmazinggenius #4
Posted 22 December 2013 - 11:18 PM
Yeah. And a limit of 5 seems a bit small. In Word (I am not comparing MS Word to CC) you can go up to size 1638, but a single character does not fit on just one page. A larger maximum would be nice, with support for font sized like 6.3 . (But cutting off numbers beyond the first decimal place, such as 7.39575 just becoming 7.3, etc.)
TheOddByte #5
Posted 23 December 2013 - 09:48 AM
Well I realize now that 'autoscale' would be kinda stupid to implent, But I'd like more scales as it would be easier to find the perfect scale in Lua if there were more scales.
And it would be better matches with scales for monitors depending on how large they are, For example if you have a 1x1 monitor or something then maybe the 0.5 scale would be too large( Not that many uses that monitor size in particular :P/> ) but it's just an example, I'd expect that many would appreciate to have more scales as it would be very useful.
electrodude512 #6
Posted 23 December 2013 - 04:13 PM
I second the idea of more possible scales. I've often needed sizes other than multiples of 0.5.
karelmikie3 #7
Posted 22 January 2014 - 10:30 AM
i would indeed really like more scales.
awsmazinggenius #8
Posted 22 January 2014 - 07:06 PM
i would indeed really like more scales.
Yes. Agreed. More scales are necessary. They would allow more creativity in our coding.