ComputerCraft Help - display different sized texts at the same time [unable to be resolved]

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

KapitanWalnut

New Member
Jul 29, 2019
4
0
0
Hi all! I'm looking to write a program to display various things on the same monitor, all with different sizes and colors. However if I attempt to print three different times at three different sizes, everything is only printed at the last size.
For example, if I'd like a title at size 2.75, description text at size 1, and another piece of detail text at size 2, everything prints in size 2.
Please help! How do I actually get it to print in different sizes on the same monitor? Is this even possible?

Program as it stands with everything else unrelated stripped out:
[pastebin link]
Code:
--randomGen
--by KapitanWalnut and RareBluskei
--3/8/2014  v0.1.1

--setup
m = peripheral.wrap("right")

--FUNCTIONS

--setup Main title text style
function mainTitleStyle()
  m.setTextColor(0x3)
  m.setTextScale(2.75)
end

--setup general text style
function genTextStyle()
  m.setTextColor(0x1)
  m.setTextScale(1)
end

--setup biome text style
function biomeTextStyle()
  m.setTextColor(0x2000)
  m.setTextScale(2)
end

--create title screen
function titleScreen()
  m.clear()
  --main title
  mainTitleStyle()
  m.setCursorPos(3,1)
  m.write("AFBeast")
  --gen text
  genTextStyle()
  m.setCursorPos(1,4)
  m.write("Current Safe Biome:")
  --safe biome
  biomeTextStyle()
  m.setCursorPos(1,6)
  m.write("Forest")
end

titleScreen()

However, this is what is displayed on the monitor. The monitor is 2 blocks tall by 3 blocks wide. Note everything is printing in size 2.
PY0eCEr.png
 
can you try doing each one individually? Like do the first line (comment out the others) then second (commenting first and third) and then third and see if it works. If it doesn't then its not a problem of having different sizes and it means the implementation of changing font size is incorrect.

EDIT: I optimised your code slightly, if the above doesn't work try this. It does the exact same thing it just uses less functions

Code:
m = peripheral.wrap("right")

function monWrite(color,size,x,y,text)
    m.setTextColor(color)
    m.setTextScale(size)
    m.setCursorPos(x,y)
    m.write(text)
end

m.clear()
monWrite(0x3,2.75,3,1,"AFBeast")
monWrite(0x1,1,1,4,"Current Safe Biome:")
monWrite(0x2000,2,1,6,"Forest")
 
Last edited:
VikeStep, I appreciate the optimization. My original code looked very similar to this. In the code I posted I broke each part out into different "font functions" if you will for testing purposes since I wasn't getting the results I expected.
Each individual section (with the other two commented out) runs as it should, both in your code and mine. The problem crops up when when I try to get two or more different sized texts to appear on the screen at the same time.

I don't think it's an issue with either of our programs, I'm starting to think that different sized texts can't be displayed at the same time...
I tested this theory by running a program that printed an orange colored string "A" at size 2 at (1,1) on the screen. Then, without clearing the screen, I ran another program that printed a white colored string "B" at size 1 at (1,6). The first text, "A" was redrawn from its original size of 3 down to a size of 1 after running the second program.
So, I'm starting to think that advanced computers, while capable of printing different colored texts on the same screen, are incapable of printing different sized texts.

The obvious solution is to just have different monitors displaying the different strings, but I'd really like to avoid that if at all possible.
 
after some googling, it seems that you can't have multiple font sizes :( It may be possible by saving the text as an image (nfp format), but then it isn't dynamic.

If you are unfamiliar with images this is how you do it, create an image.nfp file (here is one i made for a cookie clicker thing)

load it like this image = paintutils.loadImage("image.nfp")

paintutils.drawImage(image,1,1)
 
Last edited:
aw, sad day :( I suspected as much. I'll be sure to check out the Cookie Clicker, it sounds cool. Thanks for your help!